summaryrefslogtreecommitdiff
path: root/UnixPkg
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2013-07-29 21:09:55 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-07-29 21:09:55 +0000
commit5d71a30480bdf7081f72485d6bf48361c244c4d7 (patch)
treeeaa76ec905c5a488d86edb9dcc5c4c7a79958258 /UnixPkg
parentbf6ee6c7c33cf280cdfb2fd0e6b66a712b7aa4a1 (diff)
downloadedk2-platforms-5d71a30480bdf7081f72485d6bf48361c244c4d7.tar.xz
UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg)
For now the UnixPkg/Deprecated.txt file is retained to indicate that EmulatorPkg should be used instead. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14518 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg')
-rw-r--r--UnixPkg/.gdbinit8
-rw-r--r--UnixPkg/BootModePei/BootModePei.c101
-rw-r--r--UnixPkg/BootModePei/BootModePei.inf55
-rw-r--r--UnixPkg/Contributions.txt188
-rw-r--r--UnixPkg/CpuRuntimeDxe/Cpu.c556
-rw-r--r--UnixPkg/CpuRuntimeDxe/Cpu.inf65
-rw-r--r--UnixPkg/CpuRuntimeDxe/CpuDriver.h163
-rw-r--r--UnixPkg/CpuRuntimeDxe/CpuIo.c347
-rw-r--r--UnixPkg/CpuRuntimeDxe/Strings.unibin1940 -> 0 bytes
-rw-r--r--UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c1363
-rw-r--r--UnixPkg/FvbServicesRuntimeDxe/FvbInfo.c156
-rw-r--r--UnixPkg/FvbServicesRuntimeDxe/FwBlockService.h225
-rw-r--r--UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf79
-rw-r--r--UnixPkg/Include/Common/UnixInclude.h183
-rw-r--r--UnixPkg/Include/FlashLayout.h64
-rw-r--r--UnixPkg/Include/Guid/UnixSystemConfig.h36
-rw-r--r--UnixPkg/Include/Library/SecDispatchTableLib.h57
-rw-r--r--UnixPkg/Include/Library/UnixLib.h27
-rw-r--r--UnixPkg/Include/Ppi/UnixAutoScan.h66
-rw-r--r--UnixPkg/Include/Ppi/UnixFwh.h64
-rw-r--r--UnixPkg/Include/Ppi/UnixPeiLoadFile.h65
-rw-r--r--UnixPkg/Include/Ppi/UnixThunk.h56
-rw-r--r--UnixPkg/Include/Protocol/UnixIo.h154
-rw-r--r--UnixPkg/Include/Protocol/UnixThunk.h346
-rw-r--r--UnixPkg/Include/Protocol/UnixUgaIo.h139
-rw-r--r--UnixPkg/Include/UnixDxe.h36
-rw-r--r--UnixPkg/Include/UnixPeim.h30
-rw-r--r--UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf48
-rw-r--r--UnixPkg/Library/DxeUnixLib/UnixLib.c52
-rw-r--r--UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf52
-rw-r--r--UnixPkg/Library/DxeUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c222
-rw-r--r--UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c113
-rw-r--r--UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf48
-rw-r--r--UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf48
-rw-r--r--UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c305
-rw-r--r--UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf51
-rw-r--r--UnixPkg/Library/PeiUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c230
-rw-r--r--UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c114
-rw-r--r--UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf45
-rw-r--r--UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c61
-rw-r--r--UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf43
-rw-r--r--UnixPkg/Library/UnixBaseLib/ARShiftU64.c41
-rw-r--r--UnixPkg/Library/UnixBaseLib/BaseLibInternals.h1655
-rw-r--r--UnixPkg/Library/UnixBaseLib/BitField.c868
-rw-r--r--UnixPkg/Library/UnixBaseLib/CheckSum.c337
-rw-r--r--UnixPkg/Library/UnixBaseLib/ChkStkGcc.c24
-rw-r--r--UnixPkg/Library/UnixBaseLib/Cpu.c65
-rw-r--r--UnixPkg/Library/UnixBaseLib/CpuDeadLoop.c38
-rw-r--r--UnixPkg/Library/UnixBaseLib/DivS64x64Remainder.c53
-rw-r--r--UnixPkg/Library/UnixBaseLib/DivU64x32.c45
-rw-r--r--UnixPkg/Library/UnixBaseLib/DivU64x32Remainder.c49
-rw-r--r--UnixPkg/Library/UnixBaseLib/DivU64x64Remainder.c49
-rw-r--r--UnixPkg/Library/UnixBaseLib/GetPowerOfTwo32.c44
-rw-r--r--UnixPkg/Library/UnixBaseLib/GetPowerOfTwo64.c44
-rw-r--r--UnixPkg/Library/UnixBaseLib/HighBitSet32.c47
-rw-r--r--UnixPkg/Library/UnixBaseLib/HighBitSet64.c55
-rw-r--r--UnixPkg/Library/UnixBaseLib/LRotU32.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/LRotU64.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/LShiftU64.c41
-rw-r--r--UnixPkg/Library/UnixBaseLib/LinkedList.c550
-rw-r--r--UnixPkg/Library/UnixBaseLib/LongJump.c47
-rw-r--r--UnixPkg/Library/UnixBaseLib/LowBitSet32.c47
-rw-r--r--UnixPkg/Library/UnixBaseLib/LowBitSet64.c50
-rw-r--r--UnixPkg/Library/UnixBaseLib/Math64.c368
-rw-r--r--UnixPkg/Library/UnixBaseLib/ModU64x32.c45
-rw-r--r--UnixPkg/Library/UnixBaseLib/MultS64x64.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/MultU64x32.c46
-rw-r--r--UnixPkg/Library/UnixBaseLib/MultU64x64.c46
-rw-r--r--UnixPkg/Library/UnixBaseLib/RRotU32.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/RRotU64.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/RShiftU64.c41
-rw-r--r--UnixPkg/Library/UnixBaseLib/SetJump.c40
-rw-r--r--UnixPkg/Library/UnixBaseLib/String.c2074
-rw-r--r--UnixPkg/Library/UnixBaseLib/SwapBytes16.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/SwapBytes32.c45
-rw-r--r--UnixPkg/Library/UnixBaseLib/SwapBytes64.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/SwitchStack.c76
-rw-r--r--UnixPkg/Library/UnixBaseLib/Unaligned.c222
-rw-r--r--UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf201
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.S25
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.asm37
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuId.S60
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuId.asm62
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.S62
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.asm64
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/CpuPause.asm37
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/DisableCache.S39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/DisableCache.asm43
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/DisableInterrupts.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.S82
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.asm84
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/EnableCache.S39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/EnableCache.asm43
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.S36
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/EnableInterrupts.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/FlushCacheLine.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/FxRestore.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/FxSave.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/GccInline.c1801
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Invd.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/LongJump.S54
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/LongJump.asm58
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Monitor.asm43
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Mwait.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Non-existing.c153
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadCr0.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadCr2.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadCr3.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadCr4.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadCs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr0.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr1.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr2.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr3.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr4.asm42
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr5.asm42
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr6.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDr7.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadDs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadEflags.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadEs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadFs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadGdtr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadGs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadIdtr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadLdtr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm0.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm1.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm2.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm3.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm4.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm5.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm6.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMm7.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.asm40
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadPmc.asm40
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadSs.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadTr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/ReadTsc.asm40
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SetJump.S53
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SetJump.asm66
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S48
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SwitchStack.asm51
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Thunk16.S333
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Thunk16.asm314
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Wbinvd.S35
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/Wbinvd.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteCr0.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteCr2.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteCr3.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteCr4.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr0.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr1.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr2.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr3.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr4.asm43
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr5.asm43
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr6.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteDr7.asm39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteGdtr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteIdtr.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteLdtr.asm38
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm0.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm1.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm2.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm3.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm4.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm5.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm6.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMm7.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.asm41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.c42
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86DisablePaging32.c66
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86DisablePaging64.c63
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86EnablePaging32.c69
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86EnablePaging64.c65
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86FxRestore.c49
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86FxSave.c48
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86GetInterruptState.c41
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86MemoryFence.c32
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86Msr.c650
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86ReadGdtr.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86ReadIdtr.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86Thunk.c268
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86WriteGdtr.c39
-rw-r--r--UnixPkg/Library/UnixBaseLib/X86WriteIdtr.c39
-rw-r--r--UnixPkg/Library/UnixBdsLib/BdsPlatform.c565
-rw-r--r--UnixPkg/Library/UnixBdsLib/BdsPlatform.h127
-rw-r--r--UnixPkg/Library/UnixBdsLib/PlatformBds.inf65
-rw-r--r--UnixPkg/Library/UnixBdsLib/PlatformData.c132
-rw-r--r--UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoader.c54
-rw-r--r--UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoaderLib.inf39
-rw-r--r--UnixPkg/License.txt25
-rw-r--r--UnixPkg/MetronomeDxe/Metronome.c140
-rw-r--r--UnixPkg/MetronomeDxe/Metronome.h84
-rw-r--r--UnixPkg/MetronomeDxe/Metronome.inf58
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.unibin2214 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c57
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c161
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendor.unibin1588 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c88
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c196
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c33
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c68
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.unibin1774 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c45
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c131
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscDevicePath.h175
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c38
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c233
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscOemString.unibin1312 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscOemStringData.c32
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c75
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.unibin8914 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c99
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c172
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c42
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c71
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h131
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf103
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.unibin2004 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c78
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c200
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.unibin1314 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c33
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c80
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.unibin1772 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c57
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c135
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.unibin1308 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c32
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c77
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.unibin1322 -> 0 bytes
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c52
-rw-r--r--UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c92
-rw-r--r--UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.c352
-rw-r--r--UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf56
-rw-r--r--UnixPkg/ResetRuntimeDxe/Reset.c151
-rw-r--r--UnixPkg/ResetRuntimeDxe/Reset.inf56
-rw-r--r--UnixPkg/Sec/FwVol.c314
-rw-r--r--UnixPkg/Sec/Gasket.c456
-rw-r--r--UnixPkg/Sec/Gasket.h594
-rw-r--r--UnixPkg/Sec/Ia32/Gasket.S344
-rw-r--r--UnixPkg/Sec/Ia32/Stack.S95
-rw-r--r--UnixPkg/Sec/Ia32/SwitchStack.c98
-rw-r--r--UnixPkg/Sec/SecMain.c1340
-rw-r--r--UnixPkg/Sec/SecMain.h601
-rw-r--r--UnixPkg/Sec/SecMain.inf106
-rw-r--r--UnixPkg/Sec/UgaX11.c865
-rw-r--r--UnixPkg/Sec/UnixThunk.c343
-rw-r--r--UnixPkg/Sec/X64/MangleGasket.S1294
-rw-r--r--UnixPkg/Sec/X64/NameManglingFix.c44
-rw-r--r--UnixPkg/Sec/X64/SwitchStack.S120
-rw-r--r--UnixPkg/TimerDxe/Timer.c375
-rw-r--r--UnixPkg/TimerDxe/Timer.h162
-rw-r--r--UnixPkg/TimerDxe/Timer.inf61
-rw-r--r--UnixPkg/UnixAutoScanPei/UnixAutoScan.c116
-rw-r--r--UnixPkg/UnixAutoScanPei/UnixAutoScan.inf57
-rw-r--r--UnixPkg/UnixBlockIoDxe/ComponentName.c197
-rw-r--r--UnixPkg/UnixBlockIoDxe/DriverConfiguration.c338
-rw-r--r--UnixPkg/UnixBlockIoDxe/DriverDiagnostics.c187
-rw-r--r--UnixPkg/UnixBlockIoDxe/EntryPoint.c51
-rw-r--r--UnixPkg/UnixBlockIoDxe/UnixBlockIo.c1288
-rw-r--r--UnixPkg/UnixBlockIoDxe/UnixBlockIo.h219
-rw-r--r--UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf69
-rw-r--r--UnixPkg/UnixBusDriverDxe/ComponentName.c208
-rw-r--r--UnixPkg/UnixBusDriverDxe/EntryPoint.c51
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.c724
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.h312
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf94
-rw-r--r--UnixPkg/UnixConsoleDxe/ComponentName.c197
-rw-r--r--UnixPkg/UnixConsoleDxe/Console.c310
-rw-r--r--UnixPkg/UnixConsoleDxe/Console.h519
-rw-r--r--UnixPkg/UnixConsoleDxe/ConsoleIn.c241
-rw-r--r--UnixPkg/UnixConsoleDxe/ConsoleOut.c620
-rw-r--r--UnixPkg/UnixConsoleDxe/EntryPoint.c51
-rw-r--r--UnixPkg/UnixConsoleDxe/UnixConsole.inf65
-rw-r--r--UnixPkg/UnixFirmwareVolumePei/UnixFwh.c138
-rw-r--r--UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf59
-rw-r--r--UnixPkg/UnixFlashMapPei/FlashMap.c91
-rw-r--r--UnixPkg/UnixFlashMapPei/FlashMap.inf70
-rw-r--r--UnixPkg/UnixGopDxe/ComponentName.c251
-rw-r--r--UnixPkg/UnixGopDxe/UnixGop.h376
-rw-r--r--UnixPkg/UnixGopDxe/UnixGop.inf73
-rw-r--r--UnixPkg/UnixGopDxe/UnixGopDriver.c396
-rw-r--r--UnixPkg/UnixGopDxe/UnixGopInput.c884
-rw-r--r--UnixPkg/UnixGopDxe/UnixGopScreen.c404
-rw-r--r--UnixPkg/UnixPkg.dec82
-rw-r--r--UnixPkg/UnixPkg.dsc337
-rw-r--r--UnixPkg/UnixPkg.fdf384
-rw-r--r--UnixPkg/UnixPkgX64.dsc345
-rw-r--r--UnixPkg/UnixPkgX64.fdf380
-rw-r--r--UnixPkg/UnixSerialIoDxe/ComponentName.c208
-rw-r--r--UnixPkg/UnixSerialIoDxe/EntryPoint.c49
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.c1704
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.h571
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf67
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/ComponentName.c204
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/EntryPoint.c51
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c2193
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.h599
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf69
-rw-r--r--UnixPkg/UnixSnpDxe/ComponentName.c318
-rw-r--r--UnixPkg/UnixSnpDxe/UnixSnp.c1791
-rw-r--r--UnixPkg/UnixSnpDxe/UnixSnp.h156
-rw-r--r--UnixPkg/UnixSnpDxe/UnixSnpDxe.inf57
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.c103
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.h30
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.inf60
-rw-r--r--UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.c79
-rw-r--r--UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf59
-rw-r--r--UnixPkg/UnixUgaDxe/ComponentName.c198
-rw-r--r--UnixPkg/UnixUgaDxe/EntryPoint.c49
-rw-r--r--UnixPkg/UnixUgaDxe/UnixUga.h332
-rw-r--r--UnixPkg/UnixUgaDxe/UnixUga.inf73
-rw-r--r--UnixPkg/UnixUgaDxe/UnixUgaDriver.c300
-rw-r--r--UnixPkg/UnixUgaDxe/UnixUgaInput.c418
-rw-r--r--UnixPkg/UnixUgaDxe/UnixUgaScreen.c454
-rwxr-xr-xUnixPkg/Xcode/xcode_project/XcodeBuild.sh13
-rw-r--r--UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/default.pbxuser191
-rw-r--r--UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/project.pbxproj117
-rwxr-xr-xUnixPkg/Xcode/xcode_project64/XcodeBuild.sh14
-rw-r--r--UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser191
-rw-r--r--UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj117
-rwxr-xr-xUnixPkg/build.sh123
-rwxr-xr-xUnixPkg/build64.sh129
-rw-r--r--UnixPkg/readme.txt62
330 files changed, 0 insertions, 54926 deletions
diff --git a/UnixPkg/.gdbinit b/UnixPkg/.gdbinit
deleted file mode 100644
index 173818c0e7..0000000000
--- a/UnixPkg/.gdbinit
+++ /dev/null
@@ -1,8 +0,0 @@
-set confirm off
-set output-radix 16
-b SecGdbScriptBreak
-command
-silent
-source SecMain.gdb
-c
-end
diff --git a/UnixPkg/BootModePei/BootModePei.c b/UnixPkg/BootModePei/BootModePei.c
deleted file mode 100644
index 6427da83de..0000000000
--- a/UnixPkg/BootModePei/BootModePei.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/**@file
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMode.c
-
-Abstract:
-
- Tiano PEIM to provide the platform support functionality within Unix
-
-**/
-
-
-
-//
-// The package level header files this module uses
-//
-#include <PiPei.h>
-//
-// The protocols, PPI and GUID defintions for this module
-//
-#include <Ppi/MasterBootMode.h>
-#include <Ppi/BootInRecoveryMode.h>
-//
-// The Library classes this module consumes
-//
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-
-
-//
-// Module globals
-//
-EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiMasterBootModePpiGuid,
- NULL
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiBootInRecoveryModePpiGuid,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-InitializeBootMode (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Peform the boot mode determination logic
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
- Status - EFI_SUCCESS if the boot mode could be set
-
---*/
-// TODO: FfsHeader - add argument and description to function comment
-{
- EFI_STATUS Status;
- UINTN BootMode;
-
- DEBUG ((EFI_D_ERROR, "Unix Boot Mode PEIM Loaded\n"));
-
- //
- // Let's assume things are OK if not told otherwise
- // Should we read an environment variable in order to easily change this?
- //
- BootMode = BOOT_WITH_FULL_CONFIGURATION;
-
- Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
- ASSERT_EFI_ERROR (Status);
-
- Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
- ASSERT_EFI_ERROR (Status);
-
- if (BootMode == BOOT_IN_RECOVERY_MODE) {
- Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
- ASSERT_EFI_ERROR (Status);
- }
-
- return Status;
-}
diff --git a/UnixPkg/BootModePei/BootModePei.inf b/UnixPkg/BootModePei/BootModePei.inf
deleted file mode 100644
index 49302a59cd..0000000000
--- a/UnixPkg/BootModePei/BootModePei.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Component description file for BootMode module
-#
-# This module provides platform specific function to detect boot mode.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = BootModePei
- FILE_GUID = f3ff9aee-8985-11db-b133-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeBootMode
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- BootModePei.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
-
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- BaseLib
- PeimEntryPoint
- DebugLib
-
-
-[Ppis]
- gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
- gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/Contributions.txt b/UnixPkg/Contributions.txt
deleted file mode 100644
index 667ca1035c..0000000000
--- a/UnixPkg/Contributions.txt
+++ /dev/null
@@ -1,188 +0,0 @@
-
-======================
-= Code Contributions =
-======================
-
-To make a contribution to a TianoCore project, follow these steps.
-1. Create a change description in the format specified below to
- use in the source control commit log.
-2. Your commit message must include your "Signed-off-by" signature,
- and "Contributed-under" message.
-3. Your "Contributed-under" message explicitly states that the
- contribution is made under the terms of the specified
- contribution agreement. Your "Contributed-under" message
- must include the name of contribution agreement and version.
- For example: Contributed-under: TianoCore Contribution Agreement 1.0
- The "TianoCore Contribution Agreement" is included below in
- this document.
-4. Submit your code to the TianoCore project using the process
- that the project documents on its web page. If the process is
- not documented, then submit the code on development email list
- for the project.
-
-=======================================
-= Change Description / Commit Message =
-=======================================
-
-Your change description should use the standard format for a
-commit message, and must include your "Signed-off-by" signature
-and the "Contributed-under" message.
-
-== Sample Change Description / Commit Message =
-
-=== Definitions for sample change description ===
-
-* "CodeModule" is a short idenfier for the affected code. For
- example MdePkg, or MdeModulePkg UsbBusDxe.
-* "Brief-single-line-summary" is a short summary of the change.
-* The entire first line should be less than ~70 characters.
-* "Full-commit-message" a verbose multiple line comment describing
- the change. Each line should be less than ~70 characters.
-* "Contributed-under" explicitely states that the contribution is
- made under the terms of the contribtion agreement. This
- agreement is included below in this document.
-* "Signed-off-by" is the contributor's signature identifying them
- by their real/legal name and their email address.
-
-=== Start of sample change description / commit message ===
-CodeModule: Brief-single-line-summary
-
-Full-commit-message
-
-Contributed-under: TianoCore Contribution Agreement 1.0
-Signed-off-by: Contributor Name <contributor@email.server>
-=== End of sample change description / commit message ===
-
-========================================
-= TianoCore Contribution Agreement 1.0 =
-========================================
-
-INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
-INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
-PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
-TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
-REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
-CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
-AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
-AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
-USE THE CONTENT.
-
-Unless otherwise indicated, all Content made available on the TianoCore
-site is provided to you under the terms and conditions of the BSD
-License ("BSD"). A copy of the BSD License is available at
-http://opensource.org/licenses/bsd-license.php
-or when applicable, in the associated License.txt file.
-
-Certain other content may be made available under other licenses as
-indicated in or with such Content. (For example, in a License.txt file.)
-
-You accept and agree to the following terms and conditions for Your
-present and future Contributions submitted to TianoCore site. Except
-for the license granted to Intel hereunder, You reserve all right,
-title, and interest in and to Your Contributions.
-
-== SECTION 1: Definitions ==
-* "You" or "Contributor" shall mean the copyright owner or legal
- entity authorized by the copyright owner that is making a
- Contribution hereunder. All other entities that control, are
- controlled by, or are under common control with that entity are
- considered to be a single Contributor. For the purposes of this
- definition, "control" means (i) the power, direct or indirect, to
- cause the direction or management of such entity, whether by
- contract or otherwise, or (ii) ownership of fifty percent (50%)
- or more of the outstanding shares, or (iii) beneficial ownership
- of such entity.
-* "Contribution" shall mean any original work of authorship,
- including any modifications or additions to an existing work,
- that is intentionally submitted by You to the TinaoCore site for
- inclusion in, or documentation of, any of the Content. For the
- purposes of this definition, "submitted" means any form of
- electronic, verbal, or written communication sent to the
- TianoCore site or its representatives, including but not limited
- to communication on electronic mailing lists, source code
- control systems, and issue tracking systems that are managed by,
- or on behalf of, the TianoCore site for the purpose of
- discussing and improving the Content, but excluding
- communication that is conspicuously marked or otherwise
- designated in writing by You as "Not a Contribution."
-
-== SECTION 2: License for Contributions ==
-* Contributor hereby agrees that redistribution and use of the
- Contribution 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 Contributor's
- copyright notice, this list of conditions and the following
- disclaimer.
-** Redistributions in binary form must reproduce the Contributor's
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-* Disclaimer. None of the names of Contributor, Intel, or the names
- of their respective contributors may be used to endorse or
- promote products derived from this software without specific
- prior written permission.
-* Contributor grants a license (with the right to sublicense) under
- claims of Contributor's patents that Contributor can license that
- are infringed by the Contribution (as delivered by Contributor) to
- make, use, distribute, sell, offer for sale, and import the
- Contribution and derivative works thereof solely to the minimum
- extent necessary for licensee to exercise the granted copyright
- license; this patent license applies solely to those portions of
- the Contribution that are unmodified. No hardware per se is
- licensed.
-* EXCEPT AS EXPRESSLY SET FORTH IN SECTION 3 BELOW, THE
- CONTRIBUTION IS PROVIDED BY THE CONTRIBUTOR "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
- CONTRIBUTOR 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 THE
- CONTRIBUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
-== SECTION 3: Representations ==
-* You represent that You are legally entitled to grant the above
- license. If your employer(s) has rights to intellectual property
- that You create that includes Your Contributions, You represent
- that You have received permission to make Contributions on behalf
- of that employer, that Your employer has waived such rights for
- Your Contributions.
-* You represent that each of Your Contributions is Your original
- creation (see Section 4 for submissions on behalf of others).
- You represent that Your Contribution submissions include complete
- details of any third-party license or other restriction
- (including, but not limited to, related patents and trademarks)
- of which You are personally aware and which are associated with
- any part of Your Contributions.
-
-== SECTION 4: Third Party Contributions ==
-* Should You wish to submit work that is not Your original creation,
- You may submit it to TianoCore site separately from any
- Contribution, identifying the complete details of its source
- and of any license or other restriction (including, but not
- limited to, related patents, trademarks, and license agreements)
- of which You are personally aware, and conspicuously marking the
- work as "Submitted on behalf of a third-party: [named here]".
-
-== SECTION 5: Miscellaneous ==
-* Applicable Laws. Any claims arising under or relating to this
- Agreement shall be governed by the internal substantive laws of
- the State of Delaware or federal courts located in Delaware,
- without regard to principles of conflict of laws.
-* Language. This Agreement is in the English language only, which
- language shall be controlling in all respects, and all versions
- of this Agreement in any other language shall be for accommodation
- only and shall not be binding. All communications and notices made
- or given pursuant to this Agreement, and all documentation and
- support to be provided, unless otherwise noted, shall be in the
- English language.
-
diff --git a/UnixPkg/CpuRuntimeDxe/Cpu.c b/UnixPkg/CpuRuntimeDxe/Cpu.c
deleted file mode 100644
index 54c784ea66..0000000000
--- a/UnixPkg/CpuRuntimeDxe/Cpu.c
+++ /dev/null
@@ -1,556 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Cpu.c
-
-Abstract:
-
- Unix Emulation Architectural Protocol Driver as defined in Tiano.
- This CPU module abstracts the interrupt subsystem of a platform and
- the CPU-specific setjump/long pair. Other services are not implemented
- in this driver.
-
---*/
-#include <FrameworkDxe.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Cpu.h>
-#include <Protocol/Smbios.h>
-#include <Guid/DataHubRecords.h>
-#include <Protocol/CpuIo2.h>
-#include <Protocol/FrameworkHii.h>
-#include <Protocol/UnixThunk.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HiiLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UnixLib.h>
-
-#include "CpuDriver.h"
-#include "UnixDxe.h"
-#include <Protocol/UnixIo.h>
-
-#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
-
-CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
- CPU_ARCH_PROT_PRIVATE_SIGNATURE,
- NULL,
- {
- UnixFlushCpuDataCache,
- UnixEnableInterrupt,
- UnixDisableInterrupt,
- UnixGetInterruptState,
- UnixInit,
- UnixRegisterInterruptHandler,
- UnixGetTimerValue,
- UnixSetMemoryAttributes,
- 0,
- 4
- },
- {
- {
- CpuMemoryServiceRead,
- CpuMemoryServiceWrite
- },
- {
- CpuIoServiceRead,
- CpuIoServiceWrite
- }
- },
- TRUE
-};
-
-
-//
-// Service routines for the driver
-//
-EFI_STATUS
-EFIAPI
-UnixFlushCpuDataCache (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 Length,
- IN EFI_CPU_FLUSH_TYPE FlushType
- )
-/*++
-
-Routine Description:
-
- This routine would provide support for flushing the CPU data cache.
- In the case of UNIX emulation environment, this flushing is not necessary and
- is thus not implemented.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
- Start adddress in memory to flush
- Length of memory to flush
- Flush type
-
-Returns:
-
- Status
- EFI_SUCCESS
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: FlushType - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
- //
- // Only WB flush is supported. We actually need do nothing on UNIX emulator
- // environment. Classify this to follow EFI spec
- //
- return EFI_SUCCESS;
- }
- //
- // Other flush types are not supported by UNIX emulator
- //
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixEnableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- This routine provides support for emulation of the interrupt enable of the
- the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
- Architectural Protocol observes in order to defer behaviour while in its
- emulated interrupt, or timer tick.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
-
-Returns:
-
- Status
- EFI_SUCCESS
-
---*/
-// TODO: This - add argument and description to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- Private->InterruptState = TRUE;
- gUnix->EnableInterrupt ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixDisableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- This routine provides support for emulation of the interrupt disable of the
- the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
- Architectural Protocol observes in order to defer behaviour while in its
- emulated interrupt, or timer tick.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
-
-Returns:
-
- Status
- EFI_SUCCESS
-
---*/
-// TODO: This - add argument and description to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- Private->InterruptState = FALSE;
- gUnix->DisableInterrupt ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixGetInterruptState (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- OUT BOOLEAN *State
- )
-/*++
-
-Routine Description:
-
- This routine provides support for emulation of the interrupt disable of the
- the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
- Architectural Protocol observes in order to defer behaviour while in its
- emulated interrupt, or timer tick.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
-
-Returns:
-
- Status
- EFI_SUCCESS
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: State - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- if (State == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- *State = Private->InterruptState;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixInit (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_CPU_INIT_TYPE InitType
- )
-/*++
-
-Routine Description:
-
- This routine would support generation of a CPU INIT. At
- present, this code does not provide emulation.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
- INIT Type
-
-Returns:
-
- Status
- EFI_UNSUPPORTED - not yet implemented
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: InitType - add argument and description to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixRegisterInterruptHandler (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- )
-/*++
-
-Routine Description:
-
- This routine would support registration of an interrupt handler. At
- present, this code does not provide emulation.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
- Pointer to interrupt handlers
- Interrupt type
-
-Returns:
-
- Status
- EFI_UNSUPPORTED - not yet implemented
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: InterruptType - add argument and description to function comment
-// TODO: InterruptHandler - add argument and description to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- //
- // Do parameter checking for EFI spec conformance
- //
- if (InterruptType < 0 || InterruptType > 0xff) {
- return EFI_UNSUPPORTED;
- }
- //
- // Do nothing for Nt32 emulation
- //
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This routine would support querying of an on-CPU timer. At present,
- this code does not provide timer emulation.
-
-Arguments:
-
- This - Pointer to CPU Architectural Protocol interface
- TimerIndex - Index of given CPU timer
- TimerValue - Output of the timer
- TimerPeriod - Output of the timer period
-
-Returns:
-
- EFI_UNSUPPORTED - not yet implemented
- EFI_INVALID_PARAMETER - TimeValue is NULL
-
---*/
-{
- if (TimerValue == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // No timer supported
- //
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSetMemoryAttributes (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- This routine would support querying of an on-CPU timer. At present,
- this code does not provide timer emulation.
-
-Arguments:
-
- Pointer to CPU Architectural Protocol interface
- Start address of memory region
- The size in bytes of the memory region
- The bit mask of attributes to set for the memory region
-
-Returns:
-
- Status
- EFI_UNSUPPORTED - not yet implemented
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: BaseAddress - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- //
- // Check for invalid parameter for Spec conformance
- //
- if (Length == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Do nothing for Nt32 emulation
- //
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- return EFI_UNSUPPORTED;
-}
-
-
-
-/**
- Logs SMBIOS record.
-
- @param Smbios Pointer to SMBIOS protocol instance.
- @param Buffer Pointer to the data buffer.
-
-**/
-VOID
-LogSmbiosData (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- IN UINT8 *Buffer
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
-
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = Smbios->Add (
- Smbios,
- NULL,
- &SmbiosHandle,
- (EFI_SMBIOS_TABLE_HEADER*)Buffer
- );
- ASSERT_EFI_ERROR (Status);
-}
-
-VOID
-CpuUpdateSmbios (
- VOID
- )
-/*++
-
-Routine Description:
- This function will log processor version and frequency data to data hub.
-
-Arguments:
- Event - Event whose notification function is being invoked.
- Context - Pointer to the notification function's context.
-
-Returns:
- None.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SMBIOS_PROTOCOL *Smbios;
- UINT32 TotalSize;
- EFI_HII_HANDLE HiiHandle;
- STRING_REF Token;
- UINTN CpuVerStrLen;
- EFI_STRING CpuVerStr;
- SMBIOS_TABLE_TYPE4 *SmbiosRecord;
- CHAR8 *OptionalStrStart;
-
- //
- // Locate Smbios protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
-
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // Initialize strings to HII database
- //
- HiiHandle = HiiAddPackages (
- &gEfiCallerIdGuid,
- NULL,
- CpuStrings,
- NULL
- );
- ASSERT (HiiHandle != NULL);
-
-
- Token = STRING_TOKEN (STR_INTEL_GENUINE_PROCESSOR);
- CpuVerStr = HiiGetPackageString(&gEfiCallerIdGuid, Token, NULL);
- CpuVerStrLen = StrLen(CpuVerStr);
- ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- TotalSize = sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1;
- SmbiosRecord = AllocatePool(TotalSize);
- ZeroMem(SmbiosRecord, TotalSize);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- //
- // Processor version is the 1st string.
- //
- SmbiosRecord->ProcessorVersion = 1;
- //
- // Store CPU frequency data record to data hub - It's an emulator so make up a value
- //
- SmbiosRecord->CurrentSpeed = 1234;
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(CpuVerStr, OptionalStrStart);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- LogSmbiosData(Smbios, (UINT8 *) SmbiosRecord);
- FreePool (SmbiosRecord);
-}
-
-EFI_STATUS
-EFIAPI
-InitializeCpu (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the state information for the CPU Architectural Protocol
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
-
- EFI_SUCCESS - protocol instance can be published
- EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
- EFI_DEVICE_ERROR - cannot create the thread
-
---*/
-// TODO: SystemTable - add argument and description to function comment
-{
- EFI_STATUS Status;
-
- CpuUpdateSmbios ();
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mCpuTemplate.Handle,
- &gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
- &gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- DEBUG ((EFI_D_ERROR, "CPU Architectural Protocol Loaded\n"));
-
- return Status;
-}
diff --git a/UnixPkg/CpuRuntimeDxe/Cpu.inf b/UnixPkg/CpuRuntimeDxe/Cpu.inf
deleted file mode 100644
index ea49064cea..0000000000
--- a/UnixPkg/CpuRuntimeDxe/Cpu.inf
+++ /dev/null
@@ -1,65 +0,0 @@
-## @file
-# Component description file for Cpu module.
-#
-# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = Cpu
- FILE_GUID = f3794b60-8985-11db-8e53-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeCpu
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- CpuIo.c
- Cpu.c
- CpuDriver.h
- Strings.uni
-
-
-[Packages]
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- UnixPkg/UnixPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiDriverEntryPoint
- UefiLib
- HiiLib
- DebugLib
- BaseLib
- UnixLib
-
-[Protocols]
- gEfiUnixIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
- gEfiHiiProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
- gEfiCpuIo2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-[Depex]
- gEfiSmbiosProtocolGuid
diff --git a/UnixPkg/CpuRuntimeDxe/CpuDriver.h b/UnixPkg/CpuRuntimeDxe/CpuDriver.h
deleted file mode 100644
index 7bd59df8da..0000000000
--- a/UnixPkg/CpuRuntimeDxe/CpuDriver.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CpuDriver.h
-
-Abstract:
-
- UNIX Emulation Architectural Protocol Driver as defined in Tiano.
-
---*/
-
-#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
-#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
-
-
-
-extern UINT8 CpuStrings[];
-
-//
-// Internal Data Structures
-//
-#define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd')
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
-
- EFI_CPU_ARCH_PROTOCOL Cpu;
- EFI_CPU_IO2_PROTOCOL CpuIo;
-
- //
- // Local Data for CPU interface goes here
- //
- BOOLEAN InterruptState;
-
-} CPU_ARCH_PROTOCOL_PRIVATE;
-
-#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- CPU_ARCH_PROTOCOL_PRIVATE, \
- Cpu, \
- CPU_ARCH_PROT_PRIVATE_SIGNATURE \
- )
-
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- );
-
-EFI_STATUS
-EFIAPI
-CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- );
-
-EFI_STATUS
-EFIAPI
-InitializeCpu (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-EFI_STATUS
-EFIAPI
-UnixFlushCpuDataCache (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 Length,
- IN EFI_CPU_FLUSH_TYPE FlushType
- );
-
-EFI_STATUS
-EFIAPI
-UnixEnableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-UnixDisableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-UnixGetInterruptState (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- OUT BOOLEAN *State
- );
-
-EFI_STATUS
-EFIAPI
-UnixInit (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_CPU_INIT_TYPE InitType
- );
-
-EFI_STATUS
-EFIAPI
-UnixRegisterInterruptHandler (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- );
-
-EFI_STATUS
-EFIAPI
-UnixGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UnixSetMemoryAttributes (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- );
-
-#endif
diff --git a/UnixPkg/CpuRuntimeDxe/CpuIo.c b/UnixPkg/CpuRuntimeDxe/CpuIo.c
deleted file mode 100644
index 1a7f4f4efb..0000000000
--- a/UnixPkg/CpuRuntimeDxe/CpuIo.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CpuIo.c
-
-Abstract:
-
- This is the code that publishes the CPU I/O Protocol.
- The intent herein is to have a single I/O service that can load
- as early as possible, extend into runtime, and be layered upon by
- the implementations of architectural protocols and the PCI Root
- Bridge I/O Protocol.
-
---*/
-#include <FrameworkDxe.h>
-#include <Protocol/Cpu.h>
-#include <Protocol/DataHub.h>
-#include <Guid/DataHubRecords.h>
-#include <Protocol/CpuIo2.h>
-#include <Protocol/FrameworkHii.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HiiLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <CpuDriver.h>
-
-#define IA32_MAX_IO_ADDRESS 0xFFFF
-#define IA32_MAX_MEM_ADDRESS 0xFFFFFFFF
-
-EFI_STATUS
-CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
- );
-
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Perform the Memory Access Read service for the CPU I/O Protocol
-
-Arguments:
-
- Pointer to an instance of the CPU I/O Protocol
- Width of the Memory Access
- Address of the Memory access
- Count of the number of accesses to perform
- Pointer to the buffer to read or write from memory
-
-Returns:
-
- Status
-
- EFI_SUCCESS - The data was read from or written to the EFI
- System.
- EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
- EFI_UNSUPPORTED - The address range specified by Address, Width,
- and Count is not valid for this EFI System.
-
---*/
-// TODO: This - add argument and description to function comment
-{
- EFI_STATUS Status;
-
- if (!Buffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Do nothing for Nt32 version
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Perform the Memory Access Read service for the CPU I/O Protocol
-
-Arguments:
-
- Pointer to an instance of the CPU I/O Protocol
- Width of the Memory Access
- Address of the Memory access
- Count of the number of accesses to perform
- Pointer to the buffer to read or write from memory
-
-Returns:
-
- Status
-
- EFI_SUCCESS - The data was read from or written to the EFI System.
- EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
- EFI_UNSUPPORTED - The address range specified by Address, Width, and
- Count is not valid for this EFI System.
-
---*/
-// TODO: This - add argument and description to function comment
-{
- EFI_STATUS Status;
-
- if (!Buffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Do nothing for Nt32 version
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- )
-/*++
-
-Routine Description:
-
- This is the service that implements the I/O read
-
-Arguments:
-
- Pointer to an instance of the CPU I/O Protocol
- Width of the Memory Access
- Address of the I/O access
- Count of the number of accesses to perform
- Pointer to the buffer to read or write from I/O space
-
-Returns:
-
- Status
- EFI_SUCCESS - The data was read from or written to the EFI System.
- EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
- EFI_UNSUPPORTED - The address range specified by Address, Width, and
- Count is not valid for this EFI System.
---*/
-// TODO: This - add argument and description to function comment
-// TODO: UserAddress - add argument and description to function comment
-// TODO: UserBuffer - add argument and description to function comment
-{
- UINTN Address;
- EFI_STATUS Status;
-
- if (!UserBuffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- Address = (UINTN) UserAddress;
-
- if (Width >= EfiCpuIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Do nothing for Nt32 version
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
- )
-/*++
-
-Routine Description:
-
-
- This is the service that implements the I/O Write
-
-Arguments:
-
- Pointer to an instance of the CPU I/O Protocol
- Width of the Memory Access
- Address of the I/O access
- Count of the number of accesses to perform
- Pointer to the buffer to read or write from I/O space
-
-Returns:
-
- Status
-
- Status
- EFI_SUCCESS - The data was read from or written to the EFI System.
- EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
- EFI_UNSUPPORTED - The address range specified by Address, Width, and
- Count is not valid for this EFI System.
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: UserAddress - add argument and description to function comment
-// TODO: UserBuffer - add argument and description to function comment
-{
- UINTN Address;
- EFI_STATUS Status;
-
- if (!UserBuffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- Address = (UINTN) UserAddress;
-
- if (Width >= EfiCpuIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Do nothing for Nt32 version
- //
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Width - TODO: add argument description
- Address - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
- Limit - TODO: add argument description
-
-Returns:
-
- EFI_UNSUPPORTED - TODO: Add description for return value
- EFI_UNSUPPORTED - TODO: Add description for return value
- EFI_UNSUPPORTED - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UINTN AlignMask;
-
- if (Address > Limit) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // For FiFo type, the target address won't increase during the access, so treat count as 1
- //
- if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
- Count = 1;
- }
-
- Width = Width & 0x03;
- if (Address - 1 + (1 << Width) * Count > Limit) {
- return EFI_UNSUPPORTED;
- }
-
- AlignMask = (1 << Width) - 1;
- if ((UINTN) Buffer & AlignMask) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
diff --git a/UnixPkg/CpuRuntimeDxe/Strings.uni b/UnixPkg/CpuRuntimeDxe/Strings.uni
deleted file mode 100644
index 66edf8b72d..0000000000
--- a/UnixPkg/CpuRuntimeDxe/Strings.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c b/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
deleted file mode 100644
index b49a660eab..0000000000
--- a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
+++ /dev/null
@@ -1,1363 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FWBlockService.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "PiDxe.h"
-#include <Guid/EventGroup.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/UefiRuntimeLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-
-#include "FwBlockService.h"
-
-ESAL_FWB_GLOBAL *mFvbModuleGlobal;
-
-#define EFI_FVB2_STATUS (EFI_FVB2_READ_STATUS | EFI_FVB2_WRITE_STATUS | EFI_FVB2_LOCK_STATUS)
-
-EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
- FVB_DEVICE_SIGNATURE,
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- {
- sizeof (MEMMAP_DEVICE_PATH),
- 0
- }
- },
- EfiMemoryMappedIO,
- 0,
- 0,
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- sizeof (EFI_DEVICE_PATH_PROTOCOL),
- 0
- }
- }
- },
- 0,
- {
- FvbProtocolGetAttributes,
- FvbProtocolSetAttributes,
- FvbProtocolGetPhysicalAddress,
- FvbProtocolGetBlockSize,
- FvbProtocolRead,
- FvbProtocolWrite,
- FvbProtocolEraseBlocks,
- NULL
- }
-};
-
-
-
-VOID
-EFIAPI
-FvbVirtualddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup internal data so that EFI and SAL can be call in virtual mode.
- Call the passed in Child Notify event and convert the mFvbModuleGlobal
- date items to there virtual address.
-
- mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] - Physical copy of instance data
- mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] - Virtual pointer to common
- instance data.
-
-Arguments:
-
- (Standard EFI notify event - EFI_EVENT_NOTIFY)
-
-Returns:
-
- None
-
---*/
-{
- EFI_FW_VOL_INSTANCE *FwhInstance;
- UINTN Index;
-
- EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal->FvInstance[FVB_VIRTUAL]);
-
- //
- // Convert the base address of all the instances
- //
- Index = 0;
- FwhInstance = mFvbModuleGlobal->FvInstance[FVB_PHYSICAL];
- while (Index < mFvbModuleGlobal->NumFv) {
- EfiConvertPointer (0x0, (VOID **) &FwhInstance->FvBase[FVB_VIRTUAL]);
- FwhInstance = (EFI_FW_VOL_INSTANCE *)
- (
- (UINTN) ((UINT8 *) FwhInstance) + FwhInstance->VolumeHeader.HeaderLength +
- (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
- );
- Index++;
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal);
-}
-
-EFI_STATUS
-GetFvbInstance (
- IN UINTN Instance,
- IN ESAL_FWB_GLOBAL *Global,
- OUT EFI_FW_VOL_INSTANCE **FwhInstance,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Retrieves the physical address of a memory mapped FV
-
-Arguments:
- Instance - The FV instance whose base address is going to be
- returned
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- FwhInstance - The EFI_FW_VOL_INSTANCE fimrware instance structure
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - Successfully returns
- EFI_INVALID_PARAMETER - Instance not found
-
---*/
-{
- EFI_FW_VOL_INSTANCE *FwhRecord;
-
- if (Instance >= Global->NumFv) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find the right instance of the FVB private data
- //
- FwhRecord = Global->FvInstance[Virtual];
- while (Instance > 0) {
- FwhRecord = (EFI_FW_VOL_INSTANCE *)
- (
- (UINTN) ((UINT8 *) FwhRecord) + FwhRecord->VolumeHeader.HeaderLength +
- (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
- );
- Instance--;
- }
-
- *FwhInstance = FwhRecord;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *Address,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Retrieves the physical address of a memory mapped FV
-
-Arguments:
- Instance - The FV instance whose base address is going to be
- returned
- Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - Successfully returns
- EFI_INVALID_PARAMETER - Instance not found
-
---*/
-{
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- EFI_STATUS Status;
-
- //
- // Find the right instance of the FVB private data
- //
- Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);
- ASSERT_EFI_ERROR (Status);
- *Address = FwhInstance->FvBase[Virtual];
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- returned
- Attributes - Output buffer which contains attributes
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - Successfully returns
- EFI_INVALID_PARAMETER - Instance not found
-
---*/
-{
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- EFI_STATUS Status;
-
- //
- // Find the right instance of the FVB private data
- //
- Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);
- ASSERT_EFI_ERROR (Status);
- *Attributes = FwhInstance->VolumeHeader.Attributes;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FvbGetLbaAddress (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *LbaAddress,
- OUT UINTN *LbaLength,
- OUT UINTN *NumOfBlocks,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Retrieves the starting address of an LBA in an FV
-
-Arguments:
- Instance - The FV instance which the Lba belongs to
- Lba - The logical block address
- LbaAddress - On output, contains the physical starting address
- of the Lba
- LbaLength - On output, contains the length of the block
- NumOfBlocks - A pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - Successfully returns
- EFI_INVALID_PARAMETER - Instance not found
-
---*/
-{
- UINT32 NumBlocks;
- UINT32 BlockLength;
- UINTN Offset;
- EFI_LBA StartLba;
- EFI_LBA NextLba;
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
- EFI_STATUS Status;
-
- //
- // Find the right instance of the FVB private data
- //
- Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);
- ASSERT_EFI_ERROR (Status);
-
- StartLba = 0;
- Offset = 0;
- BlockMap = &(FwhInstance->VolumeHeader.BlockMap[0]);
-
- //
- // Parse the blockmap of the FV to find which map entry the Lba belongs to
- //
- while (TRUE) {
- NumBlocks = BlockMap->NumBlocks;
- BlockLength = BlockMap->Length;
-
- if (NumBlocks == 0 || BlockLength == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- NextLba = StartLba + NumBlocks;
-
- //
- // The map entry found
- //
- if (Lba >= StartLba && Lba < NextLba) {
- Offset = Offset + (UINTN) MultU64x32 ((Lba - StartLba), BlockLength);
- if (LbaAddress != NULL) {
- *LbaAddress = FwhInstance->FvBase[Virtual] + Offset;
- }
-
- if (LbaLength != NULL) {
- *LbaLength = BlockLength;
- }
-
- if (NumOfBlocks != NULL) {
- *NumOfBlocks = (UINTN) (NextLba - Lba);
- }
-
- return EFI_SUCCESS;
- }
-
- StartLba = NextLba;
- Offset = Offset + NumBlocks * BlockLength;
- BlockMap++;
- }
-}
-
-EFI_STATUS
-FvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN BlockOffset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Reads specified number of bytes into a buffer from the specified block
-
-Arguments:
- Instance - The FV instance to be read from
- Lba - The logical block address to be read from
- BlockOffset - Offset into the block at which to begin reading
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- Buffer - Pointer to a caller allocated buffer that will be
- used to hold the data read
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
- EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output,
- NumBytes contains the total number of bytes returned
- in Buffer
- EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be read
- EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL
-
---*/
-{
- EFI_FVB_ATTRIBUTES_2 Attributes;
- UINTN LbaAddress;
- UINTN LbaLength;
- EFI_STATUS Status;
-
- //
- // Check for invalid conditions
- //
- if ((NumBytes == NULL) || (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*NumBytes == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check if the FV is read enabled
- //
- FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);
-
- if ((Attributes & EFI_FVB2_READ_STATUS) == 0) {
- return EFI_ACCESS_DENIED;
- }
- //
- // Perform boundary checks and adjust NumBytes
- //
- if (BlockOffset > LbaLength) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (LbaLength < (*NumBytes + BlockOffset)) {
- *NumBytes = (UINT32) (LbaLength - BlockOffset);
- Status = EFI_BAD_BUFFER_SIZE;
- }
-
- CopyMem (Buffer, (UINT8 *) (LbaAddress + BlockOffset), (UINTN) (*NumBytes));
-
- return Status;
-}
-
-EFI_STATUS
-FvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN BlockOffset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Writes specified number of bytes from the input buffer to the block
-
-Arguments:
- Instance - The FV instance to be written to
- Lba - The starting logical block index to write to
- BlockOffset - Offset into the block at which to begin writing
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- Buffer - Pointer to a caller allocated buffer that contains
- the source for the write
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - The firmware volume was written successfully
- EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output,
- NumBytes contains the total number of bytes
- actually written
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be written
- EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL
-
---*/
-{
- EFI_FVB_ATTRIBUTES_2 Attributes;
- UINTN LbaAddress;
- UINTN LbaLength;
- EFI_STATUS Status;
-
- //
- // Check for invalid conditions
- //
- if ((NumBytes == NULL) || (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*NumBytes == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check if the FV is write enabled
- //
- FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);
-
- if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
- return EFI_ACCESS_DENIED;
- }
- //
- // Perform boundary checks and adjust NumBytes
- //
- if (BlockOffset > LbaLength) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (LbaLength < (*NumBytes + BlockOffset)) {
- *NumBytes = (UINT32) (LbaLength - BlockOffset);
- Status = EFI_BAD_BUFFER_SIZE;
- }
- //
- // Write data
- //
- CopyMem ((UINT8 *) (LbaAddress + BlockOffset), Buffer, (UINTN) (*NumBytes));
-
- return Status;
-}
-
-EFI_STATUS
-FvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Erases and initializes a firmware volume block
-
-Arguments:
- Instance - The FV instance to be erased
- Lba - The logical block index to be erased
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - The erase request was successfully completed
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be written. Firmware device may have been
- partially erased
- EFI_INVALID_PARAMETER - Instance not found
-
---*/
-{
-
- EFI_FVB_ATTRIBUTES_2 Attributes;
- UINTN LbaAddress;
- UINTN LbaLength;
- EFI_STATUS Status;
- UINT8 Data;
-
- //
- // Check if the FV is write enabled
- //
- FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);
-
- if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
- return EFI_ACCESS_DENIED;
- }
- //
- // Get the starting address of the block for erase.
- //
- Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((Attributes & EFI_FVB2_ERASE_POLARITY) != 0) {
- Data = 0xFF;
- } else {
- Data = 0x0;
- }
-
- SetMem ((UINT8 *) LbaAddress, LbaLength, Data);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FvbSetVolumeAttributes (
- IN UINTN Instance,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- modified
- Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES_2
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
- Global - Pointer to ESAL_FWB_GLOBAL that contains all
- instance data
- Virtual - Whether CPU is in virtual or physical mode
-
-Returns:
- EFI_SUCCESS - Successfully returns
- EFI_ACCESS_DENIED - The volume setting is locked and cannot be modified
- EFI_INVALID_PARAMETER - Instance not found, or The attributes requested are
- in conflict with the capabilities as declared in the
- firmware volume header
-
---*/
-{
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- EFI_FVB_ATTRIBUTES_2 OldAttributes;
- EFI_FVB_ATTRIBUTES_2 *AttribPtr;
- UINT32 Capabilities;
- UINT32 OldStatus;
- UINT32 NewStatus;
- EFI_STATUS Status;
- EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
-
-
- //
- // Find the right instance of the FVB private data
- //
- Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);
- ASSERT_EFI_ERROR (Status);
-
- AttribPtr = (EFI_FVB_ATTRIBUTES_2 *) &(FwhInstance->VolumeHeader.Attributes);
- OldAttributes = *AttribPtr;
- Capabilities = OldAttributes & (EFI_FVB2_READ_DISABLED_CAP | \
- EFI_FVB2_READ_ENABLED_CAP | \
- EFI_FVB2_WRITE_DISABLED_CAP | \
- EFI_FVB2_WRITE_ENABLED_CAP | \
- EFI_FVB2_LOCK_CAP \
- );
-
- OldStatus = OldAttributes & EFI_FVB2_STATUS;
- NewStatus = *Attributes & EFI_FVB2_STATUS;
- UnchangedAttributes = EFI_FVB2_READ_DISABLED_CAP | \
- EFI_FVB2_READ_ENABLED_CAP | \
- EFI_FVB2_WRITE_DISABLED_CAP | \
- EFI_FVB2_WRITE_ENABLED_CAP | \
- EFI_FVB2_LOCK_CAP | \
- EFI_FVB2_STICKY_WRITE | \
- EFI_FVB2_MEMORY_MAPPED | \
- EFI_FVB2_ERASE_POLARITY | \
- EFI_FVB2_READ_LOCK_CAP | \
- EFI_FVB2_WRITE_LOCK_CAP | \
- EFI_FVB2_ALIGNMENT;
-
- //
- // Some attributes of FV is read only can *not* be set
- //
- if ((OldAttributes & UnchangedAttributes) ^ (*Attributes & UnchangedAttributes)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If firmware volume is locked, no status bit can be updated
- //
- if (OldAttributes & EFI_FVB2_LOCK_STATUS) {
- if (OldStatus ^ NewStatus) {
- return EFI_ACCESS_DENIED;
- }
- }
- //
- // Test read disable
- //
- if ((Capabilities & EFI_FVB2_READ_DISABLED_CAP) == 0) {
- if ((NewStatus & EFI_FVB2_READ_STATUS) == 0) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Test read enable
- //
- if ((Capabilities & EFI_FVB2_READ_ENABLED_CAP) == 0) {
- if (NewStatus & EFI_FVB2_READ_STATUS) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Test write disable
- //
- if ((Capabilities & EFI_FVB2_WRITE_DISABLED_CAP) == 0) {
- if ((NewStatus & EFI_FVB2_WRITE_STATUS) == 0) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Test write enable
- //
- if ((Capabilities & EFI_FVB2_WRITE_ENABLED_CAP) == 0) {
- if (NewStatus & EFI_FVB2_WRITE_STATUS) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Test lock
- //
- if ((Capabilities & EFI_FVB2_LOCK_CAP) == 0) {
- if (NewStatus & EFI_FVB2_LOCK_STATUS) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- *AttribPtr = (*AttribPtr) & (0xFFFFFFFF & (~EFI_FVB2_STATUS));
- *AttribPtr = (*AttribPtr) | NewStatus;
- *Attributes = *AttribPtr;
-
- return EFI_SUCCESS;
-}
-//
-// FVB protocol APIs
-//
-EFI_STATUS
-EFIAPI
-FvbProtocolGetPhysicalAddress (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-/*++
-
-Routine Description:
-
- Retrieves the physical address of the device.
-
-Arguments:
-
- This - Calling context
- Address - Output buffer containing the address.
-
-Returns:
-
-Returns:
- EFI_SUCCESS - Successfully returns
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbGetPhysicalAddress (FvbDevice->Instance, Address, mFvbModuleGlobal, EfiGoneVirtual ());
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolGetBlockSize (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieve the size of a logical block
-
-Arguments:
- This - Calling context
- Lba - Indicates which block to return the size for.
- BlockSize - A pointer to a caller allocated UINTN in which
- the size of the block is returned
- NumOfBlocks - a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbGetLbaAddress (
- FvbDevice->Instance,
- Lba,
- NULL,
- BlockSize,
- NumOfBlocks,
- mFvbModuleGlobal,
- EfiGoneVirtual ()
- );
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolGetAttributes (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves Volume attributes. No polarity translations are done.
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - Successfully returns
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbGetVolumeAttributes (FvbDevice->Instance, Attributes, mFvbModuleGlobal, EfiGoneVirtual ());
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolSetAttributes (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-/*++
-
-Routine Description:
- Sets Volume attributes. No polarity translations are done.
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - Successfully returns
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbSetVolumeAttributes (FvbDevice->Instance, Attributes, mFvbModuleGlobal, EfiGoneVirtual ());
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolEraseBlocks (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- ...
- )
-/*++
-
-Routine Description:
-
- The EraseBlock() function erases one or more blocks as denoted by the
- variable argument list. The entire parameter list of blocks must be verified
- prior to erasing any blocks. If a block is requested that does not exist
- within the associated firmware volume (it has a larger index than the last
- block of the firmware volume), the EraseBlock() function must return
- EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
-
-Arguments:
- This - Calling context
- ... - Starting LBA followed by Number of Lba to erase.
- a -1 to terminate the list.
-
-Returns:
- EFI_SUCCESS - The erase request was successfully completed
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be written. Firmware device may have been
- partially erased
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- UINTN NumOfBlocks;
- VA_LIST args;
- EFI_LBA StartingLba;
- UINTN NumOfLba;
- EFI_STATUS Status;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- Status = GetFvbInstance (FvbDevice->Instance, mFvbModuleGlobal, &FwhInstance, EfiGoneVirtual ());
- ASSERT_EFI_ERROR (Status);
-
- NumOfBlocks = FwhInstance->NumOfBlocks;
-
- VA_START (args, This);
-
- do {
- StartingLba = VA_ARG (args, EFI_LBA);
- if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
- break;
- }
-
- NumOfLba = VA_ARG (args, UINT32);
-
- //
- // Check input parameters
- //
- if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {
- VA_END (args);
- return EFI_INVALID_PARAMETER;
- }
- } while (1);
-
- VA_END (args);
-
- VA_START (args, This);
- do {
- StartingLba = VA_ARG (args, EFI_LBA);
- if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
- break;
- }
-
- NumOfLba = VA_ARG (args, UINT32);
-
- while (NumOfLba > 0) {
- Status = FvbEraseBlock (FvbDevice->Instance, StartingLba, mFvbModuleGlobal, EfiGoneVirtual ());
- if (EFI_ERROR (Status)) {
- VA_END (args);
- return Status;
- }
-
- StartingLba++;
- NumOfLba--;
- }
-
- } while (1);
-
- VA_END (args);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolWrite (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
-
- Writes data beginning at Lba:Offset from FV. The write terminates either
- when *NumBytes of data have been written, or when a block boundary is
- reached. *NumBytes is updated to reflect the actual number of bytes
- written. The write opertion does not include erase. This routine will
- attempt to write only the specified bytes. If the writes do not stick,
- it will return an error.
-
-Arguments:
- This - Calling context
- Lba - Block in which to begin write
- Offset - Offset in the block at which to begin write
- NumBytes - On input, indicates the requested write size. On
- output, indicates the actual number of bytes written
- Buffer - Buffer containing source data for the write.
-
-Returns:
- EFI_SUCCESS - The firmware volume was written successfully
- EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output,
- NumBytes contains the total number of bytes
- actually written
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be written
- EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL
-
---*/
-{
-
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbWriteBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
-}
-
-EFI_STATUS
-EFIAPI
-FvbProtocolRead (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
-
- Reads data beginning at Lba:Offset from FV. The Read terminates either
- when *NumBytes of data have been read, or when a block boundary is
- reached. *NumBytes is updated to reflect the actual number of bytes
- written. The write opertion does not include erase. This routine will
- attempt to write only the specified bytes. If the writes do not stick,
- it will return an error.
-
-Arguments:
- This - Calling context
- Lba - Block in which to begin Read
- Offset - Offset in the block at which to begin Read
- NumBytes - On input, indicates the requested write size. On
- output, indicates the actual number of bytes Read
- Buffer - Buffer containing source data for the Read.
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
- EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output,
- NumBytes contains the total number of bytes returned
- in Buffer
- EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state
- EFI_DEVICE_ERROR - The block device is not functioning correctly and
- could not be read
- EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL
-
---*/
-{
-
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
-}
-EFI_STATUS
-ValidateFvHeader (
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
- )
-/*++
-
-Routine Description:
- Check the integrity of firmware volume header
-
-Arguments:
- FwVolHeader - A pointer to a firmware volume header
-
-Returns:
- EFI_SUCCESS - The firmware volume is consistent
- EFI_NOT_FOUND - The firmware volume has corrupted. So it is not an FV
-
---*/
-{
- UINT16 *Ptr;
- UINT16 HeaderLength;
- UINT16 Checksum;
-
- //
- // Verify the header revision, header signature, length
- // Length of FvBlock cannot be 2**64-1
- // HeaderLength cannot be an odd number
- //
- if ((FwVolHeader->Revision != EFI_FVH_REVISION) ||
- (FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
- (FwVolHeader->FvLength == ((UINTN) -1)) ||
- ((FwVolHeader->HeaderLength & 0x01) != 0)
- ) {
- return EFI_NOT_FOUND;
- }
- //
- // Verify the header checksum
- //
- HeaderLength = (UINT16) (FwVolHeader->HeaderLength / 2);
- Ptr = (UINT16 *) FwVolHeader;
- Checksum = 0;
- while (HeaderLength > 0) {
- Checksum = Checksum + (*Ptr);
- HeaderLength--;
- Ptr++;
- }
-
- if (Checksum != 0) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-FvbInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This function does common initialization for FVB services
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_DXE_SERVICES *DxeServices;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
- UINT32 BufferSize;
- EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
- EFI_HANDLE FwbHandle;
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *OldFwbInterface;
- EFI_DEVICE_PATH_PROTOCOL *TempFwbDevicePath;
- FV_DEVICE_PATH TempFvbDevicePathData;
- UINT32 MaxLbaSize;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
- UINTN NumOfBlocks;
- EFI_PEI_HOB_POINTERS FvHob;
-
- //
- // Get the DXE services table
- //
- DxeServices = gDS;
-
- //
- // Allocate runtime services data for global variable, which contains
- // the private data of all firmware volume block instances
- //
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- sizeof (ESAL_FWB_GLOBAL),
- (VOID**) &mFvbModuleGlobal
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Calculate the total size for all firmware volume block instances
- //
- BufferSize = 0;
-
- FvHob.Raw = GetHobList ();
- while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {
- BaseAddress = FvHob.FirmwareVolume->BaseAddress;
- Length = FvHob.FirmwareVolume->Length;
- //
- // Check if it is a "real" flash
- //
- Status = DxeServices->GetMemorySpaceDescriptor (
- BaseAddress,
- &Descriptor
- );
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) {
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- continue;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
- Status = ValidateFvHeader (FwVolHeader);
- if (EFI_ERROR (Status)) {
- //
- // Get FvbInfo
- //
- Status = GetFvbInfo (Length, &FwVolHeader);
- if (EFI_ERROR (Status)) {
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- continue;
- }
- }
-
- BufferSize += (sizeof (EFI_FW_VOL_INSTANCE) + FwVolHeader->HeaderLength - sizeof (EFI_FIRMWARE_VOLUME_HEADER));
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- }
-
- //
- // Only need to allocate once. There is only one copy of physical memory for
- // the private data of each FV instance. But in virtual mode or in physical
- // mode, the address of the the physical memory may be different.
- //
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- BufferSize,
- (VOID**) &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Make a virtual copy of the FvInstance pointer.
- //
- FwhInstance = mFvbModuleGlobal->FvInstance[FVB_PHYSICAL];
- mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] = FwhInstance;
-
- mFvbModuleGlobal->NumFv = 0;
- MaxLbaSize = 0;
-
- FvHob.Raw = GetHobList ();
- while (NULL != (FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw))) {
- BaseAddress = FvHob.FirmwareVolume->BaseAddress;
- Length = FvHob.FirmwareVolume->Length;
- //
- // Check if it is a "real" flash
- //
- Status = DxeServices->GetMemorySpaceDescriptor (
- BaseAddress,
- &Descriptor
- );
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) {
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- continue;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
- Status = ValidateFvHeader (FwVolHeader);
- if (EFI_ERROR (Status)) {
- //
- // Get FvbInfo to provide in FwhInstance.
- //
- Status = GetFvbInfo (Length, &FwVolHeader);
- if (EFI_ERROR (Status)) {
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- continue;
- }
- //
- // Write healthy FV header back.
- //
- CopyMem (
- (VOID *) (UINTN) BaseAddress,
- (VOID *) FwVolHeader,
- FwVolHeader->HeaderLength
- );
- }
-
- FwhInstance->FvBase[FVB_PHYSICAL] = (UINTN) BaseAddress;
- FwhInstance->FvBase[FVB_VIRTUAL] = (UINTN) BaseAddress;
-
- CopyMem ((UINTN *) &(FwhInstance->VolumeHeader), (UINTN *) FwVolHeader, FwVolHeader->HeaderLength);
- FwVolHeader = &(FwhInstance->VolumeHeader);
- EfiInitializeLock (&(FwhInstance->FvbDevLock), TPL_HIGH_LEVEL);
-
- NumOfBlocks = 0;
-
- for (PtrBlockMapEntry = FwVolHeader->BlockMap; PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
- //
- // Get the maximum size of a block. The size will be used to allocate
- // buffer for Scratch space, the intermediate buffer for FVB extension
- // protocol
- //
- if (MaxLbaSize < PtrBlockMapEntry->Length) {
- MaxLbaSize = PtrBlockMapEntry->Length;
- }
-
- NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;
- }
- //
- // The total number of blocks in the FV.
- //
- FwhInstance->NumOfBlocks = NumOfBlocks;
-
- //
- // Add a FVB Protocol Instance
- //
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- sizeof (EFI_FW_VOL_BLOCK_DEVICE),
- (VOID**) &FvbDevice
- );
- ASSERT_EFI_ERROR (Status);
-
- CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));
-
- FvbDevice->Instance = mFvbModuleGlobal->NumFv;
- mFvbModuleGlobal->NumFv++;
-
- //
- // Set up the devicepath
- //
- FvbDevice->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;
- FvbDevice->DevicePath.MemMapDevPath.EndingAddress = BaseAddress + (FwVolHeader->FvLength - 1);
-
- //
- // Find a handle with a matching device path that has supports FW Block protocol
- //
- TempFwbDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &TempFvbDevicePathData;
- CopyMem (TempFwbDevicePath, &FvbDevice->DevicePath, sizeof (FV_DEVICE_PATH));
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid, &TempFwbDevicePath, &FwbHandle);
- if (EFI_ERROR (Status)) {
- //
- // LocateDevicePath fails so install a new interface and device path
- //
- FwbHandle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &FwbHandle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- &FvbDevice->FwVolBlockInstance,
- &gEfiDevicePathProtocolGuid,
- &FvbDevice->DevicePath,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- } else if (IsDevicePathEnd (TempFwbDevicePath)) {
- //
- // Device allready exists, so reinstall the FVB protocol
- //
- Status = gBS->HandleProtocol (
- FwbHandle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID**)&OldFwbInterface
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->ReinstallProtocolInterface (
- FwbHandle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- OldFwbInterface,
- &FvbDevice->FwVolBlockInstance
- );
- ASSERT_EFI_ERROR (Status);
-
- } else {
- //
- // There was a FVB protocol on an End Device Path node
- //
- ASSERT (FALSE);
- }
-
- FwhInstance = (EFI_FW_VOL_INSTANCE *)
- (
- (UINTN) ((UINT8 *) FwhInstance) + FwVolHeader->HeaderLength +
- (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
- );
-
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- }
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/FvbServicesRuntimeDxe/FvbInfo.c b/UnixPkg/FvbServicesRuntimeDxe/FvbInfo.c
deleted file mode 100644
index ebfa28dd95..0000000000
--- a/UnixPkg/FvbServicesRuntimeDxe/FvbInfo.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FvbInfo.c
-
-Abstract:
-
- Defines data structure that is the volume header found.These data is intent
- to decouple FVB driver with FV header.
-
---*/
-#include "PiDxe.h"
-#include <Guid/EventGroup.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/UefiRuntimeLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DevicePathLib.h>
-
-#include <Guid/FirmwareFileSystem2.h>
-#include <Guid/SystemNvDataGuid.h>
-
-typedef struct {
- UINT64 FvLength;
- EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
- //
- // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
- //
- EFI_FV_BLOCK_MAP_ENTRY End[1];
-} EFI_FVB_MEDIA_INFO;
-
-EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
- //
- // Recovery BOIS FVB
- //
- {
- FixedPcdGet32 (PcdUnixFlashFvRecoverySize),
- {
- {
- 0,
- }, // ZeroVector[16]
- EFI_FIRMWARE_FILE_SYSTEM2_GUID,
- FixedPcdGet32 (PcdUnixFlashFvRecoverySize),
- EFI_FVH_SIGNATURE,
- EFI_FVB2_READ_ENABLED_CAP |
- EFI_FVB2_READ_STATUS |
- EFI_FVB2_WRITE_ENABLED_CAP |
- EFI_FVB2_WRITE_STATUS |
- EFI_FVB2_ERASE_POLARITY,
- sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
- 0, // CheckSum
- 0, // ExtHeaderOffset
- {
- 0,
- }, // Reserved[1]
- 2, // Revision
- {
- {
- FixedPcdGet32 (PcdUnixFlashFvRecoverySize)/FixedPcdGet32 (PcdUnixFirmwareBlockSize),
- FixedPcdGet32 (PcdUnixFirmwareBlockSize),
- }
- }
- },
- {
- {
- 0,
- 0
- }
- }
- },
- //
- // Systen NvStorage FVB
- //
- {
- FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + \
- FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize),
- {
- {
- 0,
- }, // ZeroVector[16]
- EFI_SYSTEM_NV_DATA_FV_GUID,
- FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + \
- FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize),
- EFI_FVH_SIGNATURE,
- EFI_FVB2_READ_ENABLED_CAP |
- EFI_FVB2_READ_STATUS |
- EFI_FVB2_WRITE_ENABLED_CAP |
- EFI_FVB2_WRITE_STATUS |
- EFI_FVB2_ERASE_POLARITY,
- sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
- 0, // CheckSum
- 0, // ExtHeaderOffset
- {
- 0,
- }, // Reserved[1]
- 2, // Revision
- {
- {
- (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + \
- FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdUnixFirmwareBlockSize),
- FixedPcdGet32 (PcdUnixFirmwareBlockSize),
- }
- }
- },
- {
- {
- 0,
- 0
- }
- }
- }
-};
-
-EFI_STATUS
-GetFvbInfo (
- IN UINT64 FvLength,
- OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {
- if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {
- *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/UnixPkg/FvbServicesRuntimeDxe/FwBlockService.h b/UnixPkg/FvbServicesRuntimeDxe/FwBlockService.h
deleted file mode 100644
index b6d0c2e5dc..0000000000
--- a/UnixPkg/FvbServicesRuntimeDxe/FwBlockService.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwBlockService.h
-
-Abstract:
-
- Firmware volume block driver for Intel Firmware Hub (FWH) device
-
---*/
-
-#ifndef _FW_BLOCK_SERVICE_H
-#define _FW_BLOCK_SERVICE_H
-
-//
-// BugBug: Add documentation here for data structure!!!!
-//
-#define FVB_PHYSICAL 0
-#define FVB_VIRTUAL 1
-
-typedef struct {
- EFI_LOCK FvbDevLock;
- UINTN FvBase[2];
- UINTN NumOfBlocks;
- EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
-} EFI_FW_VOL_INSTANCE;
-
-typedef struct {
- UINT32 NumFv;
- EFI_FW_VOL_INSTANCE *FvInstance[2];
-} ESAL_FWB_GLOBAL;
-
-//
-// Fvb Protocol instance data
-//
-#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
-#define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
-#define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
-
-typedef struct {
- MEMMAP_DEVICE_PATH MemMapDevPath;
- EFI_DEVICE_PATH_PROTOCOL EndDevPath;
-} FV_DEVICE_PATH;
-
-typedef struct {
- UINTN Signature;
- FV_DEVICE_PATH DevicePath;
- UINTN Instance;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
-} EFI_FW_VOL_BLOCK_DEVICE;
-
-EFI_STATUS
-GetFvbInfo (
- IN UINT64 FvLength,
- OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
- )
-;
-
-EFI_STATUS
-FvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN BlockOffset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-FvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN BlockOffset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-FvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-FvbSetVolumeAttributes (
- IN UINTN Instance,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-FvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-FvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *Address,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-
-VOID
-EFIAPI
-FvbClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-EFI_STATUS
-FvbGetLbaAddress (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *LbaAddress,
- OUT UINTN *LbaLength,
- OUT UINTN *NumOfBlocks,
- IN ESAL_FWB_GLOBAL *Global,
- IN BOOLEAN Virtual
- )
-;
-
-//
-// Protocol APIs
-//
-EFI_STATUS
-EFIAPI
-FvbProtocolGetAttributes (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolSetAttributes (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolGetPhysicalAddress (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolGetBlockSize (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolRead (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolWrite (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-FvbProtocolEraseBlocks (
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- ...
- )
-;
-
-#endif
diff --git a/UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf b/UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
deleted file mode 100644
index 5f350b8f74..0000000000
--- a/UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
+++ /dev/null
@@ -1,79 +0,0 @@
-## @file
-# Component description file for Unix Fimware Volume Block DXE driver module.
-#
-# This DXE runtime driver implements and produces the Fimware Volue Block Protocol on
-# Unix emulator.
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = FwBlockService
- FILE_GUID = f42fd042-8985-11db-a7db-0040d02b1835
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = FvbInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- FvbInfo.c
- FWBlockService.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- HobLib
- DebugLib
- UefiRuntimeLib
- DxeServicesTableLib
- BaseLib
- UefiDriverEntryPoint
- UefiLib
- DevicePathLib
-
-[Guids]
- gEfiEventVirtualAddressChangeGuid # ALWAYS_CONSUMED Create Event: EVENT_GROUP_GUID
-
-[Protocols]
- gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEfiDevicePathProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
-
-[FixedPcd]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/Include/Common/UnixInclude.h b/UnixPkg/Include/Common/UnixInclude.h
deleted file mode 100644
index 3dbe09d8a2..0000000000
--- a/UnixPkg/Include/Common/UnixInclude.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- UnixInclude.h
-
-Abstract:
- Public include file for the Unix Library
-
---*/
-
-#ifndef __UNIX_INCLUDE_H__
-#define __UNIX_INCLUDE_H__
-
-// #include <sys/poll.h>
-// #include <dirent.h>
-
-//
-// Name mangle to prevent build errors. I.e conflicts between EFI and OS
-//
-#define NTOHL _UNIX_EFI_NAME_MANGLE_NTOHL_
-#define HTONL _UNIX_EFI_NAME_MANGLE_HTONL_
-#define NTOHS _UNIX_EFI_NAME_MANGLE_NTOHS_
-#define HTONS _UNIX_EFI_NAME_MANGLE_HTOHS_
-#define B0 _UNIX_EFI_NAME_MANGLE_B0_
-
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/termios.h>
-#include <sys/time.h>
-
-#if __CYGWIN__
-#include <sys/dirent.h>
-#else
-#include <sys/dir.h>
-#endif
-
-#include <unistd.h>
-#include <poll.h>
-#include <fcntl.h>
-#include <time.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <ifaddrs.h>
-
-#ifdef __APPLE__
-#include <net/if_dl.h>
-#include <net/bpf.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#define _XOPEN_SOURCE
-#ifndef _Bool
- #define _Bool char // for clang debug
-#endif
-#else
-#include <termio.h>
-#include <sys/vfs.h>
-#endif
-
-#include <utime.h>
-
-#if __APPLE__
-//
-// EFI packing is not compatible witht he default OS packing for struct stat.
-// st_size is 64-bit but starts on a 32-bit offset in the structure. The compiler
-// flags used to produce compatible EFI images, break struct stat
-//
-#ifdef MDE_CPU_IA32
-#pragma pack(4)
-#endif
-
-#if defined(__DARWIN_64_BIT_INO_T)
-
-
-typedef struct {
- UINTN tv_sec; /* seconds */
- UINTN tv_nsec; /* and nanoseconds */
-} EFI_timespec;
-
-
-
-typedef struct stat_fix { \
- dev_t st_dev; /* [XSI] ID of device containing file */
- mode_t st_mode; /* [XSI] Mode of file (see below) */
- nlink_t st_nlink; /* [XSI] Number of hard links */
- __darwin_ino64_t st_ino; /* [XSI] File serial number */
- uid_t st_uid; /* [XSI] User ID of the file */
- gid_t st_gid; /* [XSI] Group ID of the file */
- dev_t st_rdev; /* [XSI] Device ID */
-
- // clang for X64 ABI follows Windows and a long is 32-bits
- // this breaks system inlcude files so that is why we need
- // to redefine timespec as EFI_timespec
- EFI_timespec st_atimespec;
- EFI_timespec st_mtimespec;
- EFI_timespec st_ctimespec;
- EFI_timespec st_birthtimespec;
-
- off_t st_size; /* [XSI] file size, in bytes */
- blkcnt_t st_blocks; /* [XSI] blocks allocated for file */
- blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */
- __uint32_t st_flags; /* user defined flags for file */
- __uint32_t st_gen; /* file generation number */
- __int32_t st_lspare; /* RESERVED: DO NOT USE! */
- __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
-} STAT_FIX;
-
-#else /* !__DARWIN_64_BIT_INO_T */
-
-typedef struct stat_fix {
- dev_t st_dev; /* [XSI] ID of device containing file */
- ino_t st_ino; /* [XSI] File serial number */
- mode_t st_mode; /* [XSI] Mode of file (see below) */
- nlink_t st_nlink; /* [XSI] Number of hard links */
- uid_t st_uid; /* [XSI] User ID of the file */
- gid_t st_gid; /* [XSI] Group ID of the file */
- dev_t st_rdev; /* [XSI] Device ID */
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
- struct timespec st_atimespec; /* time of last access */
- struct timespec st_mtimespec; /* time of last data modification */
- struct timespec st_ctimespec; /* time of last status change */
-#else
- time_t st_atime; /* [XSI] Time of last access */
- long st_atimensec; /* nsec of last access */
- time_t st_mtime; /* [XSI] Last data modification time */
- long st_mtimensec; /* last data modification nsec */
- time_t st_ctime; /* [XSI] Time of last status change */
- long st_ctimensec; /* nsec of last status change */
-#endif
- off_t st_size; /* [XSI] file size, in bytes */
- blkcnt_t st_blocks; /* [XSI] blocks allocated for file */
- blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */
- __uint32_t st_flags; /* user defined flags for file */
- __uint32_t st_gen; /* file generation number */
- __int32_t st_lspare; /* RESERVED: DO NOT USE! */
- __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
-} STAT_FIX;
-
-#endif
-
-#ifdef MDE_CPU_IA32
-#pragma pack(4)
-#endif
-
-#else
-
- typedef struct stat STAT_FIX;
-
-#endif
-
-//
-// Undo name mangling
-//
-#undef NTOHL
-#undef HTONL
-#undef NTOHS
-#undef HTONS
-#undef B0
-
-
-#endif
-
diff --git a/UnixPkg/Include/FlashLayout.h b/UnixPkg/Include/FlashLayout.h
deleted file mode 100644
index 5fa197b8fc..0000000000
--- a/UnixPkg/Include/FlashLayout.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FlashLayout.h
-
-Abstract:
-
- Platform specific flash layout
-
- BugBug: We need a better way
-
---*/
-
-#ifndef __EFI_FLASH_LAYOUT__
-#define __EFI_FLASH_LAYOUT__
-
-//
-// Firmware Volume Information for Nt32
-// adding one working block before FFS FV,
-// and another one for spare block behind FFS FV
-//
-//
-// Note: When block number is changed in .dsc file,
-// this value should be changed accordingly!!!
-//
-#define FIRMWARE_BLOCK_NUMBER 0x28
-
-#define EFI_WINNT_FIRMWARE_OFFSET 0x0
-#define EFI_WINNT_FIRMWARE_LENGTH (0x10000 * FIRMWARE_BLOCK_NUMBER)
-
-#define EFI_WINNT_RUNTIME_UPDATABLE_OFFSET (EFI_WINNT_FIRMWARE_OFFSET + EFI_WINNT_FIRMWARE_LENGTH)
-
-#define EFI_WINNT_RUNTIME_UPDATABLE_LENGTH 0x10000
-
-#define EFI_WINNT_FTW_SPARE_BLOCK_OFFSET (EFI_WINNT_RUNTIME_UPDATABLE_OFFSET + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH)
-
-#define EFI_WINNT_FTW_SPARE_BLOCK_LENGTH 0x10000
-
-#define EFI_WINNT_RUNTIME_UPDATABLE_FV_HEADER_LENGTH 0x48
-
-#define EFI_VARIABLE_STORE_OFFSET EFI_WINNT_RUNTIME_UPDATABLE_OFFSET
-
-#define EFI_VARIABLE_STORE_LENGTH 0x00C000
-
-#define EFI_EVENT_LOG_OFFSET (EFI_VARIABLE_STORE_OFFSET + EFI_VARIABLE_STORE_LENGTH)
-
-#define EFI_EVENT_LOG_LENGTH 0x002000
-
-#define EFI_FTW_WORKING_OFFSET (EFI_EVENT_LOG_OFFSET + EFI_EVENT_LOG_LENGTH)
-
-#define EFI_FTW_WORKING_LENGTH 0x002000
-
-#endif
-
diff --git a/UnixPkg/Include/Guid/UnixSystemConfig.h b/UnixPkg/Include/Guid/UnixSystemConfig.h
deleted file mode 100644
index dc56bebdb4..0000000000
--- a/UnixPkg/Include/Guid/UnixSystemConfig.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**@file
- Setup Variable data structure for Unix platform.
-
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-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 __UNIX_SYSTEM_CONFIGUE_H__
-#define __UNIX_SYSTEM_CONFIGUE_H__
-
-#define EFI_UXIX_SYSTEM_CONFIG_GUID \
- {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
-
-
-#pragma pack(1)
-typedef struct {
- //
- // Console output mode
- //
- UINT32 ConOutColumn;
- UINT32 ConOutRow;
-} UNIX_SYSTEM_CONFIGURATION;
-#pragma pack()
-
-
-extern EFI_GUID gEfiUnixSystemConfigGuid;
-
-#endif
diff --git a/UnixPkg/Include/Library/SecDispatchTableLib.h b/UnixPkg/Include/Library/SecDispatchTableLib.h
deleted file mode 100644
index 9e220073f4..0000000000
--- a/UnixPkg/Include/Library/SecDispatchTableLib.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
- Allows an override of the SEC SEC PPI Dispatch Table. This allows
- customized PPIs to be passed into the PEI Core.
-
-Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-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 __SEC_DISPATCH_TABLE_LIB_H__
-#define __SEC_DISPATCH_TABLE_LIB_H__
-
-
-/**
- Return the number of bytes that OverrideDispatchTable() will append to
- the dispatch table.
-
- @return Size of table in bytes OverrideDispatchTable() will return
-
-**/
-UINTN
-EFIAPI
-OverrideDispatchTableExtraSize (
- VOID
- );
-
-
-/**
- Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed
- up from SEC to PEI.
-
- @param OriginalTable SECs default PPI dispatch table
- @param OriginalTableSize Size of SECs default PPI dispatch table
- @param NewTable New dispatch table
- @param NewTableSize Size of of the NewTable in bytes
-
- @return EFI_SUCCESS table was copied
-
-**/
-EFI_STATUS
-EFIAPI
-OverrideDispatchTable (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable,
- IN UINTN OriginalTableSize,
- IN OUT EFI_PEI_PPI_DESCRIPTOR *NewTable,
- IN UINTN NewTableSize
- );
-
-
-#endif
diff --git a/UnixPkg/Include/Library/UnixLib.h b/UnixPkg/Include/Library/UnixLib.h
deleted file mode 100644
index 32ed2e5100..0000000000
--- a/UnixPkg/Include/Library/UnixLib.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixLib.h
-
-Abstract:
-
- Public include file for the Unix Library
-
---*/
-
-#ifndef __UNIX_LIB_H__
-#define __UNIX_LIB_H__
-
-extern EFI_UNIX_THUNK_PROTOCOL *gUnix;
-
-#endif
diff --git a/UnixPkg/Include/Ppi/UnixAutoScan.h b/UnixPkg/Include/Ppi/UnixAutoScan.h
deleted file mode 100644
index 577fd719e8..0000000000
--- a/UnixPkg/Include/Ppi/UnixAutoScan.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixAutoscan.h
-
-Abstract:
-
-Unix Autoscan PPI
-
---*/
-
-#ifndef __UNIX_PEI_AUTOSCAN_H__
-#define __UNIX_PEI_AUTOSCAN_H__
-
-#include <UnixDxe.h>
-
-#define PEI_UNIX_AUTOSCAN_PPI_GUID \
- { \
- 0xf2ed3d14, 0x8985, 0x11db, {0xb0, 0x57, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef
-EFI_STATUS
-(EFIAPI *PEI_UNIX_AUTOSCAN) (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- );
-
-/*++
-
-Routine Description:
- This service is called from Index == 0 until it returns EFI_UNSUPPORTED.
- It allows discontiguous memory regions to be supported by the emulator.
- It uses gSystemMemory[] and gSystemMemoryCount that were created by
- parsing the host environment variable EFI_MEMORY_SIZE.
- The size comes from the varaible and the address comes from the call to
- WinNtOpenFile.
-
-Arguments:
- Index - Which memory region to use
- MemoryBase - Return Base address of memory region
- MemorySize - Return size in bytes of the memory region
-
-Returns:
- EFI_SUCCESS - If memory region was mapped
- EFI_UNSUPPORTED - If Index is not supported
-
---*/
-typedef struct {
- PEI_UNIX_AUTOSCAN UnixAutoScan;
-} PEI_UNIX_AUTOSCAN_PPI;
-
-extern EFI_GUID gPeiUnixAutoScanPpiGuid;
-
-#endif
diff --git a/UnixPkg/Include/Ppi/UnixFwh.h b/UnixPkg/Include/Ppi/UnixFwh.h
deleted file mode 100644
index 1befccf250..0000000000
--- a/UnixPkg/Include/Ppi/UnixFwh.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixFwh.h
-
-Abstract:
-
- Unix FWH PPI as defined in Tiano
-
---*/
-
-#ifndef __UNIX_PEI_FWH_H__
-#define __UNIX_PEI_FWH_H__
-
-#include <UnixDxe.h>
-
-#define UNIX_FWH_PPI_GUID \
- { \
- 0xf2f0dc30, 0x8985, 0x11db, {0xa1, 0x5b, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef
-EFI_STATUS
-(EFIAPI *UNIX_FWH_INFORMATION) (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- );
-
-/*++
-
-Routine Description:
- Return the FD Size and base address. Since the FD is loaded from a
- file into host memory only the SEC will know it's address.
-
-Arguments:
- Index - Which FD, starts at zero.
- FdSize - Size of the FD in bytes
- FdBase - Start address of the FD. Assume it points to an FV Header
- FixUp - Difference between actual FD address and build address
-
-Returns:
- EFI_SUCCESS - Return the Base address and size of the FV
- EFI_UNSUPPORTED - Index does nto map to an FD in the system
-
---*/
-typedef struct {
- UNIX_FWH_INFORMATION UnixFwh;
-} UNIX_FWH_PPI;
-
-extern EFI_GUID gUnixFwhPpiGuid;
-
-#endif
diff --git a/UnixPkg/Include/Ppi/UnixPeiLoadFile.h b/UnixPkg/Include/Ppi/UnixPeiLoadFile.h
deleted file mode 100644
index f1de509dea..0000000000
--- a/UnixPkg/Include/Ppi/UnixPeiLoadFile.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixPeiLoadFile.h
-
-Abstract:
-
- Unix Load File PPI.
-
- When the PEI core is done it calls the DXE IPL via PPI
-
---*/
-
-#ifndef __UNIX_PEI_LOAD_FILE_H__
-#define __UNIX_PEI_LOAD_FILE_H__
-
-#include <UnixDxe.h>
-
-#define UNIX_PEI_LOAD_FILE_GUID \
- { \
- 0xf2f48768, 0x8985, 0x11db, {0xb8, 0xda, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef
-EFI_STATUS
-(EFIAPI *UNIX_PEI_LOAD_FILE) (
- VOID *Pe32Data,
- EFI_PHYSICAL_ADDRESS *ImageAddress,
- UINT64 *ImageSize,
- EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-/*++
-
-Routine Description:
- Loads and relocates a PE/COFF image into memory.
-
-Arguments:
- Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
- ImageAddress - The base address of the relocated PE/COFF image
- ImageSize - The size of the relocated PE/COFF image
- EntryPoint - The entry point of the relocated PE/COFF image
-
-Returns:
- EFI_SUCCESS - The file was loaded and relocated
- EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
-
---*/
-typedef struct {
- UNIX_PEI_LOAD_FILE PeiLoadFileService;
-} UNIX_PEI_LOAD_FILE_PPI;
-
-extern EFI_GUID gUnixPeiLoadFilePpiGuid;
-
-#endif
diff --git a/UnixPkg/Include/Ppi/UnixThunk.h b/UnixPkg/Include/Ppi/UnixThunk.h
deleted file mode 100644
index 96076a3eab..0000000000
--- a/UnixPkg/Include/Ppi/UnixThunk.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixThunk.h
-
-Abstract:
-
- Unix Thunk interface PPI
-
---*/
-
-#ifndef __UNIX_PEI_UNIX_THUNK_H__
-#define __UNIX_PEI_UNIX_THUNK_H__
-
-#include <UnixDxe.h>
-
-#define PEI_UNIX_THUNK_PPI_GUID \
- { \
- 0xf2f830f2, 0x8985, 0x11db, {0x80, 0x6b, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef
-VOID *
-(EFIAPI *PEI_UNIX_THUNK_INTERFACE) (
- VOID
- );
-
-/*++
-
-Routine Description:
- Export of EFI_UNIX_THUNK_PROTOCOL from the Unix SEC.
-
-Arguments:
- InterfaceBase - Address of the EFI_UNIX_THUNK_PROTOCOL
-
-Returns:
- EFI_SUCCESS - Data returned
-
---*/
-typedef struct {
- PEI_UNIX_THUNK_INTERFACE UnixThunk;
-} PEI_UNIX_THUNK_PPI;
-
-extern EFI_GUID gPeiUnixThunkPpiGuid;
-
-#endif
diff --git a/UnixPkg/Include/Protocol/UnixIo.h b/UnixPkg/Include/Protocol/UnixIo.h
deleted file mode 100644
index c9b91ef366..0000000000
--- a/UnixPkg/Include/Protocol/UnixIo.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixIo.h
-
-Abstract:
-
---*/
-
-#ifndef _UNIX_IO_H_
-#define _UNIX_IO_H_
-
-#include <Protocol/UnixThunk.h>
-
-#define EFI_UNIX_IO_PROTOCOL_GUID \
- { \
- 0xf2e23f54, 0x8985, 0x11db, {0xac, 0x79, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef struct {
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- EFI_GUID *TypeGuid;
- UINT16 *EnvString;
- UINT16 InstanceNumber;
-} EFI_UNIX_IO_PROTOCOL;
-
-extern EFI_GUID gEfiUnixIoProtocolGuid;
-
-//
-// The following GUIDs are used in EFI_UNIX_IO_PROTOCOL_GUID
-// Device paths. They map 1:1 with UNIX envirnment variables. The variables
-// define what virtual hardware the emulator/UnixBusDriver will produce.
-//
-//
-// EFI_UNIX_VIRTUAL_DISKS
-//
-#define EFI_UNIX_VIRTUAL_DISKS_GUID \
- { \
- 0xf2ba331a, 0x8985, 0x11db, {0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixVirtualDisksGuid;
-
-//
-// EFI_UNIX_PHYSICAL_DISKS
-//
-#define EFI_UNIX_PHYSICAL_DISKS_GUID \
- { \
- 0xf2bdcc96, 0x8985, 0x11db, {0x87, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixPhysicalDisksGuid;
-
-//
-// EFI_UNIX_FILE_SYSTEM
-//
-#define EFI_UNIX_FILE_SYSTEM_GUID \
- { \
- 0xf2c16b9e, 0x8985, 0x11db, {0x92, 0xc8, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixFileSystemGuid;
-
-//
-// EFI_WIN_NT_SERIAL_PORT
-//
-#define EFI_UNIX_SERIAL_PORT_GUID \
- { \
- 0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x2, 0x15, 0x86, 0x14, 0x90, 0xf3} \
- }
-
-extern EFI_GUID gEfiUnixSerialPortGuid;
-
-//
-// EFI_UNIX_UGA
-//
-#define EFI_UNIX_UGA_GUID \
- { \
- 0xf2c8b80e, 0x8985, 0x11db, {0x93, 0xf1, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixUgaGuid;
-
-//
-// EFI_UNIX_GOP
-//
-#define EFI_UNIX_GOP_GUID \
- { \
- 0xbace07c2, 0x8987, 0x11db, {0xa5, 0x9a, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixGopGuid;
-
-//
-// EFI_UNIX_CONSOLE
-//
-#define EFI_UNIX_CONSOLE_GUID \
- { \
- 0xf2cc5d06, 0x8985, 0x11db, {0xbb, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixConsoleGuid;
-
-//
-// EFI_UNIX_MEMORY
-//
-#define EFI_UNIX_MEMORY_GUID \
- { \
- 0xf2d006cc, 0x8985, 0x11db, {0xa4, 0x72, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixMemoryGuid;
-
-//
-// EFI_UNIX_CPU_MODEL
-//
-#define EFI_UNIX_CPU_MODEL_GUID \
- { \
- 0xf2d3b330, 0x8985, 0x11db, {0x8a, 0xa3, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixCPUModelGuid;
-
-//
-// EFI_UNIX_CPU_SPEED
-//
-#define EFI_UNIX_CPU_SPEED_GUID \
- { \
- 0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-extern EFI_GUID gEfiUnixCPUSpeedGuid;
-
-//
-// EFI_UNIX_NETWORK
-//
-#define EFI_UNIX_NETWORK_GUID \
- { \
- 0x081603B4, 0x0F1D, 0x4022, {0xB6, 0xFD, 0x4C, 0xE3, 0x5E, 0x09, 0xA1, 0xA6 } \
- }
-
-extern EFI_GUID gEfiUnixNetworkGuid;
-
-#endif
diff --git a/UnixPkg/Include/Protocol/UnixThunk.h b/UnixPkg/Include/Protocol/UnixThunk.h
deleted file mode 100644
index 476dcc659f..0000000000
--- a/UnixPkg/Include/Protocol/UnixThunk.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixThunk.h
-
-Abstract:
-
- This protocol allows an EFI driver in the Unix emulation environment
- to make Posix calls.
-
- NEVER make an Unix call directly, always make the call via this protocol.
-
- There are no This pointers on the protocol member functions as they map
- exactly into Unix system calls.
-
---*/
-
-#ifndef _UNIX_THUNK_H_
-#define _UNIX_THUNK_H_
-
-#include <Common/UnixInclude.h>
-
-#include <Base.h>
-#include <Library/PeCoffLib.h>
-
-
-
-#define EFI_UNIX_THUNK_PROTOCOL_GUID \
- { \
- 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
- }
-
-typedef
-VOID
-(EFIAPI *UnixSleep) (
- unsigned long Milliseconds
- );
-
-typedef
-VOID
-(EFIAPI *UnixExit) (
- int status // exit code for all threads
- );
-
-typedef
-VOID
-(EFIAPI *UnixSetTimer) (
- UINT64 PeriodMs,
- VOID (EFIAPI *CallBack)(UINT64 DeltaMs)
- );
-
-typedef
-VOID
-(EFIAPI *UnixGetLocalTime) (
- EFI_TIME *Time
- );
-
-typedef
-struct tm *
-(EFIAPI *UnixGmTime)(
- const time_t *timep
- );
-
-typedef
-long
-(EFIAPI *UnixGetTimeZone)(
- void
- );
-
-typedef
-int
-(EFIAPI *UnixGetDayLight)(
- void
- );
-
-typedef
-int
-(EFIAPI *UnixPoll)(
- struct pollfd *pfd,
- unsigned int nfds,
- int timeout
- );
-
-typedef
-long
-(EFIAPI *UnixRead) (
- int fd,
- void *buf,
- int count
- );
-
-typedef
-long
-(EFIAPI *UnixWrite) (
- int fd,
- const void *buf,
- int count
- );
-
-typedef
-char *
-(EFIAPI *UnixGetenv) (const char *var);
-
-typedef
-int
-(EFIAPI *UnixOpen) (const char *name, int flags, int mode);
-
-typedef
-off_t
-(EFIAPI *UnixSeek) (int fd, off_t off, int whence);
-
-typedef
-int
-(EFIAPI *UnixFtruncate) (int fd, long int len);
-
-typedef
-int
-(EFIAPI *UnixClose) (int fd);
-
-typedef
-int
-(EFIAPI *UnixMkdir)(const char *pathname, mode_t mode);
-
-typedef
-int
-(EFIAPI *UnixRmDir)(const char *pathname);
-
-typedef
-int
-(EFIAPI *UnixUnLink)(const char *pathname);
-
-typedef
-int
-(EFIAPI *UnixGetErrno)(VOID);
-
-typedef
-DIR *
-(EFIAPI *UnixOpenDir)(const char *pathname);
-
-typedef
-void
-(EFIAPI *UnixRewindDir)(DIR *dir);
-
-typedef
-struct dirent *
-(EFIAPI *UnixReadDir)(DIR *dir);
-
-typedef
-int
-(EFIAPI *UnixCloseDir)(DIR *dir);
-
-typedef
-int
-(EFIAPI *UnixStat)(const char *path, STAT_FIX *buf);
-
-typedef
-int
-(EFIAPI *UnixStatFs)(const char *path, struct statfs *buf);
-
-typedef
-int
-(EFIAPI *UnixRename)(const char *oldpath, const char *newpath);
-
-typedef
-time_t
-(EFIAPI *UnixMkTime)(struct tm *tm);
-
-typedef
-int
-(EFIAPI *UnixFSync)(int fd);
-
-typedef
-int
-(EFIAPI *UnixChmod)(const char *path, mode_t mode);
-
-typedef
-int
-(EFIAPI *UnixUTime)(const char *filename, const struct utimbuf *buf);
-
-struct _EFI_UNIX_UGA_IO_PROTOCOL;
-typedef
-EFI_STATUS
-(EFIAPI *UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
- CONST CHAR16 *Title);
-
-typedef
-int
-(EFIAPI *UnixTcflush) (int fildes, int queue_selector);
-
-typedef
-void
-(EFIAPI *UnixPerror) (__const char *__s);
-
-typedef
-int
-#if __CYGWIN__
-(EFIAPI *UnixIoCtl) (int fd, int __request, UINTN Arg);
-#else
-(EFIAPI *UnixIoCtl) (int fd, unsigned long int __request, void *Arg);
-#endif
-
-typedef
-int
-(EFIAPI *UnixFcntl) (int __fd, int __cmd, void *Arg);
-
-typedef
-int
-(EFIAPI *UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
-
-typedef
-int
-(EFIAPI *UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
-
-typedef
-int
-(EFIAPI *UnixTcgetattr) (int __fd, struct termios *__termios_p);
-
-typedef
-int
-(EFIAPI *UnixTcsetattr) (int __fd, int __optional_actions,
- __const struct termios *__termios_p);
-
-
-//
-// Worker functions to enable source level debug in the emulator
-//
-
-typedef
-RETURN_STATUS
-(EFIAPI *UnixPeCoffGetEntryPoint) (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- );
-
-typedef
-VOID
-(EFIAPI *UnixPeCoffRelocateImageExtraAction) (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-VOID
-(EFIAPI *UnixPeCoffLoaderUnloadImageExtraAction) (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-int
-(EFIAPI *UnixGetIfAddrs) (
- struct ifaddrs **ifap
- );
-
-typedef
-void
-(EFIAPI *UnixFreeIfAddrs) (
- struct ifaddrs *ifap
- );
-
-typedef
-int
-(EFIAPI *UnixSocket) (
- int domain,
- int type,
- int protocol
- );
-
-typedef
-void
-(EFIAPI *UnixDisableInterruptEmulation) (void);
-
-typedef
-void
-(EFIAPI *UnixEnableInterruptEmulation) (void);
-
-
-
-
-#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('L', 'N', 'X', 'T')
-
-typedef struct _EFI_UNIX_THUNK_PROTOCOL {
- UINT64 Signature;
-
- UnixSleep Sleep;
- UnixExit Exit;
- UnixSetTimer SetTimer;
- UnixGetLocalTime GetLocalTime;
- UnixGmTime GmTime;
- UnixGetTimeZone GetTimeZone;
- UnixGetDayLight GetDayLight;
- UnixPoll Poll;
- UnixRead Read;
- UnixWrite Write;
- UnixGetenv Getenv;
- UnixOpen Open;
- UnixSeek Lseek;
- UnixFtruncate FTruncate;
- UnixClose Close;
- UnixMkdir MkDir;
- UnixRmDir RmDir;
- UnixUnLink UnLink;
- UnixGetErrno GetErrno;
- UnixOpenDir OpenDir;
- UnixRewindDir RewindDir;
- UnixReadDir ReadDir;
- UnixCloseDir CloseDir;
- UnixStat Stat;
- UnixStatFs StatFs;
- UnixRename Rename;
- UnixMkTime MkTime;
- UnixFSync FSync;
- UnixChmod Chmod;
- UnixUTime UTime;
- UnixTcflush Tcflush;
- UnixUgaCreate UgaCreate;
- UnixPerror Perror;
- UnixIoCtl IoCtl;
- UnixFcntl Fcntl;
- UnixCfsetispeed Cfsetispeed;
- UnixCfsetospeed Cfsetospeed;
- UnixTcgetattr Tcgetattr;
- UnixTcsetattr Tcsetattr;
- UnixPeCoffGetEntryPoint PeCoffGetEntryPoint;
- UnixPeCoffRelocateImageExtraAction PeCoffRelocateImageExtraAction;
- UnixPeCoffLoaderUnloadImageExtraAction PeCoffUnloadImageExtraAction;
- UnixEnableInterruptEmulation EnableInterrupt;
- UnixDisableInterruptEmulation DisableInterrupt;
-
- UnixGetIfAddrs GetIfAddrs;
- UnixFreeIfAddrs FreeIfAddrs;
- UnixSocket Socket;
-} EFI_UNIX_THUNK_PROTOCOL;
-
-extern EFI_GUID gEfiUnixThunkProtocolGuid;
-
-#endif
diff --git a/UnixPkg/Include/Protocol/UnixUgaIo.h b/UnixPkg/Include/Protocol/UnixUgaIo.h
deleted file mode 100644
index 1327e6a096..0000000000
--- a/UnixPkg/Include/Protocol/UnixUgaIo.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Tristan Gingold. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the
-BSD License which accompanies this distribution. The full text of the
-license may be found at http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixUgaIo.h
-
-Abstract:
-
---*/
-
-#ifndef _UNIX_UGA_IO_H_
-#define _UNIX_UGA_IO_H_
-
-#include <Protocol/SimplePointer.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UgaDraw.h>
-
-#define EFI_UNIX_UGA_IO_PROTOCOL_GUID {0xf2e5e2c6, 0x8985, 0x11db, {0xa1, 0x91, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
-
-typedef struct _EFI_UNIX_UGA_IO_PROTOCOL EFI_UNIX_UGA_IO_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *UGAClose)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGASize)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga,
- UINT32 Width,
- UINT32 Height
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGACheckKey)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGAGetKey)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga,
- EFI_KEY_DATA *key
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGAKeySetState) (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- );
-
-
-typedef
-VOID
-(EFIAPI *UGA_REGISTER_KEY_NOTIFY_CALLBACK) (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGARegisterKeyNotify) (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN UGA_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- );
-
-
-typedef struct {
- UINTN SourceX;
- UINTN SourceY;
- UINTN DestinationX;
- UINTN DestinationY;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
-} UGA_BLT_ARGS;
-
-typedef
-EFI_STATUS
-(EFIAPI *UGABlt)(
- IN EFI_UNIX_UGA_IO_PROTOCOL *Uga,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UGA_BLT_ARGS *Args
- );
-
-typedef
-BOOLEAN
-(EFIAPI *UGAIsKeyPressed) (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGACheckPointer)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UGAGetPointerState)(
- EFI_UNIX_UGA_IO_PROTOCOL *Uga,
- EFI_SIMPLE_POINTER_STATE *state
- );
-
-struct _EFI_UNIX_UGA_IO_PROTOCOL {
- VOID *Private;
- UGAClose UgaClose;
- UGASize UgaSize;
- UGACheckKey UgaCheckKey;
- UGAKeySetState UgaKeySetState;
- UGAGetKey UgaGetKey;
- UGARegisterKeyNotify UgaRegisterKeyNotify;
- UGABlt UgaBlt;
- UGAIsKeyPressed UgaIsKeyPressed;
- UGACheckPointer UgaCheckPointer;
- UGAGetPointerState UgaGetPointerState;
-};
-
-
-extern EFI_GUID gEfiUnixUgaIoProtocolGuid;
-
-#endif
diff --git a/UnixPkg/Include/UnixDxe.h b/UnixPkg/Include/UnixDxe.h
deleted file mode 100644
index 29cde565a1..0000000000
--- a/UnixPkg/Include/UnixDxe.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- UnixDxe.h
-
-Abstract:
- Public include file for the Unix Library
-
---*/
-
-#ifndef __UNIX_DXE_H__
-#define __UNIX_DXE_H__
-
-#include <Ppi/UnixPeiLoadFile.h>
-#include <Ppi/UnixAutoScan.h>
-#include <Ppi/UnixThunk.h>
-#include <Ppi/UnixFwh.h>
-
-//
-// UnixIo.h depends on UnixThunk.h
-//
-
-#include <Common/UnixInclude.h>
-#include <Protocol/UnixThunk.h>
-#include <Protocol/UnixIo.h>
-
-#endif
diff --git a/UnixPkg/Include/UnixPeim.h b/UnixPkg/Include/UnixPeim.h
deleted file mode 100644
index af91d3f86f..0000000000
--- a/UnixPkg/Include/UnixPeim.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- UnixPeim.h
-
-Abstract:
- Public include file for the Unix Library
-
---*/
-
-#ifndef __UNIX_PEIM_H__
-#define __UNIX_PEIM_H__
-
-#include <Ppi/UnixPeiLoadFile.h>
-#include <Ppi/UnixAutoScan.h>
-#include <Ppi/UnixThunk.h>
-#include <Ppi/UnixFwh.h>
-
-#include <Protocol/UnixThunk.h>
-
-#endif
diff --git a/UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf b/UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
deleted file mode 100644
index 432dc59dae..0000000000
--- a/UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# A library to produce the global variable 'gUnix'
-#
-# This library contains a single global variable 'gUnix' along with a constructor to initialize that global.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = DxeUnixLib
- FILE_GUID = f39efc84-8985-11db-ad67-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UnixLib
-
- CONSTRUCTOR = UnixLibConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- HobLib
- DebugLib
-
-
-[Protocols]
- gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
diff --git a/UnixPkg/Library/DxeUnixLib/UnixLib.c b/UnixPkg/Library/DxeUnixLib/UnixLib.c
deleted file mode 100644
index 093544889a..0000000000
--- a/UnixPkg/Library/DxeUnixLib/UnixLib.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixLib.c
-
-Abstract:
-
- Unix Library
-
---*/
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Library/UnixLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-
-EFI_UNIX_THUNK_PROTOCOL *gUnix;
-
-EFI_STATUS
-EFIAPI
-UnixLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiUnixThunkProtocolGuid);
- ASSERT (GuidHob != NULL);
- gUnix = (EFI_UNIX_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- ASSERT (gUnix != NULL);
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf b/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
deleted file mode 100644
index f07d494f52..0000000000
--- a/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-# Memory Status Code Library for UEFI drivers
-#
-# Lib to provide memory journal status code reporting Routines
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = DxeUnixOemHookStatusCodeLib
- FILE_GUID = 0BB6F68A-2FC5-4394-9375-2B43F1C34B59
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = OemHookStatusCodeLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-
-[Sources]
- UnixOemHookStatusCodeLib.c
-
-
-[Packages]
- UnixPkg/UnixPkg.dec
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-
-[LibraryClasses]
- ReportStatusCodeLib
- BaseMemoryLib
- PrintLib
- HobLib
- DebugLib
-
-[Protocols]
- gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
diff --git a/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c b/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c
deleted file mode 100644
index d9a7b3e981..0000000000
--- a/UnixPkg/Library/DxeUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/** @file
- OEM hook status code library functions with no library constructor/destructor
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: UnixOemHookStatusCodeLib.c
-
-**/
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/StatusCodeDataTypeDebug.h>
-#include "UnixDxe.h"
-#include <Library/OemHookStatusCodeLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PrintLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/ReportStatusCodeLib.h>
-
-//
-// Cache of UnixThunk protocol
-//
-EFI_UNIX_THUNK_PROTOCOL *mUnix;
-
-//
-// Cache of standard output handle .
-//
-int mStdOut;
-
-/**
-
- Initialize OEM status code device .
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- //
- // Retrieve UnixThunkProtocol from GUID'ed HOB
- //
- GuidHob = GetFirstGuidHob (&gEfiUnixThunkProtocolGuid);
- ASSERT (GuidHob != NULL);
- mUnix = (EFI_UNIX_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- ASSERT (mUnix != NULL);
-
- //
- // Cache standard output handle.
- //
- mStdOut = 1;
-
- return EFI_SUCCESS;
-}
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- BASE_LIST Marker;
-
- Buffer[0] = '\0';
-
- if (Data != NULL &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "\n\rASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
-
- //
- // Callout to standard output.
- //
- mUnix->Write (
- mStdOut,
- Buffer,
- CharCount
- );
-
- return EFI_SUCCESS;
-
- } else if (Data != NULL &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiBSPrint (
- Buffer,
- sizeof (Buffer),
- Format,
- Marker
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "ERROR: C%x:V%x I%x",
- CodeType,
- Value,
- Instance
- );
-
- //
- // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
- //
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "PROGRESS CODE: V%x I%x\n\r",
- Value,
- Instance
- );
- } else {
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "Undefined: C%x:V%x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Callout to standard output.
- //
- mUnix->Write (
- mStdOut,
- Buffer,
- CharCount
- );
-
- return EFI_SUCCESS;
-}
-
diff --git a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
deleted file mode 100644
index f98b30bed8..0000000000
--- a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/**@file
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiUnixPeCoffExtraActionLib.c
-
-Abstract:
-
- Provides services to perform additional actions to relocate and unload
- PE/Coff image for Unix environment specific purpose such as souce level debug.
- This version only works for DXE phase
-
-
-**/
-
-#include <PiDxe.h>
-#include <UnixDxe.h>
-#include <Library/PeCoffLib.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PeCoffExtraActionLib.h>
-
-//
-
-// Cache of UnixThunk protocol
-
-//
-
-EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;
-
-
-/**
- The constructor function gets the pointer of the WinNT thunk functions
- It will ASSERT() if Unix thunk protocol is not installed.
-
- @retval EFI_SUCCESS Unix thunk protocol is found and cached.
-
-**/
-EFI_STATUS
-EFIAPI
-DxeUnixPeCoffLibExtraActionConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- //
- // Retrieve UnixThunkProtocol from GUID'ed HOB
- //
- GuidHob = GetFirstGuidHob (&gEfiUnixThunkProtocolGuid);
- ASSERT (GuidHob != NULL);
- mUnix = (EFI_UNIX_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- ASSERT (mUnix != NULL);
-
- return EFI_SUCCESS;
-}
-
-/**
- Performs additional actions after a PE/COFF image has been loaded and relocated.
-
- If ImageContext is NULL, then ASSERT().
-
- @param ImageContext 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
- )
-{
- if (mUnix != NULL) {
- mUnix->PeCoffRelocateImageExtraAction (ImageContext);
- }
-}
-
-
-
-/**
- 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 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
- )
-{
- if (mUnix != NULL) {
- mUnix->PeCoffUnloadImageExtraAction (ImageContext);
- }
-}
diff --git a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
deleted file mode 100644
index 6b8a89d21b..0000000000
--- a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# PeCoff extra action libary for DXE phase that run Unix emulator.
-#
-# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = DxeUnixPeCoffExtraActionLib
- FILE_GUID = C6F96971-39D2-49a5-93FC-5D42FB4D7DD2
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeCoffExtraActionLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER
-
- CONSTRUCTOR = DxeUnixPeCoffLibExtraActionConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-
-[Sources]
- DxeUnixPeCoffExtraActionLib.c
-
-[Packages]
- UnixPkg/UnixPkg.dec
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- DebugLib
- HobLib
- BaseMemoryLib
-
-[Protocols]
- gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
diff --git a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf b/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf
deleted file mode 100644
index 24e0b468d5..0000000000
--- a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.
-#
-# PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = EdkUnixPeiPeCoffGetEntryPointLib
- FILE_GUID = f3b702e8-8985-11db-9558-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeCoffGetEntryPointLib
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PeCoffGetEntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- PeiServicesLib
- DebugLib
-
-
-[Ppis]
- gUnixPeiLoadFilePpiGuid # PPI ALWAYS_CONSUMED
-
diff --git a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
deleted file mode 100644
index 3a8f304020..0000000000
--- a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeCoffGetEntryPoint.c
-
-Abstract:
-
- Tiano PE/COFF loader
-
-Revision History
-
---*/
-#include "PiPei.h"
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Ppi/UnixPeiLoadFile.h>
-#include <IndustryStandard/PeImage.h>
-#include <Library/DebugLib.h>
-
-RETURN_STATUS
-EFIAPI
-PeCoffLoaderGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- )
-/*++
-
-Routine Description:
-
- Loads a PE/COFF image into memory, this is not follow the original purpose of
- PeCoffGetEntryPoint library class. But it's ok that Unix package not run on a real
- platform and this is for source level debug.
-
-Arguments:
-
- Pe32Data - Pointer to a PE/COFF Image
-
- EntryPoint - Pointer to the entry point of the PE/COFF image
-
-Returns:
-
- EFI_SUCCESS if the EntryPoint was returned
- EFI_INVALID_PARAMETER if the EntryPoint could not be found from Pe32Data
-
---*/
-{
- PEI_UNIX_THUNK_PPI *UnixThunkPpi;
- EFI_STATUS Status;
- EFI_UNIX_THUNK_PROTOCOL *Unix;
-
- //
- // Locate Unix ThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gPeiUnixThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &UnixThunkPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- Unix = (EFI_UNIX_THUNK_PROTOCOL *)UnixThunkPpi->UnixThunk ();
-
- return Unix->PeCoffGetEntryPoint (Pe32Data, EntryPoint);
-}
-
-/**
- Returns the machine type of PE/COFF image.
- This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.
- The reason is Unix package needs to load the image to memory to support source
- level debug.
-
-
- @param Pe32Data Pointer to a PE/COFF header
-
- @return Machine type or zero if not a valid iamge
-
-**/
-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) {
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
-
- } else {
- 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 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 EFI_IMAGE_MACHINE_IA32:
- //
- // Assume PE32 image with IA32 Machine field.
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- break;
- case EFI_IMAGE_MACHINE_X64:
- case EFI_IMAGE_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 (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;
- }
-
- 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 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 SizeOfHeaders;
-}
-
diff --git a/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf b/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
deleted file mode 100644
index 792dfa8cf8..0000000000
--- a/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
+++ /dev/null
@@ -1,51 +0,0 @@
-## @file
-# Memory Status Code Library for UEFI drivers
-#
-# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = PeiUnixOemHookStatusCodeLib
- FILE_GUID = 23E378C1-B199-49ad-9F14-DAF5D3C7EC28
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = OemHookStatusCodeLib|PEIM
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-
-[Sources]
- UnixOemHookStatusCodeLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- PeiServicesLib
- ReportStatusCodeLib
- BaseMemoryLib
- PrintLib
- DebugLib
-
-[Ppis]
- gPeiUnixThunkPpiGuid # PPI ALWAYS_CONSUMED
-
diff --git a/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c b/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c
deleted file mode 100644
index b42101c24f..0000000000
--- a/UnixPkg/Library/PeiUnixOemHookStatusCodeLib/UnixOemHookStatusCodeLib.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/** @file
- OEM hook status code library functions with no library constructor/destructor
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: UnixOemHookStatusCodeLib.c
-
-**/
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/StatusCodeDataTypeDebug.h>
-#include <Ppi/UnixThunk.h>
-#include <Library/OemHookStatusCodeLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PrintLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/PeiServicesLib.h>
-
-//
-// Cache of UnixThunk protocol
-//
-EFI_UNIX_THUNK_PROTOCOL *mUnix;
-
-//
-// Cache of standard output handle .
-//
-int mStdOut;
-
-/**
-
- Initialize OEM status code device .
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- )
-{
- PEI_UNIX_THUNK_PPI *UnixThunkPpi;
- EFI_STATUS Status;
-
-
- //
- // Locate Unix ThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gPeiUnixThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &UnixThunkPpi
- );
-
- ASSERT_EFI_ERROR (Status);
-
- mUnix = (EFI_UNIX_THUNK_PROTOCOL *) UnixThunkPpi->UnixThunk ();
-
- //
- // Cache standard output handle.
- //
- mStdOut = 1;
-
- return EFI_SUCCESS;
-}
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- BASE_LIST Marker;
-
- Buffer[0] = '\0';
-
- if (Data != NULL &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "\n\rASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
-
- //
- // Callout to standard output.
- //
- mUnix->Write (
- mStdOut,
- Buffer,
- CharCount
- );
-
- return EFI_SUCCESS;
-
- } else if (Data != NULL &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiBSPrint (
- Buffer,
- sizeof (Buffer),
- Format,
- Marker
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "ERROR: C%x:V%x I%x",
- CodeType,
- Value,
- Instance
- );
-
- //
- // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
- //
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "PROGRESS CODE: V%x I%x\n\r",
- Value,
- Instance
- );
- } else {
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "Undefined: C%x:V%x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Callout to standard output.
- //
- mUnix->Write (
- mStdOut,
- Buffer,
- CharCount
- );
-
- return EFI_SUCCESS;
-}
-
diff --git a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c
deleted file mode 100644
index 98b5b9e116..0000000000
--- a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/**@file
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiUnixPeCoffExtraActionLib.c
-
-Abstract:
-
- Provides services to perform additional actions to relocate and unload
- PE/Coff image for UNIX environment specific purpose such as souce level debug.
- This version only works for PEI phase
-
-
-**/
-#include <PiPei.h>
-#include <Ppi/UnixThunk.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/PeCoffExtraActionLib.h>
-
-//
-// Cache of UnixThunk protocol
-//
-EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;
-
-/**
- The function caches the pointer of the Unix thunk functions
- It will ASSERT() if Unix thunk ppi is not installed.
-
- @retval EFI_SUCCESS WinNT thunk protocol is found and cached.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixPeCoffGetUnixThunkStucture (
- )
-{
- PEI_UNIX_THUNK_PPI *UnixThunkPpi;
- EFI_STATUS Status;
-
-
- //
- // Locate Unix ThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gPeiUnixThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &UnixThunkPpi
- );
-
- ASSERT_EFI_ERROR (Status);
-
- mUnix = (EFI_UNIX_THUNK_PROTOCOL *) UnixThunkPpi->UnixThunk ();
-
- return EFI_SUCCESS;
-}
-
-/**
- Performs additional actions after a PE/COFF image has been loaded and relocated.
-
- If ImageContext is NULL, then ASSERT().
-
- @param ImageContext 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
- )
-{
- if (mUnix == NULL) {
- UnixPeCoffGetUnixThunkStucture ();
- }
- mUnix->PeCoffRelocateImageExtraAction (ImageContext);
- }
-
-
-/**
- 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 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
- )
-{
- if (mUnix == NULL) {
- UnixPeCoffGetUnixThunkStucture ();
- }
- mUnix->PeCoffUnloadImageExtraAction (ImageContext);
-}
diff --git a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
deleted file mode 100644
index 054557483a..0000000000
--- a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
+++ /dev/null
@@ -1,45 +0,0 @@
-## @file
-# PeCoff extra action libary for Pei phase that run UNIX emulator.
-#
-# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = PeiUnixPeCoffExtraActionLib
- FILE_GUID = 1D0D29DE-A5EC-46aa-AE8A-1A5A1F71F202
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeCoffExtraActionLib|PEI_CORE PEIM
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-
-[Sources]
- PeiUnixPeCoffExtraActionLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- BaseLib
- PeiServicesLib
- DebugLib
-
-[Ppis]
- gPeiUnixThunkPpiGuid # PPI ALWAYS_CONSUMED
diff --git a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c
deleted file mode 100644
index 924547d6b4..0000000000
--- a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @file
- Allows an override of the SEC SEC PPI Dispatch Table. This allows
- customized PPIs to be passed into the PEI Core.
-
-Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
---*/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/SecDispatchTableLib.h>
-
-
-/**
- Return the number of bytes that OverrideDispatchTable() will append to
- the dispatch table.
-
- @return Size of table in bytes OverrideDispatchTable() will return
-
-**/
-UINTN
-EFIAPI
-OverrideDispatchTableExtraSize (
- )
-{
- return 0;
-}
-
-
-/**
- Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed
- up from SEC to PEI.
-
- @param OriginalTable SECs default PPI dispatch table
- @param OriginalTableSize Size of SECs default PPI dispatch table
- @param NewTable New dispatch table
- @param NewTableSize Size of of the NewTable in bytes
-
- @return EFI_SUCCESS table was copied
-
-**/
-EFI_STATUS
-EFIAPI
-OverrideDispatchTable (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable,
- IN UINTN OriginalTableSize,
- IN OUT EFI_PEI_PPI_DESCRIPTOR *NewTable,
- IN UINTN NewTableSize
- )
-{
- CopyMem (NewTable, OriginalTable, OriginalTableSize);
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
deleted file mode 100644
index 2900fdbb6a..0000000000
--- a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-## @file
-# A library to produce the global variable 'gUnix'
-#
-# This library contains a single global variable 'gUnix' along with a constructor to initialize that global.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = NullSecDispatchTableLib
- FILE_GUID = D9F3D6F5-97C4-469A-848B-03F742FCCEA3
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SecDispatchTableLib
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- SecDispatchTableLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
-
-
diff --git a/UnixPkg/Library/UnixBaseLib/ARShiftU64.c b/UnixPkg/Library/UnixBaseLib/ARShiftU64.c
deleted file mode 100644
index 6c799faed6..0000000000
--- a/UnixPkg/Library/UnixBaseLib/ARShiftU64.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/BaseLibInternals.h b/UnixPkg/Library/UnixBaseLib/BaseLibInternals.h
deleted file mode 100644
index a60310ab6f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/BaseLibInternals.h
+++ /dev/null
@@ -1,1655 +0,0 @@
-/** @file
- Declaration of internal functions in BaseLib.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- 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 <Base.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
-//
-// 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 locates the Node in the List.
-
- By searching the List, finds the location of the Node in List. At the same time,
- 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 Node is NULL, then ASSERT();
- If PcdMaximumLinkedListLenth 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 List A pointer to a node in a linked list.
- @param Node A pointer to one nod.
-
- @retval TRUE Node is in List.
- @retval FALSE Node isn't in List, or List is invalid.
-
-**/
-BOOLEAN
-EFIAPI
-IsNodeInList (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
- );
-
-/**
- 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
- );
-
-
-//
-// 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
- );
-
-
-#elif defined (MDE_CPU_IPF)
-//
-//
-// IPF specific functions
-//
-
-/**
- Reads control register DCR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_DCR.
-
- @return The 64-bit control register DCR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterDcr (
- VOID
- );
-
-
-/**
- Reads control register ITM.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_ITM.
-
- @return The 64-bit control register ITM.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterItm (
- VOID
- );
-
-
-/**
- Reads control register IVA.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IVA.
-
- @return The 64-bit control register IVA.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIva (
- VOID
- );
-
-
-/**
- Reads control register PTA.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_PTA.
-
- @return The 64-bit control register PTA.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterPta (
- VOID
- );
-
-
-/**
- Reads control register IPSR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IPSR.
-
- @return The 64-bit control register IPSR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIpsr (
- VOID
- );
-
-
-/**
- Reads control register ISR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_ISR.
-
- @return The 64-bit control register ISR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIsr (
- VOID
- );
-
-
-/**
- Reads control register IIP.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IIP.
-
- @return The 64-bit control register IIP.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIip (
- VOID
- );
-
-
-/**
- Reads control register IFA.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IFA.
-
- @return The 64-bit control register IFA.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIfa (
- VOID
- );
-
-
-/**
- Reads control register ITIR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_ITIR.
-
- @return The 64-bit control register ITIR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterItir (
- VOID
- );
-
-
-/**
- Reads control register IIPA.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IIPA.
-
- @return The 64-bit control register IIPA.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIipa (
- VOID
- );
-
-
-/**
- Reads control register IFS.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IFS.
-
- @return The 64-bit control register IFS.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIfs (
- VOID
- );
-
-
-/**
- Reads control register IIM.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IIM.
-
- @return The 64-bit control register IIM.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIim (
- VOID
- );
-
-
-/**
- Reads control register IHA.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IHA.
-
- @return The 64-bit control register IHA.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIha (
- VOID
- );
-
-
-/**
- Reads control register LID.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_LID.
-
- @return The 64-bit control register LID.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterLid (
- VOID
- );
-
-
-/**
- Reads control register IVR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IVR.
-
- @return The 64-bit control register IVR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIvr (
- VOID
- );
-
-
-/**
- Reads control register TPR.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_TPR.
-
- @return The 64-bit control register TPR.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterTpr (
- VOID
- );
-
-
-/**
- Reads control register EOI.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_EOI.
-
- @return The 64-bit control register EOI.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterEoi (
- VOID
- );
-
-
-/**
- Reads control register IRR0.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IRR0.
-
- @return The 64-bit control register IRR0.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIrr0 (
- VOID
- );
-
-
-/**
- Reads control register IRR1.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IRR1.
-
- @return The 64-bit control register IRR1.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIrr1 (
- VOID
- );
-
-
-/**
- Reads control register IRR2.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IRR2.
-
- @return The 64-bit control register IRR2.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIrr2 (
- VOID
- );
-
-
-/**
- Reads control register IRR3.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_IRR3.
-
- @return The 64-bit control register IRR3.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterIrr3 (
- VOID
- );
-
-
-/**
- Reads control register ITV.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_ITV.
-
- @return The 64-bit control register ITV.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterItv (
- VOID
- );
-
-
-/**
- Reads control register PMV.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_PMV.
-
- @return The 64-bit control register PMV.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterPmv (
- VOID
- );
-
-
-/**
- Reads control register CMCV.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_CMCV.
-
- @return The 64-bit control register CMCV.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterCmcv (
- VOID
- );
-
-
-/**
- Reads control register LRR0.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_LRR0.
-
- @return The 64-bit control register LRR0.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterLrr0 (
- VOID
- );
-
-
-/**
- Reads control register LRR1.
-
- This is a worker function for AsmReadControlRegister()
- when its parameter Index is IPF_CONTROL_REGISTER_LRR1.
-
- @return The 64-bit control register LRR1.
-
-**/
-UINT64
-EFIAPI
-AsmReadControlRegisterLrr1 (
- VOID
- );
-
-
-/**
- Reads application register K0.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K0.
-
- @return The 64-bit application register K0.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK0 (
- VOID
- );
-
-
-
-/**
- Reads application register K1.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K1.
-
- @return The 64-bit application register K1.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK1 (
- VOID
- );
-
-
-/**
- Reads application register K2.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K2.
-
- @return The 64-bit application register K2.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK2 (
- VOID
- );
-
-
-/**
- Reads application register K3.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K3.
-
- @return The 64-bit application register K3.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK3 (
- VOID
- );
-
-
-/**
- Reads application register K4.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K4.
-
- @return The 64-bit application register K4.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK4 (
- VOID
- );
-
-
-/**
- Reads application register K5.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K5.
-
- @return The 64-bit application register K5.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK5 (
- VOID
- );
-
-
-/**
- Reads application register K6.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K6.
-
- @return The 64-bit application register K6.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK6 (
- VOID
- );
-
-
-/**
- Reads application register K7.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_K7.
-
- @return The 64-bit application register K7.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterK7 (
- VOID
- );
-
-
-/**
- Reads application register RSC.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_RSC.
-
- @return The 64-bit application register RSC.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterRsc (
- VOID
- );
-
-
-/**
- Reads application register BSP.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_BSP.
-
- @return The 64-bit application register BSP.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterBsp (
- VOID
- );
-
-
-/**
- Reads application register BSPSTORE.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE.
-
- @return The 64-bit application register BSPSTORE.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterBspstore (
- VOID
- );
-
-
-/**
- Reads application register RNAT.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_RNAT.
-
- @return The 64-bit application register RNAT.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterRnat (
- VOID
- );
-
-
-/**
- Reads application register FCR.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_FCR.
-
- @return The 64-bit application register FCR.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterFcr (
- VOID
- );
-
-
-/**
- Reads application register EFLAG.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG.
-
- @return The 64-bit application register EFLAG.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterEflag (
- VOID
- );
-
-
-/**
- Reads application register CSD.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_CSD.
-
- @return The 64-bit application register CSD.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterCsd (
- VOID
- );
-
-
-/**
- Reads application register SSD.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_SSD.
-
- @return The 64-bit application register SSD.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterSsd (
- VOID
- );
-
-
-/**
- Reads application register CFLG.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_CFLG.
-
- @return The 64-bit application register CFLG.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterCflg (
- VOID
- );
-
-
-/**
- Reads application register FSR.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_FSR.
-
- @return The 64-bit application register FSR.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterFsr (
- VOID
- );
-
-
-/**
- Reads application register FIR.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_FIR.
-
- @return The 64-bit application register FIR.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterFir (
- VOID
- );
-
-
-/**
- Reads application register FDR.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_FDR.
-
- @return The 64-bit application register FDR.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterFdr (
- VOID
- );
-
-
-/**
- Reads application register CCV.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_CCV.
-
- @return The 64-bit application register CCV.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterCcv (
- VOID
- );
-
-
-/**
- Reads application register UNAT.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_UNAT.
-
- @return The 64-bit application register UNAT.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterUnat (
- VOID
- );
-
-
-/**
- Reads application register FPSR.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_FPSR.
-
- @return The 64-bit application register FPSR.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterFpsr (
- VOID
- );
-
-
-/**
- Reads application register ITC.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_ITC.
-
- @return The 64-bit application register ITC.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterItc (
- VOID
- );
-
-
-/**
- Reads application register PFS.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_PFS.
-
- @return The 64-bit application register PFS.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterPfs (
- VOID
- );
-
-
-/**
- Reads application register LC.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_LC.
-
- @return The 64-bit application register LC.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterLc (
- VOID
- );
-
-
-/**
- Reads application register EC.
-
- This is a worker function for AsmReadApplicationRegister()
- when its parameter Index is IPF_APPLICATION_REGISTER_EC.
-
- @return The 64-bit application register EC.
-
-**/
-UINT64
-EFIAPI
-AsmReadApplicationRegisterEc (
- VOID
- );
-
-
-
-/**
- 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.
-
- 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 NewBsp A pointer to the new memory location for RSE backing
- store.
-
-**/
-VOID
-EFIAPI
-AsmSwitchStackAndBackingStore (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- );
-
-/**
- Internal worker function to invalidate a range of instruction cache lines
- in the cache coherency domain of the calling CPU.
-
- Internal worker function to invalidate 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, the no instruction
- cache lines are invalidated. Address is returned.
- This function is only available on IPF.
-
- @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
-InternalFlushCacheRange (
- IN VOID *Address,
- IN UINTN Length
- );
-
-#else
-
-#endif
-
-#endif
diff --git a/UnixPkg/Library/UnixBaseLib/BitField.c b/UnixPkg/Library/UnixBaseLib/BitField.c
deleted file mode 100644
index d17e562407..0000000000
--- a/UnixPkg/Library/UnixBaseLib/BitField.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/** @file
- Bit field functions of BaseLib.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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.
-
- @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
- )
-{
- //
- // ~((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.
-
- @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
- )
-{
- //
- // ~((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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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);
-
- 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().
-
- @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);
-
- 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().
-
- @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
- );
-}
diff --git a/UnixPkg/Library/UnixBaseLib/CheckSum.c b/UnixPkg/Library/UnixBaseLib/CheckSum.c
deleted file mode 100644
index 29688291bb..0000000000
--- a/UnixPkg/Library/UnixBaseLib/CheckSum.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/** @file
- Utility functions to generate checksum based on 2's complement
- algorithm.
-
- Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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);
-}
-
-
diff --git a/UnixPkg/Library/UnixBaseLib/ChkStkGcc.c b/UnixPkg/Library/UnixBaseLib/ChkStkGcc.c
deleted file mode 100644
index ecba3853b1..0000000000
--- a/UnixPkg/Library/UnixBaseLib/ChkStkGcc.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- Provides hack function for passng GCC build.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/Cpu.c b/UnixPkg/Library/UnixBaseLib/Cpu.c
deleted file mode 100644
index 8bcbf25750..0000000000
--- a/UnixPkg/Library/UnixBaseLib/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.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/CpuDeadLoop.c b/UnixPkg/Library/UnixBaseLib/CpuDeadLoop.c
deleted file mode 100644
index 3f9440547d..0000000000
--- a/UnixPkg/Library/UnixBaseLib/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.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-
-#include <Base.h>
-#include <Library/BaseLib.h>
-
-/**
- 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/UnixPkg/Library/UnixBaseLib/DivS64x64Remainder.c b/UnixPkg/Library/UnixBaseLib/DivS64x64Remainder.c
deleted file mode 100644
index bb2fddcff8..0000000000
--- a/UnixPkg/Library/UnixBaseLib/DivS64x64Remainder.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/DivU64x32.c b/UnixPkg/Library/UnixBaseLib/DivU64x32.c
deleted file mode 100644
index 3e637ccfee..0000000000
--- a/UnixPkg/Library/UnixBaseLib/DivU64x32.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/DivU64x32Remainder.c b/UnixPkg/Library/UnixBaseLib/DivU64x32Remainder.c
deleted file mode 100644
index cf51f13647..0000000000
--- a/UnixPkg/Library/UnixBaseLib/DivU64x32Remainder.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/DivU64x64Remainder.c b/UnixPkg/Library/UnixBaseLib/DivU64x64Remainder.c
deleted file mode 100644
index 1366ca4c0a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/DivU64x64Remainder.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo32.c b/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo32.c
deleted file mode 100644
index 913efb7a9f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo32.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo64.c b/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo64.c
deleted file mode 100644
index 3574bc4d3c..0000000000
--- a/UnixPkg/Library/UnixBaseLib/GetPowerOfTwo64.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/HighBitSet32.c b/UnixPkg/Library/UnixBaseLib/HighBitSet32.c
deleted file mode 100644
index 8d055fe397..0000000000
--- a/UnixPkg/Library/UnixBaseLib/HighBitSet32.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/HighBitSet64.c b/UnixPkg/Library/UnixBaseLib/HighBitSet64.c
deleted file mode 100644
index 23abb735be..0000000000
--- a/UnixPkg/Library/UnixBaseLib/HighBitSet64.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LRotU32.c b/UnixPkg/Library/UnixBaseLib/LRotU32.c
deleted file mode 100644
index d9bde78622..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LRotU32.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LRotU64.c b/UnixPkg/Library/UnixBaseLib/LRotU64.c
deleted file mode 100644
index 66b982a042..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LRotU64.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LShiftU64.c b/UnixPkg/Library/UnixBaseLib/LShiftU64.c
deleted file mode 100644
index d13fd2185d..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LShiftU64.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LinkedList.c b/UnixPkg/Library/UnixBaseLib/LinkedList.c
deleted file mode 100644
index 726a402be7..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LinkedList.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/** @file
- Linked List Library Functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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 locates the Node in the List.
-
- By searching the List, finds the location of the Node in List. At the same time,
- 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 Node is NULL, then ASSERT().
- If PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE and Node
- is in not a member of List, then return FALSE
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
-
- @param List A pointer to a node in a linked list.
- @param Node A pointer to a node in a linked list.
- @param VerifyNodeInList TRUE if a check should be made to see if Node is a
- member of List. FALSE if no membership test should
- be performed.
-
- @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
-InternalBaseLibIsNodeInList (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node,
- IN BOOLEAN VerifyNodeInList
- )
-{
- UINTN Count;
- CONST LIST_ENTRY *Ptr;
-
- //
- // Test the validity of List and Node
- //
- ASSERT (List != NULL);
- ASSERT (List->ForwardLink != NULL);
- ASSERT (List->BackLink != NULL);
- ASSERT (Node != NULL);
-
- Count = 0;
- Ptr = List;
-
- if (FeaturePcdGet (PcdVerifyNodeInList) && VerifyNodeInList) {
- //
- // Check to see if Node is a member of List.
- // Exit early if the number of nodes in List >= PcdMaximumLinkedListLength
- //
- do {
- Ptr = Ptr->ForwardLink;
- if (PcdGet32 (PcdMaximumLinkedListLength) > 0) {
- Count++;
- //
- // ASSERT() if the linked list is too long
- //
- ASSERT (Count < PcdGet32 (PcdMaximumLinkedListLength));
-
- //
- // Return if the linked list is too long
- //
- if (Count >= PcdGet32 (PcdMaximumLinkedListLength)) {
- return (BOOLEAN)(Ptr == Node);
- }
- }
- } while ((Ptr != List) && (Ptr != Node));
-
- if (Ptr != Node) {
- return FALSE;
- }
- }
-
- if (PcdGet32 (PcdMaximumLinkedListLength) > 0) {
- //
- // 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)));
-
- //
- // ASSERT() if the linked list is too long
- //
- ASSERT (Count < PcdGet32 (PcdMaximumLinkedListLength));
- }
-
- return TRUE;
-}
-
-/**
- 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 PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (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 PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (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 PcdMaximumLinkedListLenth 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 NULL The list is empty.
-
-**/
-LIST_ENTRY *
-EFIAPI
-GetFirstNode (
- IN CONST LIST_ENTRY *List
- )
-{
- //
- // ASSERT List not too long
- //
- ASSERT (InternalBaseLibIsNodeInList (List, List, FALSE));
-
- 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 PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (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 PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (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 PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (ListHead, ListHead, FALSE));
-
- 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 PcdMaximumLinkedListLenth 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 one of the nodes in the doubly-linked list.
- @retval FALSE Node is not one of the nodes in the doubly-linked 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 (InternalBaseLibIsNodeInList (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 PcdMaximumLinkedListLenth 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 (InternalBaseLibIsNodeInList (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 (InternalBaseLibIsNodeInList (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/UnixPkg/Library/UnixBaseLib/LongJump.c b/UnixPkg/Library/UnixBaseLib/LongJump.c
deleted file mode 100644
index 062be8f2da..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LongJump.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
- Long Jump functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LowBitSet32.c b/UnixPkg/Library/UnixBaseLib/LowBitSet32.c
deleted file mode 100644
index 64300367d6..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LowBitSet32.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/LowBitSet64.c b/UnixPkg/Library/UnixBaseLib/LowBitSet64.c
deleted file mode 100644
index 2bc8bc3910..0000000000
--- a/UnixPkg/Library/UnixBaseLib/LowBitSet64.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/Math64.c b/UnixPkg/Library/UnixBaseLib/Math64.c
deleted file mode 100644
index 83d7684721..0000000000
--- a/UnixPkg/Library/UnixBaseLib/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.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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 = (((-1) << (sizeof (-1) * 8 - 1)) >> (sizeof (-1) * 8 - 1));
- 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/UnixPkg/Library/UnixBaseLib/ModU64x32.c b/UnixPkg/Library/UnixBaseLib/ModU64x32.c
deleted file mode 100644
index 29d7b779f7..0000000000
--- a/UnixPkg/Library/UnixBaseLib/ModU64x32.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/MultS64x64.c b/UnixPkg/Library/UnixBaseLib/MultS64x64.c
deleted file mode 100644
index 229c76ce68..0000000000
--- a/UnixPkg/Library/UnixBaseLib/MultS64x64.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/MultU64x32.c b/UnixPkg/Library/UnixBaseLib/MultU64x32.c
deleted file mode 100644
index a2c2436f1f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/MultU64x32.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/MultU64x64.c b/UnixPkg/Library/UnixBaseLib/MultU64x64.c
deleted file mode 100644
index a1a7629dac..0000000000
--- a/UnixPkg/Library/UnixBaseLib/MultU64x64.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/RRotU32.c b/UnixPkg/Library/UnixBaseLib/RRotU32.c
deleted file mode 100644
index f4779f5043..0000000000
--- a/UnixPkg/Library/UnixBaseLib/RRotU32.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/RRotU64.c b/UnixPkg/Library/UnixBaseLib/RRotU64.c
deleted file mode 100644
index 45be7efdc3..0000000000
--- a/UnixPkg/Library/UnixBaseLib/RRotU64.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/RShiftU64.c b/UnixPkg/Library/UnixBaseLib/RShiftU64.c
deleted file mode 100644
index 8a4834bb90..0000000000
--- a/UnixPkg/Library/UnixBaseLib/RShiftU64.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/SetJump.c b/UnixPkg/Library/UnixBaseLib/SetJump.c
deleted file mode 100644
index b8fb35bb52..0000000000
--- a/UnixPkg/Library/UnixBaseLib/SetJump.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- Internal ASSERT () functions for SetJump.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/String.c b/UnixPkg/Library/UnixBaseLib/String.c
deleted file mode 100644
index 273291a915..0000000000
--- a/UnixPkg/Library/UnixBaseLib/String.c
+++ /dev/null
@@ -1,2074 +0,0 @@
-/** @file
- Unicode and ASCII string primatives.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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"
-
-
-/**
- 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;
-}
-
-/**
- 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;
-}
-
-/**
- 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') &&
- (*FirstString == *SecondString) &&
- (Length > 1)) {
- FirstString++;
- SecondString++;
- Length--;
- }
-
- return *FirstString - *SecondString;
-}
-
-/**
- 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;
-}
-
-/**
- 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;
-}
-
-/**
- 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
-InternalCharToUpper (
- 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 (UINTN) (10 + InternalCharToUpper (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 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.
-
- @retval Value translated from String.
-
-**/
-UINTN
-EFIAPI
-StrDecimalToUintn (
- IN CONST CHAR16 *String
- )
-{
- UINTN Result;
-
- //
- // ASSERT String is less long than PcdMaximumUnicodeStringLength.
- // Length tests are performed inside StrLen().
- //
- ASSERT (StrSize (String) != 0);
-
- //
- // 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;
-
- while (InternalIsDecimalDigitCharacter (*String)) {
- //
- // If the number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= ((((UINTN) ~0) - (*String - L'0')) / 10));
-
- Result = Result * 10 + (*String - L'0');
- String++;
- }
-
- 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 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.
-
- @retval Value translated from String.
-
-**/
-UINT64
-EFIAPI
-StrDecimalToUint64 (
- IN CONST CHAR16 *String
- )
-{
- UINT64 Result;
-
- //
- // ASSERT String is less long than PcdMaximumUnicodeStringLength.
- // Length tests are performed inside StrLen().
- //
- ASSERT (StrSize (String) != 0);
-
- //
- // 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;
-
- while (InternalIsDecimalDigitCharacter (*String)) {
- //
- // If the number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= DivU64x32 (((UINT64) ~0) - (*String - L'0') , 10));
-
- Result = MultU64x32 (Result, 10) + (*String - L'0');
- String++;
- }
-
- 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 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.
-
- @retval Value translated from String.
-
-**/
-UINTN
-EFIAPI
-StrHexToUintn (
- IN CONST CHAR16 *String
- )
-{
- UINTN Result;
-
- //
- // ASSERT String is less long than PcdMaximumUnicodeStringLength.
- // Length tests are performed inside StrLen().
- //
- ASSERT (StrSize (String) != 0);
-
- //
- // 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 (InternalCharToUpper (*String) == L'X') {
- if (*(String - 1) != L'0') {
- return 0;
- }
- //
- // Skip the 'X'
- //
- String++;
- }
-
- Result = 0;
-
- while (InternalIsHexaDecimalDigitCharacter (*String)) {
- //
- // If the Hex Number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= ((((UINTN) ~0) - InternalHexCharToUintn (*String)) >> 4));
-
- Result = (Result << 4) + InternalHexCharToUintn (*String);
- String++;
- }
-
- 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 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.
-
- @retval Value translated from String.
-
-**/
-UINT64
-EFIAPI
-StrHexToUint64 (
- IN CONST CHAR16 *String
- )
-{
- UINT64 Result;
-
- //
- // ASSERT String is less long than PcdMaximumUnicodeStringLength.
- // Length tests are performed inside StrLen().
- //
- ASSERT (StrSize (String) != 0);
-
- //
- // 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 (InternalCharToUpper (*String) == L'X') {
- ASSERT (*(String - 1) == L'0');
- if (*(String - 1) != L'0') {
- return 0;
- }
- //
- // Skip the 'X'
- //
- String++;
- }
-
- Result = 0;
-
- while (InternalIsHexaDecimalDigitCharacter (*String)) {
- //
- // If the Hex Number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= RShiftU64 (((UINT64) ~0) - InternalHexCharToUintn (*String) , 4));
-
- Result = LShiftU64 (Result, 4);
- Result = Result + InternalHexCharToUintn (*String);
- String++;
- }
-
- 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'));
-}
-
-/**
- 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.
-
- 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) ((CHAR16 *) Destination - Source) > StrLen (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;
-}
-
-
-/**
- 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;
-}
-
-/**
- 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;
-}
-
-/**
- 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
-InternalBaseLibAsciiToUpper (
- 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 (UINTN) (10 + InternalBaseLibAsciiToUpper (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 = InternalBaseLibAsciiToUpper (*FirstString);
- UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
- while ((*FirstString != '\0') && (UpperFirstString == UpperSecondString)) {
- FirstString++;
- SecondString++;
- UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
- UpperSecondString = InternalBaseLibAsciiToUpper (*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') &&
- (*FirstString == *SecondString) &&
- (Length > 1)) {
- FirstString++;
- SecondString++;
- Length--;
- }
- return *FirstString - *SecondString;
-}
-
-/**
- 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;
-}
-
-/**
- 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;
-}
-
-/**
- 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 ASSERT().
- 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;
-
- //
- // ASSERT Strings is less long than PcdMaximumAsciiStringLength
- //
- ASSERT (AsciiStrSize (String) != 0);
-
- //
- // Ignore the pad spaces (space or tab)
- //
- while ((*String == ' ') || (*String == '\t' )) {
- String++;
- }
-
- //
- // Ignore leading Zeros after the spaces
- //
- while (*String == '0') {
- String++;
- }
-
- Result = 0;
-
- while (InternalAsciiIsDecimalDigitCharacter (*String)) {
- //
- // If the number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= ((((UINTN) ~0) - (*String - L'0')) / 10));
-
- Result = Result * 10 + (*String - '0');
- String++;
- }
-
- 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 ASSERT().
- 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;
-
- //
- // ASSERT Strings is less long than PcdMaximumAsciiStringLength
- //
- ASSERT (AsciiStrSize (String) != 0);
-
- //
- // Ignore the pad spaces (space or tab)
- //
- while ((*String == ' ') || (*String == '\t' )) {
- String++;
- }
-
- //
- // Ignore leading Zeros after the spaces
- //
- while (*String == '0') {
- String++;
- }
-
- Result = 0;
-
- while (InternalAsciiIsDecimalDigitCharacter (*String)) {
- //
- // If the number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= DivU64x32 (((UINT64) ~0) - (*String - L'0') , 10));
-
- Result = MultU64x32 (Result, 10) + (*String - '0');
- String++;
- }
-
- 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 ASSERT().
- 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;
-
- //
- // ASSERT Strings is less long than PcdMaximumAsciiStringLength
- //
- ASSERT (AsciiStrSize (String) != 0);
-
- //
- // Ignore the pad spaces (space or tab)
- //
- while ((*String == ' ') || (*String == '\t' )) {
- String++;
- }
-
- //
- // Ignore leading Zeros after the spaces
- //
- while (*String == '0') {
- String++;
- }
-
- if (InternalBaseLibAsciiToUpper (*String) == 'X') {
- ASSERT (*(String - 1) == '0');
- if (*(String - 1) != '0') {
- return 0;
- }
- //
- // Skip the 'X'
- //
- String++;
- }
-
- Result = 0;
-
- while (InternalAsciiIsHexaDecimalDigitCharacter (*String)) {
- //
- // If the Hex Number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= ((((UINTN) ~0) - InternalHexCharToUintn (*String)) >> 4));
-
- Result = (Result << 4) + InternalAsciiHexCharToUintn (*String);
- String++;
- }
-
- 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 ASSERT().
- 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;
-
- //
- // ASSERT Strings is less long than PcdMaximumAsciiStringLength
- //
- ASSERT (AsciiStrSize (String) != 0);
-
- //
- // Ignore the pad spaces (space or tab) and leading Zeros
- //
- //
- // Ignore the pad spaces (space or tab)
- //
- while ((*String == ' ') || (*String == '\t' )) {
- String++;
- }
-
- //
- // Ignore leading Zeros after the spaces
- //
- while (*String == '0') {
- String++;
- }
-
- if (InternalBaseLibAsciiToUpper (*String) == 'X') {
- ASSERT (*(String - 1) == '0');
- if (*(String - 1) != '0') {
- return 0;
- }
- //
- // Skip the 'X'
- //
- String++;
- }
-
- Result = 0;
-
- while (InternalAsciiIsHexaDecimalDigitCharacter (*String)) {
- //
- // If the Hex Number represented by String overflows according
- // to the range defined by UINTN, then ASSERT().
- //
- ASSERT (Result <= RShiftU64 (((UINT64) ~0) - InternalHexCharToUintn (*String) , 4));
-
- Result = LShiftU64 (Result, 4);
- Result = Result + InternalAsciiHexCharToUintn (*String);
- String++;
- }
-
- return Result;
-}
-
-
-/**
- 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) > (AsciiStrLen (Source) * sizeof (CHAR16)));
-
-
- ReturnValue = Destination;
- while (*Source != '\0') {
- *(Destination++) = (CHAR16) *(Source++);
- }
- //
- // End the Destination with a NULL.
- //
- *Destination = '\0';
-
- //
- // ASSERT Original Destination is less long than PcdMaximumUnicodeStringLength
- //
- ASSERT (StrSize (ReturnValue) != 0);
-
- return ReturnValue;
-}
-
-/**
- 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/UnixPkg/Library/UnixBaseLib/SwapBytes16.c b/UnixPkg/Library/UnixBaseLib/SwapBytes16.c
deleted file mode 100644
index 64a674a0cd..0000000000
--- a/UnixPkg/Library/UnixBaseLib/SwapBytes16.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/SwapBytes32.c b/UnixPkg/Library/UnixBaseLib/SwapBytes32.c
deleted file mode 100644
index 7e30d25132..0000000000
--- a/UnixPkg/Library/UnixBaseLib/SwapBytes32.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/SwapBytes64.c b/UnixPkg/Library/UnixBaseLib/SwapBytes64.c
deleted file mode 100644
index 6a6ce8388f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/SwapBytes64.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- Math worker functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/SwitchStack.c b/UnixPkg/Library/UnixBaseLib/SwitchStack.c
deleted file mode 100644
index 36811175af..0000000000
--- a/UnixPkg/Library/UnixBaseLib/SwitchStack.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
- Switch Stack functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/Unaligned.c b/UnixPkg/Library/UnixBaseLib/Unaligned.c
deleted file mode 100644
index 68dafa6452..0000000000
--- a/UnixPkg/Library/UnixBaseLib/Unaligned.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/** @file
- Unaligned access functions of BaseLib.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf b/UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf
deleted file mode 100644
index 081b8724dd..0000000000
--- a/UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf
+++ /dev/null
@@ -1,201 +0,0 @@
-## @file
-# Base Library implementation for X64 UnixPkg. X64 code writes CR3 so to
-# not change MdeModulePkg DxeIpl we need a UnixPkg copy of the BaseLib.
-#
-# Currently I'm debugging UnixPkg with SVR V ABI so there are some
-# temp changes for that too.
-#
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# 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
- FILE_GUID = 25A41BF7-7718-4e9a-9A7E-50DC324929FD
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = BaseLib
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM
-#
-
-[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
- String.c
- BaseLibInternals.h
-
-
-[Sources.X64]
- X64/Thunk16.asm
- X64/CpuPause.asm
- X64/EnableDisableInterrupts.asm
- X64/DisableInterrupts.asm
- X64/EnableInterrupts.asm
- X64/FlushCacheLine.asm
- X64/Invd.asm
- X64/Wbinvd.asm
- X64/DisablePaging64.asm
- X64/Mwait.asm
- X64/Monitor.asm
- X64/ReadPmc.asm
- X64/ReadTsc.asm
- X64/WriteMm7.asm
- X64/WriteMm6.asm
- X64/WriteMm5.asm
- X64/WriteMm4.asm
- X64/WriteMm3.asm
- X64/WriteMm2.asm
- X64/WriteMm1.asm
- X64/WriteMm0.asm
- X64/ReadMm7.asm
- X64/ReadMm6.asm
- X64/ReadMm5.asm
- X64/ReadMm4.asm
- X64/ReadMm3.asm
- X64/ReadMm2.asm
- X64/ReadMm1.asm
- X64/ReadMm0.asm
- X64/FxRestore.asm
- X64/FxSave.asm
- X64/WriteLdtr.asm
- X64/ReadLdtr.asm
- X64/WriteIdtr.asm
- X64/ReadIdtr.asm
- X64/WriteGdtr.asm
- X64/ReadGdtr.asm
- X64/ReadTr.asm
- X64/ReadSs.asm
- X64/ReadGs.asm
- X64/ReadFs.asm
- X64/ReadEs.asm
- X64/ReadDs.asm
- X64/ReadCs.asm
- X64/WriteDr7.asm
- X64/WriteDr6.asm
- X64/WriteDr5.asm
- X64/WriteDr4.asm
- X64/WriteDr3.asm
- X64/WriteDr2.asm
- X64/WriteDr1.asm
- X64/WriteDr0.asm
- X64/ReadDr7.asm
- X64/ReadDr6.asm
- X64/ReadDr5.asm
- X64/ReadDr4.asm
- X64/ReadDr3.asm
- X64/ReadDr2.asm
- X64/ReadDr1.asm
- X64/ReadDr0.asm
- X64/WriteCr4.asm
- X64/WriteCr3.asm
- X64/WriteCr2.asm
- X64/WriteCr0.asm
- X64/ReadCr4.asm
- X64/ReadCr3.asm
- X64/ReadCr2.asm
- X64/ReadCr0.asm
- X64/ReadEflags.asm
- X64/CpuIdEx.asm
- X64/CpuId.asm
- X64/LongJump.asm
- X64/SetJump.asm
- X64/SwitchStack.asm
- X64/EnableCache.asm
- X64/DisableCache.asm
-
- X64/CpuBreakpoint.c | MSFT
- X64/WriteMsr64.c | MSFT
- X64/ReadMsr64.c | MSFT
-
- X64/CpuBreakpoint.asm | INTEL
- X64/WriteMsr64.asm | INTEL
- X64/ReadMsr64.asm | 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
- X64/GccInline.c | GCC
- X64/Thunk16.S | GCC
- X64/SwitchStack.S | GCC
- X64/SetJump.S | GCC
- X64/LongJump.S | GCC
- X64/EnableDisableInterrupts.S | GCC
- X64/DisablePaging64.S | GCC
- X64/CpuId.S | GCC
- X64/CpuIdEx.S | GCC
- X64/EnableCache.S | GCC
- X64/DisableCache.S | GCC
- ChkStkGcc.c | GCC
-
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- PcdLib
- DebugLib
- BaseMemoryLib
-
-[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength
- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength
- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength
- gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList
diff --git a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.S b/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.S
deleted file mode 100644
index 51cf9c0784..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.S
+++ /dev/null
@@ -1,25 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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.S
-#
-# Abstract:
-#
-# Implementation of CpuBreakpoint() on x86_64
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(CpuBreakpoint)
-ASM_PFX(CpuBreakpoint):
- int $0x3
- ret
diff --git a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.asm b/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.asm
deleted file mode 100644
index 25dd9b48e8..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-;------------------------------------------------------------------------------ ;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; CpuBreakpoint (
-; VOID
-; );
-;------------------------------------------------------------------------------
-CpuBreakpoint PROC
- int 3
- ret
-CpuBreakpoint ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.c b/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.c
deleted file mode 100644
index d654f84571..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuBreakpoint.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- CpuBreakpoint function.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- 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 ();
-
-#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/UnixPkg/Library/UnixBaseLib/X64/CpuId.S b/UnixPkg/Library/UnixBaseLib/X64/CpuId.S
deleted file mode 100644
index c3d2597205..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuId.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/CpuId.asm b/UnixPkg/Library/UnixBaseLib/X64/CpuId.asm
deleted file mode 100644
index c6182c1611..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuId.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmCpuid (
-; IN UINT32 RegisterInEax,
-; OUT UINT32 *RegisterOutEax OPTIONAL,
-; OUT UINT32 *RegisterOutEbx OPTIONAL,
-; OUT UINT32 *RegisterOutEcx OPTIONAL,
-; OUT UINT32 *RegisterOutEdx OPTIONAL
-; )
-;------------------------------------------------------------------------------
-AsmCpuid PROC USES rbx
- mov eax, ecx
- push rax ; save Index on stack
- push rdx
- cpuid
- test r9, r9
- jz @F
- mov [r9], ecx
-@@:
- pop rcx
- jrcxz @F
- mov [rcx], eax
-@@:
- mov rcx, r8
- jrcxz @F
- mov [rcx], ebx
-@@:
- mov rcx, [rsp + 38h]
- jrcxz @F
- mov [rcx], edx
-@@:
- pop rax ; restore Index to rax as return value
- ret
-AsmCpuid ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.S b/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.S
deleted file mode 100644
index d47f53c84c..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.asm b/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.asm
deleted file mode 100644
index b41ba8e2fe..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuIdEx.asm
+++ /dev/null
@@ -1,64 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .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
-; )
-;------------------------------------------------------------------------------
-AsmCpuidEx PROC USES rbx
- mov eax, ecx
- mov ecx, edx
- push rax ; save Index on stack
- cpuid
- mov r10, [rsp + 38h]
- test r10, r10
- jz @F
- mov [r10], ecx
-@@:
- mov rcx, r8
- jrcxz @F
- mov [rcx], eax
-@@:
- mov rcx, r9
- jrcxz @F
- mov [rcx], ebx
-@@:
- mov rcx, [rsp + 40h]
- jrcxz @F
- mov [rcx], edx
-@@:
- pop rax ; restore Index to rax as return value
- ret
-AsmCpuidEx ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/CpuPause.asm b/UnixPkg/Library/UnixBaseLib/X64/CpuPause.asm
deleted file mode 100644
index a84465fe0a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/CpuPause.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-;------------------------------------------------------------------------------ ;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; CpuPause (
-; VOID
-; );
-;------------------------------------------------------------------------------
-CpuPause PROC
- pause
- ret
-CpuPause ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/DisableCache.S b/UnixPkg/Library/UnixBaseLib/X64/DisableCache.S
deleted file mode 100644
index 970f2f3618..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/DisableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/DisableCache.asm b/UnixPkg/Library/UnixBaseLib/X64/DisableCache.asm
deleted file mode 100644
index 9fd5bd79bd..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/DisableCache.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmDisableCache (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmDisableCache PROC
- mov rax, cr0
- bts rax, 30
- btr rax, 29
- mov cr0, rax
- wbinvd
- ret
-AsmDisableCache ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/DisableInterrupts.asm b/UnixPkg/Library/UnixBaseLib/X64/DisableInterrupts.asm
deleted file mode 100644
index 4e54e0d889..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/DisableInterrupts.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; DisableInterrupts (
-; VOID
-; );
-;------------------------------------------------------------------------------
-DisableInterrupts PROC
- cli
- ret
-DisableInterrupts ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.S b/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.S
deleted file mode 100644
index 676e9e175a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.S
+++ /dev/null
@@ -1,82 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.asm b/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.asm
deleted file mode 100644
index 32dcd5aa1f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/DisablePaging64.asm
+++ /dev/null
@@ -1,84 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86DisablePaging64 (
-; IN UINT16 Cs,
-; IN UINT32 EntryPoint,
-; IN UINT32 Context1, OPTIONAL
-; IN UINT32 Context2, OPTIONAL
-; IN UINT32 NewStack
-; );
-;------------------------------------------------------------------------------
-InternalX86DisablePaging64 PROC
- cli
- lea rsi, @F ; rsi <- The start address of transition code
- mov edi, [rsp + 28h] ; 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, 0fch
- 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 48h ; prefix to composite "retq" with next "retf"
- retf ; Use far return to load CS register from stack
-
-; Start of transition code
-@@:
- 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, 0c0000080h
- rdmsr
- and ah, NOT 1 ; clear LME
- wrmsr
- mov rax, cr4
- and al, NOT (1 SHL 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
-InternalX86DisablePaging64 ENDP
-
-mTransitionEnd LABEL BYTE
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/EnableCache.S b/UnixPkg/Library/UnixBaseLib/X64/EnableCache.S
deleted file mode 100644
index 9d739603c9..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/EnableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/EnableCache.asm b/UnixPkg/Library/UnixBaseLib/X64/EnableCache.asm
deleted file mode 100644
index 88b71d706f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/EnableCache.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmEnableCache (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmEnableCache PROC
- wbinvd
- mov rax, cr0
- btr rax, 29
- btr rax, 30
- mov cr0, rax
- ret
-AsmEnableCache ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.S b/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.S
deleted file mode 100644
index f2ff61ecfd..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.S
+++ /dev/null
@@ -1,36 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.asm b/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.asm
deleted file mode 100644
index f6b2d9c97a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/EnableDisableInterrupts.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; EnableDisableInterrupts (
-; VOID
-; );
-;------------------------------------------------------------------------------
-EnableDisableInterrupts PROC
- sti
- cli
- ret
-EnableDisableInterrupts ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/EnableInterrupts.asm b/UnixPkg/Library/UnixBaseLib/X64/EnableInterrupts.asm
deleted file mode 100644
index e776c27c4b..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/EnableInterrupts.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; EnableInterrupts (
-; VOID
-; );
-;------------------------------------------------------------------------------
-EnableInterrupts PROC
- sti
- ret
-EnableInterrupts ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/FlushCacheLine.asm b/UnixPkg/Library/UnixBaseLib/X64/FlushCacheLine.asm
deleted file mode 100644
index e30f9a90b9..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/FlushCacheLine.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID *
-; EFIAPI
-; AsmFlushCacheLine (
-; IN VOID *LinearAddress
-; );
-;------------------------------------------------------------------------------
-AsmFlushCacheLine PROC
- clflush [rcx]
- mov rax, rcx
- ret
-AsmFlushCacheLine ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/FxRestore.asm b/UnixPkg/Library/UnixBaseLib/X64/FxRestore.asm
deleted file mode 100644
index 8496331ac5..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/FxRestore.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86FxRestore (
-; IN CONST IA32_FX_BUFFER *Buffer
-; );
-;------------------------------------------------------------------------------
-InternalX86FxRestore PROC
- fxrstor [rcx]
- ret
-InternalX86FxRestore ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/FxSave.asm b/UnixPkg/Library/UnixBaseLib/X64/FxSave.asm
deleted file mode 100644
index d41e9351b3..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/FxSave.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86FxSave (
-; OUT IA32_FX_BUFFER *Buffer
-; );
-;------------------------------------------------------------------------------
-InternalX86FxSave PROC
- fxsave [rcx]
- ret
-InternalX86FxSave ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/GccInline.c b/UnixPkg/Library/UnixBaseLib/X64/GccInline.c
deleted file mode 100644
index 731172aacc..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/GccInline.c
+++ /dev/null
@@ -1,1801 +0,0 @@
-/** @file
- GCC inline implementation of BaseLib processor specific functions.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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
- )
-{
- 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/UnixPkg/Library/UnixBaseLib/X64/Invd.asm b/UnixPkg/Library/UnixBaseLib/X64/Invd.asm
deleted file mode 100644
index ed6f95da55..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Invd.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmInvd (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmInvd PROC
- invd
- ret
-AsmInvd ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/LongJump.S b/UnixPkg/Library/UnixBaseLib/X64/LongJump.S
deleted file mode 100644
index f20446fcf0..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/LongJump.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/LongJump.asm b/UnixPkg/Library/UnixBaseLib/X64/LongJump.asm
deleted file mode 100644
index eaf32ea2e6..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/LongJump.asm
+++ /dev/null
@@ -1,58 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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.
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalLongJump (
-; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-InternalLongJump PROC
- mov rbx, [rcx]
- mov rsp, [rcx + 8]
- mov rbp, [rcx + 10h]
- mov rdi, [rcx + 18h]
- mov rsi, [rcx + 20h]
- mov r12, [rcx + 28h]
- mov r13, [rcx + 30h]
- mov r14, [rcx + 38h]
- mov r15, [rcx + 40h]
- ; load non-volatile fp registers
- ldmxcsr [rcx + 50h]
- movdqu xmm6, [rcx + 58h]
- movdqu xmm7, [rcx + 68h]
- movdqu xmm8, [rcx + 78h]
- movdqu xmm9, [rcx + 88h]
- movdqu xmm10, [rcx + 98h]
- movdqu xmm11, [rcx + 0A8h]
- movdqu xmm12, [rcx + 0B8h]
- movdqu xmm13, [rcx + 0C8h]
- movdqu xmm14, [rcx + 0D8h]
- movdqu xmm15, [rcx + 0E8h]
- mov rax, rdx ; set return value
- jmp qword ptr [rcx + 48h]
-InternalLongJump ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Monitor.asm b/UnixPkg/Library/UnixBaseLib/X64/Monitor.asm
deleted file mode 100644
index 8ae6e7320c..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Monitor.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmMonitor (
-; IN UINTN Eax,
-; IN UINTN Ecx,
-; IN UINTN Edx
-; );
-;------------------------------------------------------------------------------
-AsmMonitor PROC
- mov eax, ecx
- mov ecx, edx
- mov edx, r8d
- DB 0fh, 1, 0c8h ; monitor
- ret
-AsmMonitor ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Mwait.asm b/UnixPkg/Library/UnixBaseLib/X64/Mwait.asm
deleted file mode 100644
index 02ec8633e5..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Mwait.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmMwait (
-; IN UINTN Eax,
-; IN UINTN Ecx
-; );
-;------------------------------------------------------------------------------
-AsmMwait PROC
- mov eax, ecx
- mov ecx, edx
- DB 0fh, 1, 0c9h ; mwait
- ret
-AsmMwait ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Non-existing.c b/UnixPkg/Library/UnixBaseLib/X64/Non-existing.c
deleted file mode 100644
index 5ceb64bd79..0000000000
--- a/UnixPkg/Library/UnixBaseLib/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.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.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.
-
-**/
-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/UnixPkg/Library/UnixBaseLib/X64/ReadCr0.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadCr0.asm
deleted file mode 100644
index c3ff5b0772..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadCr0.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr0 PROC
- mov rax, cr0
- ret
-AsmReadCr0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadCr2.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadCr2.asm
deleted file mode 100644
index f1473b9ad4..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadCr2.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr2 PROC
- mov rax, cr2
- ret
-AsmReadCr2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadCr3.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadCr3.asm
deleted file mode 100644
index 432468e731..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadCr3.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr3 PROC
- mov rax, cr3
- ret
-AsmReadCr3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadCr4.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadCr4.asm
deleted file mode 100644
index 17d44996ea..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadCr4.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr4 PROC
- mov rax, cr4
- ret
-AsmReadCr4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadCs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadCs.asm
deleted file mode 100644
index ac3040cd1b..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadCs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadCs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCs PROC
- mov eax, cs
- ret
-AsmReadCs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr0.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr0.asm
deleted file mode 100644
index 8ac85ade8e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr0.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr0 PROC
- mov rax, dr0
- ret
-AsmReadDr0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr1.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr1.asm
deleted file mode 100644
index 8b042e2d2e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr1.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr1 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr1 PROC
- mov rax, dr1
- ret
-AsmReadDr1 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr2.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr2.asm
deleted file mode 100644
index 9361756584..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr2.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr2 PROC
- mov rax, dr2
- ret
-AsmReadDr2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr3.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr3.asm
deleted file mode 100644
index a25fc9d97a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr3.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr3 PROC
- mov rax, dr3
- ret
-AsmReadDr3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr4.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr4.asm
deleted file mode 100644
index dc6c5e9826..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr4.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr4 PROC
- ;
- ; 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 0fh, 21h, 0e0h
- ret
-AsmReadDr4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr5.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr5.asm
deleted file mode 100644
index 7e313522f6..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr5.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr5 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr5 PROC
- ;
- ; 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 0fh, 21h, 0e8h
- ret
-AsmReadDr5 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr6.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr6.asm
deleted file mode 100644
index ee6b9ec695..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr6.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr6 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr6 PROC
- mov rax, dr6
- ret
-AsmReadDr6 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDr7.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDr7.asm
deleted file mode 100644
index 7173057e9e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDr7.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr7 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr7 PROC
- mov rax, dr7
- ret
-AsmReadDr7 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadDs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadDs.asm
deleted file mode 100644
index d67512c3de..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadDs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadDs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDs PROC
- mov eax, ds
- ret
-AsmReadDs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadEflags.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadEflags.asm
deleted file mode 100644
index b3ecc7cc16..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadEflags.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadEflags (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadEflags PROC
- pushfq
- pop rax
- ret
-AsmReadEflags ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadEs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadEs.asm
deleted file mode 100644
index 76cffdcb5c..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadEs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadEs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadEs PROC
- mov eax, es
- ret
-AsmReadEs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadFs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadFs.asm
deleted file mode 100644
index e91aa14aa6..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadFs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadFs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadFs PROC
- mov eax, fs
- ret
-AsmReadFs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadGdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadGdtr.asm
deleted file mode 100644
index ebc60bd999..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadGdtr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86ReadGdtr (
-; OUT IA32_DESCRIPTOR *Gdtr
-; );
-;------------------------------------------------------------------------------
-InternalX86ReadGdtr PROC
- sgdt fword ptr [rcx]
- ret
-InternalX86ReadGdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadGs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadGs.asm
deleted file mode 100644
index f185c38761..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadGs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadGs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadGs PROC
- mov eax, gs
- ret
-AsmReadGs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadIdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadIdtr.asm
deleted file mode 100644
index 4d53feb9d8..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadIdtr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86ReadIdtr (
-; OUT IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86ReadIdtr PROC
- sidt fword ptr [rcx]
- ret
-InternalX86ReadIdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadLdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadLdtr.asm
deleted file mode 100644
index dbe517e353..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadLdtr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadLdtr (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadLdtr PROC
- sldt eax
- ret
-AsmReadLdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm0.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm0.asm
deleted file mode 100644
index 99212c747d..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm0.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm0 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0c0h
- ret
-AsmReadMm0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm1.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm1.asm
deleted file mode 100644
index 7a9ae7c1ce..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm1.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm1 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm1 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0c8h
- ret
-AsmReadMm1 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm2.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm2.asm
deleted file mode 100644
index 337ac73dde..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm2.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm2 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0d0h
- ret
-AsmReadMm2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm3.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm3.asm
deleted file mode 100644
index 266e29a9d1..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm3.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm3 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0d8h
- ret
-AsmReadMm3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm4.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm4.asm
deleted file mode 100644
index 9cc7435807..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm4.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm4 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0e0h
- ret
-AsmReadMm4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm5.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm5.asm
deleted file mode 100644
index b66522535f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm5.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm5 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm5 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0e8h
- ret
-AsmReadMm5 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm6.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm6.asm
deleted file mode 100644
index 1e3ebc5d8e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm6.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm6 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm6 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0f0h
- ret
-AsmReadMm6 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMm7.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMm7.asm
deleted file mode 100644
index 8228672135..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMm7.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm7 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm7 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 7eh, 0f8h
- ret
-AsmReadMm7 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.asm
deleted file mode 100644
index 878ed18245..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMsr64 (
-; IN UINT32 Index
-; );
-;------------------------------------------------------------------------------
-AsmReadMsr64 PROC
- rdmsr ; edx & eax are zero extended
- shl rdx, 20h
- or rax, rdx
- ret
-AsmReadMsr64 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.c b/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.c
deleted file mode 100644
index 343e9246b0..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadMsr64.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- CpuBreakpoint function.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- 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/UnixPkg/Library/UnixBaseLib/X64/ReadPmc.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadPmc.asm
deleted file mode 100644
index 1b74f67e72..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadPmc.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadPmc (
-; IN UINT32 PmcIndex
-; );
-;------------------------------------------------------------------------------
-AsmReadPmc PROC
- rdpmc
- shl rdx, 20h
- or rax, rdx
- ret
-AsmReadPmc ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadSs.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadSs.asm
deleted file mode 100644
index 8f308c49af..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadSs.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadSs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadSs PROC
- mov eax, ss
- ret
-AsmReadSs ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadTr.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadTr.asm
deleted file mode 100644
index a114f53146..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadTr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadTr (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadTr PROC
- str eax
- ret
-AsmReadTr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/ReadTsc.asm b/UnixPkg/Library/UnixBaseLib/X64/ReadTsc.asm
deleted file mode 100644
index d792bfb204..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/ReadTsc.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadTsc (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadTsc PROC
- rdtsc
- shl rdx, 20h
- or rax, rdx
- ret
-AsmReadTsc ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/SetJump.S b/UnixPkg/Library/UnixBaseLib/X64/SetJump.S
deleted file mode 100644
index ea9e225a93..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/SetJump.S
+++ /dev/null
@@ -1,53 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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/UnixPkg/Library/UnixBaseLib/X64/SetJump.asm b/UnixPkg/Library/UnixBaseLib/X64/SetJump.asm
deleted file mode 100644
index efdbb9a1fc..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/SetJump.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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.
-;
-;------------------------------------------------------------------------------
-
- .code
-
-EXTERNDEF InternalAssertJumpBuffer:PROC
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; SetJump (
-; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
-; );
-;------------------------------------------------------------------------------
-SetJump PROC
- push rcx
- add rsp, -20h
- call InternalAssertJumpBuffer
- add rsp, 20h
- pop rcx
- pop rdx
- mov [rcx], rbx
- mov [rcx + 8], rsp
- mov [rcx + 10h], rbp
- mov [rcx + 18h], rdi
- mov [rcx + 20h], rsi
- mov [rcx + 28h], r12
- mov [rcx + 30h], r13
- mov [rcx + 38h], r14
- mov [rcx + 40h], r15
- mov [rcx + 48h], rdx
- ; save non-volatile fp registers
- stmxcsr [rcx + 50h]
- movdqu [rcx + 58h], xmm6
- movdqu [rcx + 68h], xmm7
- movdqu [rcx + 78h], xmm8
- movdqu [rcx + 88h], xmm9
- movdqu [rcx + 98h], xmm10
- movdqu [rcx + 0A8h], xmm11
- movdqu [rcx + 0B8h], xmm12
- movdqu [rcx + 0C8h], xmm13
- movdqu [rcx + 0D8h], xmm14
- movdqu [rcx + 0E8h], xmm15
- xor rax, rax
- jmp rdx
-SetJump ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S b/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S
deleted file mode 100644
index fd7ba6e717..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S
+++ /dev/null
@@ -1,48 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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):
- movq %rcx, %rax
- movq %rdx, %rcx
- movq %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
- call *%rax
diff --git a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.asm b/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.asm
deleted file mode 100644
index 0f802b0174..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.asm
+++ /dev/null
@@ -1,51 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; 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
-;
-;------------------------------------------------------------------------------
-InternalSwitchStack PROC
- 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 - 20h]
- call rax
-InternalSwitchStack ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Thunk16.S b/UnixPkg/Library/UnixBaseLib/X64/Thunk16.S
deleted file mode 100644
index 0ec71cd4b0..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Thunk16.S
+++ /dev/null
@@ -1,333 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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 <Library/BaseLib.h>
-
-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
-#define _EDI 0 // size 4
-#define _ESI 4 // size 4
-#define _EBP 8 // size 4
-#define _ESP 12 // size 4
-#define _EBX 16 // size 4
-#define _EDX 20 // size 4
-#define _ECX 24 // size 4
-#define _EAX 28 // size 4
-#define _DS 32 // size 2
-#define _ES 34 // size 2
-#define _FS 36 // size 2
-#define _GS 38 // size 2
-#define _EFLAGS 40 // size 8
-#define _EIP 48 // size 4
-#define _CS 52 // size 2
-#define _SS 54 // size 2
-#define IA32_REGS_SIZE 56
-
- .data
-
-.set L_m16SizeSym, ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)
-.set L_mThunk16AttrSym, _ThunkAttr - ASM_PFX(m16Start)
-.set L_m16GdtSym, ASM_PFX(NullSeg) - ASM_PFX(m16Start)
-.set L_m16GdtrBaseSym, _16GdtrBase - ASM_PFX(m16Start)
-.set L_mTransitionSym, _EntryPoint - ASM_PFX(m16Start)
-
-ASM_PFX(m16Size): .word L_m16SizeSym
-ASM_PFX(mThunk16Attr): .word L_mThunk16AttrSym
-ASM_PFX(m16Gdt): .word L_m16GdtSym
-ASM_PFX(m16GdtrBase): .word L_m16GdtrBaseSym
-ASM_PFX(mTransition): .word L_mTransitionSym
-
- .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
-_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:
- movw %ss,%ax
- 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
-.set EipOffset, L_64Eip - L_Base
- .word EipOffset
- .byte 0x66,0xb8 # mov eax, imm32
-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
-SavedCr0: .space 4
- movq %rax, %cr0
- .byte 0x66,0xea # jmp far cs:L_64Bit
-L_64Eip: .space 4
-SavedCs: .space 2
-L_64BitCode:
- .byte 0x90
- .byte 0x67,0xbc # mov esp, imm32
-SavedSp: .space 4 # restore stack
- nop
- ret
-
-_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start)
- .word CODE16
-_16Gdtr: .word L_GDT_SIZE - 1
-_16GdtrBase: .quad ASM_PFX(NullSeg)
-_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 L_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 (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
- lea (ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start))(%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) - SavedCr4) + 0xf)(%rcx), %r11
- andq $0xfffffffffffffff0, %r11 # r11 <- 16-byte aligned shadowed GDT table in real mode buffer
-
- movw %r10w, (SavedGdt - SavedCr4)(%rcx) # save the limit of shadowed GDT table
- movq %r11, (SavedGdt - 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
- movl %eax, (SavedCr0 - SavedCr4)(%rcx)
- andl $0x7ffffffe,%eax # clear PE, PG bits
- movq %cr4, %rbp
- movl %ebp, (%rcx) # save CR4 in SavedCr4
- andl $0x300,%ebp # clear all but PCE and OSFXSR bits
- movl %r8d, %esi # esi <- 16-bit stack segment
- .byte 0x6a, DATA32
- popq %rdx
- lgdt (_16Gdtr - SavedCr4)(%rcx)
- movl %edx,%ss
- pushfq
- lea -8(%rdx), %edx
- lea L_RetFromRealMode(%rip), %r8
- pushq %r8
- movl %cs, %r8d
- movw %r8w, (SavedCs - SavedCr4)(%rcx)
- movl %esp, (SavedSp - SavedCr4)(%rcx)
- .byte 0xff, 0x69 # jmp (_EntryPoint - SavedCr4)(%rcx)
-.set EntryPointSavedCr4Offset, _EntryPoint - SavedCr4
- .byte EntryPointSavedCr4Offset
-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/UnixPkg/Library/UnixBaseLib/X64/Thunk16.asm b/UnixPkg/Library/UnixBaseLib/X64/Thunk16.asm
deleted file mode 100644
index 829df1c2a0..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Thunk16.asm
+++ /dev/null
@@ -1,314 +0,0 @@
-
-#include "BaseLibInternals.h"
-
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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
-;
-;------------------------------------------------------------------------------
-
-EXTERNDEF m16Start:BYTE
-EXTERNDEF m16Size:WORD
-EXTERNDEF mThunk16Attr:WORD
-EXTERNDEF m16Gdt:WORD
-EXTERNDEF m16GdtrBase:WORD
-EXTERNDEF mTransition:WORD
-
-IA32_REGS STRUC 4t
-_EDI DD ?
-_ESI DD ?
-_EBP DD ?
-_ESP DD ?
-_EBX DD ?
-_EDX DD ?
-_ECX DD ?
-_EAX DD ?
-_DS DW ?
-_ES DW ?
-_FS DW ?
-_GS DW ?
-_EFLAGS DQ ?
-_EIP DD ?
-_CS DW ?
-_SS DW ?
-IA32_REGS ENDS
-
- .const
-
-m16Size DW InternalAsmThunk16 - m16Start
-mThunk16Attr DW _ThunkAttr - m16Start
-m16Gdt DW _NullSeg - m16Start
-m16GdtrBase DW _16GdtrBase - m16Start
-mTransition DW _EntryPoint - m16Start
-
- .code
-
-m16Start LABEL BYTE
-
-SavedGdt LABEL FWORD
- DW ?
- DQ ?
-
-;------------------------------------------------------------------------------
-; _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 PROC
- ;
- ; 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.
- ;
- DB 16h ; push ss
- DB 0eh ; push cs
- DB 66h
- call @Base ; push eip
-@Base:
- DB 66h
- push 0 ; reserved high order 32 bits of EFlags
- pushf ; pushfd actually
- cli ; disable interrupts
- push gs
- push fs
- DB 6 ; push es
- DB 1eh ; push ds
- DB 66h, 60h ; pushad
- DB 66h, 0bah ; mov edx, imm32
-_ThunkAttr DD ?
- test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15
- jz @1
- mov eax, 15cd2401h ; 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:
- mov ax, ss
- lea bp, [esp + sizeof (IA32_REGS)]
- ;
- ; rsi in the following 2 instructions is indeed bp in 16-bit code
- ;
- mov word ptr (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._ESP, bp
- DB 66h
- mov ebx, (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._EIP
- shl ax, 4 ; shl eax, 4
- add bp, ax ; add ebp, eax
- mov ax, cs
- shl ax, 4
- lea ax, [eax + ebx + (@64BitCode - @Base)]
- DB 66h, 2eh, 89h, 87h ; mov cs:[bx + (@64Eip - @Base)], eax
- DW @64Eip - @Base
- DB 66h, 0b8h ; mov eax, imm32
-SavedCr4 DD ?
- mov cr4, rax
- ;
- ; rdi in the instruction below is indeed bx in 16-bit code
- ;
- DB 66h, 2eh ; 2eh is "cs:" segment override
- lgdt fword ptr [rdi + (SavedGdt - @Base)]
- DB 66h
- mov ecx, 0c0000080h
- rdmsr
- or ah, 1
- wrmsr
- DB 66h, 0b8h ; mov eax, imm32
-SavedCr0 DD ?
- mov cr0, rax
- DB 66h, 0eah ; jmp far cs:@64Bit
-@64Eip DD ?
-SavedCs DW ?
-@64BitCode:
- db 090h
- db 067h, 0bch ; mov esp, imm32
-SavedSp DD ? ; restore stack
- nop
- ret
-_BackFromUserCode ENDP
-
-_EntryPoint DD _ToUserCode - m16Start
- DW CODE16
-_16Gdtr LABEL FWORD
- DW GDT_SIZE - 1
-_16GdtrBase DQ _NullSeg
-_16Idtr FWORD (1 SHL 10) - 1
-
-;------------------------------------------------------------------------------
-; _ToUserCode() takes control in real mode before passing control to user code.
-; It will be shadowed to somewhere in memory below 1MB.
-;------------------------------------------------------------------------------
-_ToUserCode PROC
- mov ss, edx ; set new segment selectors
- mov ds, edx
- mov es, edx
- mov fs, edx
- mov gs, edx
- DB 66h
- mov ecx, 0c0000080h
- mov cr0, rax ; real mode starts at next instruction
- rdmsr
- and ah, NOT 1
- wrmsr
- mov cr4, rbp
- mov ss, esi ; set up 16-bit stack segment
- mov sp, bx ; set up 16-bit stack pointer
- DB 66h ; make the following call 32-bit
- call @Base ; push eip
-@Base:
- pop bp ; ebp <- address of @Base
- push [esp + sizeof (IA32_REGS) + 2]
- lea eax, [rsi + (@RealMode - @Base)] ; rsi is "bp" in 16-bit code
- push rax
- retf ; execution begins at next instruction
-@RealMode:
- DB 66h, 2eh ; CS and operand size override
- lidt fword ptr [rsi + (_16Idtr - @Base)]
- DB 66h, 61h ; popad
- DB 1fh ; pop ds
- DB 07h ; pop es
- pop fs
- pop gs
- popf ; popfd
- lea sp, [esp + 4] ; skip high order 32 bits of EFlags
- DB 66h ; make the following retf 32-bit
- retf ; transfer control to user code
-_ToUserCode ENDP
-
-CODE16 = _16Code - $
-DATA16 = _16Data - $
-DATA32 = _32Data - $
-
-_NullSeg DQ 0
-_16Code LABEL QWORD
- DW -1
- DW 0
- DB 0
- DB 9bh
- DB 8fh ; 16-bit segment, 4GB limit
- DB 0
-_16Data LABEL QWORD
- DW -1
- DW 0
- DB 0
- DB 93h
- DB 8fh ; 16-bit segment, 4GB limit
- DB 0
-_32Data LABEL QWORD
- DW -1
- DW 0
- DB 0
- DB 93h
- DB 0cfh ; 16-bit segment, 4GB limit
- DB 0
-
-GDT_SIZE = $ - _NullSeg
-
-;------------------------------------------------------------------------------
-; IA32_REGISTER_SET *
-; EFIAPI
-; InternalAsmThunk16 (
-; IN IA32_REGISTER_SET *RegisterSet,
-; IN OUT VOID *Transition
-; );
-;------------------------------------------------------------------------------
-InternalAsmThunk16 PROC USES rbp rbx rsi rdi
- mov rbx, ds
- push rbx ; Save ds segment register on the stack
- mov rbx, es
- push rbx ; Save es segment register on the stack
- mov rbx, ss
- push rbx ; Save ss segment register on the stack
-
- push fs
- push gs
- mov rsi, rcx
- movzx r8d, (IA32_REGS ptr [rsi])._SS
- mov edi, (IA32_REGS ptr [rsi])._ESP
- lea rdi, [edi - (sizeof (IA32_REGS) + 4)]
- imul eax, r8d, 16 ; eax <- r8d(stack segment) * 16
- mov ebx, edi ; ebx <- stack for 16-bit code
- push sizeof (IA32_REGS) / 4
- add edi, eax ; edi <- linear address of 16-bit stack
- pop rcx
- rep movsd ; copy RegSet
- lea ecx, [rdx + (SavedCr4 - 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 - m16Start)] ; offset address
- stosd ; [edi] <- return address of user code
-
- sgdt fword ptr [rsp + 60h] ; save GDT stack in argument space
- movzx r10, word ptr [rsp + 60h] ; r10 <- GDT limit
- lea r11, [rcx + (InternalAsmThunk16 - SavedCr4) + 0xf]
- and r11, 0xfffffff0 ; r11 <- 16-byte aligned shadowed GDT table in real mode buffer
-
- mov word ptr [rcx + (SavedGdt - SavedCr4)], r10w ; save the limit of shadowed GDT table
- mov qword ptr [rcx + (SavedGdt - SavedCr4) + 2], r11 ; save the base address of shadowed GDT table
-
- mov rsi, qword ptr [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 fword ptr [rsp + 50h] ; save IDT stack in argument space
- mov rax, cr0
- mov [rcx + (SavedCr0 - SavedCr4)], eax
- and eax, 7ffffffeh ; clear PE, PG bits
- mov rbp, cr4
- mov [rcx], ebp ; save CR4 in SavedCr4
- and ebp, 300h ; clear all but PCE and OSFXSR bits
- mov esi, r8d ; esi <- 16-bit stack segment
- DB 6ah, DATA32 ; push DATA32
- pop rdx ; rdx <- 32-bit data segment selector
- lgdt fword ptr [rcx + (_16Gdtr - SavedCr4)]
- mov ss, edx
- pushfq
- lea edx, [rdx + DATA16 - DATA32]
- lea r8, @RetFromRealMode
- push r8
- mov r8d, cs
- mov [rcx + (SavedCs - SavedCr4)], r8w
- mov [rcx + (SavedSp - SavedCr4)], esp
- jmp fword ptr [rcx + (_EntryPoint - SavedCr4)]
-@RetFromRealMode:
- popfq
- lgdt fword ptr [rsp + 60h] ; restore protected mode GDTR
- lidt fword ptr [rsp + 50h] ; restore protected mode IDTR
- lea eax, [rbp - sizeof (IA32_REGS)]
- pop gs
- pop fs
- pop rbx
- mov ss, rbx
- pop rbx
- mov es, rbx
- pop rbx
- mov ds, rbx
- ret
-InternalAsmThunk16 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.S b/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.S
deleted file mode 100644
index 52702d55ad..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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.S
-#
-# Abstract:
-#
-# AsmWbinvd function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmWbinvd (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmWbinvd)
-ASM_PFX(AsmWbinvd):
- wbinvd
- ret
diff --git a/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.asm b/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.asm
deleted file mode 100644
index b0807e088f..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/Wbinvd.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWbinvd (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmWbinvd PROC
- wbinvd
- ret
-AsmWbinvd ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteCr0.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteCr0.asm
deleted file mode 100644
index 98fef9cd61..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteCr0.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr0 (
-; UINTN Cr0
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr0 PROC
- mov cr0, rcx
- mov rax, rcx
- ret
-AsmWriteCr0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteCr2.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteCr2.asm
deleted file mode 100644
index 3d77d6aef2..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteCr2.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr2 (
-; UINTN Cr2
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr2 PROC
- mov cr2, rcx
- mov rax, rcx
- ret
-AsmWriteCr2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteCr3.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteCr3.asm
deleted file mode 100644
index 9b39938150..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteCr3.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr3 (
-; UINTN Cr3
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr3 PROC
- mov cr3, rcx
- mov rax, rcx
- ret
-AsmWriteCr3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteCr4.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteCr4.asm
deleted file mode 100644
index 145584257e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteCr4.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr4 (
-; UINTN Cr4
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr4 PROC
- mov cr4, rcx
- mov rax, rcx
- ret
-AsmWriteCr4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr0.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr0.asm
deleted file mode 100644
index dafe9ab169..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr0.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr0 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr0 PROC
- mov dr0, rcx
- mov rax, rcx
- ret
-AsmWriteDr0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr1.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr1.asm
deleted file mode 100644
index 7167f5e5c2..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr1.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr1 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr1 PROC
- mov dr1, rcx
- mov rax, rcx
- ret
-AsmWriteDr1 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr2.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr2.asm
deleted file mode 100644
index c14ba34b15..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr2.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr2 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr2 PROC
- mov dr2, rcx
- mov rax, rcx
- ret
-AsmWriteDr2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr3.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr3.asm
deleted file mode 100644
index 8873916c4e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr3.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr3 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr3 PROC
- mov dr3, rcx
- mov rax, rcx
- ret
-AsmWriteDr3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr4.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr4.asm
deleted file mode 100644
index 4803525dd9..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr4.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr4 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr4 PROC
- ;
- ; 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 0fh, 23h, 0e1h
- mov rax, rcx
- ret
-AsmWriteDr4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr5.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr5.asm
deleted file mode 100644
index 2cdb328771..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr5.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr5 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr5 PROC
- ;
- ; 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 0fh, 23h, 0e9h
- mov rax, rcx
- ret
-AsmWriteDr5 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr6.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr6.asm
deleted file mode 100644
index 22c9c871c4..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr6.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr6 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr6 PROC
- mov dr6, rcx
- mov rax, rcx
- ret
-AsmWriteDr6 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteDr7.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteDr7.asm
deleted file mode 100644
index b55afd39af..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteDr7.asm
+++ /dev/null
@@ -1,39 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr7 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr7 PROC
- mov dr7, rcx
- mov rax, rcx
- ret
-AsmWriteDr7 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteGdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteGdtr.asm
deleted file mode 100644
index 0cc8b7ad7a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteGdtr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86WriteGdtr (
-; IN CONST IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86WriteGdtr PROC
- lgdt fword ptr [rcx]
- ret
-InternalX86WriteGdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteIdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteIdtr.asm
deleted file mode 100644
index 01ca1c0b59..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteIdtr.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86WriteIdtr (
-; IN CONST IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86WriteIdtr PROC
- pushfq
- cli
- lidt fword ptr [rcx]
- popfq
- ret
-InternalX86WriteIdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteLdtr.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteLdtr.asm
deleted file mode 100644
index af6786389b..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteLdtr.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteLdtr (
-; IN UINT16 Ldtr
-; );
-;------------------------------------------------------------------------------
-AsmWriteLdtr PROC
- lldt cx
- ret
-AsmWriteLdtr ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm0.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm0.asm
deleted file mode 100644
index f40db0339d..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm0.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm0 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm0 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0c1h
- ret
-AsmWriteMm0 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm1.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm1.asm
deleted file mode 100644
index ec17208ec4..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm1.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm1 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm1 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0c9h
- ret
-AsmWriteMm1 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm2.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm2.asm
deleted file mode 100644
index 38c0d5ed26..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm2.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm2 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm2 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0d1h
- ret
-AsmWriteMm2 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm3.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm3.asm
deleted file mode 100644
index 5f5bbdd482..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm3.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm3 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm3 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0d9h
- ret
-AsmWriteMm3 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm4.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm4.asm
deleted file mode 100644
index 7f533137f8..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm4.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm4 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm4 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0e1h
- ret
-AsmWriteMm4 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm5.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm5.asm
deleted file mode 100644
index ea30bc14a4..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm5.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm5 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm5 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0e9h
- ret
-AsmWriteMm5 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm6.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm6.asm
deleted file mode 100644
index aa926ae710..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm6.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm6 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm6 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0f1h
- ret
-AsmWriteMm6 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMm7.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMm7.asm
deleted file mode 100644
index 652e041452..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMm7.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm7 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm7 PROC
- ;
- ; 64-bit MASM doesn't support MMX instructions, so use opcode here
- ;
- DB 48h, 0fh, 6eh, 0f9h
- ret
-AsmWriteMm7 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.asm b/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.asm
deleted file mode 100644
index 19ef572845..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM 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:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmWriteMsr64 (
-; IN UINT32 Index,
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMsr64 PROC
- mov rax, rdx ; meanwhile, rax <- return value
- shr rdx, 20h ; edx:eax contains the value to write
- wrmsr
- ret
-AsmWriteMsr64 ENDP
-
- END
diff --git a/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.c b/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.c
deleted file mode 100644
index 58f0754246..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X64/WriteMsr64.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- CpuBreakpoint function.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- 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/UnixPkg/Library/UnixBaseLib/X86DisablePaging32.c b/UnixPkg/Library/UnixBaseLib/X86DisablePaging32.c
deleted file mode 100644
index cf14c84383..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86DisablePaging32.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/** @file
- IA-32/x64 AsmDisablePaging32()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86DisablePaging64.c b/UnixPkg/Library/UnixBaseLib/X86DisablePaging64.c
deleted file mode 100644
index add86cc6eb..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86DisablePaging64.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/** @file
- IA-32/x64 AsmDisablePaging64()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86EnablePaging32.c b/UnixPkg/Library/UnixBaseLib/X86EnablePaging32.c
deleted file mode 100644
index cb0ea29a4a..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86EnablePaging32.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/** @file
- IA-32/x64 AsmEnablePaging32()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86EnablePaging64.c b/UnixPkg/Library/UnixBaseLib/X86EnablePaging64.c
deleted file mode 100644
index 28f9f2733e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86EnablePaging64.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/** @file
- IA-32/x64 AsmEnablePaging64()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86FxRestore.c b/UnixPkg/Library/UnixBaseLib/X86FxRestore.c
deleted file mode 100644
index d93cc91df3..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86FxRestore.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/** @file
- IA-32/x64 AsmFxRestore()
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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[sizeof (IA32_FX_BUFFER) - 4]));
-
- InternalX86FxRestore (Buffer);
-}
diff --git a/UnixPkg/Library/UnixBaseLib/X86FxSave.c b/UnixPkg/Library/UnixBaseLib/X86FxSave.c
deleted file mode 100644
index 2dc935079e..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86FxSave.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- IA-32/x64 AsmFxSave()
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;
-}
diff --git a/UnixPkg/Library/UnixBaseLib/X86GetInterruptState.c b/UnixPkg/Library/UnixBaseLib/X86GetInterruptState.c
deleted file mode 100644
index ed3f495f9c..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86GetInterruptState.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- IA-32/x64 GetInterruptState()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86MemoryFence.c b/UnixPkg/Library/UnixBaseLib/X86MemoryFence.c
deleted file mode 100644
index 77e1c5a4dd..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86MemoryFence.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- IA-32/x64 MemoryFence().
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- 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/UnixPkg/Library/UnixBaseLib/X86Msr.c b/UnixPkg/Library/UnixBaseLib/X86Msr.c
deleted file mode 100644
index 6a6bd9e766..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86Msr.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/** @file
- IA-32/x64 MSR functions.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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().
-
- @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/UnixPkg/Library/UnixBaseLib/X86ReadGdtr.c b/UnixPkg/Library/UnixBaseLib/X86ReadGdtr.c
deleted file mode 100644
index ecd2b802cf..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86ReadGdtr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- IA-32/x64 AsmReadGdtr()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86ReadIdtr.c b/UnixPkg/Library/UnixBaseLib/X86ReadIdtr.c
deleted file mode 100644
index 392b6e3400..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86ReadIdtr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- IA-32/x64 AsmReadIdtr()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86Thunk.c b/UnixPkg/Library/UnixBaseLib/X86Thunk.c
deleted file mode 100644
index ae223b3163..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86Thunk.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/** @file
- Real Mode Thunk Functions for IA32 and x64.
-
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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 (
- 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/UnixPkg/Library/UnixBaseLib/X86WriteGdtr.c b/UnixPkg/Library/UnixBaseLib/X86WriteGdtr.c
deleted file mode 100644
index 54383d5d56..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86WriteGdtr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- IA-32/x64 AsmWriteGdtr()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBaseLib/X86WriteIdtr.c b/UnixPkg/Library/UnixBaseLib/X86WriteIdtr.c
deleted file mode 100644
index d187bc2d07..0000000000
--- a/UnixPkg/Library/UnixBaseLib/X86WriteIdtr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- IA-32/x64 AsmWriteIdtr()
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE 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/UnixPkg/Library/UnixBdsLib/BdsPlatform.c b/UnixPkg/Library/UnixBdsLib/BdsPlatform.c
deleted file mode 100644
index 671ff954fb..0000000000
--- a/UnixPkg/Library/UnixBdsLib/BdsPlatform.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsPlatform.c
-
-Abstract:
-
- This file include all platform action which can be customized
- by IBV/OEM.
-
---*/
-
-#include "BdsPlatform.h"
-
-UNIX_SYSTEM_CONFIGURATION mSystemConfigData;
-
-VOID
-SetupVariableInit (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN Size;
-
- Size = sizeof (mSystemConfigData);
- Status = gRT->GetVariable (
- L"Setup",
- &gEfiUnixSystemConfigGuid,
- NULL,
- &Size,
- (VOID *) &mSystemConfigData
- );
-
- if (EFI_ERROR (Status)) {
- //
- // SetupVariable is corrupt
- //
- mSystemConfigData.ConOutRow = PcdGet32 (PcdConOutColumn);
- mSystemConfigData.ConOutColumn = PcdGet32 (PcdConOutRow);
-
- Status = gRT->SetVariable (
- L"Setup",
- &gEfiUnixSystemConfigGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (mSystemConfigData),
- (VOID *) &mSystemConfigData
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status));
- }
- }
-}
-
-//
-// BDS Platform Functions
-//
-VOID
-EFIAPI
-PlatformBdsInit (
- VOID
- )
-/*++
-
-Routine Description:
-
- Platform Bds init. Include the platform firmware vendor, revision
- and so crc check.
-
-Arguments:
-
-Returns:
-
- None.
-
---*/
-{
- SetupVariableInit ();
-}
-
-EFI_STATUS
-PlatformBdsConnectConsole (
- IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
- )
-/*++
-
-Routine Description:
-
- Connect the predefined platform default console device. Always try to find
- and enable the vga device if have.
-
-Arguments:
-
- PlatformConsole - Predfined platform default console device array.
-
-Returns:
-
- EFI_SUCCESS - Success connect at least one ConIn and ConOut
- device, there must have one ConOut device is
- active vga device.
-
- EFI_STATUS - Return the status of
- BdsLibConnectAllDefaultConsoles ()
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
-
- Index = 0;
- Status = EFI_SUCCESS;
-
- //
- // Have chance to connect the platform default console,
- // the platform default console is the minimue device group
- // the platform should support
- //
- while (PlatformConsole[Index].DevicePath != NULL) {
- //
- // Update the console variable with the connect type
- //
- if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
- BdsLibUpdateConsoleVariable (L"ConIn", PlatformConsole[Index].DevicePath, NULL);
- }
-
- if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
- BdsLibUpdateConsoleVariable (L"ConOut", PlatformConsole[Index].DevicePath, NULL);
- }
-
- if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
- BdsLibUpdateConsoleVariable (L"ErrOut", PlatformConsole[Index].DevicePath, NULL);
- }
-
- Index++;
- }
- //
- // Connect the all the default console with current cosole variable
- //
- Status = BdsLibConnectAllDefaultConsoles ();
- return Status;
-}
-
-VOID
-PlatformBdsConnectSequence (
- VOID
- )
-/*++
-
-Routine Description:
-
- Connect with predeined platform connect sequence,
- the OEM/IBV can customize with their own connect sequence.
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
-{
- UINTN Index;
-
- Index = 0;
-
- //
- // Here we can get the customized platform connect sequence
- // Notes: we can connect with new variable which record the
- // last time boots connect device path sequence
- //
- while (gPlatformConnectSequence[Index] != NULL) {
- //
- // Build the platform boot option
- //
- BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);
- Index++;
- }
-
- //
- // Just use the simple policy to connect all devices
- //
- BdsLibConnectAll ();
-}
-
-VOID
-PlatformBdsGetDriverOption (
- IN OUT LIST_ENTRY *BdsDriverLists
- )
-/*++
-
-Routine Description:
-
- Load the predefined driver option, OEM/IBV can customize this
- to load their own drivers
-
-Arguments:
-
- BdsDriverLists - The header of the driver option link list.
-
-Returns:
-
- None.
-
---*/
-{
- UINTN Index;
-
- Index = 0;
-
- //
- // Here we can get the customized platform driver option
- //
- while (gPlatformDriverOption[Index] != NULL) {
- //
- // Build the platform boot option
- //
- BdsLibRegisterNewOption (BdsDriverLists, gPlatformDriverOption[Index], NULL, L"DriverOrder");
- Index++;
- }
-
-}
-
-VOID
-PlatformBdsDiagnostics (
- IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
- IN BOOLEAN QuietBoot,
- IN BASEM_MEMORY_TEST BaseMemoryTest
- )
-/*++
-
-Routine Description:
-
- Perform the platform diagnostic, such like test memory. OEM/IBV also
- can customize this fuction to support specific platform diagnostic.
-
-Arguments:
-
- MemoryTestLevel - The memory test intensive level
-
- QuietBoot - Indicate if need to enable the quiet boot
-
- BaseMemoryTest - A pointer to BdsMemoryTest()
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Here we can decide if we need to show
- // the diagnostics screen
- // Notes: this quiet boot code should be remove
- // from the graphic lib
- //
- if (QuietBoot) {
- EnableQuietBoot (PcdGetPtr(PcdLogoFile));
- //
- // Perform system diagnostic
- //
- Status = BaseMemoryTest (MemoryTestLevel);
- if (EFI_ERROR (Status)) {
- DisableQuietBoot ();
- }
-
- return ;
- }
- //
- // Perform system diagnostic
- //
- Status = BaseMemoryTest (MemoryTestLevel);
-}
-
-VOID
-EFIAPI
-PlatformBdsPolicyBehavior (
- IN OUT LIST_ENTRY *DriverOptionList,
- IN OUT LIST_ENTRY *BootOptionList,
- IN PROCESS_CAPSULES ProcessCapsules,
- IN BASEM_MEMORY_TEST BaseMemoryTest
- )
-/*++
-
-Routine Description:
-
- The function will excute with as the platform policy, current policy
- is driven by boot mode. IBV/OEM can customize this code for their specific
- policy action.
-
-Arguments:
-
- DriverOptionList - The header of the driver option link list
-
- BootOptionList - The header of the boot option link list
-
- ProcessCapsules - A pointer to ProcessCapsules()
-
- BaseMemoryTest - A pointer to BaseMemoryTest()
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 Timeout;
- EFI_BOOT_MODE BootMode;
-
- //
- // Init the time out value
- //
- Timeout = PcdGet16 (PcdPlatformBootTimeOut);
-
- //
- // Load the driver option as the driver option list
- //
- PlatformBdsGetDriverOption (DriverOptionList);
-
- //
- // Get current Boot Mode
- //
- Status = BdsLibGetBootMode (&BootMode);
-
- //
- // Go the different platform policy with different boot mode
- // Notes: this part code can be change with the table policy
- //
- switch (BootMode) {
-
- case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
- case BOOT_WITH_MINIMAL_CONFIGURATION:
- //
- // In no-configuration boot mode, we can connect the
- // console directly.
- //
- BdsLibConnectAllDefaultConsoles ();
- PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);
-
- //
- // Perform some platform specific connect sequence
- //
- PlatformBdsConnectSequence ();
-
- //
- // Notes: current time out = 0 can not enter the
- // front page
- //
- PlatformBdsEnterFrontPage (Timeout, FALSE);
-
- //
- // Check the boot option with the boot option list
- //
- BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
- break;
-
- case BOOT_ON_FLASH_UPDATE:
- //
- // Boot with the specific configuration
- //
- PlatformBdsConnectConsole (gPlatformConsole);
- PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
- BdsLibConnectAll ();
- ProcessCapsules (BOOT_ON_FLASH_UPDATE);
- break;
-
- case BOOT_IN_RECOVERY_MODE:
- //
- // In recovery mode, just connect platform console
- // and show up the front page
- //
- PlatformBdsConnectConsole (gPlatformConsole);
- PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
-
- //
- // In recovery boot mode, we still enter to the
- // frong page now
- //
- PlatformBdsEnterFrontPage (Timeout, FALSE);
- break;
-
- case BOOT_WITH_FULL_CONFIGURATION:
- case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
- case BOOT_WITH_DEFAULT_SETTINGS:
- default:
- //
- // Connect platform console
- //
- Status = PlatformBdsConnectConsole (gPlatformConsole);
- if (EFI_ERROR (Status)) {
- //
- // Here OEM/IBV can customize with defined action
- //
- PlatformBdsNoConsoleAction ();
- }
-
- PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);
-
- //
- // Perform some platform specific connect sequence
- //
- PlatformBdsConnectSequence ();
-
- //
- // Give one chance to enter the setup if we
- // have the time out
- //
- PlatformBdsEnterFrontPage (Timeout, FALSE);
-
- //
- // Here we have enough time to do the enumeration of boot device
- //
- BdsLibEnumerateAllBootOption (BootOptionList);
- break;
- }
-
- return ;
-
-}
-
-VOID
-EFIAPI
-PlatformBdsBootSuccess (
- IN BDS_COMMON_OPTION *Option
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt succeeds. We don't expect a boot option to
- return, so the EFI 1.0 specification defines that you will default to an
- interactive mode and stop processing the BootOrder list in this case. This
- is alos a platform implementation and can be customized by IBV/OEM.
-
-Arguments:
-
- Option - Pointer to Boot Option that succeeded to boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with EFI_SUCCESS and there is not in the boot device
- // select loop then we need to pop up a UI and wait for user input.
- //
- TmpStr = Option->StatusString;
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- FreePool (TmpStr);
- }
-}
-
-VOID
-EFIAPI
-PlatformBdsBootFail (
- IN BDS_COMMON_OPTION *Option,
- IN EFI_STATUS Status,
- IN CHAR16 *ExitData,
- IN UINTN ExitDataSize
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt fails.
-
-Arguments:
-
- Option - Pointer to Boot Option that failed to boot.
-
- Status - Status returned from failed boot.
-
- ExitData - Exit data returned from failed boot.
-
- ExitDataSize - Exit data size returned from failed boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with failed status then we need to pop up a UI and wait
- // for user input.
- //
- TmpStr = Option->StatusString;
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- FreePool (TmpStr);
- }
-}
-
-EFI_STATUS
-PlatformBdsNoConsoleAction (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function is remained for IBV/OEM to do some platform action,
- if there no console device can be connected.
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - Direct return success now.
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-PlatformBdsLockNonUpdatableFlash (
- VOID
- )
-{
- return;
-}
-
-/**
- Lock the ConsoleIn device in system table. All key
- presses will be ignored until the Password is typed in. The only way to
- disable the password is to type it in to a ConIn device.
-
- @param Password Password used to lock ConIn device.
-
- @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
- @retval EFI_UNSUPPORTED Password not found
-
-**/
-EFI_STATUS
-EFIAPI
-LockKeyboards (
- IN CHAR16 *Password
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/UnixPkg/Library/UnixBdsLib/BdsPlatform.h b/UnixPkg/Library/UnixBdsLib/BdsPlatform.h
deleted file mode 100644
index d83923a6a5..0000000000
--- a/UnixPkg/Library/UnixBdsLib/BdsPlatform.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsPlatform.h
-
-Abstract:
-
- Head file for BDS Platform specific code
-
---*/
-
-#ifndef _BDS_PLATFORM_H
-#define _BDS_PLATFORM_H
-
-#include <PiDxe.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseLib.h>
-#include <Library/PcdLib.h>
-#include <Library/GenericBdsLib.h>
-#include <Library/PlatformBdsLib.h>
-#include <Library/DevicePathLib.h>
-
-#include <Protocol/UnixThunk.h>
-#include <Protocol/UnixIo.h>
-#include <Guid/UnixSystemConfig.h>
-
-extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[];
-
-#define gEndEntire \
- { \
- END_DEVICE_PATH_TYPE,\
- END_ENTIRE_DEVICE_PATH_SUBTYPE,\
- END_DEVICE_PATH_LENGTH,\
- 0\
- }
-
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Instance;
-} UNIX_VENDOR_DEVICE_PATH_NODE;
-
-//
-// Below is the platform console device path
-//
-typedef struct {
- VENDOR_DEVICE_PATH UnixBus;
- UNIX_VENDOR_DEVICE_PATH_NODE SerialDevice;
- UART_DEVICE_PATH Uart;
- VENDOR_DEVICE_PATH TerminalType;
- EFI_DEVICE_PATH_PROTOCOL End;
-} UNIX_ISA_SERIAL_DEVICE_PATH;
-
-typedef struct {
- VENDOR_DEVICE_PATH UnixBus;
- UNIX_VENDOR_DEVICE_PATH_NODE UnixUgaDevice;
- EFI_DEVICE_PATH_PROTOCOL End;
-} UNIX_PLATFORM_UGA_DEVICE_PATH;
-
-typedef struct {
- VENDOR_DEVICE_PATH UnixBus;
- UNIX_VENDOR_DEVICE_PATH_NODE ConsoleDevice;
- EFI_DEVICE_PATH_PROTOCOL End;
-} UNIX_CONSOLE_DEVICE_PATH;
-//
-// Platform BDS Functions
-//
-VOID
-PlatformBdsGetDriverOption (
- IN LIST_ENTRY *BdsDriverLists
- )
-;
-
-EFI_STATUS
-BdsMemoryTest (
- EXTENDMEM_COVERAGE_LEVEL Level
- )
-;
-
-
-VOID
-PlatformBdsConnectSequence (
- VOID
- )
-;
-
-EFI_STATUS
-ProcessCapsules (
- EFI_BOOT_MODE BootMode
- )
-;
-
-EFI_STATUS
-PlatformBdsConnectConsole (
- IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
- )
-;
-
-EFI_STATUS
-PlatformBdsNoConsoleAction (
- VOID
- )
-;
-
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- );
-
-#endif // _BDS_PLATFORM_H
diff --git a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf b/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
deleted file mode 100644
index 6974827e00..0000000000
--- a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
+++ /dev/null
@@ -1,65 +0,0 @@
-## @file
-# Platfrom BDS driver
-#
-# Do platform action customized by IBV/OEM.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = PlatformBdsLib
- FILE_GUID = f392b762-8985-11db-be87-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformBdsLib|DXE_DRIVER
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- BdsPlatform.c
- PlatformData.c
- BdsPlatform.h
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- PcdLib
- GenericBdsLib
- DevicePathLib
-
-
-[Guids]
- gEfiUnixSystemConfigGuid
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
-
-[Depex]
- gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/UnixPkg/Library/UnixBdsLib/PlatformData.c b/UnixPkg/Library/UnixBdsLib/PlatformData.c
deleted file mode 100644
index 449ad52e16..0000000000
--- a/UnixPkg/Library/UnixBdsLib/PlatformData.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PlatformData.c
-
-Abstract:
-
- Defined the platform specific device path which will be used by
- platform Bbd to perform the platform policy connect.
-
---*/
-
-#include "BdsPlatform.h"
-
-//
-// Predefined platform default time out value
-//
-UINT16 gPlatformBootTimeOutDefault = 10;
-
-//
-// Platform specific keyboard device path
-//
-UNIX_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath =
-{
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- },
- EFI_UNIX_THUNK_PROTOCOL_GUID
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
- },
- EFI_UNIX_UGA_GUID,
- 0
- },
- gEndEntire
-};
-
-UNIX_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- },
- EFI_UNIX_THUNK_PROTOCOL_GUID
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
- },
- EFI_UNIX_GOP_GUID,
- 0
- },
- gEndEntire
-};
-
-UNIX_CONSOLE_DEVICE_PATH gUnixConsoleDevicePath = {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- },
- EFI_UNIX_THUNK_PROTOCOL_GUID
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
- },
- EFI_UNIX_CONSOLE_GUID,
- 0
- },
- gEndEntire
-};
-//
-// Predefined platform default console device path
-//
-BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
- {
- (EFI_DEVICE_PATH_PROTOCOL *) &gUnixConsoleDevicePath,
- (CONSOLE_OUT | CONSOLE_IN)
- },
- {
- (EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath,
- (CONSOLE_OUT | CONSOLE_IN)
- },
- {
- (EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath,
- (CONSOLE_OUT | CONSOLE_IN)
- },
- {
- NULL,
- 0
- }
-};
-
-//
-// Predefined platform specific driver option
-//
-EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[] = { NULL };
-
-//
-// Predefined platform connect sequence
-//
-EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] = { NULL };
diff --git a/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoader.c b/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoader.c
deleted file mode 100644
index 48e6461488..0000000000
--- a/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoader.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- TianoPeCoffLoader.c
-
-Abstract:
-
- Wrap the Base PE/COFF loader with the PE COFF Protocol
-
-
---*/
-
-#include <Guid/PeiPeCoffLoader.h>
-
-#include <Library/EdkPeCoffLoaderLib.h>
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *mPeiEfiPeiPeCoffLoader;
-
-EFI_STATUS
-EFIAPI
-PeCoffLoaderConstructor (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- Status = (*PeiServices)->LocatePpi (
- PeiServices,
- &gEfiPeiPeCoffLoaderGuid,
- 0,
- NULL,
- (VOID **)&mPeiEfiPeiPeCoffLoader
- );
- return Status;
-}
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- )
-{
- return mPeiEfiPeiPeCoffLoader;
-}
diff --git a/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoaderLib.inf b/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoaderLib.inf
deleted file mode 100644
index ca2bad61b9..0000000000
--- a/UnixPkg/Library/UnixPeCoffLoaderLib/UnixPeCoffLoaderLib.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-## @file
-# Component description file for the Nt32PeCoffLoaderLib library.
-#
-# EdkPeCoffLoaderLib library class for NT32 instance implemented by PeiPeCoffLoader PPI.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixPeCoffLoaderLib
- FILE_GUID = f3cf597e-8985-11db-95f6-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = EdkPeCoffLoaderLib
-
- CONSTRUCTOR = PeCoffLoaderConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixPeCoffLoader.c
-
-
-[Guids]
- gEfiPeiPeCoffLoaderGuid # SOMETIMES_CONSUMED
-
diff --git a/UnixPkg/License.txt b/UnixPkg/License.txt
deleted file mode 100644
index be68999be6..0000000000
--- a/UnixPkg/License.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2012, Intel 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:
-
-* 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.
-
-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.
diff --git a/UnixPkg/MetronomeDxe/Metronome.c b/UnixPkg/MetronomeDxe/Metronome.c
deleted file mode 100644
index be2b7e7c74..0000000000
--- a/UnixPkg/MetronomeDxe/Metronome.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Metronome.c
-
-Abstract:
-
- UNIX Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
-
---*/
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Protocol/Metronome.h>
-#include "Metronome.h"
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UnixLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-//
-// Global Variables
-//
-EFI_METRONOME_ARCH_PROTOCOL mMetronome = {
- UnixMetronomeDriverWaitForTick,
- TICK_PERIOD
-};
-
-//
-// Worker Functions
-//
-
-EFI_STATUS
-EFIAPI
-UnixMetronomeDriverWaitForTick (
- IN EFI_METRONOME_ARCH_PROTOCOL *This,
- IN UINT32 TickNumber
- )
-/*++
-
-Routine Description:
-
- The WaitForTick() function waits for the number of ticks specified by
- TickNumber from a known time source in the platform. If TickNumber of
- ticks are detected, then EFI_SUCCESS is returned. The actual time passed
- between entry of this function and the first tick is between 0 and
- TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
- time has elapsed, wait for two ticks. This function waits for a hardware
- event to determine when a tick occurs. It is possible for interrupt
- processing, or exception processing to interrupt the execution of the
- WaitForTick() function. Depending on the hardware source for the ticks, it
- is possible for a tick to be missed. This function cannot guarantee that
- ticks will not be missed. If a timeout occurs waiting for the specified
- number of ticks, then EFI_TIMEOUT is returned.
-
-Arguments:
-
- This - The EFI_METRONOME_ARCH_PROTOCOL instance.
- TickNumber - Number of ticks to wait.
-
-Returns:
-
- EFI_SUCCESS - The wait for the number of ticks specified by TickNumber
- succeeded.
-
---*/
-{
- UINT64 SleepTime;
-
- //
- // Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec
- // Tick Period is in 100ns units, divide by 10000 to convert to ms
- //
- SleepTime = DivU64x32 (MultU64x32 ((UINT64) TickNumber, TICK_PERIOD) + 9999, 10000);
- gUnix->Sleep ((UINT32) SleepTime);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UnixMetronomeDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the Metronome Architectural Protocol driver
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
-
-
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_SUCCESS - Metronome Architectural Protocol created
-
- EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
-
- EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
-
- //
- // Install the Metronome Architectural Protocol onto a new handle
- //
- Handle = NULL;
- DEBUG ((EFI_D_ERROR, "*******************file %d line %d\n", __FUNCTION__, __LINE__));
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiMetronomeArchProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mMetronome
- );
-
- return Status;
-}
diff --git a/UnixPkg/MetronomeDxe/Metronome.h b/UnixPkg/MetronomeDxe/Metronome.h
deleted file mode 100644
index 9f9c11fa2b..0000000000
--- a/UnixPkg/MetronomeDxe/Metronome.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Metronome.h
-
-Abstract:
-
- UNIX Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
-
---*/
-
-#ifndef _UNIX_THUNK_METRONOME_H_
-#define _UNIX_THUNK_METRONOME_H_
-
-
-
-//
-// Period of on tick in 100 nanosecond units
-//
-#define TICK_PERIOD 2000
-
-//
-// Function Prototypes
-//
-
-EFI_STATUS
-EFIAPI
-UnixMetronomeDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixMetronomeDriverWaitForTick (
- IN EFI_METRONOME_ARCH_PROTOCOL *This,
- IN UINT32 TickNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- TickNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/UnixPkg/MetronomeDxe/Metronome.inf b/UnixPkg/MetronomeDxe/Metronome.inf
deleted file mode 100644
index 95cd6f1a90..0000000000
--- a/UnixPkg/MetronomeDxe/Metronome.inf
+++ /dev/null
@@ -1,58 +0,0 @@
-## @file
-# Unix Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
-#
-# This metronome module simulates metronome by Sleep WinAPI.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = Metronome
- FILE_GUID = f348f6fe-8985-11db-b4c3-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = UnixMetronomeDriverInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Metronome.h
- Metronome.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UnixLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiMetronomeArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni
deleted file mode 100644
index 669654ece4..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
deleted file mode 100644
index 373781aad4..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscBaseBoardManufacturerData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {
- STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER),
- STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME),
- STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION),
- STRING_TOKEN(STR_MISC_BASE_BOARD_SERIAL_NUMBER),
- STRING_TOKEN(STR_MISC_BASE_BOARD_ASSET_TAG),
- STRING_TOKEN(STR_MISC_BASE_BOARD_CHASSIS_LOCATION),
- { // BaseBoardFeatureFlags
- 1, // Motherboard
- 0, // RequiresDaughterCard
- 0, // Removable
- 1, // Replaceable,
- 0, // HotSwappable
- 0, // Reserved
- },
- EfiBaseBoardTypeUnknown, // BaseBoardType
- { // BaseBoardChassisLink
- EFI_MISC_SUBCLASS_GUID, // ProducerName
- 1, // Instance
- 1, // SubInstance
- },
- 0, // BaseBoardNumberLinks
- { // LinkN
- EFI_MISC_SUBCLASS_GUID, // ProducerName
- 1, // Instance
- 1, // SubInstance
- },
-};
-
-/* eof - MiscBaseBoardManufacturerData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c
deleted file mode 100644
index 0158ae9d52..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/** @file
- BaseBoard manufacturer information boot time changes.
- SMBIOS type 2.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/**
- This function makes boot time changes to the contents of the
- MiscBaseBoardManufacturer (Type 2).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer)
-{
- CHAR8 *OptionalStrStart;
- UINTN ManuStrLen;
- UINTN ProductStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- UINTN ChassisStrLen;
- EFI_STATUS Status;
- EFI_STRING Manufacturer;
- EFI_STRING Product;
- EFI_STRING Version;
- EFI_STRING SerialNumber;
- EFI_STRING AssertTag;
- EFI_STRING Chassis;
- STRING_REF TokenToGet;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE2 *SmbiosRecord;
- EFI_MISC_BASE_BOARD_MANUFACTURER *ForType2InputData;
-
- ForType2InputData = (EFI_MISC_BASE_BOARD_MANUFACTURER *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER);
- Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- ManuStrLen = StrLen(Manufacturer);
- if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME);
- Product = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- ProductStrLen = StrLen(Product);
- if (ProductStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION);
- Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- VerStrLen = StrLen(Version);
- if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER);
- SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- SerialNumStrLen = StrLen(SerialNumber);
- if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG);
- AssertTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- AssertTagStrLen = StrLen(AssertTag);
- if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION);
- Chassis = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- ChassisStrLen = StrLen(Chassis);
- if (ChassisStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- //
- // Manu will be the 1st optional string following the formatted structure.
- //
- SmbiosRecord->Manufacturer = 1;
- //
- // ProductName will be the 2st optional string following the formatted structure.
- //
- SmbiosRecord->ProductName = 2;
- //
- // Version will be the 3rd optional string following the formatted structure.
- //
- SmbiosRecord->Version = 3;
- //
- // SerialNumber will be the 4th optional string following the formatted structure.
- //
- SmbiosRecord->SerialNumber = 4;
- //
- // AssertTag will be the 5th optional string following the formatted structure.
- //
- SmbiosRecord->AssetTag = 5;
-
- //
- // LocationInChassis will be the 6th optional string following the formatted structure.
- //
- SmbiosRecord->LocationInChassis = 6;
- SmbiosRecord->FeatureFlag = (*(BASE_BOARD_FEATURE_FLAGS*)&(ForType2InputData->BaseBoardFeatureFlags));
- SmbiosRecord->ChassisHandle = 0;
- SmbiosRecord->BoardType = (UINT8)ForType2InputData->BaseBoardType;
- SmbiosRecord->NumberOfContainedObjectHandles = 0;
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- //
- // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string
- //
- OptionalStrStart -= 2;
- UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
- UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1);
- UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1);
- UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1);
- UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
- UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1);
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni
deleted file mode 100644
index dda02d2970..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
deleted file mode 100644
index 5b86b8d43e..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscBiosVendorData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {
- STRING_TOKEN(STR_MISC_BIOS_VENDOR), // BiosVendor
- STRING_TOKEN(STR_MISC_BIOS_VERSION), // BiosVersion
- STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate
- 0xBABE, // BiosStartingAddress
- { // BiosPhysicalDeviceSize
- 2, // Value
- 3, // Exponent
- },
- { // BiosCharacteristics1
- 0, // Reserved1 :2
- 0, // Unknown :1
- 1, // BiosCharacteristicsNotSupported :1
- 0, // IsaIsSupported :1
- 0, // McaIsSupported :1
- 0, // EisaIsSupported :1
- 0, // PciIsSupported :1
- 0, // PcmciaIsSupported :1
- 0, // PlugAndPlayIsSupported :1
- 0, // ApmIsSupported :1
- 0, // BiosIsUpgradable :1
- 0, // BiosShadowingAllowed :1
- 0, // VlVesaIsSupported :1
- 0, // EscdSupportIsAvailable :1
- 0, // BootFromCdIsSupported :1
- 0, // SelectableBootIsSupported :1
- 0, // RomBiosIsSocketed :1
- 0, // BootFromPcmciaIsSupported :1
- 0, // EDDSpecificationIsSupported :1
- 0, // JapaneseNecFloppyIsSupported :1
- 0, // JapaneseToshibaFloppyIsSupported :1
- 0, // Floppy525_360IsSupported :1
- 0, // Floppy525_12IsSupported :1
- 0, // Floppy35_720IsSupported :1
- 0, // Floppy35_288IsSupported :1
- 0, // PrintScreenIsSupported :1
- 0, // Keyboard8042IsSupported :1
- 0, // SerialIsSupported :1
- 0, // PrinterIsSupported :1
- 0, // CgaMonoIsSupported :1
- 0, // NecPc98 :1
- 0, // AcpiIsSupported :1
- 0, // UsbLegacyIsSupported :1
- 0, // AgpIsSupported :1
- 0, // I20BootIsSupported :1
- 0, // Ls120BootIsSupported :1
- 0, // AtapiZipDriveBootIsSupported :1
- 0, // Boot1394IsSupported :1
- 0, // SmartBatteryIsSupported :1
- 0, // BiosBootSpecIsSupported :1
- 0, // FunctionKeyNetworkBootIsSupported :1
- 0 // Reserved :22
- },
- { // BiosCharacteristics2
- 0, // BiosReserved :16
- 0, // SystemReserved :16
- 0 // Reserved :32
- },
-};
-
-/* eof - MiscBiosVendorData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c
deleted file mode 100644
index fbfb52fce5..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/** @file
- BIOS vendor information boot time changes.
- Misc. subclass type 2.
- SMBIOS type 0.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-
-/**
- This function returns the value & exponent to Base2 for a given
- Hex value. This is used to calculate the BiosPhysicalDeviceSize.
-
- @param Value The hex value which is to be converted into value-exponent form
- @param Exponent The exponent out of the conversion
-
- @retval EFI_SUCCESS All parameters were valid and *Value & *Exponent have been set.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-GetValueExponentBase2(
- IN OUT UINTN *Value,
- OUT UINTN *Exponent
- )
-{
- if ((Value == NULL) || (Exponent == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- while ((*Value % 2) == 0) {
- *Value=*Value/2;
- (*Exponent)++;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k'
- as the unit.
-
- @param Base2Data Pointer to Base2_Data
-
- @retval EFI_SUCCESS Transform successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-UINT16
-Base2ToByteWith64KUnit (
- IN EFI_EXP_BASE2_DATA *Base2Data
- )
-{
- UINT16 Value;
- UINT16 Exponent;
-
- Value = Base2Data->Value;
- Exponent = Base2Data->Exponent;
- Exponent -= 16;
- Value <<= Exponent;
-
- return Value;
-}
-
-
-/**
- This function makes boot time changes to the contents of the
- MiscBiosVendor (Type 0).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
-{
- CHAR8 *OptionalStrStart;
- UINTN VendorStrLen;
- UINTN VerStrLen;
- UINTN DateStrLen;
- CHAR16 *Version;
- CHAR16 *ReleaseDate;
- EFI_STATUS Status;
- EFI_STRING Char16String;
- STRING_REF TokenToGet;
- STRING_REF TokenToUpdate;
- SMBIOS_TABLE_TYPE0 *SmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_MISC_BIOS_VENDOR *ForType0InputData;
-
- ForType0InputData = (EFI_MISC_BIOS_VENDOR *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Version = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
- if (StrLen (Version) > 0) {
- TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);
- HiiSetString (mHiiHandle, TokenToUpdate, Version, NULL);
- }
-
- ReleaseDate = (CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString);
- if (StrLen(ReleaseDate) > 0) {
- TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
- HiiSetString (mHiiHandle, TokenToUpdate, ReleaseDate, NULL);
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VENDOR);
- Char16String = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- VendorStrLen = StrLen(Char16String);
- if (VendorStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION);
- Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- VerStrLen = StrLen(Version);
- if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
- ReleaseDate = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- DateStrLen = StrLen(ReleaseDate);
- if (DateStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- //
- // Vendor will be the 1st optional string following the formatted structure.
- //
- SmbiosRecord->Vendor = 1;
- //
- // Version will be the 2nd optional string following the formatted structure.
- //
- SmbiosRecord->BiosVersion = 2;
- SmbiosRecord->BiosSegment = (UINT16)ForType0InputData->BiosStartingAddress;
- //
- // ReleaseDate will be the 3rd optional string following the formatted structure.
- //
- SmbiosRecord->BiosReleaseDate = 3;
- //
- // Nt32 has no PCD value to indicate BIOS Size, just fill 0 for simply.
- //
- SmbiosRecord->BiosSize = 0;
- SmbiosRecord->BiosCharacteristics = *(MISC_BIOS_CHARACTERISTICS*)(&ForType0InputData->BiosCharacteristics1);
- //
- // CharacterExtensionBytes also store in ForType0InputData->BiosCharacteristics1 later two bytes to save size.
- //
- SmbiosRecord->BIOSCharacteristicsExtensionBytes[0] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 4);
- SmbiosRecord->BIOSCharacteristicsExtensionBytes[1] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 5);
-
- SmbiosRecord->SystemBiosMajorRelease = ForType0InputData->BiosMajorRelease;
- SmbiosRecord->SystemBiosMinorRelease = ForType0InputData->BiosMinorRelease;
- SmbiosRecord->EmbeddedControllerFirmwareMajorRelease = ForType0InputData->BiosEmbeddedFirmwareMajorRelease;
- SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease;
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(Char16String, OptionalStrStart);
- UnicodeStrToAsciiStr(Version, OptionalStrStart + VendorStrLen + 1);
- UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1);
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
deleted file mode 100644
index 86fb2de4ae..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscBootInformationData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {
- EfiBootInformationStatusNoError, // BootInformationStatus
- {0} // BootInformationData
-};
-
-/* eof - MiscBootInformationData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c
deleted file mode 100644
index fec5ecc0bd..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
- boot information boot time changes.
- SMBIOS type 32.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-
-
-/**
- This function makes boot time changes to the contents of the
- MiscBootInformation (Type 32).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-
-MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE32 *SmbiosRecord;
- EFI_MISC_BOOT_INFORMATION_STATUS* ForType32InputData;
-
- ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus;
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni
deleted file mode 100644
index 177ff38925..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
deleted file mode 100644
index 4883f6751e..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscChassisManufacturerData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Chassis Manufacturer data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {
- STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER), // ChassisManufactrurer
- STRING_TOKEN(STR_MISC_CHASSIS_VERSION), // ChassisVersion
- STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber
- STRING_TOKEN(STR_MISC_CHASSIS_ASSET_TAG), // ChassisAssetTag
- { // ChassisTypeStatus
- EfiMiscChassisTypeOther, // ChassisType
- 0, // ChassisLockPresent
- 0 // Reserved
- },
- EfiChassisStateOther, // ChassisBootupState
- EfiChassisStateOther, // ChassisPowerSupplyState
- EfiChassisStateOther, // ChassisThermalState
- EfiChassisSecurityStatusOther, // ChassisSecurityState
- 0 // ChassisOemDefined
-};
-
-/* eof - MiscChassisManufacaturerData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c
deleted file mode 100644
index ce89603479..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/** @file
- Chassis manufacturer information boot time changes.
- SMBIOS type 3.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-
-/**
- This function makes boot time changes to the contents of the
- MiscChassisManufacturer (Type 3).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer)
-{
- CHAR8 *OptionalStrStart;
- UINTN ManuStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- EFI_STATUS Status;
- EFI_STRING Manufacturer;
- EFI_STRING Version;
- EFI_STRING SerialNumber;
- EFI_STRING AssertTag;
- STRING_REF TokenToGet;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE3 *SmbiosRecord;
- EFI_MISC_CHASSIS_MANUFACTURER *ForType3InputData;
-
- ForType3InputData = (EFI_MISC_CHASSIS_MANUFACTURER *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER);
- Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- ManuStrLen = StrLen(Manufacturer);
- if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_VERSION);
- Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- VerStrLen = StrLen(Version);
- if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER);
- SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- SerialNumStrLen = StrLen(SerialNumber);
- if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG);
- AssertTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- AssertTagStrLen = StrLen(AssertTag);
- if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- //
- // Manu will be the 1st optional string following the formatted structure.
- //
- SmbiosRecord->Manufacturer = 1;
- SmbiosRecord->Type = (UINT8)ForType3InputData->ChassisType.ChassisType;
- //
- // Version will be the 2nd optional string following the formatted structure.
- //
- SmbiosRecord->Version = 2;
- //
- // SerialNumber will be the 3rd optional string following the formatted structure.
- //
- SmbiosRecord->SerialNumber = 3;
- //
- // AssertTag will be the 4th optional string following the formatted structure.
- //
- SmbiosRecord->AssetTag = 4;
- SmbiosRecord->BootupState = (UINT8)ForType3InputData->ChassisBootupState;
- SmbiosRecord->PowerSupplyState = (UINT8)ForType3InputData->ChassisPowerSupplyState;
- SmbiosRecord->ThermalState = (UINT8)ForType3InputData->ChassisThermalState;
- SmbiosRecord->SecurityStatus = (UINT8)ForType3InputData->ChassisSecurityState;
- CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4);
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
- UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1);
- UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1);
- UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscDevicePath.h b/UnixPkg/MiscSubClassPlatformDxe/MiscDevicePath.h
deleted file mode 100644
index f9f64a16ca..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscDevicePath.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscDevicePath.h
-
-Abstract:
-
- Misc class required EFI Device Path definitions (Ports, slots &
- onboard devices)
-
---*/
-
-#ifndef _MISC_DEVICE_PATH_H
-#define _MISC_DEVICE_PATH_H
-
-
-#pragma pack(1)
-//
-// USB
-//
-
-/* For reference:
-#define USB1_1_STR "ACPI(PNP0A03,0)/PCI(1D,0)."
-#define USB1_2_STR "ACPI(PNP0A03,0)/PCI(1D,1)."
-#define USB1_3_STR "ACPI(PNP0A03,0)/PCI(1D,2)."
-#define USB2_1_STR "ACPI(PNP0A03,0)/PCI(1D,7)."
-*/
-
-//
-// #define acpi { 0x02, 0x01, 0x00, 0x0C, 0x0a0341d0, 0x00000000 }
-// #define pci( device,function) { 0x01, 0x01, 0x00, 0x06, device, function }
-// #define end { 0xFF, 0xFF, 0x00, 0x04 }
-//
-#define DP_ACPI \
- { \
- {ACPI_DEVICE_PATH, ACPI_DP, {(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
- ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)}}, EISA_PNP_ID (0x0A03), 0 \
- }
-#define DP_PCI(device, function) \
- { \
- {HARDWARE_DEVICE_PATH, HW_PCI_DP, {(UINT8) (sizeof (PCI_DEVICE_PATH)), (UINT8) \
- ((sizeof (PCI_DEVICE_PATH)) >> 8)}}, function, device \
- }
-#define DP_END \
- { \
- END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0} \
- }
-
-#define DP_LPC(eisaid, function) \
- { \
- {ACPI_DEVICE_PATH, ACPI_DP, {(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
- ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)}}, EISA_PNP_ID (eisaid), function \
- }
-
-//
-// Shanmu >> moved to TianoDevicePath.h
-//
-
-/*
-typedef struct _USB_PORT_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH PciBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} USB_PORT_DEVICE_PATH;
-
-
-//IDE ??I am not sure. Should this be ATAPI_DEVICE_PATH
-typedef struct _IDE_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH PciBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} IDE_DEVICE_PATH;
-
-//RMC Connector
-typedef struct _RMC_CONN_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH PciBridgeDevicePath;
- PCI_DEVICE_PATH PciBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} RMC_CONN_DEVICE_PATH;
-
-//static RMC_CONN_DEVICE_PATH mRmcConnDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x0A,0x00 ), end };
-
-//RIDE
-typedef struct _RIDE_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH PciBridgeDevicePath;
- PCI_DEVICE_PATH PciBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} RIDE_DEVICE_PATH;
-
-//static RIDE_DEVICE_PATH mRideDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x02,0x00 ), end };
-
-//Gigabit NIC
-//typedef struct _GB_NIC_DEVICE_PATH
-//{
-// ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
-// PCI_DEVICE_PATH PciBridgeDevicePath;
-// PCI_DEVICE_PATH PciXBridgeDevicePath;
-// PCI_DEVICE_PATH PciXBusDevicePath;
-// EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-//} GB_NIC_DEVICE_PATH;
-
-//static GB_NIC_DEVICE_PATH mGbNicDevicePath = { acpi, pci( 0x03,0x00 ),pci( 0x1F,0x00 ),pci( 0x07,0x00 ), end };
-
-
-//P/S2 Connector
-typedef struct _PS2_CONN_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH LpcBridgeDevicePath;
- ACPI_HID_DEVICE_PATH LpcBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} PS2_CONN_DEVICE_PATH;
-
-//static PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,0 ), end };
-//static PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,1 ), end };
-
-//Serial Port Connector
-typedef struct _SERIAL_CONN_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH LpcBridgeDevicePath;
- ACPI_HID_DEVICE_PATH LpcBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} SERIAL_CONN_DEVICE_PATH;
-
-//static SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,0 ), end };
-//static SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,1 ), end };
-
-//Parallel Port Connector
-typedef struct _PARALLEL_CONN_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH LpcBridgeDevicePath;
- ACPI_HID_DEVICE_PATH LpcBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} PARALLEL_CONN_DEVICE_PATH;
-
-//static PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0401,0 ), end };
-
-//Floopy Connector
-typedef struct _FLOOPY_CONN_DEVICE_PATH
-{
- ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
- PCI_DEVICE_PATH LpcBridgeDevicePath;
- ACPI_HID_DEVICE_PATH LpcBusDevicePath;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} FLOOPY_CONN_DEVICE_PATH;
-
-//static FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,0 ), end };
-//static FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,1 ), end };
-
-*/
-
-//
-// End Shanmu
-//
-#pragma pack()
-
-#endif
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
deleted file mode 100644
index 4ebb633139..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscNumberOfInstallableLanguagesData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages)
-= {
- 1, // NumberOfInstallableLanguages
- { // LanguageFlags
- 0, // AbbreviatedLanguageFormat
- 0 // Reserved
- },
- 0, // CurrentLanguageNumber
-};
-
-/* eof - MiscNumberOfInstallableLanguagesData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
deleted file mode 100644
index 6eff73e450..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/** @file
- This driver parses the mSmbiosMiscDataTable structure and reports
- any generated data.
-
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/*++
- Check whether the language is supported for given HII handle
-
- @param HiiHandle The HII package list handle.
- @param Offset The offest of current lanague in the supported languages.
- @param CurrentLang The language code.
-
- @retval TRUE Supported.
- @retval FALSE Not Supported.
-
---*/
-VOID
-EFIAPI
-CurrentLanguageMatch (
- IN EFI_HII_HANDLE HiiHandle,
- OUT UINT16 *Offset,
- OUT CHAR8 *CurrentLang
- )
-{
- CHAR8 *DefaultLang;
- CHAR8 *BestLanguage;
- CHAR8 *Languages;
- CHAR8 *MatchLang;
- CHAR8 *EndMatchLang;
- UINTN CompareLength;
-
- Languages = HiiGetSupportedLanguages (HiiHandle);
- if (Languages == NULL) {
- return;
- }
-
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
- DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang);
- BestLanguage = GetBestLanguage (
- Languages,
- FALSE,
- (CurrentLang != NULL) ? CurrentLang : "",
- DefaultLang,
- NULL
- );
- if (BestLanguage != NULL) {
- //
- // Find the best matching RFC 4646 language, compute the offset.
- //
- CompareLength = AsciiStrLen (BestLanguage);
- for (MatchLang = Languages, (*Offset) = 0; MatchLang != '\0'; (*Offset)++) {
- //
- // Seek to the end of current match language.
- //
- for (EndMatchLang = MatchLang; *EndMatchLang != '\0' && *EndMatchLang != ';'; EndMatchLang++);
-
- if ((EndMatchLang == MatchLang + CompareLength) && AsciiStrnCmp(MatchLang, BestLanguage, CompareLength) == 0) {
- //
- // Find the current best Language in the supported languages
- //
- break;
- }
- //
- // best language match be in the supported language.
- //
- ASSERT (*EndMatchLang == ';');
- MatchLang = EndMatchLang + 1;
- }
- FreePool (BestLanguage);
- }
-
- FreePool (Languages);
- if (CurrentLang != NULL) {
- FreePool (CurrentLang);
- }
- return ;
-}
-
-
-/**
- Get next language from language code list (with separator ';').
-
- @param LangCode Input: point to first language in the list. On
- Otput: point to next language in the list, or
- NULL if no more language in the list.
- @param Lang The first language in the list.
-
-**/
-VOID
-EFIAPI
-GetNextLanguage (
- IN OUT CHAR8 **LangCode,
- OUT CHAR8 *Lang
- )
-{
- UINTN Index;
- CHAR8 *StringPtr;
-
- ASSERT (LangCode != NULL);
- ASSERT (*LangCode != NULL);
- ASSERT (Lang != NULL);
-
- Index = 0;
- StringPtr = *LangCode;
- while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
- Index++;
- }
-
- CopyMem (Lang, StringPtr, Index);
- Lang[Index] = 0;
-
- if (StringPtr[Index] == ';') {
- Index++;
- }
- *LangCode = StringPtr + Index;
-}
-
-/**
- This function returns the number of supported languages on HiiHandle.
-
- @param HiiHandle The HII package list handle.
-
- @retval The number of supported languages.
-
-**/
-UINT16
-EFIAPI
-GetSupportedLanguageNumber (
- IN EFI_HII_HANDLE HiiHandle
- )
-{
- CHAR8 *Lang;
- CHAR8 *Languages;
- CHAR8 *LanguageString;
- UINT16 LangNumber;
-
- Languages = HiiGetSupportedLanguages (HiiHandle);
- if (Languages == NULL) {
- return 0;
- }
-
- LangNumber = 0;
- Lang = AllocatePool (AsciiStrSize (Languages));
- if (Lang != NULL) {
- LanguageString = Languages;
- while (*LanguageString != 0) {
- GetNextLanguage (&LanguageString, Lang);
- LangNumber++;
- }
- FreePool (Lang);
- }
- FreePool (Languages);
- return LangNumber;
-}
-
-
-/**
- This function makes boot time changes to the contents of the
- MiscNumberOfInstallableLanguages (Type 13).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages)
-{
- UINTN LangStrLen;
- CHAR8 CurrentLang[SMBIOS_STRING_MAX_LENGTH + 1];
- CHAR8 *OptionalStrStart;
- UINT16 Offset;
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE13 *SmbiosRecord;
- EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *ForType13InputData;
-
- ForType13InputData = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ForType13InputData->NumberOfInstallableLanguages = GetSupportedLanguageNumber (mHiiHandle);
-
- //
- // Try to check if current langcode matches with the langcodes in installed languages
- //
- ZeroMem(CurrentLang, SMBIOS_STRING_MAX_LENGTH + 1);
- CurrentLanguageMatch (mHiiHandle, &Offset, CurrentLang);
- LangStrLen = AsciiStrLen(CurrentLang);
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
-
- SmbiosRecord->InstallableLanguages = (UINT8)ForType13InputData->NumberOfInstallableLanguages;
- SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat;
- SmbiosRecord->CurrentLanguages = 1;
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- AsciiStrCpy(OptionalStrStart, CurrentLang);
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscOemString.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscOemString.uni
deleted file mode 100644
index 782a83bf89..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscOemString.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringData.c
deleted file mode 100644
index 0ec8d35d31..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringData.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscOemStringData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {
- { STRING_TOKEN(STR_MISC_OEM_STRING) }
-};
-
-/* eof - MiscOemStringData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
deleted file mode 100644
index f0401cebbd..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
- boot information boot time changes.
- SMBIOS type 11.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/**
- This function makes boot time changes to the contents of the
- MiscOemString (Type 11).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(OemString)
-{
- UINTN OemStrLen;
- CHAR8 *OptionalStrStart;
- EFI_STATUS Status;
- EFI_STRING OemStr;
- STRING_REF TokenToGet;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE11 *SmbiosRecord;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);
- OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- OemStrLen = StrLen(OemStr);
- if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->StringCount = 1;
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(OemStr, OptionalStrStart);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni
deleted file mode 100644
index 87c5a8112b..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
deleted file mode 100644
index 354a7d1aca..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscPortInternalConnectorDesignatorData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {
- STRING_TOKEN(STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR), // PortInternalConnectorDesignator
- STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR), // PortExternalConnectorDesignator
- EfiPortConnectorTypeOther, // PortInternalConnectorType
- EfiPortConnectorTypeOther, // PortExternalConnectorType
- EfiPortTypeNone, // PortType
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {
- STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD), // PortInternalConnectorDesignator
- STRING_TOKEN (STR_MISC_PORT_EXTERNAL_KEYBOARD), // PortExternalConnectorDesignator
- EfiPortConnectorTypeNone, // PortInternalConnectorType
- EfiPortConnectorTypePS2, // PortExternalConnectorType
- EfiPortTypeKeyboard, // PortType
- // mPs2KbyboardDevicePath // PortPath
- //
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {
- STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE), // PortInternalConnectorDesignator
- STRING_TOKEN (STR_MISC_PORT_EXTERNAL_MOUSE), // PortExternalConnectorDesignator
- EfiPortConnectorTypeNone, // PortInternalConnectorType
- EfiPortConnectorTypePS2, // PortExternalConnectorType
- EfiPortTypeMouse, // PortType
- // mPs2MouseDevicePath // PortPath
- //
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {
- STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM1),
- STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1),
- EfiPortConnectorTypeNone,
- EfiPortConnectorTypeDB9Female,
- EfiPortTypeSerial16550ACompatible,
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {
- STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM2),
- STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2),
- EfiPortConnectorTypeNone,
- EfiPortConnectorTypeDB9Female,
- EfiPortTypeSerial16550ACompatible,
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {
- STRING_TOKEN(STR_MISC_PORT_INTERNAL_EXTENSION_POWER),
- STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER),
- EfiPortConnectorTypeOther,
- EfiPortConnectorTypeNone,
- EfiPortTypeOther,
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {
- STRING_TOKEN(STR_MISC_PORT_INTERNAL_FLOPPY),
- STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY),
- EfiPortConnectorTypeOnboardFloppy,
- EfiPortConnectorTypeNone,
- EfiPortTypeOther,
- {{{{0, 0, {0, 0}}, 0, 0}, {{0, 0, {0, 0}}, 0, 0}, {0, 0, {0, 0}}}} // PortPath
-};
-
-/* eof - MiscPortInternalConnectorDesignatorData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
deleted file mode 100644
index 9f7708be73..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscPortInternalConnectorDesignatorFunction.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-
-MISC_SMBIOS_TABLE_FUNCTION (
- MiscPortInternalConnectorDesignator
- )
-/*++
-Description:
-
- This function makes boot time changes to the contents of the
- MiscPortConnectorInformation (Type 8).
-
-Parameters:
-
- RecordType
- Type of record to be processed from the Data Table.
- mMiscSubclassDataTable[].RecordType
-
- RecordLen
- Size of static RecordData from the Data Table.
- mMiscSubclassDataTable[].RecordLen
-
- RecordData
- Pointer to copy of RecordData from the Data Table. Changes made
- to this copy will be written to the Data Hub but will not alter
- the contents of the static Data Table.
-
- LogRecordData
- Set *LogRecordData to TRUE to log RecordData to Data Hub.
- Set *LogRecordData to FALSE when there is no more data to log.
-
-Returns:
-
- EFI_SUCCESS
- All parameters were valid and *RecordData and *LogRecordData have
- been set.
-
- EFI_UNSUPPORTED
- Unexpected RecordType value.
-
- EFI_INVALID_PARAMETER
- One of the following parameter conditions was true:
- RecordLen was zero.
- RecordData was NULL.
- LogRecordData was NULL.
---*/
-{
- CHAR8 *OptionalStrStart;
- UINTN InternalRefStrLen;
- UINTN ExternalRefStrLen;
- EFI_STRING InternalRef;
- EFI_STRING ExternalRef;
- STRING_REF TokenForInternal;
- STRING_REF TokenForExternal;
- EFI_STATUS Status;
- SMBIOS_TABLE_TYPE8 *SmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *ForType8InputData;
-
- ForType8InputData = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *)RecordData;
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenForInternal = 0;
- TokenForExternal = 0;
-
- switch (ForType8InputData->PortInternalConnectorDesignator) {
-
- case STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR);
- break;
- case STR_MISC_PORT_INTERNAL_KEYBOARD:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_KEYBOARD);
- break;
- case STR_MISC_PORT_INTERNAL_MOUSE:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_MOUSE);
- break;
- case STR_MISC_PORT_INTERNAL_COM1:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM1);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1);
- break;
- case STR_MISC_PORT_INTERNAL_COM2:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM2);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2);
- break;
- case STR_MISC_PORT_INTERNAL_EXTENSION_POWER:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_EXTENSION_POWER);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER);
- break;
- case STR_MISC_PORT_INTERNAL_FLOPPY:
- TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_FLOPPY);
- TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY);
- break;
- default:
- break;
- }
-
- InternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForInternal, NULL);
- InternalRefStrLen = StrLen(InternalRef);
- if (InternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- ExternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForExternal, NULL);
- ExternalRefStrLen = StrLen(ExternalRef);
- if (ExternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE8);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->InternalReferenceDesignator = 1;
- SmbiosRecord->InternalConnectorType = (UINT8)ForType8InputData->PortInternalConnectorType;
- SmbiosRecord->ExternalReferenceDesignator = 2;
- SmbiosRecord->ExternalConnectorType = (UINT8)ForType8InputData->PortExternalConnectorType;
- SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType;
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(InternalRef, OptionalStrStart);
- UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
-
-
-
-/* eof - MiscSystemManufacturerFunction.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
deleted file mode 100644
index 33f0f6be7e..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscResetCapabilitiesData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {
- { // ResetCapabilities
- 0, // Status
- 0, // BootOption
- 0, // BootOptionOnLimit
- 0, // WatchdogTimerPresent
- 0 // Reserved
- },
- 0, // ResetCount
- 0, // ResetLimit
- 0, // ResetTimerInterval
- 0 // ResetTimeout
-};
-
-/* eof - MiscResetCapabilities.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
deleted file mode 100644
index 588f9d65de..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/** @file
- ResetCapabilities.
- SMBIOS type 23.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/**
- This function makes boot time changes to the contents of the
- MiscOemString (Type 11).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE23 *SmbiosRecord;
- EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
-
- ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
- SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
- SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
- SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
- SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
-
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h b/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h
deleted file mode 100644
index b682aebb07..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSubclassDriver.h
-
-Abstract:
-
- Header file for MiscSubclass Driver.
-
---*/
-
-#ifndef _MISC_SUBCLASS_DRIVER_H
-#define _MISC_SUBCLASS_DRIVER_H
-
-#include <FrameworkDxe.h>
-#include <UnixDxe.h>
-#include <Guid/DataHubRecords.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-#include <Protocol/UnixIo.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HiiLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/PcdLib.h>
-
-
-#include <MiscDevicePath.h>
-#include <Protocol/FrameworkHii.h>
-#include <Library/HiiLib.h>
-
-//
-// Data table entry update function.
-//
-typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) (
- IN VOID *RecordData,
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-//
-// Data table entry definition.
-//
-typedef struct {
- //
- // intermediat input data for SMBIOS record
- //
- VOID *RecordData;
- EFI_MISC_SMBIOS_DATA_FUNCTION *Function;
-} EFI_MISC_SMBIOS_DATA_TABLE;
-
-//
-// Data Table extern definitions.
-//
-#define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \
-extern NAME1 NAME2 ## Data; \
-extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function
-
-
-//
-// Data Table entries
-//
-#define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \
-{ \
- & NAME1 ## Data, \
- & NAME2 ## Function \
-}
-
-//
-// Global definition macros.
-//
-#define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \
- NAME1 NAME2 ## Data
-
-#define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \
- EFI_STATUS EFIAPI NAME2 ## Function( \
- IN VOID *RecordData, \
- IN EFI_SMBIOS_PROTOCOL *Smbios \
- )
-
-
-//
-// Data Table Array
-//
-extern EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[];
-
-//
-// Data Table Array Entries
-//
-extern UINTN mMiscSubclassDataTableEntries;
-extern UINT8 MiscSubclassStrings[];
-extern EFI_HII_HANDLE mHiiHandle;
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- );
-
-#endif /* _MISC_SUBCLASS_DRIVER_H */
-
-/* eof - MiscSubclassDriver.h */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf b/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
deleted file mode 100644
index bb7dab6eb3..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
+++ /dev/null
@@ -1,103 +0,0 @@
-## @file
-# Misc Sub class driver
-#
-# Parses the MiscSubclassDataTable and reports any generated data to the DataHub.
-# All .uni file who tagged with "ToolCode="DUMMY"" in following file list is included by
-# MiscSubclassDriver.uni file, the StrGather tool will expand MiscSubclassDriver.uni file
-# and parse all .uni file.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = MiscSubclass
- FILE_GUID = f2fbd108-8985-11db-b06a-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = MiscSubclassDriverEntryPoint
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- MiscBaseBoardManufacturer.uni
- MiscBaseBoardManufacturerData.c
- MiscBaseBoardManufacturerFunction.c
- MiscBiosVendor.uni
- MiscBiosVendorData.c
- MiscBiosVendorFunction.c
- MiscBootInformationData.c
- MiscBootInformationFunction.c
- MiscChassisManufacturer.uni
- MiscChassisManufacturerData.c
- MiscChassisManufacturerFunction.c
- MiscNumberOfInstallableLanguagesData.c
- MiscNumberOfInstallableLanguagesFunction.c
- MiscOemString.uni
- MiscOemStringData.c
- MiscOemStringFunction.c
- MiscPortInternalConnectorDesignator.uni
- MiscPortInternalConnectorDesignatorData.c
- MiscPortInternalConnectorDesignatorFunction.c
- MiscResetCapabilitiesData.c
- MiscResetCapabilitiesFunction.c
- MiscSystemLanguageString.uni
- MiscSystemLanguageStringData.c
- MiscSystemLanguageStringFunction.c
- MiscSystemManufacturer.uni
- MiscSystemManufacturerData.c
- MiscSystemManufacturerFunction.c
- MiscSystemOptionString.uni
- MiscSystemOptionStringData.c
- MiscSystemOptionStringFunction.c
- MiscSystemSlotDesignation.uni
- MiscSystemSlotDesignationData.c
- MiscSystemSlotDesignationFunction.c
- MiscDevicePath.h
- MiscSubClassDriver.h
- MiscSubClassDriver.uni
- MiscSubclassDriverDataTable.c
- MiscSubclassDriverEntryPoint.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- DevicePathLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiDriverEntryPoint
- UefiLib
- HiiLib
- DebugLib
- BaseLib
- PcdLib
-
-[Protocols]
- gEfiUnixIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
-
-[Depex]
- gEfiSmbiosProtocolGuid
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni
deleted file mode 100644
index 7a4e8a2cbc..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
deleted file mode 100644
index 1d0df8e224..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSubclassDriverDataTable.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-
-//
-// External definitions referenced by Data Table entries.
-//
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer, MiscBaseBoardManufacturer);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor,MiscBiosVendor );
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus, BootInformationStatus);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer, MiscChassisManufacturer);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA,NumberOfInstallableLanguages, NumberOfInstallableLanguages);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_OEM_STRING_DATA,OemString, OemString);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy, MiscPortInternalConnectorDesignator);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities, MiscResetCapabilities);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA,SystemLanguageString, SystemLanguageString);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer, MiscSystemManufacturer);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString, SystemOptionString);
-MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation, MiscSystemSlotDesignation);
-
-
-//
-// Data Table.
-//
-EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[] = {
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBaseBoardManufacturer, MiscBaseBoardManufacturer),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBiosVendor,MiscBiosVendor ),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( BootInformationStatus, BootInformationStatus),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscChassisManufacturer, MiscChassisManufacturer),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NumberOfInstallableLanguages, NumberOfInstallableLanguages),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(OemString, OemString),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortKeyboard, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortMouse, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom1, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom2, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortExtensionPower, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortFloppy, MiscPortInternalConnectorDesignator),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscResetCapabilities, MiscResetCapabilities),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(SystemLanguageString, SystemLanguageString),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemManufacturer, MiscSystemManufacturer),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( SystemOptionString, SystemOptionString),
- MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemSlotDesignation, MiscSystemSlotDesignation),
- };
-
-//
-// Number of Data Table entries.
-//
-UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SMBIOS_DATA_TABLE);
-
-/* eof - MiscSubclassDriverDataTable.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
deleted file mode 100644
index 283a76139c..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSubclassDriverEntryPoint.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-EFI_HII_HANDLE mHiiHandle;
-
-/**
- This is the standard EFI driver point that detects whether there is a
- MemoryConfigurationData Variable and, if so, reports memory configuration info
- to the DataHub.
-
- @param ImageHandle Handle for the image of this driver
- @param SystemTable Pointer to the EFI System Table
-
- @return EFI_SUCCESS if the data is successfully reported
- @return EFI_NOT_FOUND if the HOB list could not be located.
-
-**/
-EFI_STATUS
-LogMemorySmbiosRecord (
- VOID
- )
-{
- EFI_STATUS Status;
- UINT64 TotalMemorySize;
- UINT8 NumSlots;
- SMBIOS_TABLE_TYPE19 *Type19Record;
- EFI_SMBIOS_HANDLE MemArrayMappedAddrSmbiosHandle;
- EFI_SMBIOS_PROTOCOL *Smbios;
- CHAR16 *UnixMemString;
-
- Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
- ASSERT_EFI_ERROR (Status);
-
- NumSlots = 1;
-
- //
- // Process Memory String in form size!size ...
- // So 64!64 is 128 MB
- //
- UnixMemString = PcdGetPtr (PcdUnixMemorySize);
- for (TotalMemorySize = 0; *UnixMemString != '\0';) {
- TotalMemorySize += StrDecimalToUint64 (UnixMemString);
- while (*UnixMemString != '\0') {
- if (*UnixMemString == '!') {
- UnixMemString++;
- break;
- }
- UnixMemString++;
- }
- }
-
- //
- // Convert Total Memory Size to based on KiloByte
- //
- TotalMemorySize = LShiftU64 (TotalMemorySize, 20);
- //
- // Generate Memory Array Mapped Address info
- //
- Type19Record = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE19) + 2);
- Type19Record->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS;
- Type19Record->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE19);
- Type19Record->Hdr.Handle = 0;
- Type19Record->StartingAddress = 0;
- Type19Record->EndingAddress = (UINT32)RShiftU64(TotalMemorySize, 10) - 1;
- Type19Record->MemoryArrayHandle = 0;
- Type19Record->PartitionWidth = (UINT8)(NumSlots);
-
- //
- // Generate Memory Array Mapped Address info (TYPE 19)
- //
- Status = AddSmbiosRecord (Smbios, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record);
-
- FreePool(Type19Record);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-MiscSubclassDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-Description:
-
- Standard EFI driver point. This driver parses the mMiscSubclassDataTable
- structure and reports any generated data to the DataHub.
-
-Arguments:
-
- ImageHandle
- Handle for the image of this driver
-
- SystemTable
- Pointer to the EFI System Table
-
-Returns:
-
- EFI_SUCCESS
- The data was successfully reported to the Data Hub.
-
---*/
-{
- UINTN Index;
- EFI_STATUS EfiStatus;
- EFI_SMBIOS_PROTOCOL *Smbios;
-
- EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
-
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
- return EfiStatus;
- }
-
- mHiiHandle = HiiAddPackages (
- &gEfiCallerIdGuid,
- NULL,
- MiscSubclassStrings,
- NULL
- );
- ASSERT (mHiiHandle != NULL);
-
- for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {
- //
- // If the entry have a function pointer, just log the data.
- //
- if (mMiscSubclassDataTable[Index].Function != NULL) {
- EfiStatus = (*mMiscSubclassDataTable[Index].Function)(
- mMiscSubclassDataTable[Index].RecordData,
- Smbios
- );
-
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
- return EfiStatus;
- }
- }
- }
-
- //
- // Log Memory SMBIOS Record
- //
- EfiStatus = LogMemorySmbiosRecord();
- return EfiStatus;
-}
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- )
-{
- *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- return Smbios->Add (
- Smbios,
- NULL,
- SmbiosHandle,
- Record
- );
-}
-
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni
deleted file mode 100644
index 709c53a660..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
deleted file mode 100644
index e6c7b23766..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSystemLanguageStringData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
- 0,
- STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)
-};
-
-/* eof - MiscSystemLanguageStringData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
deleted file mode 100644
index 86d63b4191..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- ResetCapabilities.
- SMBIOS type 23.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/**
- This function makes boot time changes to the contents of the
- MiscOemString (Type 11).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE13 *SmbiosRecord;
- UINTN StrLeng;
- CHAR8 *OptionalStrStart;
- EFI_STRING Str;
- STRING_REF TokenToGet;
-
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING);
- Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- StrLeng = StrLen(Str);
- if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->InstallableLanguages = 1;
- SmbiosRecord->Flags = 1;
- SmbiosRecord->CurrentLanguages = 1;
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(Str, OptionalStrStart);
-
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
-
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni
deleted file mode 100644
index 3ff890b83d..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
deleted file mode 100644
index a253ccac48..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSystemManufacturerData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) System Manufacturer data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)
-= {
- STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER),
- // SystemManufactrurer
- STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME),
- // SystemProductName
- STRING_TOKEN(STR_MISC_SYSTEM_VERSION),
- // SystemVersion
- STRING_TOKEN(STR_MISC_SYSTEM_SERIAL_NUMBER),
- // SystemSerialNumber
- {
- 0xbadfaced,
- 0xdead,
- 0xbeef,
- {
- 0x13,
- 0x13,
- 0x13,
- 0x13,
- 0x13,
- 0x13,
- 0x13,
- 0x13
- }
- },
- // SystemUuid
- EfiSystemWakeupTypePowerSwitch // SystemWakeupType
-};
-
-/* eof - MiscSystemManufacturerData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
deleted file mode 100644
index 3582447a40..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSystemManufacturerFunction.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-/**
- This function makes boot time changes to the contents of the
- MiscSystemManufacturer (Type 1).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer)
-{
- CHAR8 *OptionalStrStart;
- UINTN ManuStrLen;
- UINTN VerStrLen;
- UINTN PdNameStrLen;
- UINTN SerialNumStrLen;
- EFI_STATUS Status;
- EFI_STRING Manufacturer;
- EFI_STRING ProductName;
- EFI_STRING Version;
- EFI_STRING SerialNumber;
- STRING_REF TokenToGet;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE1 *SmbiosRecord;
- EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData;
-
- ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER);
- Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- ManuStrLen = StrLen(Manufacturer);
- if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME);
- ProductName = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- PdNameStrLen = StrLen(ProductName);
- if (PdNameStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_VERSION);
- Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- VerStrLen = StrLen(Version);
- if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER);
- SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- SerialNumStrLen = StrLen(SerialNumber);
- if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
- //
- // Manu will be the 1st optional string following the formatted structure.
- //
- SmbiosRecord->Manufacturer = 1;
- //
- // ProductName will be the 2nd optional string following the formatted structure.
- //
- SmbiosRecord->ProductName = 2;
- //
- // Version will be the 3rd optional string following the formatted structure.
- //
- SmbiosRecord->Version = 3;
- //
- // Version will be the 4th optional string following the formatted structure.
- //
- SmbiosRecord->SerialNumber = 4;
- CopyMem ((UINT8 *) (&SmbiosRecord->Uuid),&ForType1InputData->SystemUuid,16);
- SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType;
-
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
- UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1);
- UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1);
- UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
-
-/* eof - MiscSystemManufacturerFunction.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni
deleted file mode 100644
index abf2da762c..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
deleted file mode 100644
index edda87509e..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSystemOptionStringData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {
- {STRING_TOKEN(STR_MISC_SYSTEM_OPTION_STRING)}
-};
-
-/* eof - MiscSystemOptionStringData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c
deleted file mode 100644
index 145603a9a9..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
- BIOS system option string boot time changes.
- SMBIOS type 12.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-
-
-/**
- This function makes boot time changes to the contents of the
- MiscSystemOptionString (Type 12).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString)
-{
- CHAR8 *OptionalStrStart;
- UINTN OptStrLen;
- EFI_STRING OptionString;
- EFI_STATUS Status;
- STRING_REF TokenToGet;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE12 *SmbiosRecord;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING);
- OptionString = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- OptStrLen = StrLen(OptionString);
- if (OptStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE12);
- //
- // Make handle chosen by smbios protocol.add automatically.
- //
- SmbiosRecord->Hdr.Handle = 0;
-
- SmbiosRecord->StringCount = 1;
- OptionalStrStart = (CHAR8*) (SmbiosRecord + 1);
- UnicodeStrToAsciiStr(OptionString, OptionalStrStart);
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni
deleted file mode 100644
index 45e9ce3c00..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni
+++ /dev/null
Binary files differ
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
deleted file mode 100644
index 760138f43e..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MiscSystemSlotDesignationData.c
-
-Abstract:
-
- This driver parses the mMiscSubclassDataTable structure and reports
- any generated data to the DataHub.
-
---*/
-
-#include "MiscSubClassDriver.h"
-
-//
-// Static (possibly build generated) Bios Vendor data.
-//
-MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {
- STRING_TOKEN(STR_MISC_SYSTEM_SLOT_DESIGNATION), // SlotDesignation
- EfiSlotTypeOther, // SlotType
- EfiSlotDataBusWidthOther, // SlotDataBusWidth
- EfiSlotUsageOther, // SlotUsage
- EfiSlotLengthOther, // SlotLength
- 0, // SlotId
- { // SlotCharacteristics
- 0, // CharacteristicsUnknown :1;
- 0, // Provides50Volts :1;
- 0, // Provides33Volts :1;
- 0, // SharedSlot :1;
- 0, // PcCard16Supported :1;
- 0, // CardBusSupported :1;
- 0, // ZoomVideoSupported :1;
- 0, // ModemRingResumeSupported:1;
- 0, // PmeSignalSupported :1;
- 0, // HotPlugDevicesSupported :1;
- 0, // SmbusSignalSupported :1;
- 0 // Reserved :21;
- },
- {0, 0, {0, 0}} // SlotDevicePath
-};
-
-/* eof - MiscSystemSlotsData.c */
diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c
deleted file mode 100644
index 2bf8844236..0000000000
--- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- BIOS system slot designator information boot time changes.
- SMBIOS type 9.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "MiscSubClassDriver.h"
-/**
- This function makes boot time changes to the contents of the
- MiscSystemSlotDesignator structure (Type 9).
-
- @param RecordData Pointer to copy of RecordData from the Data Table.
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation)
-{
- CHAR8 *OptionalStrStart;
- UINTN SlotDesignationStrLen;
- EFI_STATUS Status;
- EFI_STRING SlotDesignation;
- STRING_REF TokenToGet;
- SMBIOS_TABLE_TYPE9 *SmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_MISC_SYSTEM_SLOT_DESIGNATION* ForType9InputData;
-
- ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData;
-
- //
- // First check for invalid parameters.
- //
- if (RecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- TokenToGet = 0;
- switch (ForType9InputData->SlotDesignation) {
- case STR_MISC_SYSTEM_SLOT_DESIGNATION:
- TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION);
- break;
- default:
- break;
- }
-
- SlotDesignation = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
- SlotDesignationStrLen = StrLen(SlotDesignation);
- if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1);
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE9);
- SmbiosRecord->Hdr.Handle = 0;
- SmbiosRecord->SlotDesignation = 1;
- SmbiosRecord->SlotType = ForType9InputData->SlotType;
- SmbiosRecord->SlotDataBusWidth = ForType9InputData->SlotDataBusWidth;
- SmbiosRecord->CurrentUsage = ForType9InputData->SlotUsage;
- SmbiosRecord->SlotLength = ForType9InputData->SlotLength;
- SmbiosRecord->SlotID = ForType9InputData->SlotId;
-
- //
- // Slot Characteristics
- //
- CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2);
- OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
- UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart);
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
deleted file mode 100644
index 7ab629cbf6..0000000000
--- a/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RealTimeClock.c
-
-Abstract:
-
- UNIX Emulation Architectural Protocol Driver as defined in Tiano
-
---*/
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Protocol/RealTimeClock.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UnixLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-BOOLEAN
-DayValid (
- IN EFI_TIME *Time
- );
-
-BOOLEAN
-IsLeapYear (
- IN EFI_TIME *Time
- );
-
-EFI_STATUS
-RtcTimeFieldsValid (
- IN EFI_TIME *Time
- );
-
-EFI_STATUS
-EFIAPI
-InitializeRealTimeClock (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-EFI_STATUS
-EFIAPI
-UnixGetTime (
- OUT EFI_TIME * Time,
- OUT EFI_TIME_CAPABILITIES * Capabilities OPTIONAL
- )
-/*++
-
-Routine Description:
- Service routine for RealTimeClockInstance->GetTime
-
-Arguments:
-
- Time - A pointer to storage that will receive a snapshot of the current time.
-
- Capabilities - A pointer to storage that will receive the capabilities of the real time clock
- in the platform. This includes the real time clock's resolution and accuracy.
- All reported device capabilities are rounded up. This is an OPTIONAL argument.
-
-Returns:
-
- EFI_SUCEESS - The underlying GetSystemTime call occurred and returned
- Note that in the NT32 emulation, the GetSystemTime call has no return value
- thus you will always receive a EFI_SUCCESS on this.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
-
- //
- // Check parameter for null pointer
- //
- if (Time == NULL) {
- return EFI_INVALID_PARAMETER;
-
- }
-
- gUnix->GetLocalTime (Time);
-
- if (Capabilities != NULL) {
- Capabilities->Resolution = 1;
- Capabilities->Accuracy = 50000000;
- Capabilities->SetsToZero = FALSE;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSetTime (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
- Service routine for RealTimeClockInstance->SetTime
-
-Arguments:
-
- Time - A pointer to storage containing the time and date information to
- program into the real time clock.
-
-Returns:
-
- EFI_SUCEESS - The operation completed successfully.
-
- EFI_INVALID_PARAMETER - One of the fields in Time is out of range.
-
- EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
-
- if (Time == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Make sure that the time fields are valid
- //
- Status = RtcTimeFieldsValid (Time);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
- Service routine for RealTimeClockInstance->GetWakeupTime
-
-Arguments:
- This - Indicates the protocol instance structure.
-
- Enabled - Indicates if the alarm is currently enabled or disabled.
-
- Pending - Indicates if the alarm signal is pending and requires
- acknowledgement.
-
- Time - The current alarm setting.
-
-Returns:
-
- EFI_SUCEESS - The operation completed successfully.
-
- EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
-
- EFI_UNSUPPORTED - The operation is not supported on this platform.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSetWakeupTime (
- IN BOOLEAN Enable,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
- Service routine for RealTimeClockInstance->SetWakeupTime
-
-Arguments:
-
- Enabled - Enable or disable the wakeup alarm.
-
- Time - If enable is TRUE, the time to set the wakup alarm for.
- If enable is FALSE, then this parameter is optional, and
- may be NULL.
-
-Returns:
-
- EFI_SUCEESS - The operation completed successfully.
-
- EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
-
- EFI_INVALID_PARAMETER - A field in Time is out of range.
-
- EFI_UNSUPPORTED - The operation is not supported on this platform.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeRealTimeClock (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Install Real Time Clock Protocol
-
-Arguments:
- ImageHandle - Image Handle
- SystemTable - Pointer to system table
-
-Returns:
-
- EFI_SUCEESS - Real Time Clock Services are installed into the Runtime Services Table
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- SystemTable->RuntimeServices->GetTime = UnixGetTime;
- SystemTable->RuntimeServices->SetTime = UnixSetTime;
- SystemTable->RuntimeServices->GetWakeupTime = UnixGetWakeupTime;
- SystemTable->RuntimeServices->SetWakeupTime = UnixSetWakeupTime;
-
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiRealTimeClockArchProtocolGuid,
- NULL,
- NULL
- );
- return Status;
-}
-
-EFI_STATUS
-RtcTimeFieldsValid (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Arguments:
-
- Returns:
---*/
-// TODO: Time - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- if (Time->Year < 1998 ||
- Time->Year > 2099 ||
- Time->Month < 1 ||
- Time->Month > 12 ||
- (!DayValid (Time)) ||
- Time->Hour > 23 ||
- Time->Minute > 59 ||
- Time->Second > 59 ||
- Time->Nanosecond > 999999999 ||
- (!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||
- (Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
- ) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-DayValid (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Time - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
-
- STATIC const INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
- if (Time->Day < 1 ||
- Time->Day > DayOfMonth[Time->Month - 1] ||
- (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
- ) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOLEAN
-IsLeapYear (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Time - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- if (Time->Year % 4 == 0) {
- if (Time->Year % 100 == 0) {
- if (Time->Year % 400 == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
- } else {
- return TRUE;
- }
- } else {
- return FALSE;
- }
-}
diff --git a/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf b/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
deleted file mode 100644
index 256d74f18d..0000000000
--- a/UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-## @file
-# Unix Emulation Real time clock Architectural Protocol Driver as defined in TIANO
-#
-# This real time clock module simulates virtual device by time WinAPI.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = RealTimeClock
- FILE_GUID = f3552032-8985-11db-8429-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeRealTimeClock
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- RealTimeClock.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UnixLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiRealTimeClockArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/ResetRuntimeDxe/Reset.c b/UnixPkg/ResetRuntimeDxe/Reset.c
deleted file mode 100644
index a67d82cad1..0000000000
--- a/UnixPkg/ResetRuntimeDxe/Reset.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Reset.c
-
-Abstract:
-
- Reset Architectural Protocol as defined in Tiano under UNIX Emulation
-
---*/
-
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Protocol/Reset.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UnixLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-EFI_STATUS
-EFIAPI
-InitializeUnixReset (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-VOID
-EFIAPI
-UnixResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-InitializeUnixReset (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
---*/
-// TODO: SystemTable - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- SystemTable->RuntimeServices->ResetSystem = UnixResetSystem;
-
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiResetArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-VOID
-EFIAPI
-UnixResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ResetType - TODO: add argument description
- ResetStatus - TODO: add argument description
- DataSize - TODO: add argument description
- ResetData - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
-
- //
- // Disconnect all
- //
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
- }
-
- gBS->FreePool (HandleBuffer);
- }
-
-
- //
- // Discard ResetType, always return 0 as exit code
- //
- gUnix->Exit (0);
-
- //
- // Should never go here
- //
- ASSERT (FALSE);
-
- return;
-}
diff --git a/UnixPkg/ResetRuntimeDxe/Reset.inf b/UnixPkg/ResetRuntimeDxe/Reset.inf
deleted file mode 100644
index d367dff903..0000000000
--- a/UnixPkg/ResetRuntimeDxe/Reset.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-## @file
-# Unix Emulation Reset Architectural Protocol Driver as defined in TIANO
-#
-# This Reset module simulates system reset by process exit on NT.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = Reset
- FILE_GUID = f3613084-8985-11db-8c26-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixReset
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Reset.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UnixLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiResetArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/Sec/FwVol.c b/UnixPkg/Sec/FwVol.c
deleted file mode 100644
index 6723148bdc..0000000000
--- a/UnixPkg/Sec/FwVol.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- FwVol.c
-
-Abstract:
- A simple FV stack so the SEC can extract the SEC Core from an
- FV.
-
---*/
-
-#include "SecMain.h"
-
-#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
- (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
-
-EFI_FFS_FILE_STATE
-GetFileState (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Returns the highest bit set of the State field
-
-Arguments:
- ErasePolarity - Erase Polarity as defined by EFI_FVB2_ERASE_POLARITY
- in the Attributes field.
- FfsHeader - Pointer to FFS File Header.
-
-Returns:
- Returns the highest bit in the State field
-
---*/
-{
- EFI_FFS_FILE_STATE FileState;
- EFI_FFS_FILE_STATE HighestBit;
-
- FileState = FfsHeader->State;
-
- if (ErasePolarity != 0) {
- FileState = (EFI_FFS_FILE_STATE)~FileState;
- }
-
- HighestBit = 0x80;
- while (HighestBit != 0 && (HighestBit & FileState) == 0) {
- HighestBit >>= 1;
- }
-
- return HighestBit;
-}
-
-UINT8
-CalculateHeaderChecksum (
- IN EFI_FFS_FILE_HEADER *FileHeader
- )
-/*++
-
-Routine Description:
- Calculates the checksum of the header of a file.
-
-Arguments:
- FileHeader - Pointer to FFS File Header.
-
-Returns:
- Checksum of the header.
-
---*/
-{
- UINT8 *ptr;
- UINTN Index;
- UINT8 Sum;
-
- Sum = 0;
- ptr = (UINT8 *) FileHeader;
-
- for (Index = 0; Index < sizeof (EFI_FFS_FILE_HEADER) - 3; Index += 4) {
- Sum = (UINT8) (Sum + ptr[Index]);
- Sum = (UINT8) (Sum + ptr[Index + 1]);
- Sum = (UINT8) (Sum + ptr[Index + 2]);
- Sum = (UINT8) (Sum + ptr[Index + 3]);
- }
-
- for (; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
- Sum = (UINT8) (Sum + ptr[Index]);
- }
- //
- // State field (since this indicates the different state of file).
- //
- Sum = (UINT8) (Sum - FileHeader->State);
- //
- // Checksum field of the file is not part of the header checksum.
- //
- Sum = (UINT8) (Sum - FileHeader->IntegrityCheck.Checksum.File);
-
- return Sum;
-}
-
-EFI_STATUS
-SecFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume as defined by SearchType. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- SearchType - Filter to find only files of this type.
- Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
- FileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file
- found.
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- EFI_FFS_FILE_HEADER *FfsFileHeader;
- UINT32 FileLength;
- UINT32 FileOccupiedSize;
- UINT32 FileOffset;
- UINT64 FvLength;
- UINT8 ErasePolarity;
- UINT8 FileState;
-
- FvLength = FwVolHeader->FvLength;
- if (FwVolHeader->Attributes & EFI_FVB2_ERASE_POLARITY) {
- ErasePolarity = 1;
- } else {
- ErasePolarity = 0;
- }
- //
- // If FileHeader is not specified (NULL) start with the first file in the
- // firmware volume. Otherwise, start from the FileHeader.
- //
- if (*FileHeader == NULL) {
- FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FwVolHeader + FwVolHeader->HeaderLength);
- } else {
- //
- // Length is 24 bits wide so mask upper 8 bits
- // FileLength is adjusted to FileOccupiedSize as it is 8 byte aligned.
- //
- FileLength = *(UINT32 *) (*FileHeader)->Size & 0x00FFFFFF;
- FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
- FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) *FileHeader + FileOccupiedSize);
- }
-
- FileOffset = (UINT32) ((UINT8 *) FfsFileHeader - (UINT8 *) FwVolHeader);
-
- while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
- //
- // Get FileState which is the highest bit of the State
- //
- FileState = GetFileState (ErasePolarity, FfsFileHeader);
-
- switch (FileState) {
-
- case EFI_FILE_HEADER_INVALID:
- FileOffset += sizeof (EFI_FFS_FILE_HEADER);
- FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
- break;
-
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- if (CalculateHeaderChecksum (FfsFileHeader) == 0) {
- FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
- FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
-
- if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
-
- *FileHeader = FfsFileHeader;
-
- return EFI_SUCCESS;
- }
-
- FileOffset += FileOccupiedSize;
- FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
- } else {
- return EFI_NOT_FOUND;
- }
- break;
-
- case EFI_FILE_DELETED:
- FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
- FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
- FileOffset += FileOccupiedSize;
- FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
- break;
-
- default:
- return EFI_NOT_FOUND;
-
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-SecFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching section in the
- FFS volume.
-
-Arguments:
- SearchType - Filter to find only sections of this type.
- FfsFileHeader - Pointer to the current file to search.
- SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
- NULL if section not found
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- UINT32 FileSize;
- EFI_COMMON_SECTION_HEADER *Section;
- UINT32 SectionLength;
- UINT32 ParsedLength;
-
- //
- // Size is 24 bits wide so mask upper 8 bits.
- // Does not include FfsFileHeader header size
- // FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.
- //
- Section = (EFI_COMMON_SECTION_HEADER *) (FfsFileHeader + 1);
- FileSize = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
- FileSize -= sizeof (EFI_FFS_FILE_HEADER);
-
- *SectionData = NULL;
- ParsedLength = 0;
- while (ParsedLength < FileSize) {
- if (Section->Type == SectionType) {
- *SectionData = (VOID *) (Section + 1);
- return EFI_SUCCESS;
- }
- //
- // Size is 24 bits wide so mask upper 8 bits.
- // SectionLength is adjusted it is 4 byte aligned.
- // Go to the next section
- //
- SectionLength = *(UINT32 *) Section->Size & 0x00FFFFFF;
- SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
-
- ParsedLength += SectionLength;
- Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + SectionLength);
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-SecFfsFindPeiCore (
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- OUT VOID **Pe32Data
- )
-/*++
-
-Routine Description:
- Given the pointer to the Firmware Volume Header find the SEC
- core and return it's PE32 image.
-
-Arguments:
- FwVolHeader - Pointer to memory mapped FV
- Pe32Data - Pointer to SEC PE32 iamge.
-
-Returns:
- EFI_SUCCESS - Pe32Data is valid
- other - Failure
-
---*/
-{
- EFI_STATUS Status;
- EFI_FFS_FILE_HEADER *FileHeader;
- EFI_FV_FILETYPE SearchType;
-
- SearchType = EFI_FV_FILETYPE_PEI_CORE;
- FileHeader = NULL;
- do {
- Status = SecFfsFindNextFile (SearchType, FwVolHeader, &FileHeader);
- if (!EFI_ERROR (Status)) {
- Status = SecFfsFindSectionData (EFI_SECTION_PE32, FileHeader, Pe32Data);
- return Status;
- }
- } while (!EFI_ERROR (Status));
-
- return Status;
-}
diff --git a/UnixPkg/Sec/Gasket.c b/UnixPkg/Sec/Gasket.c
deleted file mode 100644
index 04c65f1a8d..0000000000
--- a/UnixPkg/Sec/Gasket.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifdef __APPLE__
-
-#include "SecMain.h"
-#include "Gasket.h"
-
-//
-// Gasket functions for EFI_UNIX_THUNK_PROTOCOL
-//
-
-void
-GasketmsSleep (unsigned long Milliseconds)
-{
- GasketUintn (msSleep, Milliseconds);
- return;
-}
-
-void
-Gasketexit (int status)
-{
- GasketUintn (exit, status);
- return;
-}
-
-
-void
-GasketSetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs))
-{
- GasketUint64Uintn (SetTimer, PeriodMs, (UINTN)CallBack);
- return;
-}
-
-
-void
-GasketGetLocalTime (EFI_TIME *Time)
-{
- GasketUintn (GetLocalTime, (UINTN)Time);
- return;
-}
-
-
-struct tm *
-Gasketgmtime (const time_t *clock)
-{
- return (struct tm *)(UINTN)GasketUintn (localtime, (UINTN)clock);
-}
-
-
-long
-GasketGetTimeZone (void)
-{
- return GasketVoid (GetTimeZone);
-}
-
-
-int
-GasketGetDayLight (void)
-{
- return GasketVoid (GetDayLight);
-}
-
-
-int
-Gasketpoll (struct pollfd *pfd, unsigned int nfds, int timeout)
-{
- return GasketUintnUintnUintn (poll, (UINTN)pfd, nfds, timeout);
-}
-
-
-long
-Gasketread (int fd, void *buf, int count)
-{
- return GasketUintnUintnUintn (read, fd, (UINTN)buf, count);
-}
-
-
-long
-Gasketwrite (int fd, const void *buf, int count)
-{
- return GasketUintnUintnUintn (write, fd, (UINTN)buf, count);
-}
-
-
-char *
-Gasketgetenv (const char *name)
-{
- return (char *)(UINTN)GasketUintn (getenv, (UINTN)name);
-}
-
-
-int
-Gasketopen (const char *name, int flags, int mode)
-{
- return GasketUintnUintnUintn (open, (UINTN)name, flags, mode);
-}
-
-
-off_t
-Gasketlseek (int fd, off_t off, int whence)
-{
- if (sizeof off == 8) {
- return GasketUintnUint64Uintn (lseek, fd, off, whence);
- } else if (sizeof off == 4) {
- return GasketUintnUintnUintn (lseek, fd, off, whence);
- }
-}
-
-
-int
-Gasketftruncate (int fd, long int len)
-{
- return GasketUintnUintn (ftruncate, fd, len);
-}
-
-
-int
-Gasketclose (int fd)
-{
- return GasketUintn (close, fd);
-}
-
-
-int
-Gasketmkdir (const char *pathname, mode_t mode)
-{
- return GasketUintnUint16 (mkdir, (UINTN)pathname, mode);
-}
-
-
-int
-Gasketrmdir (const char *pathname)
-{
- return GasketUintn (rmdir, (UINTN)pathname);
-}
-
-
-int
-Gasketunlink (const char *pathname)
-{
- return GasketUintn (unlink, (UINTN)pathname);
-}
-
-
-int
-GasketGetErrno (void)
-{
- return GasketVoid (GetErrno);
-}
-
-
-DIR *
-Gasketopendir (const char *pathname)
-{
- return (DIR *)(UINTN)GasketUintn (opendir, (UINTN)pathname);
-}
-
-
-void
-Gasketrewinddir (DIR *dir)
-{
- GasketUintn (rewinddir, (UINTN)dir);
- return;
-}
-
-
-struct dirent *
-Gasketreaddir (DIR *dir)
-{
- return (struct dirent *)(UINTN)GasketUintn (readdir, (UINTN)dir);
-}
-
-
-int
-Gasketclosedir (DIR *dir)
-{
- return GasketUintn (closedir, (UINTN)dir);
-}
-
-
-int
-Gasketstat (const char *path, STAT_FIX *buf)
-{
- return GasketUintnUintn (stat, (UINTN)path, (UINTN)buf);
-}
-
-
-int
-Gasketstatfs (const char *path, struct statfs *buf)
-{
- return GasketUintnUintn (statfs, (UINTN)path, (UINTN)buf);
-}
-
-
-int
-Gasketrename (const char *oldpath, const char *newpath)
-{
- return GasketUintnUintn (rename, (UINTN)oldpath, (UINTN)newpath);
-}
-
-
-time_t
-Gasketmktime (struct tm *tm)
-{
- return GasketUintn (mktime, (UINTN)tm);
-}
-
-
-int
-Gasketfsync (int fd)
-{
- return GasketUintn (fsync, fd);
-}
-
-
-int
-Gasketchmod (const char *path, mode_t mode)
-{
- return GasketUintnUint16 (chmod, (UINTN)path, mode);
-}
-
-
-int
-Gasketutime (const char *filename, const struct utimbuf *buf)
-{
- return GasketUintnUintn (utime, (UINTN)filename, (UINTN)buf);
-}
-
-
-int
-Gaskettcflush (int fildes, int queue_selector)
-{
- return GasketUintnUintn (tcflush, fildes, queue_selector);
-}
-
-
-EFI_STATUS
-GasketUgaCreate (struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title)
-{
- return GasketUintnUintn (UgaCreate, (UINTN)UgaIo, (UINTN)Title);
-}
-
-
-void
-Gasketperror (__const char *__s)
-{
- GasketUintn (perror, (UINTN)__s);
- return;
-}
-
-
-
-//
-// ... is always an int or pointer to device specific data structure
-//
-int
-Gasketioctl (int fd, unsigned long int __request, void *Arg)
-{
- return GasketUintnUintnUintn (ioctl, fd, __request, (UINTN)Arg);
-}
-
-
-int
-Gasketfcntl (int __fd, int __cmd, void *Arg)
-{
- return GasketUintnUintnUintn (fcntl, __fd, __cmd, (UINTN)Arg);
-}
-
-
-
-int
-Gasketcfsetispeed (struct termios *__termios_p, speed_t __speed)
-{
- return GasketUintnUintn (cfsetispeed, (UINTN)__termios_p, __speed);
-}
-
-
-int
-Gasketcfsetospeed (struct termios *__termios_p, speed_t __speed)
-{
- return GasketUintnUintn (cfsetospeed, (UINTN)__termios_p, __speed);
-}
-
-
-int
-Gaskettcgetattr (int __fd, struct termios *__termios_p)
-{
- return GasketUintnUintn (tcgetattr, __fd, (UINTN)__termios_p);
-}
-
-
-int
-Gaskettcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p)
-{
- return GasketUintnUintnUintn (tcsetattr, __fd, __optional_actions, (UINTN)__termios_p);
-}
-
-
-
-
-RETURN_STATUS
-GasketUnixPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- )
-{
- return GasketUintnUintn (SecPeCoffGetEntryPoint, (UINTN)Pe32Data, (UINTN)EntryPoint);
-}
-
-
-
-VOID
-GasketUnixPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- GasketUintn (SecPeCoffRelocateImageExtraAction, (UINTN)ImageContext);
- return;
-}
-
-
-
-VOID
-GasketUnixPeCoffUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- GasketUintn (SecPeCoffLoaderUnloadImageExtraAction, (UINTN)ImageContext);
- return;
-}
-
-
-//
-// Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL
-//
-
-EFI_STATUS
-EFIAPI
-GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- return GasketUintn (UgaClose, (UINTN)UgaIo);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height)
-{
- return GasketUintnUintnUintn (UgaSize, (UINTN)UgaIo, Width, Height);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- return GasketUintn (UgaCheckKey, (UINTN)UgaIo);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaKeySetState (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_KEY_TOGGLE_STATE *KeyToggleState)
-{
- return GasketUintnUintn (UgaGetKey, (UINTN)UgaIo, (UINTN)KeyToggleState);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_KEY_DATA *key)
-{
- return GasketUintnUintn (UgaGetKey, (UINTN)UgaIo, (UINTN)key);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaRegisterKeyNotify (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN UGA_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- )
-{
- return GasketUintnUintnUintn (UgaRegisterKeyNotify, (UINTN)UgaIo, (UINTN)CallBack, (UINTN)Context);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaBlt (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UGA_BLT_ARGS *Args
- )
-{
- return GasketUintnUintnUintnUintn (UgaBlt, (UINTN)UgaIo, (UINTN)BltBuffer, (UINTN)BltOperation, (UINTN)Args);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaCheckPointer (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- return GasketUintn (UgaCheckPointer, (UINTN)UgaIo);
-}
-
-EFI_STATUS
-EFIAPI
-GasketUgaGetPointerState (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_SIMPLE_POINTER_STATE *state)
-{
- return GasketUintnUintn (UgaGetPointerState, (UINTN)UgaIo, (UINTN)state);
-}
-
-void
-GasketUnixEnableInterrupt (void)
-{
- GasketVoid (UnixEnableInterrupt);
-}
-
-void
-GasketUnixDisableInterrupt (void)
-{
- GasketVoid (UnixDisableInterrupt);
-}
-
-
-int
-Gasketgetifaddrs (struct ifaddrs **ifap)
-{
- return( GasketUintn( getifaddrs, ( UINTN ) ifap ) );
-}
-
-
-void
-Gasketfreeifaddrs (struct ifaddrs *ifap)
-{
- GasketUintn( freeifaddrs, ( UINTN ) ifap );
-}
-
-
-int
-Gasketsocket (int domain, int type, int protocol )
-{
- return( GasketUintnUintnUintn( socket, domain, type, protocol ) );
-}
-
-
-#endif
-
diff --git a/UnixPkg/Sec/Gasket.h b/UnixPkg/Sec/Gasket.h
deleted file mode 100644
index 4c75d8abcc..0000000000
--- a/UnixPkg/Sec/Gasket.h
+++ /dev/null
@@ -1,594 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- 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 _GASKET_H_
-#define _GASKET_H_
-
-#include <Library/PeCoffLib.h>
-
-#include <Protocol/UgaDraw.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UnixUgaIo.h>
-
-
-//
-// Gasket functions for EFI_UNIX_THUNK_PROTOCOL
-//
-
-void
-EFIAPI
-GasketmsSleep (unsigned long Milliseconds);
-
-void
-EFIAPI
-Gasketexit (
- int status
- );
-
-void
-EFIAPI
-GasketSetTimer (
- UINT64 PeriodMs,
- VOID (*CallBack)(UINT64 DeltaMs)
- );
-
-void
-EFIAPI
-GasketGetLocalTime (
- EFI_TIME *Time
- );
-
-struct tm *
-EFIAPI
-Gasketgmtime (
- const time_t *clock
- );
-
-long
-EFIAPI
-GasketGetTimeZone (
- void
- );
-
-int
-EFIAPI
-GasketGetDayLight (
- void
- );
-
-
-int
-EFIAPI
-Gasketpoll (
- struct pollfd *pfd,
- unsigned int nfds,
- int timeout
- );
-
-long
-EFIAPI
-Gasketread (
- int fd,
- void *buf,
- int count);
-
-long
-EFIAPI
-Gasketwrite (
- int fd,
- const void *buf,
- int count
- );
-
-char *
-EFIAPI
-Gasketgetenv (
- const char *name
- );
-
-int
-EFIAPI
-Gasketopen (
- const char *name,
- int flags,
- int mode
- );
-
-off_t
-EFIAPI
-Gasketlseek (
- int fd,
- off_t off,
- int whence
- );
-
-int
-EFIAPI
-Gasketftruncate (
- int fd,
- long int len
- );
-
-int
-EFIAPI
-Gasketclose (
- int fd
- );
-
-int
-EFIAPI
-Gasketmkdir (
- const char *pathname,
- mode_t mode
- );
-
-int
-EFIAPI
-Gasketrmdir (
- const char *pathname
- );
-
-int
-EFIAPI
-Gasketunlink (
- const char *pathname
- );
-
-int
-EFIAPI
-GasketGetErrno (
- void
- );
-
-DIR *
-EFIAPI
-Gasketopendir (
- const char *pathname
- );
-
-void
-EFIAPI
-Gasketrewinddir (
- DIR *dir
- );
-
-struct dirent *
-EFIAPI
-Gasketreaddir (
- DIR *dir
- );
-
-int
-EFIAPI
-Gasketclosedir (
- DIR *dir
- );
-
-int
-EFIAPI
-Gasketstat (
- const char *path,
- STAT_FIX *buf)
- ;
-
-int
-EFIAPI
-Gasketstatfs (
- const char *path,
- struct statfs *buf
- );
-
-int
-EFIAPI
-Gasketrename (
- const char *oldpath,
- const char *newpath
- );
-
-time_t
-EFIAPI
-Gasketmktime (
- struct tm *tm
- );
-
-int
-EFIAPI
-Gasketfsync (
- int fd
- );
-
-int
-EFIAPI
-Gasketchmod (
- const char *path,
- mode_t mode
- );
-
-int
-EFIAPI
-Gasketutime (
- const char *filename,
- const struct utimbuf *buf
- );
-
-int
-EFIAPI
-Gaskettcflush (
- int fildes,
- int queue_selector
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaCreate (
- struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
- CONST CHAR16 *Title
- );
-
-void
-EFIAPI
-Gasketperror (
- __const char *__s
- );
-
-//
-// ... is always an int or pointer to device specific data structure
-//
-
-int
-EFIAPI
-Gasketioctl (
- int fd,
- unsigned long int __request,
- void *Arg
- );
-
-int
-EFIAPI
-Gasketfcntl (
- int __fd,
- int __cmd,
- void *Arg
- );
-
-int
-EFIAPI
-Gasketcfsetispeed (
- struct termios *__termios_p,
- speed_t __speed
- );
-
-int
-EFIAPI
-Gasketcfsetospeed (
- struct termios *__termios_p,
- speed_t __speed
- );
-
-int
-EFIAPI
-Gaskettcgetattr (
- int __fd,
- struct termios *__termios_p
- );
-
-int
-EFIAPI
-Gaskettcsetattr (
- int __fd,
- int __optional_actions,
- __const struct termios *__termios_p
- );
-
-int
-EFIAPI
-Gasketsigaction (
- int sig,
- const struct sigaction *act,
- struct sigaction *oact
- );
-
-int
-EFIAPI
-Gasketgetifaddrs (
- struct ifaddrs **ifap
- );
-
-void
-EFIAPI
-Gasketfreeifaddrs (
- struct ifaddrs *ifap
- );
-
-int
-EFIAPI
-Gasketsocket (
- int domain,
- int type,
- int protocol
- );
-
-void
-EFIAPI
-GasketUnixEnableInterrupt (void);
-
-void
-EFIAPI
-GasketUnixDisableInterrupt (void);
-
-RETURN_STATUS
-EFIAPI
-GasketUnixPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- );
-
-VOID
-EFIAPI
-GasketUnixPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-VOID
-EFIAPI
-GasketUnixPeCoffUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-
-
-UINTN
-EFIAPI
-GasketVoid (
- void *api
- );
-
-UINTN
-EFIAPI
-GasketUintn (
- void *api,
- UINTN a
- );
-
-UINTN
-EFIAPI
-GasketUintnUintn (
- void *api,
- UINTN a,
- UINTN b
- );
-
-UINTN
-EFIAPI
-GasketUintnUintnUintn (
- void *api,
- UINTN a,
- UINTN b,
- UINTN c
- );
-
-UINTN
-EFIAPI
-GasketUintnUintnUintnUintn (
- void *api,
- UINTN a,
- UINTN b,
- UINTN c,
- UINTN d
- );
-
-UINTN
-EFIAPI
-GasketUintn10Args (
- void *api,
- UINTN a,
- UINTN b,
- UINTN c,
- UINTN d,
- UINTN e,
- UINTN f,
- UINTN g,
- UINTN h,
- UINTN i,
- UINTN j
- );
-
-UINTN
-EFIAPI
-GasketUint64Uintn (
- void *api,
- UINT64 a,
- UINTN b);
-
-UINT64
-EFIAPI
-GasketUintnUint64Uintn (
- void *api,
- UINTN a,
- UINT64 b,
- UINTN c
- );
-
-UINTN
-EFIAPI
-GasketUintnUint16 (
- void *api,
- UINTN a,
- UINT16 b
- );
-
-typedef
-void
-(*CALL_BACK) (
- UINT64 Delta
- );
-
-UINTN
-ReverseGasketUint64 (
- CALL_BACK CallBack,
- UINT64 a
- );
-
-UINTN
-ReverseGasketUint64Uint64 (
- VOID *CallBack,
- VOID *Context,
- VOID *Key
- );
-
-//
-// Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL
-//
-
-
-EFI_STATUS
-EFIAPI
-GasketUgaClose (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaSize (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- UINT32 Width,
- UINT32 Height
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaCheckKey (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaGetKey (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- EFI_KEY_DATA *key
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaKeySetState (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- EFI_KEY_TOGGLE_STATE *KeyToggleState
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaRegisterKeyNotify (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN UGA_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaBlt (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UGA_BLT_ARGS *Args
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaCheckPointer (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-GasketUgaGetPointerState (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- EFI_SIMPLE_POINTER_STATE *state
- );
-
-
-//
-// Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL C calls
-//
-
-
-EFI_STATUS
-EFIAPI
-UgaCreate (
- EFI_UNIX_UGA_IO_PROTOCOL **Uga,
- CONST CHAR16 *Title
- );
-
-EFI_STATUS
-EFIAPI
-UgaClose (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-UgaSize(
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- UINT32 Width,
- UINT32 Height
- );
-
-EFI_STATUS
-EFIAPI
-UgaCheckKey(
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-UgaGetKey (
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- EFI_KEY_DATA *key
- );
-
-EFI_STATUS
-EFIAPI
-UgaRegisterKeyNotify (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN UGA_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- );
-
-
-EFI_STATUS
-EFIAPI
-UgaBlt (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UGA_BLT_ARGS *Args
- );
-
-EFI_STATUS
-EFIAPI
-UgaCheckPointer (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo
- );
-
-EFI_STATUS
-EFIAPI
-UgaGetPointerState (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_SIMPLE_POINTER_STATE *State
- );
-
-
-#endif
-
-
diff --git a/UnixPkg/Sec/Ia32/Gasket.S b/UnixPkg/Sec/Ia32/Gasket.S
deleted file mode 100644
index 5f762a3782..0000000000
--- a/UnixPkg/Sec/Ia32/Gasket.S
+++ /dev/null
@@ -1,344 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# OS X Application requires 16 byte stack alignment. The problem is these
-# APIs are exposed to code that does not have this requirement via
-# EFI_UNIX_THUNK_PROTOCOL. So these are wrapper functions that make sure
-# the stack is aligned. This code should also work if the stack is already
-# aligned. Extra stack padding is really the same as local varaibles so
-# it gets freed by the leave instruction
-#
-# I basically used the compiler, added extra 16 bytes to the local stack and
-# made sure %esp ended in 0 before the call (16 byte algined)
-#
-# The EFI_UNIX_THUNK_PROTOCOL member functions call a C API that then calls
-# one of these generic assembly routines. We do it that way to work around
-# some magic name changing that happens in C. For example stat() is _stat()
-# on Leopard and _stat$INDOE64 on Snow Leopard. That is why we pass stat()
-# into one of these gaskets from C code.
-#
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-#ifdef __APPLE__
-
- .text
-
-#------------------------------------------------------------------------------
-# int GasketVoid (void *api)
-#------------------------------------------------------------------------------
-.globl _GasketVoid
-_GasketVoid:
- pushl %ebp
- movl %esp, %ebp
- subl $34, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintn
-_GasketUintn:
- pushl %ebp
- movl %esp, %ebp
- subl $50, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUintn
-_GasketUintnUintn:
- pushl %ebp
- movl %esp, %ebp
- subl $50, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUintnUintn
-_GasketUintnUintnUintn:
- pushl %ebp
- movl %esp, %ebp
- subl $50, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 20(%ebp), %eax
- movl %eax, 8(%esp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUintnUintnUintn
-_GasketUintnUintnUintnUintn:
- pushl %ebp
- movl %esp, %ebp
- subl $50, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 24(%ebp), %eax
- movl %eax, 12(%esp)
- movl 20(%ebp), %eax
- movl %eax, 8(%esp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUintnUintnUintnUintn
-_GasketUintnUintnUintnUintnUintn:
- pushl %ebp
- movl %esp, %ebp
- subl $50, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 28(%ebp), %eax
- movl %eax, 16(%esp)
- movl 24(%ebp), %eax
- movl %eax, 12(%esp)
- movl 20(%ebp), %eax
- movl %eax, 8(%esp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintn10Args
-_GasketUintn10Args:
- pushl %ebp
- movl %esp, %ebp
- subl $82, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 48(%ebp), %eax
- movl %eax, 36(%esp)
- movl 44(%ebp), %eax
- movl %eax, 32(%esp)
- movl 40(%ebp), %eax
- movl %eax, 28(%esp)
- movl 36(%ebp), %eax
- movl %eax, 24(%esp)
- movl 32(%ebp), %eax
- movl %eax, 20(%esp)
- movl 28(%ebp), %eax
- movl %eax, 16(%esp)
- movl 24(%ebp), %eax
- movl %eax, 12(%esp)
- movl 20(%ebp), %eax
- movl %eax, 8(%esp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUint64Uintn
-_GasketUint64Uintn:
- pushl %ebp
- movl %esp, %ebp
- subl $66, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, -32(%ebp)
- movl 16(%ebp), %eax
- movl %eax, -28(%ebp)
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 20(%ebp), %eax
- movl %eax, 8(%esp)
- movl -32(%ebp), %eax
- movl -28(%ebp), %edx
- movl %eax, (%esp)
- movl %edx, 4(%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUint64Uintn
-_GasketUintnUint64Uintn:
- pushl %ebp
- movl %esp, %ebp
- subl $66, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, -32(%ebp)
- movl 20(%ebp), %eax
- movl %eax, -28(%ebp)
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl 24(%ebp), %eax
- movl %eax, 12(%esp)
- movl -32(%ebp), %eax
- movl -28(%ebp), %edx
- movl %eax, 4(%esp)
- movl %edx, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-.globl _GasketUintnUint16
-_GasketUintnUint16:
- pushl %ebp
- movl %esp, %ebp
- subl $66, %esp # sub extra 0x10 from the stack for the AND
- and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movw %ax, -28(%ebp)
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movzwl -28(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-
-.globl _ReverseGasketUint64
-_ReverseGasketUint64:
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp
- movl 12(%ebp), %eax
- movl %eax, -16(%ebp)
- movl 16(%ebp), %eax
- movl %eax, -12(%ebp)
- movl -16(%ebp), %eax
- movl -12(%ebp), %edx
- movl %eax, (%esp)
- movl %edx, 4(%esp)
- movl 8(%ebp), %eax
- call *%eax
- leave
- ret
-
-
-.globl _ReverseGasketUint64Uint64
-_ReverseGasketUint64Uint64:
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp
- movl 12(%ebp), %eax
- movl %eax, -32(%ebp)
- movl 16(%ebp), %eax
- movl %eax, -28(%ebp)
- movl 20(%ebp), %eax
- movl %eax, -40(%ebp)
- movl 24(%ebp), %eax
- movl %eax, -36(%ebp)
- movl 8(%ebp), %eax
- movl %eax, -12(%ebp)
- movl -40(%ebp), %eax
- movl -36(%ebp), %edx
- movl %eax, 8(%esp)
- movl %edx, 12(%esp)
- movl -32(%ebp), %eax
- movl -28(%ebp), %edx
- movl %eax, (%esp)
- movl %edx, 4(%esp)
- movl -12(%ebp), %eax
- call *%eax
- leave
- ret
-
-
-// Sec PPI Callbacks
-
-.globl _GasketSecUnixPeiLoadFile
-_GasketSecUnixPeiLoadFile:
- jmp _SecUnixPeiLoadFile
-
-
-.globl _GasketSecUnixPeiAutoScan
-_GasketSecUnixPeiAutoScan:
- jmp _SecUnixPeiAutoScan
-
-
-.globl _GasketSecUnixUnixThunkAddress
-_GasketSecUnixUnixThunkAddress:
- jmp _SecUnixUnixThunkAddress
-
-
-.globl _GasketSecPeiReportStatusCode
-_GasketSecPeiReportStatusCode:
- jmp _SecPeiReportStatusCode
-
-
-.globl _GasketSecUnixFdAddress
-_GasketSecUnixFdAddress:
- jmp _SecUnixFdAddress
-
-
-.globl _GasketSecTemporaryRamSupport
-_GasketSecTemporaryRamSupport:
- jmp _SecTemporaryRamSupport
-
- #endif
diff --git a/UnixPkg/Sec/Ia32/Stack.S b/UnixPkg/Sec/Ia32/Stack.S
deleted file mode 100644
index ff5a77f8ba..0000000000
--- a/UnixPkg/Sec/Ia32/Stack.S
+++ /dev/null
@@ -1,95 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# Stack.asm
-#
-# Abstract:
-#
-# Switch the stack from temporary memory to permenent memory.
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# SecSwitchStack (
-# UINT32 TemporaryMemoryBase,
-# UINT32 PermenentMemoryBase
-# );
-#------------------------------------------------------------------------------
-
-#include <ProcessorBind.h>
-
-ASM_GLOBAL ASM_PFX(SecSwitchStack)
-ASM_PFX(SecSwitchStack):
-#
-# Save three register: eax, ebx, ecx
-#
- push %eax
- push %ebx
- push %ecx
- push %edx
-
-#
-# !!CAUTION!! this function address's is pushed into stack after
-# migration of whole temporary memory, so need save it to permenent
-# memory at first!
-#
-
- movl 20(%esp), %ebx # Save the first parameter
- movl 24(%esp), %ecx # Save the second parameter
-
-#
-# Save this function's return address into permenent memory at first.
-# Then, Fixup the esp point to permenent memory
-#
-
- movl %esp, %eax
- subl %ebx, %eax
- addl %ecx, %eax
- movl (%esp), %edx # copy pushed register's value to permenent memory
- movl %edx, (%eax)
- movl 4(%esp), %edx
- movl %edx, 4(%eax)
- movl 8(%esp), %edx
- movl %edx, 8(%eax)
- movl 12(%esp), %edx
- movl %edx, 12(%eax)
- movl 16(%esp), %edx
- movl %edx, 16(%eax)
- movl %eax, %esp # From now, esp is pointed to permenent memory
-
-#
-# Fixup the ebp point to permenent memory
-#
-#ifndef __APPLE__
- movl %ebp, %eax
- subl %ebx, %eax
- addl %ecx, %eax
- movl %eax, %ebp # From now, ebp is pointed to permenent memory
-
-#
-# Fixup callee's ebp point for PeiDispatch
-#
- movl (%ebp), %eax
- subl %ebx, %eax
- addl %ecx, %eax
- movl %eax, (%ebp) # From now, Temporary's PPI caller's stack is in permenent memory
-#endif
-
- pop %edx
- pop %ecx
- pop %ebx
- pop %eax
- ret
diff --git a/UnixPkg/Sec/Ia32/SwitchStack.c b/UnixPkg/Sec/Ia32/SwitchStack.c
deleted file mode 100644
index cf5f364d0d..0000000000
--- a/UnixPkg/Sec/Ia32/SwitchStack.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SecMain.c
-
-Abstract:
- Unix emulator of SEC phase. It's really a Posix application, but this is
- Ok since all the other modules for NT32 are NOT Posix applications.
-
- This program processes host environment variables and figures out
- what the memory layout will be, how may FD's will be loaded and also
- what the boot mode is.
-
- The SEC registers a set of services with the SEC core. gPrivateDispatchTable
- is a list of PPI's produced by the SEC that are availble for usage in PEI.
-
- This code produces 128 K of temporary memory for the PEI stack by opening a
- host file and mapping it directly to memory addresses.
-
- The system.cmd script is used to set host environment variables that drive
- the configuration opitons of the SEC.
-
---*/
-
-#include "SecMain.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.
-
- 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 NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *Context3, OPTIONAL
- IN VOID *NewStack
- )
-{
- BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
-
- ASSERT (EntryPoint != NULL);
- ASSERT (NewStack != NULL);
-
- //
- // Stack should be aligned with CPU_STACK_ALIGNMENT
- //
- ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
-
- JumpBuffer.Eip = (UINTN)EntryPoint;
- JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
- JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2) + sizeof(Context3);
- ((VOID**)JumpBuffer.Esp)[1] = Context1;
- ((VOID**)JumpBuffer.Esp)[2] = Context2;
- ((VOID**)JumpBuffer.Esp)[3] = Context3;
-
- LongJump (&JumpBuffer, (UINTN)-1);
-
-
- //
- // InternalSwitchStack () will never return
- //
- ASSERT (FALSE);
-}
-
-
-
diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c
deleted file mode 100644
index f0627be39a..0000000000
--- a/UnixPkg/Sec/SecMain.c
+++ /dev/null
@@ -1,1340 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SecMain.c
-
-Abstract:
- Unix emulator of SEC phase. It's really a Posix application, but this is
- Ok since all the other modules for NT32 are NOT Posix applications.
-
- This program processes host environment variables and figures out
- what the memory layout will be, how may FD's will be loaded and also
- what the boot mode is.
-
- The SEC registers a set of services with the SEC core. gPrivateDispatchTable
- is a list of PPI's produced by the SEC that are availble for usage in PEI.
-
- This code produces 128 K of temporary memory for the PEI stack by opening a
- host file and mapping it directly to memory addresses.
-
- The system.cmd script is used to set host environment variables that drive
- the configuration opitons of the SEC.
-
---*/
-
-#include "SecMain.h"
-#include <sys/mman.h>
-#include <Ppi/UnixPeiLoadFile.h>
-#include <Ppi/TemporaryRamSupport.h>
-#include <dlfcn.h>
-
-#ifdef __APPLE__
-#define MAP_ANONYMOUS MAP_ANON
-char *gGdbWorkingFileName = NULL;
-#endif
-
-
-//
-// Globals
-//
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
-UNIX_PEI_LOAD_FILE_PPI mSecUnixLoadFilePpi = { GasketSecUnixPeiLoadFile };
-PEI_UNIX_AUTOSCAN_PPI mSecUnixAutoScanPpi = { GasketSecUnixPeiAutoScan };
-PEI_UNIX_THUNK_PPI mSecUnixThunkPpi = { GasketSecUnixUnixThunkAddress };
-EFI_PEI_PROGRESS_CODE_PPI mSecStatusCodePpi = { GasketSecPeiReportStatusCode };
-UNIX_FWH_PPI mSecFwhInformationPpi = { GasketSecUnixFdAddress };
-EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { GasketSecTemporaryRamSupport };
-#else
-UNIX_PEI_LOAD_FILE_PPI mSecUnixLoadFilePpi = { SecUnixPeiLoadFile };
-PEI_UNIX_AUTOSCAN_PPI mSecUnixAutoScanPpi = { SecUnixPeiAutoScan };
-PEI_UNIX_THUNK_PPI mSecUnixThunkPpi = { SecUnixUnixThunkAddress };
-EFI_PEI_PROGRESS_CODE_PPI mSecStatusCodePpi = { SecPeiReportStatusCode };
-UNIX_FWH_PPI mSecFwhInformationPpi = { SecUnixFdAddress };
-EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { SecTemporaryRamSupport };
-#endif
-
-EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gUnixPeiLoadFilePpiGuid,
- &mSecUnixLoadFilePpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gPeiUnixAutoScanPpiGuid,
- &mSecUnixAutoScanPpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gPeiUnixThunkPpiGuid,
- &mSecUnixThunkPpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gEfiPeiStatusCodePpiGuid,
- &mSecStatusCodePpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gEfiTemporaryRamSupportPpiGuid,
- &mSecTemporaryRamSupportPpi
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gUnixFwhPpiGuid,
- &mSecFwhInformationPpi
- }
-};
-
-
-//
-// Default information about where the FD is located.
-// This array gets filled in with information from EFI_FIRMWARE_VOLUMES
-// EFI_FIRMWARE_VOLUMES is a host environment variable set by system.cmd.
-// The number of array elements is allocated base on parsing
-// EFI_FIRMWARE_VOLUMES and the memory is never freed.
-//
-UINTN gFdInfoCount = 0;
-UNIX_FD_INFO *gFdInfo;
-
-//
-// Array that supports seperate memory rantes.
-// The memory ranges are set in system.cmd via the EFI_MEMORY_SIZE variable.
-// The number of array elements is allocated base on parsing
-// EFI_MEMORY_SIZE and the memory is never freed.
-//
-UINTN gSystemMemoryCount = 0;
-UNIX_SYSTEM_MEMORY *gSystemMemory;
-
-
-
-UINTN mImageContextModHandleArraySize = 0;
-IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
-
-
-VOID
-EFIAPI
-SecSwitchStack (
- UINT32 TemporaryMemoryBase,
- UINT32 PermenentMemoryBase
- );
-
-EFI_PHYSICAL_ADDRESS *
-MapMemory (
- INTN fd,
- UINT64 length,
- INTN prot,
- INTN flags);
-
-EFI_STATUS
-MapFile (
- IN CHAR8 *FileName,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffRelocateImage (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-
-int
-main (
- IN int Argc,
- IN char **Argv,
- IN char **Envp
- )
-/*++
-
-Routine Description:
- Main entry point to SEC for Unix. This is a unix program
-
-Arguments:
- Argc - Number of command line arguments
- Argv - Array of command line argument strings
- Envp - Array of environmemt variable strings
-
-Returns:
- 0 - Normal exit
- 1 - Abnormal exit
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS InitialStackMemory;
- UINT64 InitialStackMemorySize;
- UINTN Index;
- UINTN Index1;
- UINTN Index2;
- UINTN PeiIndex;
- CHAR8 *FileName;
- BOOLEAN Done;
- VOID *PeiCoreFile;
- CHAR16 *MemorySizeStr;
- CHAR16 *FirmwareVolumesStr;
- UINTN *StackPointer;
-
- setbuf(stdout, 0);
- setbuf(stderr, 0);
-
- MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdUnixMemorySizeForSecMain);
- FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdUnixFirmwareVolume);
-
- printf ("\nEDK SEC Main UNIX Emulation Environment from edk2.sourceforge.net\n");
-
-#ifdef __APPLE__
- //
- // We can't use dlopen on OS X, so we need a scheme to get symboles into gdb
- // We need to create a temp file that contains gdb commands so we can load
- // symbols when we load every PE/COFF image.
- //
- Index = strlen (*Argv);
- gGdbWorkingFileName = malloc (Index + strlen(".gdb") + 1);
- strcpy (gGdbWorkingFileName, *Argv);
- strcat (gGdbWorkingFileName, ".gdb");
-#endif
-
-
- //
- // Allocate space for gSystemMemory Array
- //
- gSystemMemoryCount = CountSeperatorsInString (MemorySizeStr, '!') + 1;
- gSystemMemory = calloc (gSystemMemoryCount, sizeof (UNIX_SYSTEM_MEMORY));
- if (gSystemMemory == NULL) {
- printf ("ERROR : Can not allocate memory for system. Exiting.\n");
- exit (1);
- }
- //
- // Allocate space for gSystemMemory Array
- //
- gFdInfoCount = CountSeperatorsInString (FirmwareVolumesStr, '!') + 1;
- gFdInfo = calloc (gFdInfoCount, sizeof (UNIX_FD_INFO));
- if (gFdInfo == NULL) {
- printf ("ERROR : Can not allocate memory for fd info. Exiting.\n");
- exit (1);
- }
- //
- // Setup Boot Mode. If BootModeStr == "" then BootMode = 0 (BOOT_WITH_FULL_CONFIGURATION)
- //
- printf (" BootMode 0x%02x\n", (unsigned int)PcdGet32 (PcdUnixBootMode));
-
- //
- // Open up a 128K file to emulate temp memory for PEI.
- // on a real platform this would be SRAM, or using the cache as RAM.
- // Set InitialStackMemory to zero so UnixOpenFile will allocate a new mapping
- //
- InitialStackMemorySize = STACK_SIZE;
- InitialStackMemory = (UINTN)MapMemory(0,
- (UINT32) InitialStackMemorySize,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_ANONYMOUS | MAP_PRIVATE);
- if (InitialStackMemory == 0) {
- printf ("ERROR : Can not open SecStack Exiting\n");
- exit (1);
- }
-
- printf (" SEC passing in %u KB of temp RAM at 0x%08lx to PEI\n",
- (unsigned int)(InitialStackMemorySize / 1024),
- (unsigned long)InitialStackMemory);
-
- for (StackPointer = (UINTN*) (UINTN) InitialStackMemory;
- StackPointer < (UINTN*)(UINTN)((UINTN) InitialStackMemory + (UINT64) InitialStackMemorySize);
- StackPointer ++) {
- *StackPointer = 0x5AA55AA5;
- }
-
- //
- // Open All the firmware volumes and remember the info in the gFdInfo global
- //
- FileName = (CHAR8 *)malloc (StrLen (FirmwareVolumesStr) + 1);
- if (FileName == NULL) {
- printf ("ERROR : Can not allocate memory for firmware volume string\n");
- exit (1);
- }
-
- Index2 = 0;
- for (Done = FALSE, Index = 0, PeiIndex = 0, PeiCoreFile = NULL;
- FirmwareVolumesStr[Index2] != 0;
- Index++) {
- for (Index1 = 0; (FirmwareVolumesStr[Index2] != '!') && (FirmwareVolumesStr[Index2] != 0); Index2++)
- FileName[Index1++] = FirmwareVolumesStr[Index2];
- if (FirmwareVolumesStr[Index2] == '!')
- Index2++;
- FileName[Index1] = '\0';
-
- //
- // Open the FD and remmeber where it got mapped into our processes address space
- //
- Status = MapFile (
- FileName,
- &gFdInfo[Index].Address,
- &gFdInfo[Index].Size
- );
- if (EFI_ERROR (Status)) {
- printf ("ERROR : Can not open Firmware Device File %s (%x). Exiting.\n", FileName, (unsigned int)Status);
- exit (1);
- }
-
- printf (" FD loaded from %s at 0x%08lx",
- FileName, (unsigned long)gFdInfo[Index].Address);
-
- if (PeiCoreFile == NULL) {
- //
- // Assume the beginning of the FD is an FV and look for the PEI Core.
- // Load the first one we find.
- //
- Status = SecFfsFindPeiCore ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) gFdInfo[Index].Address, &PeiCoreFile);
- if (!EFI_ERROR (Status)) {
- PeiIndex = Index;
- printf (" contains SEC Core");
- }
- }
-
- printf ("\n");
- }
- //
- // Calculate memory regions and store the information in the gSystemMemory
- // global for later use. The autosizing code will use this data to
- // map this memory into the SEC process memory space.
- //
- Index1 = 0;
- Index = 0;
- while (1) {
- UINTN val = 0;
- //
- // Save the size of the memory.
- //
- while (MemorySizeStr[Index1] >= '0' && MemorySizeStr[Index1] <= '9') {
- val = val * 10 + MemorySizeStr[Index1] - '0';
- Index1++;
- }
- gSystemMemory[Index++].Size = val * 0x100000;
- if (MemorySizeStr[Index1] == 0)
- break;
- Index1++;
- }
-
- printf ("\n");
-
- //
- // Hand off to PEI Core
- //
- SecLoadFromCore ((UINTN) InitialStackMemory, (UINTN) InitialStackMemorySize, (UINTN) gFdInfo[0].Address, PeiCoreFile);
-
- //
- // If we get here, then the PEI Core returned. This is an error as PEI should
- // always hand off to DXE.
- //
- printf ("ERROR : PEI Core returned\n");
- exit (1);
-}
-
-EFI_PHYSICAL_ADDRESS *
-MapMemory (
- INTN fd,
- UINT64 length,
- INTN prot,
- INTN flags)
-{
- STATIC UINTN base = 0x40000000;
- CONST UINTN align = (1 << 24);
- VOID *res = NULL;
- BOOLEAN isAligned = 0;
-
- //
- // Try to get an aligned block somewhere in the address space of this
- // process.
- //
- while((!isAligned) && (base != 0)) {
- res = mmap ((void *)base, length, prot, flags, fd, 0);
- if (res == MAP_FAILED) {
- return NULL;
- }
- if ((((UINTN)res) & ~(align-1)) == (UINTN)res) {
- isAligned=1;
- }
- else {
- munmap(res, length);
- base += align;
- }
- }
- return res;
-}
-
-EFI_STATUS
-MapFile (
- IN CHAR8 *FileName,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- )
-/*++
-
-Routine Description:
- Opens and memory maps a file using Unix services. If BaseAddress is non zero
- the process will try and allocate the memory starting at BaseAddress.
-
-Arguments:
- FileName - The name of the file to open and map
- MapSize - The amount of the file to map in bytes
- CreationDisposition - The flags to pass to CreateFile(). Use to create new files for
- memory emulation, and exiting files for firmware volume emulation
- BaseAddress - The base address of the mapped file in the user address space.
- If passed in as NULL the a new memory region is used.
- If passed in as non NULL the request memory region is used for
- the mapping of the file into the process space.
- Length - The size of the mapped region in bytes
-
-Returns:
- EFI_SUCCESS - The file was opened and mapped.
- EFI_NOT_FOUND - FileName was not found in the current directory
- EFI_DEVICE_ERROR - An error occured attempting to map the opened file
-
---*/
-{
- int fd;
- VOID *res;
- UINTN FileSize;
-
- fd = open (FileName, O_RDONLY);
- if (fd < 0)
- return EFI_NOT_FOUND;
- FileSize = lseek (fd, 0, SEEK_END);
-
-#if 0
- if (IsMain)
- {
- /* Read entry address. */
- lseek (fd, FileSize - 0x20, SEEK_SET);
- if (read (fd, &EntryAddress, 4) != 4)
- {
- close (fd);
- return EFI_DEVICE_ERROR;
- }
- }
-#endif
-
- res = MapMemory(fd, FileSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
-
- close (fd);
-
- if (res == MAP_FAILED)
- return EFI_DEVICE_ERROR;
-
- *Length = (UINT64) FileSize;
- *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res;
-
- return EFI_SUCCESS;
-}
-
-#define BYTES_PER_RECORD 512
-
-EFI_STATUS
-EFIAPI
-SecPeiReportStatusCode (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This routine produces the ReportStatusCode PEI service. It's passed
- up to the PEI Core via a PPI. T
-
- This code currently uses the UNIX clib printf. This does not work the same way
- as the EFI Print (), as %t, %g, %s as Unicode are not supported.
-
-Arguments:
- (see EFI_PEI_REPORT_STATUS_CODE)
-
-Returns:
- EFI_SUCCESS - Always return success
-
---*/
-// TODO: PeiServices - add argument and description to function comment
-// TODO: CodeType - add argument and description to function comment
-// TODO: Value - add argument and description to function comment
-// TODO: Instance - add argument and description to function comment
-// TODO: CallerId - add argument and description to function comment
-// TODO: Data - add argument and description to function comment
-{
- CHAR8 *Format;
- BASE_LIST Marker;
- CHAR8 PrintBuffer[BYTES_PER_RECORD * 2];
- CHAR8 *Filename;
- CHAR8 *Description;
- UINT32 LineNumber;
- UINT32 ErrorLevel;
-
-
- if (Data == NULL) {
- } else if (ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Processes ASSERT ()
- //
- printf ("ASSERT %s(%d): %s\n", Filename, (int)LineNumber, Description);
-
- } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Process DEBUG () macro
- //
- AsciiBSPrint (PrintBuffer, BYTES_PER_RECORD, Format, Marker);
- printf ("%s", PrintBuffer);
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *Context3, OPTIONAL
- IN VOID *NewStack
- );
-
-VOID
-SecLoadFromCore (
- IN UINTN LargestRegion,
- IN UINTN LargestRegionSize,
- IN UINTN BootFirmwareVolumeBase,
- IN VOID *PeiCorePe32File
- )
-/*++
-
-Routine Description:
- This is the service to load the PEI Core from the Firmware Volume
-
-Arguments:
- LargestRegion - Memory to use for PEI.
- LargestRegionSize - Size of Memory to use for PEI
- BootFirmwareVolumeBase - Start of the Boot FV
- PeiCorePe32File - PEI Core PE32
-
-Returns:
- Success means control is transfered and thus we should never return
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS TopOfMemory;
- VOID *TopOfStack;
- UINT64 PeiCoreSize;
- EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;
- EFI_PHYSICAL_ADDRESS PeiImageAddress;
- EFI_SEC_PEI_HAND_OFF *SecCoreData;
- UINTN PeiStackSize;
- EFI_PEI_PPI_DESCRIPTOR *DispatchTable;
- UINTN DispatchTableSize;
-
- //
- // Compute Top Of Memory for Stack and PEI Core Allocations
- //
- TopOfMemory = LargestRegion + LargestRegionSize;
- PeiStackSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);
-
- //
- // |-----------| <---- TemporaryRamBase + TemporaryRamSize
- // | Heap |
- // | |
- // |-----------| <---- StackBase / PeiTemporaryMemoryBase
- // | |
- // | Stack |
- // |-----------| <---- TemporaryRamBase
- //
- TopOfStack = (VOID *)(LargestRegion + PeiStackSize);
- TopOfMemory = LargestRegion + PeiStackSize;
-
- //
- // Reservet space for storing PeiCore's parament in stack.
- //
- TopOfStack = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
- TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
-
- //
- // Bind this information into the SEC hand-off state
- //
- SecCoreData = (EFI_SEC_PEI_HAND_OFF*)(UINTN) TopOfStack;
- SecCoreData->DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
- SecCoreData->BootFirmwareVolumeBase = (VOID*)BootFirmwareVolumeBase;
- SecCoreData->BootFirmwareVolumeSize = PcdGet32 (PcdUnixFirmwareFdSize);
- SecCoreData->TemporaryRamBase = (VOID*)(UINTN)LargestRegion;
- SecCoreData->TemporaryRamSize = STACK_SIZE;
- SecCoreData->StackBase = SecCoreData->TemporaryRamBase;
- SecCoreData->StackSize = PeiStackSize;
- SecCoreData->PeiTemporaryRamBase = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);
- SecCoreData->PeiTemporaryRamSize = STACK_SIZE - PeiStackSize;
-
- //
- // Load the PEI Core from a Firmware Volume
- //
- Status = SecUnixPeiLoadFile (
- PeiCorePe32File,
- &PeiImageAddress,
- &PeiCoreSize,
- &PeiCoreEntryPoint
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- DispatchTableSize = sizeof (gPrivateDispatchTable);
- DispatchTableSize += OverrideDispatchTableExtraSize ();
-
- DispatchTable = malloc (DispatchTableSize);
- if (DispatchTable == NULL) {
- return;
- }
-
- //
- // Allow an override for extra PPIs to be passed up to PEI
- // This is an easy way to enable OS specific customizations
- //
- OverrideDispatchTable (&gPrivateDispatchTable[0], sizeof (gPrivateDispatchTable), DispatchTable, DispatchTableSize);
-
- //
- // Transfer control to the PEI Core
- //
- PeiSwitchStacks (
- (SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
- SecCoreData,
- (VOID *)DispatchTable,
- NULL,
- TopOfStack
- );
- //
- // If we get here, then the PEI Core returned. This is an error
- //
- return ;
-}
-
-EFI_STATUS
-EFIAPI
-SecUnixPeiAutoScan (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- )
-/*++
-
-Routine Description:
- This service is called from Index == 0 until it returns EFI_UNSUPPORTED.
- It allows discontiguous memory regions to be supported by the emulator.
- It uses gSystemMemory[] and gSystemMemoryCount that were created by
- parsing the host environment variable EFI_MEMORY_SIZE.
- The size comes from the varaible and the address comes from the call to
- UnixOpenFile.
-
-Arguments:
- Index - Which memory region to use
- MemoryBase - Return Base address of memory region
- MemorySize - Return size in bytes of the memory region
-
-Returns:
- EFI_SUCCESS - If memory region was mapped
- EFI_UNSUPPORTED - If Index is not supported
-
---*/
-{
- void *res;
-
- if (Index >= gSystemMemoryCount) {
- return EFI_UNSUPPORTED;
- }
-
- *MemoryBase = 0;
- res = MapMemory(0, gSystemMemory[Index].Size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS);
- if (res == MAP_FAILED)
- return EFI_DEVICE_ERROR;
- *MemorySize = gSystemMemory[Index].Size;
- *MemoryBase = (UINTN)res;
- gSystemMemory[Index].Memory = *MemoryBase;
-
- return EFI_SUCCESS;
-}
-
-VOID *
-EFIAPI
-SecUnixUnixThunkAddress (
- VOID
- )
-/*++
-
-Routine Description:
- Since the SEC is the only Unix program in stack it must export
- an interface to do POSIX calls. gUnix is initailized in UnixThunk.c.
-
-Arguments:
- InterfaceSize - sizeof (EFI_WIN_NT_THUNK_PROTOCOL);
- InterfaceBase - Address of the gUnix global
-
-Returns:
- EFI_SUCCESS - Data returned
-
---*/
-{
- return gUnix;
-}
-
-
-EFI_STATUS
-SecUnixPeiLoadFile (
- IN VOID *Pe32Data,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-/*++
-
-Routine Description:
- Loads and relocates a PE/COFF image into memory.
-
-Arguments:
- Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
- ImageAddress - The base address of the relocated PE/COFF image
- ImageSize - The size of the relocated PE/COFF image
- EntryPoint - The entry point of the relocated PE/COFF image
-
-Returns:
- EFI_SUCCESS - The file was loaded and relocated
- EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
-
---*/
-{
- EFI_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = Pe32Data;
-
- ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) SecImageRead;
-
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
-
- //
- // Allocate space in UNIX (not emulator) memory. Extra space is for alignment
- //
- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) MapMemory (
- 0,
- (UINT32) (ImageContext.ImageSize + (ImageContext.SectionAlignment * 2)),
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_ANONYMOUS | MAP_PRIVATE
- );
- if (ImageContext.ImageAddress == 0) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Align buffer on section boundry
- //
- ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
- ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));
-
-
- Status = PeCoffLoaderLoadImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
-
- SecPeCoffRelocateImageExtraAction (&ImageContext);
-
- //
- // BugBug: Flush Instruction Cache Here when CPU Lib is ready
- //
-
- *ImageAddress = ImageContext.ImageAddress;
- *ImageSize = ImageContext.ImageSize;
- *EntryPoint = ImageContext.EntryPoint;
-
- return EFI_SUCCESS;
-}
-
-
-RETURN_STATUS
-EFIAPI
-SecPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS ImageAddress;
- UINT64 ImageSize;
- EFI_PHYSICAL_ADDRESS PhysEntryPoint;
-
- Status = SecUnixPeiLoadFile (Pe32Data, &ImageAddress, &ImageSize, &PhysEntryPoint);
-
- *EntryPoint = (VOID *)(UINTN)PhysEntryPoint;
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-SecUnixFdAddress (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- )
-/*++
-
-Routine Description:
- Return the FD Size and base address. Since the FD is loaded from a
- file into host memory only the SEC will know it's address.
-
-Arguments:
- Index - Which FD, starts at zero.
- FdSize - Size of the FD in bytes
- FdBase - Start address of the FD. Assume it points to an FV Header
- FixUp - Difference between actual FD address and build address
-
-Returns:
- EFI_SUCCESS - Return the Base address and size of the FV
- EFI_UNSUPPORTED - Index does nto map to an FD in the system
-
---*/
-{
- if (Index >= gFdInfoCount) {
- return EFI_UNSUPPORTED;
- }
-
- *FdBase = gFdInfo[Index].Address;
- *FdSize = gFdInfo[Index].Size;
- *FixUp = 0;
-
- if (*FdBase == 0 && *FdSize == 0) {
- return EFI_UNSUPPORTED;
- }
-
- if (Index == 0) {
- //
- // FD 0 has XIP code and well known PCD values
- // If the memory buffer could not be allocated at the FD build address
- // the Fixup is the difference.
- //
- *FixUp = *FdBase - PcdGet64 (PcdUnixFdBaseAddress);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-SecImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
- Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
-
-Arguments:
- FileHandle - The handle to the PE/COFF file
- FileOffset - The offset, in bytes, into the file to read
- ReadSize - The number of bytes to read from the file starting at FileOffset
- Buffer - A pointer to the buffer to read the data into.
-
-Returns:
- EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
-
---*/
-{
- CHAR8 *Destination8;
- CHAR8 *Source8;
- UINTN Length;
-
- Destination8 = Buffer;
- Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
- Length = *ReadSize;
- while (Length--) {
- *(Destination8++) = *(Source8++);
- }
-
- return EFI_SUCCESS;
-}
-
-UINTN
-CountSeperatorsInString (
- IN const CHAR16 *String,
- IN CHAR16 Seperator
- )
-/*++
-
-Routine Description:
- Count the number of seperators in String
-
-Arguments:
- String - String to process
- Seperator - Item to count
-
-Returns:
- Number of Seperator in String
-
---*/
-{
- UINTN Count;
-
- for (Count = 0; *String != '\0'; String++) {
- if (*String == Seperator) {
- Count++;
- }
- }
-
- return Count;
-}
-
-
-EFI_STATUS
-AddHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN VOID *ModHandle
- )
-/*++
-
-Routine Description:
- Store the ModHandle in an array indexed by the Pdb File name.
- The ModHandle is needed to unload the image.
-
-Arguments:
- ImageContext - Input data returned from PE Laoder Library. Used to find the
- .PDB file name of the PE Image.
- ModHandle - Returned from LoadLibraryEx() and stored for call to
- FreeLibrary().
-
-Returns:
- EFI_SUCCESS - ModHandle was stored.
-
---*/
-{
- UINTN Index;
- IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
- UINTN PreviousSize;
-
-
- Array = mImageContextModHandleArray;
- for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
- if (Array->ImageContext == NULL) {
- //
- // Make a copy of the stirng and store the ModHandle
- //
- Array->ImageContext = ImageContext;
- Array->ModHandle = ModHandle;
- return EFI_SUCCESS;
- }
- }
-
- //
- // No free space in mImageContextModHandleArray so grow it by
- // IMAGE_CONTEXT_TO_MOD_HANDLE entires. realloc will
- // copy the old values to the new locaiton. But it does
- // not zero the new memory area.
- //
- PreviousSize = mImageContextModHandleArraySize * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE);
- mImageContextModHandleArraySize += MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE;
-
- mImageContextModHandleArray = realloc (mImageContextModHandleArray, mImageContextModHandleArraySize * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE));
- if (mImageContextModHandleArray == NULL) {
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (mImageContextModHandleArray + PreviousSize, 0, MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE));
-
- return AddHandle (ImageContext, ModHandle);
-}
-
-
-VOID *
-RemoveHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-/*++
-
-Routine Description:
- Return the ModHandle and delete the entry in the array.
-
-Arguments:
- ImageContext - Input data returned from PE Laoder Library. Used to find the
- .PDB file name of the PE Image.
-
-Returns:
- ModHandle - ModHandle assoicated with ImageContext is returned
- NULL - No ModHandle associated with ImageContext
-
---*/
-{
- UINTN Index;
- IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
-
- if (ImageContext->PdbPointer == NULL) {
- //
- // If no PDB pointer there is no ModHandle so return NULL
- //
- return NULL;
- }
-
- Array = mImageContextModHandleArray;
- for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
- if (Array->ImageContext == ImageContext) {
- //
- // If you find a match return it and delete the entry
- //
- Array->ImageContext = NULL;
- return Array->ModHandle;
- }
- }
-
- return NULL;
-}
-
-
-
-//
-// Target for gdb breakpoint in a script that uses gGdbWorkingFileName to source a
-// add-symbol-file command. Hey what can you say scripting in gdb is not that great....
-//
-// Put .gdbinit in the CWD where you do gdb SecMain.dll for source level debug
-//
-// cat .gdbinit
-// b SecGdbScriptBreak
-// command
-// silent
-// source SecMain.dll.gdb
-// c
-// end
-//
-VOID
-SecGdbScriptBreak (
- VOID
- )
-{
-}
-
-VOID
-SecUnixLoaderBreak (
- VOID
- )
-{
-}
-
-BOOLEAN
-IsPdbFile (
- IN CHAR8 *PdbFileName
- )
-{
- UINTN Len;
-
- if (PdbFileName == NULL) {
- return FALSE;
- }
-
- Len = strlen (PdbFileName);
- if ((Len < 5)|| (PdbFileName[Len - 4] != '.')) {
- return FALSE;
- }
-
- if ((PdbFileName[Len - 3] == 'D' || PdbFileName[Len - 3] == 'd') &&
- (PdbFileName[Len - 2] == 'L' || PdbFileName[Len - 2] == 'l') &&
- (PdbFileName[Len - 1] == 'L' || PdbFileName[Len - 1] == 'l')) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-#define MAX_SPRINT_BUFFER_SIZE 0x200
-
-void
-PrintLoadAddress (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- if (ImageContext->PdbPointer == NULL) {
- fprintf (stderr,
- "0x%08lx Loading NO DEBUG with entry point 0x%08lx\n",
- (unsigned long)(ImageContext->ImageAddress),
- (unsigned long)ImageContext->EntryPoint
- );
- } else {
- fprintf (stderr,
- "0x%08lx Loading %s with entry point 0x%08lx\n",
- (unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders),
- ImageContext->PdbPointer,
- (unsigned long)ImageContext->EntryPoint
- );
- }
- // Keep output synced up
- fflush (stderr);
-}
-
-
-VOID
-EFIAPI
-SecPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
-
-#ifdef __APPLE__
- BOOLEAN EnabledOnEntry;
-
- //
- // Make sure writting of the file is an atomic operation
- //
- if (UnixInterruptEanbled ()) {
- UnixDisableInterrupt ();
- EnabledOnEntry = TRUE;
- } else {
- EnabledOnEntry = FALSE;
- }
-
- PrintLoadAddress (ImageContext);
-
- //
- // In mach-o (OS X executable) dlopen() can only load files in the MH_DYLIB of MH_BUNDLE format.
- // To convert to PE/COFF we need to construct a mach-o with the MH_PRELOAD format. We create
- // .dSYM files for the PE/COFF images that can be used by gdb for source level debugging.
- //
- FILE *GdbTempFile;
-
- //
- // In the Mach-O to PE/COFF conversion the size of the PE/COFF headers is not accounted for.
- // Thus we need to skip over the PE/COFF header when giving load addresses for our symbol table.
- //
- if (ImageContext->PdbPointer != NULL && !IsPdbFile (ImageContext->PdbPointer)) {
- //
- // Now we have a database of the images that are currently loaded
- //
-
- //
- // 'symbol-file' will clear out currnet symbol mappings in gdb.
- // you can do a 'add-symbol-file filename address' for every image we loaded to get source
- // level debug in gdb. Note Sec, being a true application will work differently.
- //
- // We add the PE/COFF header size into the image as the mach-O does not have a header in
- // loaded into system memory.
- //
- // This gives us a data base of gdb commands and after something is unloaded that entry will be
- // removed. We don't yet have the scheme of how to comunicate with gdb, but we have the
- // data base of info ready to roll.
- //
- // We could use qXfer:libraries:read, but OS X GDB does not currently support it.
- // <library-list>
- // <library name="/lib/libc.so.6"> // ImageContext->PdbPointer
- // <segment address="0x10000000"/> // ImageContext->ImageAddress + ImageContext->SizeOfHeaders
- // </library>
- // </library-list>
- //
-
- //
- // Write the file we need for the gdb script
- //
- GdbTempFile = fopen (gGdbWorkingFileName, "w");
- if (GdbTempFile != NULL) {
- fprintf (GdbTempFile, "add-symbol-file %s 0x%08lx\n", ImageContext->PdbPointer, (long unsigned int)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));
- fclose (GdbTempFile);
-
- //
- // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint.
- // Hey what can you say scripting in gdb is not that great....
- //
- SecGdbScriptBreak ();
- } else {
- ASSERT (FALSE);
- }
-
- AddHandle (ImageContext, ImageContext->PdbPointer);
-
- if (EnabledOnEntry) {
- UnixEnableInterrupt ();
- }
-
-
- }
-
-#else
-
- void *Handle = NULL;
- void *Entry = NULL;
-
- if (ImageContext->PdbPointer == NULL) {
- return;
- }
-
- if (!IsPdbFile (ImageContext->PdbPointer)) {
- return;
- }
-
- fprintf (stderr,
- "Loading %s 0x%08lx - entry point 0x%08lx\n",
- ImageContext->PdbPointer,
- (unsigned long)ImageContext->ImageAddress,
- (unsigned long)ImageContext->EntryPoint);
-
- Handle = dlopen (ImageContext->PdbPointer, RTLD_NOW);
-
- if (Handle) {
- Entry = dlsym (Handle, "_ModuleEntryPoint");
- } else {
- printf("%s\n", dlerror());
- }
-
- if (Entry != NULL) {
- ImageContext->EntryPoint = (UINTN)Entry;
- printf("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, (unsigned long)Entry);
- }
-
- SecUnixLoaderBreak ();
-
-#endif
-
- return;
-}
-
-
-VOID
-EFIAPI
-SecPeCoffLoaderUnloadImageExtraAction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- VOID *Handle;
-
- Handle = RemoveHandle (ImageContext);
-
-#ifdef __APPLE__
- FILE *GdbTempFile;
- BOOLEAN EnabledOnEntry;
-
- if (Handle != NULL) {
- //
- // Need to skip .PDB files created from VC++
- //
- if (!IsPdbFile (ImageContext->PdbPointer)) {
- if (UnixInterruptEanbled ()) {
- UnixDisableInterrupt ();
- EnabledOnEntry = TRUE;
- } else {
- EnabledOnEntry = FALSE;
- }
-
- //
- // Write the file we need for the gdb script
- //
- GdbTempFile = fopen (gGdbWorkingFileName, "w");
- if (GdbTempFile != NULL) {
- fprintf (GdbTempFile, "remove-symbol-file %s\n", ImageContext->PdbPointer);
- fclose (GdbTempFile);
-
- //
- // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint.
- // Hey what can you say scripting in gdb is not that great....
- //
- SecGdbScriptBreak ();
- } else {
- ASSERT (FALSE);
- }
-
- if (EnabledOnEntry) {
- UnixEnableInterrupt ();
- }
- }
- }
-
-#else
- //
- // Don't want to confuse gdb with symbols for something that got unloaded
- //
- if (Handle != NULL) {
- dlclose (Handle);
- }
-
-#endif
- return;
-}
-
-VOID
-ModuleEntryPoint (
- VOID
- )
-{
-}
-
-EFI_STATUS
-EFIAPI
-SecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- )
-{
- //
- // Migrate the whole temporary memory to permenent memory.
- //
- CopyMem (
- (VOID*)(UINTN)PermanentMemoryBase,
- (VOID*)(UINTN)TemporaryMemoryBase,
- CopySize
- );
-
- //
- // SecSwitchStack function must be invoked after the memory migration
- // immediatly, also we need fixup the stack change caused by new call into
- // permenent memory.
- //
- SecSwitchStack (
- (UINT32) TemporaryMemoryBase,
- (UINT32) PermanentMemoryBase
- );
-
- //
- // We need *not* fix the return address because currently,
- // The PeiCore is excuted in flash.
- //
-
- //
- // Simulate to invalid temporary memory, terminate temporary memory
- //
- //ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/Sec/SecMain.h b/UnixPkg/Sec/SecMain.h
deleted file mode 100644
index dc857d8fb0..0000000000
--- a/UnixPkg/Sec/SecMain.h
+++ /dev/null
@@ -1,601 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name:
- SecMain.h
-
-Abstract:
- Include file for host API based SEC
-
---*/
-#include <PiPei.h>
-
-#include <Protocol/UnixThunk.h>
-#include <Ppi/StatusCode.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/SecDispatchTableLib.h>
-
-
-#define STACK_SIZE 0x20000
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Address;
- UINT64 Size;
-} UNIX_FD_INFO;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Memory;
- UINT64 Size;
-} UNIX_SYSTEM_MEMORY;
-
-
-#define MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE 0x100
-
-typedef struct {
- PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext;
- VOID *ModHandle;
-} IMAGE_CONTEXT_TO_MOD_HANDLE;
-
-
-EFI_STATUS
-EFIAPI
-SecUnixPeiLoadFile (
- VOID *Pe32Data, // TODO: add IN/OUT modifier to Pe32Data
- EFI_PHYSICAL_ADDRESS *ImageAddress, // TODO: add IN/OUT modifier to ImageAddress
- UINT64 *ImageSize, // TODO: add IN/OUT modifier to ImageSize
- EFI_PHYSICAL_ADDRESS *EntryPoint // TODO: add IN/OUT modifier to EntryPoint
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixPeiLoadFile (
- VOID *Pe32Data, // TODO: add IN/OUT modifier to Pe32Data
- EFI_PHYSICAL_ADDRESS *ImageAddress, // TODO: add IN/OUT modifier to ImageAddress
- UINT64 *ImageSize, // TODO: add IN/OUT modifier to ImageSize
- EFI_PHYSICAL_ADDRESS *EntryPoint // TODO: add IN/OUT modifier to EntryPoint
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Pe32Data - TODO: add argument description
- ImageAddress - TODO: add argument description
- ImageSize - TODO: add argument description
- EntryPoint - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecUnixPeiAutoScan (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixPeiAutoScan (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Index - TODO: add argument description
- MemoryBase - TODO: add argument description
- MemorySize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID *
-EFIAPI
-SecUnixUnixThunkAddress (
- VOID
- );
-
-VOID *
-EFIAPI
-GasketSecUnixUnixThunkAddress (
- VOID
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- InterfaceSize - TODO: add argument description
- InterfaceBase - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecUnixUnixFwhAddress (
- IN OUT UINT64 *FwhSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixUnixFwhAddress (
- IN OUT UINT64 *FwhSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FwhSize - TODO: add argument description
- FwhBase - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecPeiReportStatusCode (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecPeiReportStatusCode (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PeiServices - TODO: add argument description
- CodeType - TODO: add argument description
- Value - TODO: add argument description
- Instance - TODO: add argument description
- CallerId - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-int
-main (
- IN int Argc,
- IN char **Argv,
- IN char **Envp
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Argc - TODO: add argument description
- Argv - TODO: add argument description
- Envp - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-SecLoadFromCore (
- IN UINTN LargestRegion,
- IN UINTN LargestRegionSize,
- IN UINTN BootFirmwareVolumeBase,
- IN VOID *PeiCoreFile
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- LargestRegion - TODO: add argument description
- LargestRegionSize - TODO: add argument description
- BootFirmwareVolumeBase - TODO: add argument description
- PeiCoreFile - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SecLoadFile (
- IN VOID *Pe32Data,
- IN EFI_PHYSICAL_ADDRESS *ImageAddress,
- IN UINT64 *ImageSize,
- IN EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Pe32Data - TODO: add argument description
- ImageAddress - TODO: add argument description
- ImageSize - TODO: add argument description
- EntryPoint - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SecFfsFindPeiCore (
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- OUT VOID **Pe32Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FwVolHeader - TODO: add argument description
- Pe32Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SecFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SearchType - TODO: add argument description
- FwVolHeader - TODO: add argument description
- FileHeader - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SecFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SectionType - TODO: add argument description
- FfsFileHeader - TODO: add argument description
- SectionData - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderLoadAsDll (
- IN CHAR8 *PdbFileName,
- IN VOID **ImageEntryPoint,
- OUT VOID **ModHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PdbFileName - TODO: add argument description
- ImageEntryPoint - TODO: add argument description
- ModHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderFreeLibrary (
- OUT VOID *ModHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ModHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecUnixFdAddress (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- )
-;
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixFdAddress (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- )
-;
-
-
-EFI_STATUS
-GetImageReadFunction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN EFI_PHYSICAL_ADDRESS *TopOfMemory
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageContext - TODO: add argument description
- TopOfMemory - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FileHandle - TODO: add argument description
- FileOffset - TODO: add argument description
- ReadSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-CHAR16 *
-AsciiToUnicode (
- IN CHAR8 *Ascii,
- IN UINTN *StrLen OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Ascii - TODO: add argument description
- StrLen - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINTN
-CountSeperatorsInString (
- IN const CHAR16 *String,
- IN CHAR16 Seperator
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- String - TODO: add argument description
- Seperator - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-SecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-
-
-RETURN_STATUS
-EFIAPI
-SecPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- );
-
-VOID
-EFIAPI
-SecPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-VOID
-EFIAPI
-SecPeCoffLoaderUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-
-VOID SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
-void msSleep (unsigned long Milliseconds);
-void GetLocalTime (EFI_TIME *Time);
-void TzSet (void);
-long GetTimeZone(void);
-int GetDayLight(void);
-int GetErrno(void);
-void UnixEnableInterrupt (void);
-void UnixDisableInterrupt (void);
-BOOLEAN UnixInterruptEanbled (void);
-
-
-
-extern EFI_UNIX_THUNK_PROTOCOL *gUnix;
diff --git a/UnixPkg/Sec/SecMain.inf b/UnixPkg/Sec/SecMain.inf
deleted file mode 100644
index b418d54617..0000000000
--- a/UnixPkg/Sec/SecMain.inf
+++ /dev/null
@@ -1,106 +0,0 @@
-## @file
-# Entry Point of Unix Emulator
-#
-# Main executable file of Unix Emulator that loads PEI core after initialization finished.
-# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = SecMain
- FILE_GUID = f43be88c-8985-11db-8f78-0040d02b1835
- MODULE_TYPE = USER_DEFINED
- VERSION_STRING = 1.0
- ENTRY_POINT = main
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UgaX11.c
- UnixThunk.c
- FwVol.c
- SecMain.c
-
-[Sources.Ia32]
- Gasket.c
- Ia32/Gasket.S
- Ia32/Stack.S
- Ia32/SwitchStack.c
-
-[Sources.X64]
-# X64/Gasket.S # pure UNIX x86_64 ABI also need to fix issues in BaseLib
- X64/MangleGasket.S # convert between UNIX x86_64 ABI and EFI X64 ABI
-
- X64/SwitchStack.S
- X64/NameManglingFix.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- DebugLib
- PcdLib
- PrintLib
- BaseMemoryLib
- BaseLib
- PeCoffLib
- ReportStatusCodeLib
- SecDispatchTableLib
-
-
-[Ppis]
- gUnixPeiLoadFilePpiGuid # PPI ALWAYS_PRODUCED
- gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED
- gUnixFwhPpiGuid # PPI ALWAYS_PRODUCED
- gPeiUnixAutoScanPpiGuid # PPI ALWAYS_PRODUCED
- gPeiUnixThunkPpiGuid # PPI ALWAYS_PRODUCED
- gEfiTemporaryRamSupportPpiGuid
-
-
-[Pcd]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySizeForSecMain
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress
-
-[BuildOptions]
- GCC:*_*_IA32_DLINK_FLAGS == -o "$(BIN_DIR)/SecMain" -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib/crtn.o
- GCC:*_*_*_DLINK2_FLAGS == -lc
- GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include AutoGen.h
- GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include AutoGen.h
- GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros AutoGen.h
-
- GCC:*_*_X64_DLINK_FLAGS == -o "$(BIN_DIR)/SecMain" -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/crt1.o /usr/lib/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib/crtn.o
- GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include AutoGen.h
- GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include AutoGen.h
- GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros AutoGen.h
-
-#
-# Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version
-#
- XCODE:*_*_IA32_DLINK_PATH == gcc
- XCODE:*_*_IA32_DLINK_FLAGS == -arch i386 -o "$(BIN_DIR)/SecMain" -L/usr/X11R6/lib -lXext -lX11 -framework IOKit -framework Carbon
- XCODE:*_*_IA32_ASM_FLAGS == -arch i386 -g
-
- XCODE:*_*_X64_DLINK_PATH == gcc
- XCODE:*_*_X64_DLINK_FLAGS == -o "$(BIN_DIR)/SecMain" -L/usr/X11R6/lib -lXext -lX11 -lIOKit -framework Carbon
- XCODE:*_*_X64_ASM_FLAGS == -g
diff --git a/UnixPkg/Sec/UgaX11.c b/UnixPkg/Sec/UgaX11.c
deleted file mode 100644
index 74775311e8..0000000000
--- a/UnixPkg/Sec/UgaX11.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE 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/UnixInclude.h>
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#include <PiPei.h>
-#include <Protocol/SimplePointer.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UgaDraw.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xos.h>
-#include <X11/extensions/XShm.h>
-#include <X11/keysym.h>
-#include <X11/cursorfont.h>
-
-#include <Protocol/UnixThunk.h>
-#include <Protocol/UnixUgaIo.h>
-
-#include <Ppi/StatusCode.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-
-#include "Gasket.h"
-#include "SecMain.h"
-
-
-extern void msSleep (unsigned long Milliseconds);
-
-/* XQueryPointer */
-
-struct uga_drv_shift_mask {
- unsigned char shift;
- unsigned char size;
- unsigned char csize;
-};
-
-#define NBR_KEYS 32
-typedef struct {
- EFI_UNIX_UGA_IO_PROTOCOL UgaIo;
-
- Display *display;
- int screen; /* values for window_size in main */
- Window win;
- GC gc;
- Visual *visual;
-
- int depth;
- unsigned int width;
- unsigned int height;
- unsigned int line_bytes;
- unsigned int pixel_shift;
- unsigned char *image_data;
-
- struct uga_drv_shift_mask r, g, b;
-
- int use_shm;
- XShmSegmentInfo xshm_info;
- XImage *image;
-
- unsigned int key_rd;
- unsigned int key_wr;
- unsigned int key_count;
- EFI_KEY_DATA keys[NBR_KEYS];
-
- EFI_KEY_STATE KeyState;
-
- UGA_REGISTER_KEY_NOTIFY_CALLBACK RegisterdKeyCallback;
- VOID *RegisterdKeyCallbackContext;
-
- int previous_x;
- int previous_y;
- EFI_SIMPLE_POINTER_STATE pointer_state;
- int pointer_state_changed;
-} UGA_IO_PRIVATE;
-
-void
-HandleEvents(UGA_IO_PRIVATE *drv);
-
-void
-fill_shift_mask (struct uga_drv_shift_mask *sm, unsigned long mask)
-{
- sm->shift = 0;
- sm->size = 0;
- while ((mask & 1) == 0)
- {
- mask >>= 1;
- sm->shift++;
- }
- while (mask & 1)
- {
- sm->size++;
- mask >>= 1;
- }
- sm->csize = 8 - sm->size;
-}
-
-int
-TryCreateShmImage(UGA_IO_PRIVATE *drv)
-{
- drv->image = XShmCreateImage (drv->display, drv->visual,
- drv->depth, ZPixmap, NULL, &drv->xshm_info,
- drv->width, drv->height);
- if (drv->image == NULL)
- return 0;
-
- switch (drv->image->bitmap_unit) {
- case 32:
- drv->pixel_shift = 2;
- break;
- case 16:
- drv->pixel_shift = 1;
- break;
- case 8:
- drv->pixel_shift = 0;
- break;
- }
-
- drv->xshm_info.shmid = shmget
- (IPC_PRIVATE, drv->image->bytes_per_line * drv->image->height,
- IPC_CREAT | 0777);
- if (drv->xshm_info.shmid < 0) {
- XDestroyImage(drv->image);
- return 0;
- }
-
- drv->image_data = shmat (drv->xshm_info.shmid, NULL, 0);
- if(!drv->image_data) {
- shmctl (drv->xshm_info.shmid, IPC_RMID, NULL);
- XDestroyImage(drv->image);
- return 0;
- }
-
-#ifndef __APPLE__
- //
- // This closes shared memory in real time on OS X. Only closes after folks quit using
- // it on Linux.
- //
- /* Can this fail ? */
- shmctl (drv->xshm_info.shmid, IPC_RMID, NULL);
-#endif
-
- drv->xshm_info.shmaddr = (char*)drv->image_data;
- drv->image->data = (char*)drv->image_data;
-
- if (!XShmAttach (drv->display, &drv->xshm_info)) {
- shmdt (drv->image_data);
- XDestroyImage(drv->image);
- return 0;
- }
- return 1;
-}
-
-EFI_STATUS
-UgaClose (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
-
- if (drv == NULL)
- return EFI_SUCCESS;
- if (drv->image != NULL)
- {
- XDestroyImage(drv->image);
-
- if (drv->use_shm)
- shmdt (drv->image_data);
-
- drv->image_data = NULL;
- drv->image = NULL;
- }
- XDestroyWindow(drv->display, drv->win);
- XCloseDisplay(drv->display);
-
-#ifdef __APPLE__
- // Free up the shared memory
- shmctl (drv->xshm_info.shmid, IPC_RMID, NULL);
-#endif
-
- free(drv);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaSize(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height)
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
- XSizeHints size_hints;
-
- /* Destroy current buffer if created. */
- if (drv->image != NULL)
- {
- /* Before destroy buffer, need to make sure the buffer available for access. */
- XDestroyImage(drv->image);
-
- if (drv->use_shm)
- shmdt (drv->image_data);
-
- drv->image_data = NULL;
- drv->image = NULL;
- }
-
- drv->width = Width;
- drv->height = Height;
- XResizeWindow (drv->display, drv->win, Width, Height);
-
- /* Allocate image. */
- if (XShmQueryExtension(drv->display) && TryCreateShmImage(drv)) {
- drv->use_shm = 1;
- } else {
- drv->use_shm = 0;
- if (drv->depth > 16)
- drv->pixel_shift = 2;
- else if (drv->depth > 8)
- drv->pixel_shift = 1;
- else
- drv->pixel_shift = 0;
-
- drv->image_data = malloc((drv->width * drv->height) << drv->pixel_shift);
- drv->image = XCreateImage (drv->display, drv->visual, drv->depth,
- ZPixmap, 0, (char *)drv->image_data,
- drv->width, drv->height,
- 8 << drv->pixel_shift, 0);
- }
- drv->line_bytes = drv->image->bytes_per_line;
- fill_shift_mask (&drv->r, drv->image->red_mask);
- fill_shift_mask (&drv->g, drv->image->green_mask);
- fill_shift_mask (&drv->b, drv->image->blue_mask);
-
- /* Set WM hints. */
- size_hints.flags = PSize | PMinSize | PMaxSize;
- size_hints.min_width = size_hints.max_width = size_hints.base_width = Width;
- size_hints.min_height = size_hints.max_height = size_hints.base_height = Height;
- XSetWMNormalHints (drv->display, drv->win, &size_hints);
-
- XMapWindow (drv->display, drv->win);
- HandleEvents(drv);
- return EFI_SUCCESS;
-}
-
-void
-handleKeyEvent(UGA_IO_PRIVATE *drv, XEvent *ev)
-{
- KeySym keysym;
- char str[4];
- EFI_KEY_DATA KeyData;
- int res;
-
- if (drv->key_count == NBR_KEYS)
- return;
-
- res = XLookupString(&ev->xkey, str, sizeof(str), &keysym, NULL);
- KeyData.Key.ScanCode = 0;
- KeyData.Key.UnicodeChar = 0;
- KeyData.KeyState.KeyShiftState = 0;
-
- //
- // KeyRelease is not supported (on Mac) so we can not easily implement Ex functions.
- // If a modifier key is hit by its self we get a keysym. If a modfifier and key is hit
- // we get the state bit set and keysym is the modified key.
- //
- // We use lack of state bits being set to clear ToggleState and KeyShiftState. We can
- // also use the stat bits to set ToggleState and KeyShiftState.
- // Skipping EFI_SCROLL_LOCK_ACTIVE & EFI_NUM_LOCK_ACTIVE since they are not on Macs
- //
- if ((ev->xkey.state & LockMask) == 0) {
- drv->KeyState.KeyToggleState &= ~EFI_CAPS_LOCK_ACTIVE;
- } else {
- drv->KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
- }
-
- if ((ev->xkey.state & ControlMask) == 0) {
- drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED);
- } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_CONTROL_PRESSED) == 0) {
- drv->KeyState.KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
- }
-
- if ((ev->xkey.state & ShiftMask) == 0) {
- drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_SHIFT_PRESSED | EFI_LEFT_SHIFT_PRESSED);
- } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_SHIFT_PRESSED) == 0) {
- drv->KeyState.KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
- }
-
- if ((ev->xkey.state & Mod2Mask) == 0) {
- drv->KeyState.KeyShiftState &= ~(EFI_RIGHT_LOGO_PRESSED | EFI_LEFT_LOGO_PRESSED);
- } else if ((drv->KeyState.KeyShiftState & EFI_RIGHT_LOGO_PRESSED) == 0) {
- drv->KeyState.KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
- }
-
- if ((ev->xkey.state & 0x2000) == 0) {
- drv->KeyState.KeyShiftState &= ~(EFI_LEFT_ALT_PRESSED);
- } else {
- drv->KeyState.KeyShiftState |= EFI_LEFT_ALT_PRESSED;
- }
-
-
- switch (keysym) {
- case XK_Control_R:
- drv->KeyState.KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
- break;
- case XK_Control_L:
- drv->KeyState.KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
- break;
-
- case XK_Shift_R:
- drv->KeyState.KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
- break;
- case XK_Shift_L:
- drv->KeyState.KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
- break;
-
- case XK_Mode_switch:
- drv->KeyState.KeyShiftState |= EFI_LEFT_ALT_PRESSED;
- break;
-
- case XK_Meta_R:
- drv->KeyState.KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
- break;
- case XK_Meta_L:
- drv->KeyState.KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
- break;
-
- case XK_Home: KeyData.Key.ScanCode = SCAN_HOME; break;
- case XK_End: KeyData.Key.ScanCode = SCAN_END; break;
- case XK_Left: KeyData.Key.ScanCode = SCAN_LEFT; break;
- case XK_Right: KeyData.Key.ScanCode = SCAN_RIGHT; break;
- case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;
- case XK_Down: KeyData.Key.ScanCode = SCAN_DOWN; break;
- case XK_Delete: KeyData.Key.ScanCode = SCAN_DELETE; break;
- case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;
- case XK_Page_Up: KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
- case XK_Page_Down: KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break;
- case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC; break;
- case XK_Pause: KeyData.Key.ScanCode = SCAN_PAUSE; break;
-
- case XK_F1: KeyData.Key.ScanCode = SCAN_F1; break;
- case XK_F2: KeyData.Key.ScanCode = SCAN_F2; break;
- case XK_F3: KeyData.Key.ScanCode = SCAN_F3; break;
- case XK_F4: KeyData.Key.ScanCode = SCAN_F4; break;
- case XK_F5: KeyData.Key.ScanCode = SCAN_F5; break;
- case XK_F6: KeyData.Key.ScanCode = SCAN_F6; break;
- case XK_F7: KeyData.Key.ScanCode = SCAN_F7; break;
- case XK_F8: KeyData.Key.ScanCode = SCAN_F8; break;
- case XK_F9: KeyData.Key.ScanCode = SCAN_F9; break;
-
- default:
- if (res == 1) {
- KeyData.Key.UnicodeChar = str[0];
- } else {
- return;
- }
- }
-
- // The global state is our state
- KeyData.KeyState.KeyShiftState = drv->KeyState.KeyShiftState;
- KeyData.KeyState.KeyToggleState = drv->KeyState.KeyToggleState;
-
- CopyMem (&drv->keys[drv->key_wr], &KeyData, sizeof (EFI_KEY_DATA));
- drv->key_wr = (drv->key_wr + 1) % NBR_KEYS;
- drv->key_count++;
-
-
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
- ReverseGasketUint64Uint64 (drv->RegisterdKeyCallback ,drv->RegisterdKeyCallbackContext, &KeyData);
-#else
- drv->RegisterdKeyCallback (drv->RegisterdKeyCallbackContext, &KeyData);
-#endif
-
-
-}
-
-
-void
-handleMouseMoved(UGA_IO_PRIVATE *drv, XEvent *ev)
-{
- if ( ev->xmotion.x != drv->previous_x )
- {
- drv->pointer_state.RelativeMovementX += ( ev->xmotion.x - drv->previous_x );
- drv->previous_x = ev->xmotion.x;
- drv->pointer_state_changed = 1;
- }
-
- if ( ev->xmotion.y != drv->previous_y )
- {
- drv->pointer_state.RelativeMovementY += ( ev->xmotion.y - drv->previous_y );
- drv->previous_y = ev->xmotion.y;
- drv->pointer_state_changed = 1;
- }
-
- drv->pointer_state.RelativeMovementZ = 0;
-}
-
-void
-handleMouseDown(UGA_IO_PRIVATE *drv, XEvent *ev, BOOLEAN Pressed)
-{
- if ( ev->xbutton.button == Button1 )
- {
- drv->pointer_state_changed = ( drv->pointer_state.LeftButton != Pressed );
- drv->pointer_state.LeftButton = Pressed;
- }
- if ( ev->xbutton.button == Button2 )
- {
- drv->pointer_state_changed = ( drv->pointer_state.RightButton != Pressed );
- drv->pointer_state.RightButton = Pressed;
- }
-}
-
-void
-Redraw(UGA_IO_PRIVATE *drv, UINTN X, UINTN Y, UINTN Width, UINTN Height)
-{
- if (drv->use_shm)
- XShmPutImage (drv->display, drv->win, drv->gc, drv->image,
- X, Y, X, Y, Width, Height, False);
- else
- XPutImage (drv->display, drv->win, drv->gc, drv->image,
- X, Y, X, Y, Width, Height);
- XFlush(drv->display);
-}
-
-void
-HandleEvent(UGA_IO_PRIVATE *drv, XEvent *ev)
-{
- switch (ev->type)
- {
- case Expose:
- Redraw(drv, ev->xexpose.x, ev->xexpose.y,
- ev->xexpose.width, ev->xexpose.height);
- break;
- case GraphicsExpose:
- Redraw(drv, ev->xgraphicsexpose.x, ev->xgraphicsexpose.y,
- ev->xgraphicsexpose.width, ev->xgraphicsexpose.height);
- break;
- case KeyPress:
- handleKeyEvent(drv, ev);
- break;
- case KeyRelease:
- break;
- case MappingNotify:
- XRefreshKeyboardMapping(&ev->xmapping);
- break;
- case MotionNotify:
- handleMouseMoved(drv, ev);
- break;
- case ButtonPress:
- handleMouseDown(drv, ev, TRUE);
- break;
- case ButtonRelease:
- handleMouseDown(drv, ev, FALSE);
- break;
-#if 0
- case DestroyNotify:
- XCloseDisplay (drv->display);
- exit (1);
- break;
-#endif
- case NoExpose:
- default:
- break;
- }
-}
-
-void
-HandleEvents(UGA_IO_PRIVATE *drv)
-{
- while (XPending(drv->display) != 0)
- {
- XEvent ev;
-
- XNextEvent (drv->display, &ev);
- HandleEvent(drv, &ev);
- }
-}
-
-unsigned long
-UgaPixelToColor (UGA_IO_PRIVATE *drv, EFI_UGA_PIXEL pixel)
-{
- return ((pixel.Red >> drv->r.csize) << drv->r.shift)
- | ((pixel.Green >> drv->g.csize) << drv->g.shift)
- | ((pixel.Blue >> drv->b.csize) << drv->b.shift);
-}
-
-EFI_UGA_PIXEL
-UgaColorToPixel (UGA_IO_PRIVATE *drv, unsigned long val)
-{
- EFI_UGA_PIXEL res;
-
- memset (&res, 0, sizeof (EFI_UGA_PIXEL));
- /* FIXME: should round instead of truncate. */
- res.Red = (val >> drv->r.shift) << drv->r.csize;
- res.Green = (val >> drv->g.shift) << drv->g.csize;
- res.Blue = (val >> drv->b.shift) << drv->b.csize;
-
- return res;
-}
-
-STATIC EFI_STATUS
-CheckKeyInternal( UGA_IO_PRIVATE *drv, BOOLEAN delay )
-{
- HandleEvents(drv);
- if (drv->key_count != 0)
- return EFI_SUCCESS;
- if ( delay )
- /* EFI is polling. Be CPU-friendly. */
- msSleep (20);
- return EFI_NOT_READY;
- }
-
-EFI_STATUS
-UgaCheckKey(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
- return( CheckKeyInternal( drv, TRUE ) );
-}
-
-EFI_STATUS
-EFIAPI
-UgaGetKey (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_KEY_DATA *KeyData
- )
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
- EFI_STATUS status;
-
- status = CheckKeyInternal(drv, FALSE);
- if (status != EFI_SUCCESS)
- return status;
-
- CopyMem (KeyData, &drv->keys[drv->key_rd], sizeof (EFI_KEY_DATA));
- drv->key_rd = (drv->key_rd + 1) % NBR_KEYS;
- drv->key_count--;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UgaKeySetState (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- )
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
-// XKeyEvent event;
-
- if (*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) {
- if ((drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == 0) {
- //
- // We could create an XKeyEvent and send a XK_Caps_Lock to
- // the UGA/GOP Window
- //
- }
- }
-
- drv->KeyState.KeyToggleState = *KeyToggleState;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UgaRegisterKeyNotify (
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN UGA_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- )
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
-
- drv->RegisterdKeyCallback = CallBack;
- drv->RegisterdKeyCallbackContext = Context;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-UgaBlt(
- IN EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UGA_BLT_ARGS *Args
- )
-{
- UGA_IO_PRIVATE *Private = (UGA_IO_PRIVATE *)UgaIo;
- UINTN DstY;
- UINTN SrcY;
- UINTN DstX;
- UINTN SrcX;
- UINTN Index;
- EFI_UGA_PIXEL *Blt;
- UINT8 *Dst;
- UINT8 *Src;
- UINTN Nbr;
- unsigned long Color;
-
- //
- // Check bounds
- //
- if (BltOperation == EfiUgaVideoToBltBuffer
- || BltOperation == EfiUgaVideoToVideo) {
- //
- // Source is Video.
- //
- if (Args->SourceY + Args->Height > Private->height) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Args->SourceX + Args->Width > Private->width) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- if (BltOperation == EfiUgaBltBufferToVideo
- || BltOperation == EfiUgaVideoToVideo
- || BltOperation == EfiUgaVideoFill) {
- //
- // Destination is Video
- //
- if (Args->DestinationY + Args->Height > Private->height) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Args->DestinationX + Args->Width > Private->width) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- switch (BltOperation) {
- case EfiUgaVideoToBltBuffer:
- Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (Args->DestinationY * Args->Delta) + Args->DestinationX * sizeof (EFI_UGA_PIXEL));
- Args->Delta -= Args->Width * sizeof (EFI_UGA_PIXEL);
- for (SrcY = Args->SourceY; SrcY < (Args->Height + Args->SourceY); SrcY++) {
- for (SrcX = Args->SourceX; SrcX < (Args->Width + Args->SourceX); SrcX++) {
- *Blt++ = UgaColorToPixel(Private,
- XGetPixel(Private->image, SrcX, SrcY));
- }
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) Blt + Args->Delta);
- }
- break;
- case EfiUgaBltBufferToVideo:
- Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (Args->SourceY * Args->Delta) + Args->SourceX * sizeof (EFI_UGA_PIXEL));
- Args->Delta -= Args->Width * sizeof (EFI_UGA_PIXEL);
- for (DstY = Args->DestinationY; DstY < (Args->Height + Args->DestinationY); DstY++) {
- for (DstX = Args->DestinationX; DstX < (Args->Width + Args->DestinationX); DstX++) {
- XPutPixel(Private->image, DstX, DstY, UgaPixelToColor(Private, *Blt));
- Blt++;
- }
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) Blt + Args->Delta);
- }
- break;
- case EfiUgaVideoToVideo:
- Dst = Private->image_data + (Args->DestinationX << Private->pixel_shift)
- + Args->DestinationY * Private->line_bytes;
- Src = Private->image_data + (Args->SourceX << Private->pixel_shift)
- + Args->SourceY * Private->line_bytes;
- Nbr = Args->Width << Private->pixel_shift;
- if (Args->DestinationY < Args->SourceY) {
- for (Index = 0; Index < Args->Height; Index++) {
- memcpy (Dst, Src, Nbr);
- Dst += Private->line_bytes;
- Src += Private->line_bytes;
- }
- }
- else {
- Dst += (Args->Height - 1) * Private->line_bytes;
- Src += (Args->Height - 1) * Private->line_bytes;
- for (Index = 0; Index < Args->Height; Index++) {
- //
- // Source and Destination Y may be equal, therefore Dst and Src may
- // overlap.
- //
- memmove (Dst, Src, Nbr);
- Dst -= Private->line_bytes;
- Src -= Private->line_bytes;
- }
- }
- break;
- case EfiUgaVideoFill:
- Color = UgaPixelToColor(Private, *BltBuffer);
- for (DstY = Args->DestinationY; DstY < (Args->Height + Args->DestinationY); DstY++) {
- for (DstX = Args->DestinationX; DstX < (Args->Width + Args->DestinationX); DstX++) {
- XPutPixel(Private->image, DstX, DstY, Color);
- }
- }
- break;
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Refresh screen.
- //
- switch (BltOperation) {
- case EfiUgaVideoToVideo:
- XCopyArea(Private->display, Private->win, Private->win, Private->gc,
- Args->SourceX, Args->SourceY, Args->Width, Args->Height, Args->DestinationX, Args->DestinationY);
- while (1) {
- XEvent ev;
-
- XNextEvent (Private->display, &ev);
- HandleEvent(Private, &ev);
- if (ev.type == NoExpose || ev.type == GraphicsExpose)
- break;
- }
- break;
- case EfiUgaVideoFill:
- Color = UgaPixelToColor(Private, *BltBuffer);
- XSetForeground(Private->display, Private->gc, Color);
- XFillRectangle(Private->display, Private->win, Private->gc,
- Args->DestinationX, Args->DestinationY, Args->Width, Args->Height);
- XFlush(Private->display);
- break;
- case EfiUgaBltBufferToVideo:
- Redraw(Private, Args->DestinationX, Args->DestinationY, Args->Width, Args->Height);
- break;
- default:
- break;
- }
- return EFI_SUCCESS;
-}
-
-STATIC EFI_STATUS
-CheckPointerInternal( UGA_IO_PRIVATE *drv, BOOLEAN delay )
-{
- HandleEvents(drv);
- if (drv->pointer_state_changed != 0)
- return EFI_SUCCESS;
- if ( delay )
- /* EFI is polling. Be CPU-friendly. */
- msSleep (20);
- return EFI_NOT_READY;
-}
-
-EFI_STATUS
-UgaCheckPointer(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo)
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
- return( CheckPointerInternal( drv, TRUE ) );
-}
-
-EFI_STATUS
-UgaGetPointerState (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_SIMPLE_POINTER_STATE *state)
-{
- UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo;
- EFI_STATUS status;
-
- status = CheckPointerInternal( drv, FALSE );
- if (status != EFI_SUCCESS)
- return status;
-
- memcpy( state, &drv->pointer_state, sizeof( EFI_SIMPLE_POINTER_STATE ) );
-
- drv->pointer_state.RelativeMovementX = 0;
- drv->pointer_state.RelativeMovementY = 0;
- drv->pointer_state.RelativeMovementZ = 0;
- drv->pointer_state_changed = 0;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaCreate (EFI_UNIX_UGA_IO_PROTOCOL **Uga, CONST CHAR16 *Title)
-{
- UGA_IO_PRIVATE *drv;
- unsigned int border_width = 0;
- char *display_name = NULL;
- int title_len;
-
- drv = (UGA_IO_PRIVATE *)calloc (1, sizeof (UGA_IO_PRIVATE));
- if (drv == NULL)
- return EFI_OUT_OF_RESOURCES;
-
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
-//
-//
-//
- drv->UgaIo.UgaClose = GasketUgaClose;
- drv->UgaIo.UgaSize = GasketUgaSize;
- drv->UgaIo.UgaCheckKey = GasketUgaCheckKey;
- drv->UgaIo.UgaGetKey = GasketUgaGetKey;
- drv->UgaIo.UgaKeySetState = GasketUgaKeySetState;
- drv->UgaIo.UgaRegisterKeyNotify = GasketUgaRegisterKeyNotify;
- drv->UgaIo.UgaBlt = GasketUgaBlt;
- drv->UgaIo.UgaCheckPointer = GasketUgaCheckPointer;
- drv->UgaIo.UgaGetPointerState = GasketUgaGetPointerState;
-#else
- drv->UgaIo.UgaClose = UgaClose;
- drv->UgaIo.UgaSize = UgaSize;
- drv->UgaIo.UgaCheckKey = UgaCheckKey;
- drv->UgaIo.UgaGetKey = UgaGetKey;
- drv->UgaIo.UgaKeySetState = UgaKeySetState;
- drv->UgaIo.UgaRegisterKeyNotify = UgaRegisterKeyNotify;
- drv->UgaIo.UgaBlt = UgaBlt;
- drv->UgaIo.UgaCheckPointer = UgaCheckPointer;
- drv->UgaIo.UgaGetPointerState = UgaGetPointerState;
-#endif
-
-
-
- drv->key_count = 0;
- drv->key_rd = 0;
- drv->key_wr = 0;
- drv->KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
- drv->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;
- drv->RegisterdKeyCallback = NULL;
- drv->RegisterdKeyCallbackContext = NULL;
-
-
- drv->display = XOpenDisplay (display_name);
- if (drv->display == NULL)
- {
- fprintf (stderr, "uga: cannot connect to X server %s\n",
- XDisplayName (display_name));
- free (drv);
- return EFI_DEVICE_ERROR;
- }
- drv->screen = DefaultScreen (drv->display);
- drv->visual = DefaultVisual (drv->display, drv->screen);
- drv->win = XCreateSimpleWindow
- (drv->display, RootWindow (drv->display, drv->screen),
- 0, 0, 4, 4, border_width,
- WhitePixel (drv->display, drv->screen),
- BlackPixel (drv->display, drv->screen));
-
- drv->depth = DefaultDepth (drv->display, drv->screen);
- XDefineCursor (drv->display, drv->win, XCreateFontCursor (drv->display, XC_pirate));
-
- /* Compute title len and convert to Ascii. */
- for (title_len = 0; Title[title_len] != 0; title_len++)
- ;
- {
- char title[title_len + 1];
- int i;
- for (i = 0; i < title_len; i++)
- title[i] = Title[i];
- title[i] = 0;
-
- XStoreName (drv->display, drv->win, title);
- }
-
- XSelectInput (drv->display, drv->win,
- ExposureMask | KeyPressMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask );
- drv->gc = DefaultGC (drv->display, drv->screen);
-
- *Uga = (EFI_UNIX_UGA_IO_PROTOCOL *)drv;
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/Sec/UnixThunk.c b/UnixPkg/Sec/UnixThunk.c
deleted file mode 100644
index eb9e536989..0000000000
--- a/UnixPkg/Sec/UnixThunk.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixThunk.c
-
-Abstract:
-
- Since the SEC is the only program in our emulation we
- must use a Tiano mechanism to export APIs to other modules.
- This is the role of the EFI_UNIX_THUNK_PROTOCOL.
-
- The mUnixThunkTable exists so that a change to EFI_UNIX_THUNK_PROTOCOL
- will cause an error in initializing the array if all the member functions
- are not added. It looks like adding a element to end and not initializing
- it may cause the table to be initaliized with the members at the end being
- set to zero. This is bad as jumping to zero will crash.
-
-
- gUnix is a a public exported global that contains the initialized
- data.
-
---*/
-
-#include "SecMain.h"
-#include "Uefi.h"
-#include "Library/UnixLib.h"
-
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
-#include "Gasket.h"
-#endif
-
-int settimer_initialized;
-struct timeval settimer_timeval;
-void (*settimer_callback)(UINT64 delta);
-
-BOOLEAN gEmulatorInterruptEnabled = FALSE;
-
-
-void
-settimer_handler (int sig)
-{
- struct timeval timeval;
- UINT64 delta;
-
- gettimeofday (&timeval, NULL);
- delta = ((UINT64)timeval.tv_sec * 1000) + (timeval.tv_usec / 1000)
- - ((UINT64)settimer_timeval.tv_sec * 1000)
- - (settimer_timeval.tv_usec / 1000);
- settimer_timeval = timeval;
-
- if (settimer_callback) {
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
- ReverseGasketUint64 (settimer_callback, delta);
-#else
- (*settimer_callback)(delta);
-#endif
- }
-}
-
-VOID
-SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs))
-{
- struct itimerval timerval;
- UINT32 remainder;
-
- if (!settimer_initialized) {
- struct sigaction act;
-
- settimer_initialized = 1;
- act.sa_handler = settimer_handler;
- act.sa_flags = 0;
- sigemptyset (&act.sa_mask);
- gEmulatorInterruptEnabled = TRUE;
- if (sigaction (SIGALRM, &act, NULL) != 0) {
- printf ("SetTimer: sigaction error %s\n", strerror (errno));
- }
- if (gettimeofday (&settimer_timeval, NULL) != 0) {
- printf ("SetTimer: gettimeofday error %s\n", strerror (errno));
- }
- }
- timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
- DivU64x32Remainder(PeriodMs, 1000, &remainder);
- timerval.it_value.tv_usec = remainder * 1000;
- timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
- timerval.it_interval = timerval.it_value;
-
- if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
- printf ("SetTimer: setitimer error %s\n", strerror (errno));
- }
- settimer_callback = CallBack;
-}
-
-
-void
-UnixEnableInterrupt (void)
-{
- sigset_t sigset;
-
- gEmulatorInterruptEnabled = TRUE;
- // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts
- // by enabling/disabling SIGALRM.
- sigemptyset (&sigset);
- sigaddset (&sigset, SIGALRM);
- sigprocmask (SIG_UNBLOCK, &sigset, NULL);
-}
-
-
-void
-UnixDisableInterrupt (void)
-{
- sigset_t sigset;
-
- // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts
- // by enabling/disabling SIGALRM.
- sigemptyset (&sigset);
- sigaddset (&sigset, SIGALRM);
- sigprocmask (SIG_BLOCK, &sigset, NULL);
- gEmulatorInterruptEnabled = FALSE;
-}
-
-
-BOOLEAN
-UnixInterruptEanbled (void)
-{
- return gEmulatorInterruptEnabled;
-}
-
-
-
-void
-msSleep (unsigned long Milliseconds)
-{
- struct timespec rq, rm;
- struct timeval start, end;
- unsigned long MicroSec;
-
- rq.tv_sec = Milliseconds / 1000;
- rq.tv_nsec = (Milliseconds % 1000) * 1000000;
-
- //
- // nanosleep gets interrupted by our timer tic.
- // we need to track wall clock time or we will stall for way too long
- //
- gettimeofday (&start, NULL);
- end.tv_sec = start.tv_sec + rq.tv_sec;
- MicroSec = (start.tv_usec + rq.tv_nsec/1000);
- end.tv_usec = MicroSec % 1000000;
- if (MicroSec > 1000000) {
- end.tv_sec++;
- }
-
- while (nanosleep (&rq, &rm) == -1) {
- if (errno != EINTR) {
- break;
- }
- gettimeofday (&start, NULL);
- if (start.tv_sec > end.tv_sec) {
- break;
- } if ((start.tv_sec == end.tv_sec) && (start.tv_usec > end.tv_usec)) {
- break;
- }
- rq = rm;
- }
-}
-
-void
-GetLocalTime (EFI_TIME *Time)
-{
- struct tm *tm;
- time_t t;
-
- t = time (NULL);
- tm = localtime (&t);
-
- Time->Year = 1900 + tm->tm_year;
- Time->Month = tm->tm_mon + 1;
- Time->Day = tm->tm_mday;
- Time->Hour = tm->tm_hour;
- Time->Minute = tm->tm_min;
- Time->Second = tm->tm_sec;
- Time->Nanosecond = 0;
- Time->TimeZone = GetTimeZone ();
- Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0)
- | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
-}
-
-void
-TzSet (void)
-{
- STATIC int done = 0;
- if (!done) {
- tzset ();
- done = 1;
- }
-}
-
-long
-GetTimeZone(void)
-{
- TzSet ();
- return timezone;
-}
-
-int
-GetDayLight(void)
-{
- TzSet ();
- return daylight;
-}
-
-int
-GetErrno(void)
-{
- return errno;
-}
-
-
-extern EFI_STATUS
-UgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title);
-
-EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
- EFI_UNIX_THUNK_PROTOCOL_SIGNATURE,
-#if defined(__APPLE__) || defined(MDE_CPU_X64)
-//
-// Mac OS X requires the stack to be 16-byte aligned for IA-32. So on an OS X build
-// we add an assembly wrapper that makes sure the stack ges aligned.
-// This has the nice benfit of being able to run EFI ABI code, like the EFI shell
-// that is checked in to source control in the OS X version of the emulator
-//
- GasketmsSleep, /* Sleep */
- Gasketexit, /* Exit */
- GasketSetTimer,
- GasketGetLocalTime,
- Gasketgmtime,
- GasketGetTimeZone,
- GasketGetDayLight,
- Gasketpoll,
- Gasketread,
- Gasketwrite,
- Gasketgetenv,
- Gasketopen,
- Gasketlseek,
- Gasketftruncate,
- Gasketclose,
- Gasketmkdir,
- Gasketrmdir,
- Gasketunlink,
- GasketGetErrno,
- Gasketopendir,
- Gasketrewinddir,
- Gasketreaddir,
- Gasketclosedir,
- Gasketstat,
- Gasketstatfs,
- Gasketrename,
- Gasketmktime,
- Gasketfsync,
- Gasketchmod,
- Gasketutime,
- Gaskettcflush,
- GasketUgaCreate,
- Gasketperror,
- Gasketioctl,
- Gasketfcntl,
- Gasketcfsetispeed,
- Gasketcfsetospeed,
- Gaskettcgetattr,
- Gaskettcsetattr,
- GasketUnixPeCoffGetEntryPoint,
- GasketUnixPeCoffRelocateImageExtraAction,
- GasketUnixPeCoffUnloadImageExtraAction,
-
- GasketUnixEnableInterrupt,
- GasketUnixDisableInterrupt,
-
- Gasketgetifaddrs,
- Gasketfreeifaddrs,
- Gasketsocket,
-
-#else
- msSleep, /* Sleep */
- exit, /* Exit */
- SetTimer,
- GetLocalTime,
- gmtime,
- GetTimeZone,
- GetDayLight,
- (UnixPoll)poll,
- (UnixRead)read,
- (UnixWrite)write,
- getenv,
- (UnixOpen)open,
- (UnixSeek)lseek,
- (UnixFtruncate)ftruncate,
- close,
- mkdir,
- rmdir,
- unlink,
- GetErrno,
- opendir,
- rewinddir,
- readdir,
- closedir,
- (UnixStat)stat,
- statfs,
- rename,
- mktime,
- fsync,
- chmod,
- utime,
- tcflush,
- UgaCreate,
- perror,
- ioctl,
- fcntl,
- cfsetispeed,
- cfsetospeed,
- tcgetattr,
- tcsetattr,
- SecPeCoffGetEntryPoint,
- SecPeCoffRelocateImageExtraAction,
- SecPeCoffLoaderUnloadImageExtraAction,
- UnixEnableInterrupt,
- UnixDisableInterrupt,
- getifaddrs,
- freeifaddrs,
- socket
-#endif
-};
-
-
-EFI_UNIX_THUNK_PROTOCOL *gUnix = &mUnixThunkTable;
diff --git a/UnixPkg/Sec/X64/MangleGasket.S b/UnixPkg/Sec/X64/MangleGasket.S
deleted file mode 100644
index ea1e6aa2eb..0000000000
--- a/UnixPkg/Sec/X64/MangleGasket.S
+++ /dev/null
@@ -1,1294 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# This template was generated from GasketEfiTemplate.c Unix x86_64 ABI
-#
-# The EFI_UNIX_THUNK_PROTOCOL member functions call these these generic assembly
-# routines.
-#
-# Some OS X POSIX calls get name mangled in C code and we need to fill in a C global
-# to get the correct binding (does not work from assembly). So we have 4 functions
-# that do an indirect call, while the others call POSIX APIs directly
-#
-# movq _gUnixRmDir@GOTPCREL(%rip), %rax
-#
-#
-# UNIX Arg passing: RCX, RDX, R8, R9
-# EFI Arg passing: RDI, RSI, RDX, RCX, R8, R9
-# Callee allocates 32 bytes on stack to spill registers
-# RSI, RDI calle-save on EFI, scatch on UNIX callign
-#
-#
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-//
-// Gaskets are EFI ABI to UNIX ABI calls
-// EFI ABI code will sub 40 (0x28) from %rsp before calling a function
-// This is the 32 (0x20) byte to spill registers and 8 bytes to align stack on 16 byte boundry.
-//
- .text
-
-// 32 byte shadow to spill rcx-r9, 8 bytes to align stack on 16 byte boundry
-// Any call with 0 - 4 arguments allocates 40 bytes on the stack.
-// For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56,
-// 7 or 8 args is 72, and 9 or 10 args is 88
-#define EFI_STACK_SHADOW_SPACE 40
-#define EFI_STACK_SHADOW_SPACE_5_6 56
-#define EFI_STACK_SHADOW_SPACE_7_8 72
-#define EFI_STACK_SHADOW_SPACE_9_10 88
-
-
-
- .text
-
-
-ASM_GLOBAL ASM_PFX(Gasketrmdir)
-ASM_PFX(Gasketrmdir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- movq ASM_PFX(gUnixRmDir)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketopendir)
-ASM_PFX(Gasketopendir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- movq ASM_PFX(gUnixOpenDir)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketstat)
-ASM_PFX(Gasketstat):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- movq ASM_PFX(gUnixStat)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketstatfs)
-ASM_PFX(Gasketstatfs):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- movq ASM_PFX(gUnixStatFs)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(Gasketrewinddir)
-ASM_PFX(Gasketrewinddir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- movq ASM_PFX(gUnixRewinddir)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(Gasketreaddir)
-ASM_PFX(Gasketreaddir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- movq ASM_PFX(gUnixReaddir)@GOTPCREL(%rip), %rax // Get function name mangled by C
- movq (%rax), %rax
- call *%rax
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketmsSleep)
-ASM_PFX(GasketmsSleep):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(msSleep)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketexit)
-ASM_PFX(Gasketexit):
- movq %rcx, %rdi // Swizzle args
- call ASM_PFX(exit) // Less to do as we will never return to EFI ABI world
-LDEAD_LOOP:
- jmp LDEAD_LOOP // _exit should never return
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSetTimer)
-ASM_PFX(GasketSetTimer):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(SetTimer)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketGetLocalTime)
-ASM_PFX(GasketGetLocalTime):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(GetLocalTime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketgmtime)
-ASM_PFX(Gasketgmtime):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(localtime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketGetTimeZone)
-ASM_PFX(GasketGetTimeZone):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(GetTimeZone)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketGetDayLight)
-ASM_PFX(GasketGetDayLight):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(GetDayLight)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketpoll)
-ASM_PFX(Gasketpoll):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(poll)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketread)
-ASM_PFX(Gasketread):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(read)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketwrite)
-ASM_PFX(Gasketwrite):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(write)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketgetenv)
-ASM_PFX(Gasketgetenv):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(getenv)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketopen)
-ASM_PFX(Gasketopen):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(open)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketlseek)
-ASM_PFX(Gasketlseek):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(lseek)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketftruncate)
-ASM_PFX(Gasketftruncate):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(ftruncate)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketclose)
-ASM_PFX(Gasketclose):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(close)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketmkdir)
-ASM_PFX(Gasketmkdir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(mkdir)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketunlink)
-ASM_PFX(Gasketunlink):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(unlink)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketGetErrno)
-ASM_PFX(GasketGetErrno):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(GetErrno)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(Gasketclosedir)
-ASM_PFX(Gasketclosedir):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(closedir)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketrename)
-ASM_PFX(Gasketrename):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(rename)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketmktime)
-ASM_PFX(Gasketmktime):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(mktime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketfsync)
-ASM_PFX(Gasketfsync):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(fsync)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketchmod)
-ASM_PFX(Gasketchmod):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(chmod)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketutime)
-ASM_PFX(Gasketutime):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(utime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gaskettcflush)
-ASM_PFX(Gaskettcflush):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(tcflush)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaCreate)
-ASM_PFX(GasketUgaCreate):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(UgaCreate)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketperror)
-ASM_PFX(Gasketperror):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(perror)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketioctl)
-ASM_PFX(Gasketioctl):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(UnixIoCtl1)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketfcntl)
-ASM_PFX(Gasketfcntl):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(UnixFcntl1)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketcfsetispeed)
-ASM_PFX(Gasketcfsetispeed):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(cfsetispeed)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketcfsetospeed)
-ASM_PFX(Gasketcfsetospeed):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(cfsetospeed)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gaskettcgetattr)
-ASM_PFX(Gaskettcgetattr):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(tcgetattr)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gaskettcsetattr)
-ASM_PFX(Gaskettcsetattr):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(tcsetattr)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUnixPeCoffGetEntryPoint)
-ASM_PFX(GasketUnixPeCoffGetEntryPoint):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(SecPeCoffGetEntryPoint)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction)
-ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(SecPeCoffRelocateImageExtraAction)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction)
-ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(SecPeCoffLoaderUnloadImageExtraAction)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketsocket)
-ASM_PFX(Gasketsocket):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(socket)
-
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(Gasketgetifaddrs)
-ASM_PFX(Gasketgetifaddrs):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(getifaddrs)
-
-
- popq %rbp
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(Gasketfreeifaddrs)
-ASM_PFX(Gasketfreeifaddrs):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(freeifaddrs)
-
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaClose)
-ASM_PFX(GasketUgaClose):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(UgaClose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaSize)
-ASM_PFX(GasketUgaSize):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(UgaSize)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaCheckKey)
-ASM_PFX(GasketUgaCheckKey):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(UgaCheckKey)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaGetKey)
-ASM_PFX(GasketUgaGetKey):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(UgaGetKey)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketUgaKeySetState)
-ASM_PFX(GasketUgaKeySetState):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(UgaKeySetState)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaRegisterKeyNotify)
-ASM_PFX(GasketUgaRegisterKeyNotify):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(UgaRegisterKeyNotify)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaBlt)
-ASM_PFX(GasketUgaBlt):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
- movq %r9, %rcx
-
- call ASM_PFX(UgaBlt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaCheckPointer)
-ASM_PFX(GasketUgaCheckPointer):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
-
- call ASM_PFX(UgaCheckPointer)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUgaGetPointerState)
-ASM_PFX(GasketUgaGetPointerState):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
-
- call ASM_PFX(UgaGetPointerState)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketUnixEnableInterrupt)
-ASM_PFX(GasketUnixEnableInterrupt):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(UnixEnableInterrupt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketUnixDisableInterrupt)
-ASM_PFX(GasketUnixDisableInterrupt):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(UnixDisableInterrupt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-//
-// UNIX ABI to EFI ABI call
-//
-// UINTN
-// ReverseGasketUint64 (
-// void *Api,
-// UINTN Arg1
-// );
-ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
-ASM_PFX(ReverseGasketUint64):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- movq %rdi, %rax // Swizzle args
- movq %rsi, %rcx
-
- subq $32, %rsp // 32-byte shadow space
- call *%rax
- addq $32, %rsp
-
- popq %rbp
- ret
-
-//
-// UNIX ABI to EFI ABI call
-//
-// UINTN
-// ReverseGasketUint64Uint64 (
-// void *Api,
-// UINTN Arg1
-// UINTN Arg2
-// );
-ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
-ASM_PFX(ReverseGasketUint64Uint64):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- movq %rdi, %rax // Swizzle args
- movq %rsi, %rcx
-
- subq $32, %rsp // 32-byte shadow space
- call *%rax
- addq $32, %rsp
-
- popq %rbp
- ret
-
-
-// Sec PPI Callbacks
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixPeiLoadFile)
-ASM_PFX(GasketSecUnixPeiLoadFile):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
- movq %r9, %rcx
-
- call ASM_PFX(SecUnixPeiLoadFile)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
-ASM_PFX(GasketSecUnixPeiAutoScan):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
-
- call ASM_PFX(SecUnixPeiAutoScan)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixUnixThunkAddress)
-ASM_PFX(GasketSecUnixUnixThunkAddress):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- call ASM_PFX(SecUnixUnixThunkAddress)
-
-
- popq %rdi
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecPeiReportStatusCode)
-ASM_PFX(GasketSecPeiReportStatusCode):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
- movq %r9, %rcx
- movq $0, %r8 // BugBug: This should come from the stack
- movq $0, %r9 // But we can cheat since they are optional for bringup....
-
- call ASM_PFX(SecPeiReportStatusCode)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
-ASM_PFX(GasketSecUnixFdAddress):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
- movq %r9, %rcx
-
- call ASM_PFX(SecUnixFdAddress)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSecTemporaryRamSupport)
-ASM_PFX(GasketSecTemporaryRamSupport):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
- pushq %rdi
-
- movq %rcx, %rdi // Swizzle args
- movq %rdx, %rsi
- movq %r8, %rdx
- movq %r9, %rcx
-
- call ASM_PFX(SecTemporaryRamSupport)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-
-
diff --git a/UnixPkg/Sec/X64/NameManglingFix.c b/UnixPkg/Sec/X64/NameManglingFix.c
deleted file mode 100644
index a3fd6a6edf..0000000000
--- a/UnixPkg/Sec/X64/NameManglingFix.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "SecMain.h"
-
-//
-// OS X Posix does some strange name mangling on these names in C.
-// If you call from assembler you get the wrong version of the function
-// So these globals get you the correct name mangled functions that can
-// be accessed from assembly
-//
-UnixRmDir gUnixRmDir = rmdir;
-UnixOpenDir gUnixOpenDir = opendir;
-UnixStat gUnixStat = (UnixStat)stat;
-UnixStatFs gUnixStatFs = statfs;
-UnixReadDir gUnixReaddir = readdir;
-UnixRewindDir gUnixRewinddir = rewinddir;
-
-int
-UnixIoCtl1 (
- int fd,
- unsigned long int __request,
- UINTN Arg
- )
-{
- return ioctl (fd, __request, Arg);
-}
-
-int
-UnixFcntl1 (int __fd, int __cmd, UINTN Arg)
-{
- return fcntl (__fd, __cmd, Arg);
-} \ No newline at end of file
diff --git a/UnixPkg/Sec/X64/SwitchStack.S b/UnixPkg/Sec/X64/SwitchStack.S
deleted file mode 100644
index e9adefce39..0000000000
--- a/UnixPkg/Sec/X64/SwitchStack.S
+++ /dev/null
@@ -1,120 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM 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 3 parameters EFI ABI
-# Convert UNIX to EFI ABI
-#
-# Arguments:
-#
-# (rdi) EntryPoint - Entry point with new stack.
-# (rsi) Context1 - Parameter1 for entry point. (rcx)
-# (rdx) Context2 - Parameter2 for entry point. (rdx)
-# (rcx) Context3 - Parameter3 for entry point. (r8)
-# (r8) NewStack - The pointer to new stack.
-#
-# Returns:
-#
-# None
-#
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
-ASM_PFX(PeiSwitchStacks):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- movq %r8, %rsp
-
- movq %rdi, %rax
- movq %rsi, %rcx
- movq %rcx, %r8
-
- #
- # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
- # in case the callee wishes to spill them.
- #
- subq $32, %rsp // 32-byte shadow space plus alignment pad
- call *%rax
-
-
-#------------------------------------------------------------------------------
-# Routine Description:
-#
-# Routine for switching stacks with 3 parameters UNIX ABI
-#
-# Arguments:
-#
-# (rdi) EntryPoint - Entry point with new stack.
-# (rsi) Context1 - Parameter1 for entry point.
-# (rdx) Context2 - Parameter2 for entry point.
-# (rcx) Context3 - Parameter3 for entry point.
-# (r8) NewStack - The pointer to new stack.
-#
-# Returns:
-#
-# None
-#
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(UnixPeiSwitchStacks)
-ASM_PFX(UnixPeiSwitchStacks):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- mov %rdi, %rax
- mov %rsi, %rdi
- mov %rdx, %rsi
- mov %rcx, %rdx
- mov %r8, %rsp
-
-
- #
- # Reserve space for redzone on the stack,
- # in case the callee wishes to spill them.
- #
- lea -0x80(%rsp), %rsp
- call *%rax
-
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# SecSwitchStack (
-# UINT32 TemporaryMemoryBase, // Rcx, Rdi
-# UINT32 PermenentMemoryBase // Rdx, Rsi
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(SecSwitchStack)
-ASM_PFX(SecSwitchStack):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- mov %rsp, %rax
- sub %rdi, %rax
- add %rsi, %rax
- mov (%rip), %r10
- mov %r10, (%rax)
-
- popq %rbp
- ret
-
- \ No newline at end of file
diff --git a/UnixPkg/TimerDxe/Timer.c b/UnixPkg/TimerDxe/Timer.c
deleted file mode 100644
index 5314d11ccd..0000000000
--- a/UnixPkg/TimerDxe/Timer.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*++
-
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Timer.c
-
-Abstract:
-
- UNIX Emulation Timer Architectural Protocol Driver as defined in DXE CIS
-
- This Timer module uses an UNIX Thread to simulate the timer-tick driven
- timer service. In the future, the Thread creation should possibly be
- abstracted by the CPU architectural protocol
-
---*/
-#include "PiDxe.h"
-#include <Protocol/Timer.h>
-#include <Protocol/Cpu.h>
-#include "Timer.h"
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include "UnixDxe.h"
-#include <Library/UnixLib.h>
-
-//
-// Pointer to the CPU Architectural Protocol instance
-//
-EFI_CPU_ARCH_PROTOCOL *mCpu;
-
-//
-// The Timer Architectural Protocol that this driver produces
-//
-EFI_TIMER_ARCH_PROTOCOL mTimer = {
- UnixTimerDriverRegisterHandler,
- UnixTimerDriverSetTimerPeriod,
- UnixTimerDriverGetTimerPeriod,
- UnixTimerDriverGenerateSoftInterrupt
-};
-
-//
-// The notification function to call on every timer interrupt
-//
-EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
-
-//
-// The current period of the timer interrupt
-//
-UINT64 mTimerPeriodMs;
-
-
-VOID
-EFIAPI
-TimerCallback (UINT64 DeltaMs)
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- wTimerID - TODO: add argument description
- msg - TODO: add argument description
- dwUser - TODO: add argument description
- dw1 - TODO: add argument description
- dw2 - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_TPL OriginalTPL;
- EFI_TIMER_NOTIFY CallbackFunction;
-
-
- OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- if (OriginalTPL < TPL_HIGH_LEVEL) {
- CallbackFunction = mTimerNotifyFunction;
-
- //
- // Only invoke the callback function if a Non-NULL handler has been
- // registered. Assume all other handlers are legal.
- //
- if (CallbackFunction != NULL) {
- CallbackFunction ((UINT64) (DeltaMs * 10000));
- }
- }
-
- gBS->RestoreTPL (OriginalTPL);
-
-}
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverRegisterHandler (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN EFI_TIMER_NOTIFY NotifyFunction
- )
-/*++
-
-Routine Description:
-
- This function registers the handler NotifyFunction so it is called every time
- the timer interrupt fires. It also passes the amount of time since the last
- handler call to the NotifyFunction. If NotifyFunction is NULL, then the
- handler is unregistered. If the handler is registered, then EFI_SUCCESS is
- returned. If the CPU does not support registering a timer interrupt handler,
- then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler
- when a handler is already registered, then EFI_ALREADY_STARTED is returned.
- If an attempt is made to unregister a handler when a handler is not registered,
- then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to
- register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR
- is returned.
-
-Arguments:
-
- This - The EFI_TIMER_ARCH_PROTOCOL instance.
-
- NotifyFunction - The function to call when a timer interrupt fires. This
- function executes at TPL_HIGH_LEVEL. The DXE Core will
- register a handler for the timer interrupt, so it can know
- how much time has passed. This information is used to
- signal timer based events. NULL will unregister the handler.
-
-Returns:
-
- EFI_SUCCESS - The timer handler was registered.
-
- EFI_UNSUPPORTED - The platform does not support timer interrupts.
-
- EFI_ALREADY_STARTED - NotifyFunction is not NULL, and a handler is already
- registered.
-
- EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not
- previously registered.
-
- EFI_DEVICE_ERROR - The timer handler could not be registered.
-
---*/
-{
- //
- // Check for invalid parameters
- //
- if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (NotifyFunction == NULL) {
- /* Disable timer. */
- gUnix->SetTimer (0, TimerCallback);
- } else if (mTimerNotifyFunction == NULL) {
- /* Enable Timer. */
- gUnix->SetTimer (mTimerPeriodMs, TimerCallback);
- }
- mTimerNotifyFunction = NotifyFunction;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverSetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- )
-/*++
-
-Routine Description:
-
- This function adjusts the period of timer interrupts to the value specified
- by TimerPeriod. If the timer period is updated, then the selected timer
- period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
- If an error occurs while attempting to update the timer period, then the
- timer hardware will be put back in its state prior to this call, and
- EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
- is disabled. This is not the same as disabling the CPU's interrupts.
- Instead, it must either turn off the timer hardware, or it must adjust the
- interrupt controller so that a CPU interrupt is not generated when the timer
- interrupt fires.
-
-Arguments:
-
- This - The EFI_TIMER_ARCH_PROTOCOL instance.
-
- TimerPeriod - The rate to program the timer interrupt in 100 nS units. If
- the timer hardware is not programmable, then EFI_UNSUPPORTED is
- returned. If the timer is programmable, then the timer period
- will be rounded up to the nearest timer period that is supported
- by the timer hardware. If TimerPeriod is set to 0, then the
- timer interrupts will be disabled.
-
-Returns:
-
- EFI_SUCCESS - The timer period was changed.
-
- EFI_UNSUPPORTED - The platform cannot change the period of the timer interrupt.
-
- EFI_DEVICE_ERROR - The timer period could not be changed due to a device error.
-
---*/
-{
-
- //
- // If TimerPeriod is 0, then the timer thread should be canceled
- // If the TimerPeriod is valid, then create and/or adjust the period of the timer thread
- //
- if (TimerPeriod == 0
- || ((TimerPeriod > TIMER_MINIMUM_VALUE)
- && (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
- mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
-
- gUnix->SetTimer (mTimerPeriodMs, TimerCallback);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
- )
-/*++
-
-Routine Description:
-
- This function retrieves the period of timer interrupts in 100 ns units,
- returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
- is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
- returned, then the timer is currently disabled.
-
-Arguments:
-
- This - The EFI_TIMER_ARCH_PROTOCOL instance.
-
- TimerPeriod - A pointer to the timer period to retrieve in 100 ns units. If
- 0 is returned, then the timer is currently disabled.
-
-Returns:
-
- EFI_SUCCESS - The timer period was returned in TimerPeriod.
-
- EFI_INVALID_PARAMETER - TimerPeriod is NULL.
-
---*/
-{
- if (TimerPeriod == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *TimerPeriod = mTimerPeriodMs * 10000;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverGenerateSoftInterrupt (
- IN EFI_TIMER_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- This function generates a soft timer interrupt. If the platform does not support soft
- timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned.
- If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler()
- service, then a soft timer interrupt will be generated. If the timer interrupt is
- enabled when this service is called, then the registered handler will be invoked. The
- registered handler should not be able to distinguish a hardware-generated timer
- interrupt from a software-generated timer interrupt.
-
-Arguments:
-
- This - The EFI_TIMER_ARCH_PROTOCOL instance.
-
-Returns:
-
- EFI_SUCCESS - The soft timer interrupt was generated.
-
- EFI_UNSUPPORTEDT - The platform does not support the generation of soft timer interrupts.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the Timer Architectural Protocol driver
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
-
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_SUCCESS - Timer Architectural Protocol created
-
- EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
-
- EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- //
- // Make sure the Timer Architectural Protocol is not already installed in the system
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);
-
- //
- // Get the CPU Architectural Protocol instance
- //
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (void *)&mCpu);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the Timer Architectural Protocol onto a new handle
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiTimerArchProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mTimer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Start the timer thread at the default timer period
- //
- Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/TimerDxe/Timer.h b/UnixPkg/TimerDxe/Timer.h
deleted file mode 100644
index c1888a434c..0000000000
--- a/UnixPkg/TimerDxe/Timer.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Timer.h
-
-Abstract:
-
- UNIX Emulation Architectural Protocol Driver as defined in Tiano.
- This Timer module uses an UNIX Thread to simulate the timer-tick driven
- timer service.
-
---*/
-
-#ifndef _TIMER_H_
-#define _TIMER_H_
-
-
-
-
-//
-// Legal timer value range in 100 ns units
-//
-#define TIMER_MINIMUM_VALUE 0
-#define TIMER_MAXIMUM_VALUE (0x100000000ULL - 1)
-
-//
-// Default timer value in 100 ns units (50 ms)
-//
-#define DEFAULT_TIMER_TICK_DURATION 500000
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-UnixTimerDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverRegisterHandler (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN EFI_TIMER_NOTIFY NotifyFunction
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- NotifyFunction - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverSetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- TimerPeriod - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- TimerPeriod - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixTimerDriverGenerateSoftInterrupt (
- IN EFI_TIMER_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/UnixPkg/TimerDxe/Timer.inf b/UnixPkg/TimerDxe/Timer.inf
deleted file mode 100644
index c4b9a31ba5..0000000000
--- a/UnixPkg/TimerDxe/Timer.inf
+++ /dev/null
@@ -1,61 +0,0 @@
-## @file
-# Unix Emulation Timer Architectural Protocol Driver as defined in DXE CIS
-#
-# This Timer module uses an NT Thread to simulate the timer-tick driven
-# timer service. In the future, the Thread creation should possibly be
-# abstracted by the CPU architectural protocol
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = Timer
- FILE_GUID = f36d49b4-8985-11db-809b-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = UnixTimerDriverInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Timer.c
- Timer.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UnixLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiTimerArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- gEfiCpuArchProtocolGuid
-
diff --git a/UnixPkg/UnixAutoScanPei/UnixAutoScan.c b/UnixPkg/UnixAutoScanPei/UnixAutoScan.c
deleted file mode 100644
index 4b61dc7bb5..0000000000
--- a/UnixPkg/UnixAutoScanPei/UnixAutoScan.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- UnixAutoscan.c
-
-Abstract:
- This PEIM to abstract memory auto-scan in an Unix environment.
-
-Revision History
-
---*/
-
-#include "PiPei.h"
-#include <Ppi/UnixAutoScan.h>
-#include <Ppi/MemoryDiscovered.h>
-
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-
-EFI_STATUS
-EFIAPI
-PeimInitializeUnixAutoScan (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
- Perform a call-back into the SEC simulator to get a memory value
-
-Arguments:
- FfsHeader - General purpose data available to every PEIM
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- PEI_UNIX_AUTOSCAN_PPI *PeiUnixService;
- UINT64 MemorySize;
- EFI_PHYSICAL_ADDRESS MemoryBase;
- UINTN Index;
- EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
-
-
- DEBUG ((EFI_D_ERROR, "Unix Autoscan PEIM Loaded\n"));
-
- //
- // Get the PEI UNIX Autoscan PPI
- //
- Status = PeiServicesLocatePpi (
- &gPeiUnixAutoScanPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&PeiUnixService // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Index = 0;
- do {
- Status = PeiUnixService->UnixAutoScan (Index, &MemoryBase, &MemorySize);
- if (!EFI_ERROR (Status)) {
- Attributes =
- (
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
- );
-
- if (Index == 0) {
- //
- // Register the memory with the PEI Core
- //
- Status = PeiServicesInstallPeiMemory (MemoryBase, MemorySize);
- ASSERT_EFI_ERROR (Status);
-
- Attributes |= EFI_RESOURCE_ATTRIBUTE_TESTED;
- }
-
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- Attributes,
- MemoryBase,
- MemorySize
- );
- }
- Index++;
- } while (!EFI_ERROR (Status));
-
- //
- // Build the CPU hob with 36-bit addressing and 16-bits of IO space.
- //
- BuildCpuHob (36, 16);
-
- return Status;
-}
diff --git a/UnixPkg/UnixAutoScanPei/UnixAutoScan.inf b/UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
deleted file mode 100644
index efa813ae65..0000000000
--- a/UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file
-# Component description file for UnixAutoScan module
-#
-# This module abstracts memory auto-scan in a Unix environment.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixAutoScan
- FILE_GUID = f3f36cb0-8985-11db-b195-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeUnixAutoScan
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixAutoScan.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- BaseMemoryLib
- BaseLib
- PeimEntryPoint
- DebugLib
-
-
-[Ppis]
- gEfiPeiMemoryDiscoveredPpiGuid # PPI ALWAYS_PRODUCED
- gPeiUnixAutoScanPpiGuid # PPI ALWAYS_CONSUMED
-
-
-[Depex]
- gPeiUnixAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid
-
diff --git a/UnixPkg/UnixBlockIoDxe/ComponentName.c b/UnixPkg/UnixBlockIoDxe/ComponentName.c
deleted file mode 100644
index 986e8c4ba6..0000000000
--- a/UnixPkg/UnixBlockIoDxe/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++
-
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixBlockIo.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixBlockIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixBlockIoComponentName = {
- UnixBlockIoComponentNameGetDriverName,
- UnixBlockIoComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixBlockIoDriverNameTable[] = {
- { "eng", L"Unix Block I/O Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixBlockIoComponentName.SupportedLanguages,
- mUnixBlockIoDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UNIX_BLOCK_IO_PRIVATE *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (void *)&BlockIo,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-
- return LookupUnicodeString (
- Language,
- gUnixBlockIoComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixBlockIoDxe/DriverConfiguration.c b/UnixPkg/UnixBlockIoDxe/DriverConfiguration.c
deleted file mode 100644
index 245aab6bc0..0000000000
--- a/UnixPkg/UnixBlockIoDxe/DriverConfiguration.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DriverConfiguration.c
-
-Abstract:
-
---*/
-
-#include "UnixBlockIo.h"
-
-//
-// EFI Driver Configuration Functions
-//
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-//
-// EFI Driver Configuration Protocol
-//
-EFI_DRIVER_CONFIGURATION_PROTOCOL gUnixBlockIoDriverConfiguration = {
- UnixBlockIoDriverConfigurationSetOptions,
- UnixBlockIoDriverConfigurationOptionsValid,
- UnixBlockIoDriverConfigurationForceDefaults,
- LANGUAGESUPPORTED
-};
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-/*++
-
- Routine Description:
- Allows the user to set controller specific options for a controller that a
- driver is currently managing.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.
- ControllerHandle - The handle of the controller to set options on.
- ChildHandle - The handle of the child controller to set options on. This
- is an optional parameter that may be NULL. It will be NULL
- for device drivers, and for a bus drivers that wish to set
- options for the bus controller. It will not be NULL for a
- bus driver that wishes to set options for one of its child
- controllers.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the user interface that should be
- presented to the user, and it must match one of the languages
- specified in SupportedLanguages. The number of languages
- supported by a driver is up to the driver writer.
- ActionRequired - A pointer to the action that the calling agent is required
- to perform when this function returns. See "Related
- Definitions" for a list of the actions that the calling
- agent is required to perform prior to accessing
- ControllerHandle again.
-
- Returns:
- EFI_SUCCESS - The driver specified by This successfully set the
- configuration options for the controller specified
- by ControllerHandle..
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ActionRequired is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support setting
- configuration options for the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
- EFI_DEVICE_ERROR - A device error occurred while attempt to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
- EFI_OUT_RESOURCES - There are not enough resources available to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
-
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3)) {
- Status = EFI_SUCCESS;
- }
-
- SupportedLanguage += 3;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ActionRequired == NULL || ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (void *)&BlockIo,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- *ActionRequired = EfiDriverConfigurationActionNone;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-/*++
-
- Routine Description:
- Tests to see if a controller's current configuration options are valid.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL instance.
- ControllerHandle - The handle of the controller to test if it's current
- configuration options are valid.
- ChildHandle - The handle of the child controller to test if it's current
- configuration options are valid. This is an optional
- parameter that may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers that wish
- to test the configuration options for the bus controller.
- It will not be NULL for a bus driver that wishes to test
- configuration options for one of its child controllers.
-
- Returns:
- EFI_SUCCESS - The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has a valid set of configuration
- options.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by ControllerHandle
- and ChildHandle.
- EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has an invalid set of configuration
- options.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- if (ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (void *)&BlockIo,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-/*++
-
- Routine Description:
- Forces a driver to set the default configuration options for a controller.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.
- ControllerHandle - The handle of the controller to force default configuration options on.
- ChildHandle - The handle of the child controller to force default configuration options on This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to force default configuration options for the bus controller. It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers.
- DefaultType - The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle. See Table 9-1 for legal values. A DefaultType of 0x00000000 must be supported by this protocol.
- ActionRequired - A pointer to the action that the calling agent is required to perform when this function returns. See "Related Definitions" in Section 9.1for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again.
-
- Returns:
- EFI_SUCCESS - The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ActionRequired is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the configuration type specified by DefaultType.
- EFI_DEVICE_ERROR - A device error occurred while attempt to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_OUT_RESOURCES - There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- if (ActionRequired == NULL || ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (void *)&BlockIo,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- *ActionRequired = EfiDriverConfigurationActionNone;
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/UnixBlockIoDxe/DriverDiagnostics.c b/UnixPkg/UnixBlockIoDxe/DriverDiagnostics.c
deleted file mode 100644
index 69ba61dfb5..0000000000
--- a/UnixPkg/UnixBlockIoDxe/DriverDiagnostics.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DriverDiagnostics.c
-
-Abstract:
-
---*/
-
-#include "UnixBlockIo.h"
-
-//
-// EFI Driver Diagnostics Functions
-//
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- );
-
-//
-// EFI Driver Diagnostics Protocol
-//
-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gUnixBlockIoDriverDiagnostics = {
- UnixBlockIoDriverDiagnosticsRunDiagnostics,
- LANGUAGESUPPORTED
-};
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- )
-/*++
-
- Routine Description:
- Runs diagnostics on a controller.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance.
- ControllerHandle - The handle of the controller to run diagnostics on.
- ChildHandle - The handle of the child controller to run diagnostics on
- This is an optional parameter that may be NULL. It will
- be NULL for device drivers. It will also be NULL for a
- bus drivers that wish to run diagnostics on the bus
- controller. It will not be NULL for a bus driver that
- wishes to run diagnostics on one of its child controllers.
- DiagnosticType - Indicates type of diagnostics to perform on the controller
- specified by ControllerHandle and ChildHandle. See
- "Related Definitions" for the list of supported types.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language in which the optional
- error message should be returned in Buffer, and it must
- match one of the languages specified in SupportedLanguages.
- The number of languages supported by a driver is up to
- the driver writer.
- ErrorType - A GUID that defines the format of the data returned in
- Buffer.
- BufferSize - The size, in bytes, of the data returned in Buffer.
- Buffer - A buffer that contains a Null-terminated Unicode string
- plus some additional data whose format is defined by
- ErrorType. Buffer is allocated by this function with
- AllocatePool(), and it is the caller's responsibility
- to free it with a call to FreePool().
-
- Returns:
- EFI_SUCCESS - The controller specified by ControllerHandle and
- ChildHandle passed the diagnostic.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ErrorType is NULL.
- EFI_INVALID_PARAMETER - BufferType is NULL.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support
- running diagnostics for the controller specified
- by ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- type of diagnostic specified by DiagnosticType.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to complete
- the diagnostics.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to return
- the status information in ErrorType, BufferSize,
- and Buffer.
- EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
- ChildHandle did not pass the diagnostic.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
-
- if (Language == NULL ||
- ErrorType == NULL ||
- Buffer == NULL ||
- ControllerHandle == NULL ||
- BufferSize == NULL) {
-
- return EFI_INVALID_PARAMETER;
- }
-
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3)) {
- Status = EFI_SUCCESS;
- break;
- }
-
- SupportedLanguage += 3;
- }
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- *ErrorType = NULL;
- *BufferSize = 0;
- if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
- *ErrorType = &gEfiBlockIoProtocolGuid;
- *BufferSize = 0x60;
- gBS->AllocatePool (EfiBootServicesData, (UINTN) (*BufferSize),
- (void *)Buffer);
- CopyMem (*Buffer, L"Unix Block I/O Driver Diagnostics Failed\n", *BufferSize);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (void *)&BlockIo,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- gUnixBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/UnixBlockIoDxe/EntryPoint.c b/UnixPkg/UnixBlockIoDxe/EntryPoint.c
deleted file mode 100644
index 1abe7fe13e..0000000000
--- a/UnixPkg/UnixBlockIoDxe/EntryPoint.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-
-
-#include "UnixBlockIo.h"
-
-/**
- The user Entry Point for module UnixBlockIo. The user code starts with this function.
-
- @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
-InitializeUnixBlockIo(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixBlockIoDriverBinding,
- ImageHandle,
- &gUnixBlockIoComponentName,
- NULL,
- &gUnixBlockIoDriverDiagnostics
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.c b/UnixPkg/UnixBlockIoDxe/UnixBlockIo.c
deleted file mode 100644
index 2de6cc6282..0000000000
--- a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.c
+++ /dev/null
@@ -1,1288 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixBlockIo.c
-
-Abstract:
-
- Produce block IO abstractions for real devices on your PC using Posix APIs.
- The configuration of what devices to mount or emulate comes from UNIX
- environment variables. The variables must be visible to the Microsoft*
- Developer Studio for them to work.
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- UNIX envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_UNIX_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_UNIX_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_UNIX_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_UNIX_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use UNIX to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=Z:RO;307200;2048
-
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#include <fcntl.h>
-#include <unistd.h>
-#include "UnixBlockIo.h"
-
-//
-// Block IO protocol member functions
-//
-EFI_STATUS
-EFIAPI
-UnixBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoResetBlock (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Private Worker functions
-//
-EFI_STATUS
-UnixBlockIoCreateMapping (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo,
- IN EFI_HANDLE EfiDeviceHandle,
- IN CHAR16 *Filename,
- IN BOOLEAN ReadOnly,
- IN BOOLEAN RemovableMedia,
- IN UINTN NumberOfBlocks,
- IN UINTN BlockSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- UnixIo - TODO: add argument description
- EfiDeviceHandle - TODO: add argument description
- Filename - TODO: add argument description
- ReadOnly - TODO: add argument description
- RemovableMedia - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
- BlockSize - TODO: add argument description
- DeviceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixBlockIoReadWriteCommon (
- IN UNIX_BLOCK_IO_PRIVATE *Private,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer,
- IN CHAR8 *CallerName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
- CallerName - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixBlockIoError (
- IN UNIX_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixBlockIoOpenDevice (
- UNIX_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-CHAR16 *
-GetNextElementPastTerminator (
- IN CHAR16 *EnvironmentVariable,
- IN CHAR16 Terminator
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- EnvironmentVariable - TODO: add argument description
- Terminator - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-EFI_DRIVER_BINDING_PROTOCOL gUnixBlockIoDriverBinding = {
- UnixBlockIoDriverBindingSupported,
- UnixBlockIoDriverBindingStart,
- UnixBlockIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure the UnixThunkProtocol is valid
- //
- Status = EFI_UNSUPPORTED;
- if (UnixIo->UnixThunk->Signature == EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) {
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (CompareGuid (UnixIo->TypeGuid, &gEfiUnixVirtualDisksGuid) ) {
- Status = EFI_SUCCESS;
- }
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- CHAR16 Buffer[FILENAME_BUFFER_SIZE];
- CHAR16 *Str;
- BOOLEAN RemovableMedia;
- BOOLEAN WriteProtected;
- UINTN NumberOfBlocks;
- UINTN BlockSize;
- INTN i;
-
- //
- // Grab the protocols we need
- //
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (void *)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Set DiskType
- //
- if (!CompareGuid (UnixIo->TypeGuid, &gEfiUnixVirtualDisksGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Status = EFI_NOT_FOUND;
- // Extract filename.
- Str = UnixIo->EnvString;
- i = 0;
- while (*Str && *Str != ':')
- Buffer[i++] = *Str++;
- Buffer[i] = 0;
- if (*Str != ':') {
- goto Done;
- }
-
- Str++;
-
- RemovableMedia = FALSE;
- WriteProtected = TRUE;
- NumberOfBlocks = 0;
- BlockSize = 512;
- do {
- if (*Str == 'R' || *Str == 'F') {
- RemovableMedia = (BOOLEAN) (*Str == 'R');
- Str++;
- }
- if (*Str == 'O' || *Str == 'W') {
- WriteProtected = (BOOLEAN) (*Str == 'O');
- Str++;
- }
- if (*Str == 0)
- break;
- if (*Str != ';')
- goto Done;
- Str++;
-
- NumberOfBlocks = Atoi (Str);
- Str = GetNextElementPastTerminator (Str, ';');
- if (NumberOfBlocks == 0)
- break;
-
- BlockSize = Atoi (Str);
- if (BlockSize != 0)
- Str = GetNextElementPastTerminator (Str, ';');
- } while (0);
-
- //
- // If we get here the variable is valid so do the work.
- //
- Status = UnixBlockIoCreateMapping (
- UnixIo,
- Handle,
- Buffer,
- WriteProtected,
- RemovableMedia,
- NumberOfBlocks,
- BlockSize
- );
-
-Done:
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_UNSUPPORTED - TODO: Add description for return value
-
---*/
-{
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_STATUS Status;
- UNIX_BLOCK_IO_PRIVATE *Private;
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- (void *)&BlockIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-
- //
- // BugBug: If we need to kick people off, we need to make Uninstall Close the handles.
- // We could pass in our image handle or FLAG our open to be closed via
- // Unistall (== to saying any CloseProtocol will close our open)
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- NULL
- );
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Shut down our device
- //
- Private->UnixThunk->Close (Private->fd);
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- gBS->FreePool (Private);
- }
-
- return Status;
-}
-
-CHAR16 *
-GetNextElementPastTerminator (
- IN CHAR16 *EnvironmentVariable,
- IN CHAR16 Terminator
- )
-/*++
-
-Routine Description:
-
- Worker function to parse environment variables.
-
-Arguments:
- EnvironmentVariable - Envirnment variable to parse.
-
- Terminator - Terminator to parse for.
-
-Returns:
-
- Pointer to next eliment past the first occurence of Terminator or the '\0'
- at the end of the string.
-
---*/
-{
- CHAR16 *Ptr;
-
- for (Ptr = EnvironmentVariable; *Ptr != '\0'; Ptr++) {
- if (*Ptr == Terminator) {
- Ptr++;
- break;
- }
- }
-
- return Ptr;
-}
-
-EFI_STATUS
-UnixBlockIoCreateMapping (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo,
- IN EFI_HANDLE EfiDeviceHandle,
- IN CHAR16 *Filename,
- IN BOOLEAN ReadOnly,
- IN BOOLEAN RemovableMedia,
- IN UINTN NumberOfBlocks,
- IN UINTN BlockSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- UnixIo - TODO: add argument description
- EfiDeviceHandle - TODO: add argument description
- Filename - TODO: add argument description
- ReadOnly - TODO: add argument description
- RemovableMedia - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
- BlockSize - TODO: add argument description
- DeviceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UNIX_BLOCK_IO_PRIVATE *Private;
- UINTN Index;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_BLOCK_IO_PRIVATE),
- (void *)&Private
- );
- ASSERT_EFI_ERROR (Status);
-
- EfiInitializeLock (&Private->Lock, TPL_NOTIFY);
-
- Private->UnixThunk = UnixIo->UnixThunk;
-
- Private->Signature = UNIX_BLOCK_IO_PRIVATE_SIGNATURE;
- Private->LastBlock = NumberOfBlocks - 1;
- Private->BlockSize = BlockSize;
-
- for (Index = 0; Filename[Index] != 0; Index++) {
- Private->Filename[Index] = Filename[Index];
- }
-
- Private->Filename[Index] = 0;
-
- Private->Mode = (ReadOnly ? O_RDONLY : O_RDWR);
-
- Private->NumberOfBlocks = NumberOfBlocks;
- Private->fd = -1;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gUnixBlockIoComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- Filename
- );
-
- BlockIo = &Private->BlockIo;
- BlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
- BlockIo->Media = &Private->Media;
- BlockIo->Media->BlockSize = Private->BlockSize;
- BlockIo->Media->LastBlock = Private->NumberOfBlocks - 1;
- BlockIo->Media->MediaId = 0;;
-
- BlockIo->Reset = UnixBlockIoResetBlock;
- BlockIo->ReadBlocks = UnixBlockIoReadBlocks;
- BlockIo->WriteBlocks = UnixBlockIoWriteBlocks;
- BlockIo->FlushBlocks = UnixBlockIoFlushBlocks;
-
- BlockIo->Media->ReadOnly = ReadOnly;
- BlockIo->Media->RemovableMedia = RemovableMedia;
- BlockIo->Media->LogicalPartition = FALSE;
- BlockIo->Media->MediaPresent = TRUE;
- BlockIo->Media->WriteCaching = FALSE;
-
- BlockIo->Media->IoAlign = 1;
-
- Private->EfiHandle = EfiDeviceHandle;
- Status = UnixBlockIoOpenDevice (Private);
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
- }
-
- DEBUG ((EFI_D_ERROR, "BlockDevice added: %s\n", Filename));
- }
-
- return Status;
-}
-
-EFI_STATUS
-UnixBlockIoOpenDevice (
- UNIX_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINT64 FileSize;
- UINT64 EndOfFile;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- BlockIo = &Private->BlockIo;
- EfiAcquireLock (&Private->Lock);
-
- //
- // If the device is already opened, close it
- //
- if (Private->fd >= 0) {
- BlockIo->Reset (BlockIo, FALSE);
- }
-
- //
- // Open the device
- //
- Private->fd = Private->UnixThunk->Open (Private->Filename, Private->Mode, 0644);
- if (Private->fd < 0) {
- DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %a\n", Private->Filename));
- BlockIo->Media->MediaPresent = FALSE;
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (!BlockIo->Media->MediaPresent) {
- //
- // BugBug: try to emulate if a CD appears - notify drivers to check it out
- //
- BlockIo->Media->MediaPresent = TRUE;
- EfiReleaseLock (&Private->Lock);
- EfiAcquireLock (&Private->Lock);
- }
-
- //
- // get the size of the file
- //
- Status = SetFilePointer64 (Private, 0, &FileSize, SEEK_END);
- if (EFI_ERROR (Status)) {
- FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
- DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %a\n", Private->Filename));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (Private->NumberOfBlocks == 0) {
- Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);
- Private->LastBlock = Private->NumberOfBlocks - 1;
- Private->Media.LastBlock = Private->LastBlock;
- }
-
- EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
-
- if (FileSize != EndOfFile) {
- //
- // file is not the proper size, change it
- //
- DEBUG ((EFI_D_INIT, "PlOpenBlock: Initializing block device: %a\n", Private->Filename));
-
- //
- // first set it to 0
- //
- Private->UnixThunk->FTruncate (Private->fd, 0);
-
- //
- // then set it to the needed file size (OS will zero fill it)
- //
- Private->UnixThunk->FTruncate (Private->fd, EndOfFile);
- }
-
- DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %a%N\n", Private->Filename));
- Status = EFI_SUCCESS;
-
-Done:
- if (EFI_ERROR (Status)) {
- if (Private->fd >= 0) {
- BlockIo->Reset (BlockIo, FALSE);
- }
- }
-
- EfiReleaseLock (&Private->Lock);
- return Status;
-}
-
-EFI_STATUS
-UnixBlockIoError (
- IN UNIX_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- return EFI_DEVICE_ERROR;
-
-#if 0
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_STATUS Status;
- BOOLEAN ReinstallBlockIoFlag;
-
-
- BlockIo = &Private->BlockIo;
-
- switch (Private->UnixThunk->GetLastError ()) {
-
- case ERROR_NOT_READY:
- Status = EFI_NO_MEDIA;
- BlockIo->Media->ReadOnly = FALSE;
- BlockIo->Media->MediaPresent = FALSE;
- ReinstallBlockIoFlag = FALSE;
- break;
-
- case ERROR_WRONG_DISK:
- BlockIo->Media->ReadOnly = FALSE;
- BlockIo->Media->MediaPresent = TRUE;
- BlockIo->Media->MediaId += 1;
- ReinstallBlockIoFlag = TRUE;
- Status = EFI_MEDIA_CHANGED;
- break;
-
- case ERROR_WRITE_PROTECT:
- BlockIo->Media->ReadOnly = TRUE;
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_WRITE_PROTECTED;
- break;
-
- default:
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_DEVICE_ERROR;
- break;
- }
-
- if (ReinstallBlockIoFlag) {
- BlockIo->Reset (BlockIo, FALSE);
-
- gBS->ReinstallProtocolInterface (
- Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- BlockIo,
- BlockIo
- );
- }
-
- return Status;
-#endif
-}
-
-EFI_STATUS
-UnixBlockIoReadWriteCommon (
- IN UNIX_BLOCK_IO_PRIVATE *Private,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer,
- IN CHAR8 *CallerName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
- CallerName - TODO: add argument description
-
-Returns:
-
- EFI_NO_MEDIA - TODO: Add description for return value
- EFI_MEDIA_CHANGED - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_BAD_BUFFER_SIZE - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINTN BlockSize;
- UINT64 LastBlock;
- INT64 DistanceToMove;
- UINT64 DistanceMoved;
-
- if (Private->fd < 0) {
- Status = UnixBlockIoOpenDevice (Private);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- if (!Private->Media.MediaPresent) {
- DEBUG ((EFI_D_INIT, "%s: No Media\n", CallerName));
- return EFI_NO_MEDIA;
- }
-
- if (Private->Media.MediaId != MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- if ((UINTN) Buffer % Private->Media.IoAlign != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Verify buffer size
- //
- BlockSize = Private->BlockSize;
- if (BufferSize == 0) {
- DEBUG ((EFI_D_INIT, "%s: Zero length read\n", CallerName));
- return EFI_SUCCESS;
- }
-
- if ((BufferSize % BlockSize) != 0) {
- DEBUG ((EFI_D_INIT, "%s: Invalid read size\n", CallerName));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- LastBlock = Lba + (BufferSize / BlockSize) - 1;
- if (LastBlock > Private->LastBlock) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: Attempted to read off end of device\n"));
- return EFI_INVALID_PARAMETER;
- }
- //
- // Seek to End of File
- //
- DistanceToMove = MultU64x32 (Lba, BlockSize);
- Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, SEEK_SET);
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));
- return UnixBlockIoError (Private);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Read BufferSize bytes from Lba into Buffer.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was read correctly from the device.
- EFI_DEVICE_ERROR - The device reported an error while performing the read.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHANGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The read request contains device addresses that are not
- valid for the device.
-
---*/
-{
- UNIX_BLOCK_IO_PRIVATE *Private;
- ssize_t len;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = UnixBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "UnixReadBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- len = Private->UnixThunk->Read (Private->fd, Buffer, BufferSize);
- if (len != BufferSize) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed.\n"));
- Status = UnixBlockIoError (Private);
- goto Done;
- }
-
- //
- // If we wrote then media is present.
- //
- This->Media->MediaPresent = TRUE;
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
- Routine Description:
- Write BufferSize bytes from Lba into Buffer.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was written correctly to the device.
- EFI_WRITE_PROTECTED - The device can not be written to.
- EFI_DEVICE_ERROR - The device reported an error while performing the write.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The write request contains a LBA that is not
- valid for the device.
-
---*/
-{
- UNIX_BLOCK_IO_PRIVATE *Private;
- ssize_t len;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = UnixBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "UnixWriteBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- len = Private->UnixThunk->Write (Private->fd, Buffer, BufferSize);
- if (len != BufferSize) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed.\n"));
- Status = UnixBlockIoError (Private);
- goto Done;
- }
-
- //
- // If the write succeeded, we are not write protected and media is present.
- //
- This->Media->MediaPresent = TRUE;
- This->Media->ReadOnly = FALSE;
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Flush the Block Device.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - All outstanding data was written to the device
- EFI_DEVICE_ERROR - The device reported an error while writting back the data
- EFI_NO_MEDIA - There is no media in the device.
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoResetBlock (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the Block Device.
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
- EFI_DEVICE_ERROR - The device is not functioning properly and could
- not be reset.
-
---*/
-{
- UNIX_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->fd >= 0) {
- Private->UnixThunk->Close (Private->fd);
- Private->fd = -1;
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-UINTN
-Atoi (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Convert a unicode string to a UINTN
-
-Arguments:
-
- String - Unicode string.
-
-Returns:
-
- UINTN of the number represented by String.
-
---*/
-{
- UINTN Number;
- CHAR16 *Str;
-
- //
- // skip preceeding white space
- //
- Str = String;
- while ((*Str) && (*Str == ' ')) {
- Str++;
- }
- //
- // Convert ot a Number
- //
- Number = 0;
- while (*Str != '\0') {
- if ((*Str >= '0') && (*Str <= '9')) {
- Number = (Number * 10) +*Str - '0';
- } else {
- break;
- }
-
- Str++;
- }
-
- return Number;
-}
-
-EFI_STATUS
-SetFilePointer64 (
- IN UNIX_BLOCK_IO_PRIVATE *Private,
- IN INT64 DistanceToMove,
- OUT UINT64 *NewFilePointer,
- IN INT32 MoveMethod
- )
-/*++
-
-This function extends the capability of SetFilePointer to accept 64 bit parameters
-
---*/
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: Private - add argument and description to function comment
-// TODO: DistanceToMove - add argument and description to function comment
-// TODO: NewFilePointer - add argument and description to function comment
-// TODO: MoveMethod - add argument and description to function comment
-{
- EFI_STATUS Status;
- off_t res;
-
- Status = EFI_SUCCESS;
- res = Private->UnixThunk->Lseek(Private->fd, DistanceToMove, MoveMethod);
- if (res == -1) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- if (NewFilePointer != NULL) {
- *NewFilePointer = res;
- }
-
- return Status;
-}
diff --git a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.h b/UnixPkg/UnixBlockIoDxe/UnixBlockIo.h
deleted file mode 100644
index a7e3f96455..0000000000
--- a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixBlockIo.h
-
-Abstract:
-
- Produce block IO abstractions for real devices on your PC using Posix APIs.
- The configuration of what devices to mount or emulate comes from UNIX
- environment variables. The variables must be visible to the Microsoft*
- Developer Studio for them to work.
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#ifndef _UNIX_BLOCK_IO_H_
-#define _UNIX_BLOCK_IO_H_
-
-#include "PiDxe.h"
-#include <Protocol/BlockIo.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include "UnixDxe.h"
-
-#define FILENAME_BUFFER_SIZE 80
-
-//
-// Language supported for driverconfiguration protocol
-//
-#define LANGUAGESUPPORTED "eng"
-
-#define UNIX_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('L', 'X', 'b', 'k')
-typedef struct {
- UINTN Signature;
-
- EFI_LOCK Lock;
-
- char Filename[FILENAME_BUFFER_SIZE];
- UINTN ReadMode;
- UINTN Mode;
-
- int fd;
-
- UINT64 LastBlock;
- UINTN BlockSize;
- UINT64 NumberOfBlocks;
-
- EFI_HANDLE EfiHandle;
- EFI_BLOCK_IO_PROTOCOL BlockIo;
- EFI_BLOCK_IO_MEDIA Media;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
-
-} UNIX_BLOCK_IO_PRIVATE;
-
-#define UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UNIX_BLOCK_IO_PRIVATE, BlockIo, UNIX_BLOCK_IO_PRIVATE_SIGNATURE)
-
-#define LIST_BUFFER_SIZE 512
-
-//
-// Block I/O Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixBlockIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixBlockIoComponentName;
-extern EFI_DRIVER_CONFIGURATION_PROTOCOL gUnixBlockIoDriverConfiguration;
-extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gUnixBlockIoDriverDiagnostics;
-
-//
-// EFI Driver Binding Functions
-//
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBlockIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SetFilePointer64 (
- IN UNIX_BLOCK_IO_PRIVATE *Private,
- IN INT64 DistanceToMove,
- OUT UINT64 *NewFilePointer,
- IN INT32 MoveMethod
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- DistanceToMove - TODO: add argument description
- NewFilePointer - TODO: add argument description
- MoveMethod - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINTN
-Atoi (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf b/UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
deleted file mode 100644
index fbdbdd713d..0000000000
--- a/UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
+++ /dev/null
@@ -1,69 +0,0 @@
-## @file
-# Block Io driver
-#
-# Produce block IO abstractions for real devices on your PC using Unix APIs.
-# The configuration of what devices to mount or emulate comes from
-# environment variables.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixBlockIo
- FILE_GUID = f3085888-8985-11db-9c93-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixBlockIo
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixBlockIoDriverBinding
-# COMPONENT_NAME = gUnixBlockIoComponentName
-# DRIVER_DIAG = gUnixBlockIoDriverDiagnostics
-#
-
-[Sources]
- DriverDiagnostics.c
- DriverConfiguration.c
- ComponentName.c
- UnixBlockIo.c
- UnixBlockIo.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiUnixPhysicalDisksGuid # SOMETIMES_CONSUMED
- gEfiUnixVirtualDisksGuid # ALWAYS_CONSUMED
-
-
-[Protocols]
- gEfiBlockIoProtocolGuid # PROTOCOL BY_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
diff --git a/UnixPkg/UnixBusDriverDxe/ComponentName.c b/UnixPkg/UnixBusDriverDxe/ComponentName.c
deleted file mode 100644
index 432c6d87bc..0000000000
--- a/UnixPkg/UnixBusDriverDxe/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixBusDriver.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName = {
- UnixBusDriverComponentNameGetDriverName,
- UnixBusDriverComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixBusDriverNameTable[] = {
- { "eng", L"Unix Bus Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixBusDriverComponentName.SupportedLanguages,
- mUnixBusDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UNIX_IO_DEVICE *Private;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixBusDriverBinding.DriverBindingHandle,
- &gEfiUnixThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // This is a bus driver, so ChildHandle can not be NULL.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiUnixThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiUnixIoProtocolGuid,
- (VOID**)&UnixIo,
- gUnixBusDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_IO_DEVICE_FROM_THIS (UnixIo);
-
- return LookupUnicodeString (
- Language,
- gUnixBusDriverComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixBusDriverDxe/EntryPoint.c b/UnixPkg/UnixBusDriverDxe/EntryPoint.c
deleted file mode 100644
index b226e29aa4..0000000000
--- a/UnixPkg/UnixBusDriverDxe/EntryPoint.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-
-
-#include "UnixBusDriver.h"
-
-/**
- The user Entry Point for module UnixBusDriver. The user code starts with this function.
-
- @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
-InitializeUnixBusDriver(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixBusDriverBinding,
- ImageHandle,
- &gUnixBusDriverComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c
deleted file mode 100644
index e1ec083822..0000000000
--- a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/*+++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixBusDriver.c
-
-Abstract:
-
-This following section documents the environment variables for the UNIX
-build. These variables are used to define the (virtual) hardware
-configuration of the UNIX environment
-
-A ! can be used to seperate multiple instances in a variable. Each
-instance represents a seperate hardware device.
-
-EFI_UNIX_PHYSICAL_DISKS - maps to drives on your system
-EFI_UNIX_VIRTUAL_DISKS - maps to a device emulated by a file
-EFI_UNIX_FILE_SYSTEM - mouts a directory as a file system
-EFI_UNIX_CONSOLE - make a logical comand line window (only one!)
-EFI_UNIX_UGA - Builds UGA Windows of Width and Height
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- UNIX envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_UNIX_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_UNIX_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_UNIX_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_UNIX_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use UNIX to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=Z:RO;307200;2048
-
- EFI_UNIX_FILE_SYSTEM =
- <directory path>[!...]
-
- Mounting the two directories C:\FOO and C:\BAR would look like:
- EFI_UNIX_FILE_SYSTEM=c:\foo!c:\bar
-
- EFI_UNIX_CONSOLE =
- <window title>
-
- Declaring a text console window with the title "My EFI Console" woild look like:
- EFI_UNIX_CONSOLE=My EFI Console
-
- EFI_UNIX_UGA =
- <width> <height>[!...]
-
- Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
- Example : EFI_UNIX_UGA=800 600!1024 768
-
- EFI_UNIX_PASS_THROUGH =
- <BaseAddress>;<Bus#>;<Device#>;<Function#>
-
- Declaring a base address of 0xE0000000 (used for PCI Express devices)
- and having NT32 talk to a device located at bus 0, device 1, function 0:
- Example : EFI_UNIX_PASS_THROUGH=E000000;0;1;0
-
----*/
-
-#include "UnixBusDriver.h"
-
-//
-// Define GUID for the Unix Bus Driver
-//
-EFI_GUID gUnixBusDriverGuid = {
- 0x419f582, 0x625, 0x4531, {0x8a, 0x33, 0x85, 0xa9, 0x96, 0x5c, 0x95, 0xbc}
-};
-
-//
-// DriverBinding protocol global
-//
-EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding = {
- UnixBusDriverBindingSupported,
- UnixBusDriverBindingStart,
- UnixBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-#define UNIX_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(UNIX_PCD_ENTRY))
-
-//
-// Table to map UNIX Environment variable to the GUID that should be in
-// device path.
-//
-UNIX_PCD_ENTRY mPcdEnvironment[] = {
- {PcdToken(PcdUnixConsole), &gEfiUnixConsoleGuid},
- {PcdToken(PcdUnixUga), &gEfiUnixUgaGuid},
- {PcdToken(PcdUnixGop), &gEfiUnixGopGuid},
- {PcdToken(PcdUnixFileSystem), &gEfiUnixFileSystemGuid},
- {PcdToken(PcdUnixSerialPort), &gEfiUnixSerialPortGuid},
- {PcdToken(PcdUnixVirtualDisk), &gEfiUnixVirtualDisksGuid},
- {PcdToken(PcdUnixPhysicalDisk), &gEfiUnixPhysicalDisksGuid},
- {PcdToken(PcdUnixCpuModel), &gEfiUnixCPUModelGuid},
- {PcdToken(PcdUnixCpuSpeed), &gEfiUnixCPUSpeedGuid},
- {PcdToken(PcdUnixMemorySize), &gEfiUnixMemoryGuid},
- {PcdToken(PcdUnixNetworkInterface), &gEfiUnixNetworkGuid}
-};
-
-VOID *
-AllocateMemory (
- IN UINTN Size
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- Size,
- (VOID *)&Buffer
- );
- if (EFI_ERROR (Status)) {
- ASSERT (FALSE);
- return NULL;
- }
- return Buffer;
-}
-
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- UINTN Index;
-
- //
- // Check the contents of the first Device Path Node of RemainingDevicePath to make sure
- // it is a legal Device Path Node for this bus driver's children.
- //
- if (RemainingDevicePath != NULL) {
- //
- // Check if RemainingDevicePath is the End of Device Path Node,
- // if yes, go on checking other conditions
- //
- if (!IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath isn't the End of Device Path Node,
- // check its validation
- //
- if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||
- RemainingDevicePath->SubType != HW_VENDOR_DP ||
- DevicePathNodeLength(RemainingDevicePath) != sizeof(UNIX_VENDOR_DEVICE_PATH_NODE)) {
- return EFI_UNSUPPORTED;
- }
-
- for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {
- if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {
- break;
- }
- }
-
- if (Index >= UNIX_PCD_ARRAY_SIZE) {
- return EFI_UNSUPPORTED;
- }
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- (VOID **)&UnixThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- //
- // Open the EFI Device Path protocol needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Since we call through UnixThunk we need to make sure it's valid
- //
- Status = EFI_SUCCESS;
- if (UnixThunk->Signature != EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) {
- Status = EFI_UNSUPPORTED;
- }
-
- //
- // Close protocol, don't use device path protocol in the Support() function
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS InstallStatus;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- UNIX_BUS_DEVICE *UnixBusDevice;
- UNIX_IO_DEVICE *UnixDevice;
- UINTN Index;
- CHAR16 *StartString;
- CHAR16 *SubString;
- UINT16 Count;
- UINTN StringSize;
- UINT16 ComponentName[MAX_UNIX_ENVIRNMENT_VARIABLE_LENGTH];
- UNIX_VENDOR_DEVICE_PATH_NODE *Node;
- BOOLEAN CreateDevice;
- CHAR16 *TempStr;
- CHAR16 *PcdTempStr;
- UINTN TempStrSize;
-
- Status = EFI_UNSUPPORTED;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **)&ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- (VOID **)&UnixThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_BUS_DEVICE),
- (VOID *) &UnixBusDevice
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UnixBusDevice->Signature = UNIX_BUS_DEVICE_SIGNATURE;
- UnixBusDevice->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gUnixBusDriverComponentName.SupportedLanguages,
- &UnixBusDevice->ControllerNameTable,
- L"Unix Bus Controller"
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gUnixBusDriverGuid,
- UnixBusDevice,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (UnixBusDevice->ControllerNameTable);
- gBS->FreePool (UnixBusDevice);
- return Status;
- }
- }
-
- //
- // Loop on the Variable list. Parse each variable to produce a set of handles that
- // represent virtual hardware devices.
- //
- InstallStatus = EFI_NOT_FOUND;
- for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {
- PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token);
- ASSERT (PcdTempStr != NULL);
-
- TempStrSize = StrLen (PcdTempStr);
- TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);
- StrCpy (TempStr, PcdTempStr);
-
- StartString = TempStr;
-
- //
- // Parse the environment variable into sub strings using '!' as a delimator.
- // Each substring needs it's own handle to be added to the system. This code
- // does not understand the sub string. Thats the device drivers job.
- //
- Count = 0;
- while (*StartString != '\0') {
-
- //
- // Find the end of the sub string
- //
- SubString = StartString;
- while (*SubString != '\0' && *SubString != '!') {
- SubString++;
- }
-
- if (*SubString == '!') {
- //
- // Replace token with '\0' to make sub strings. If this is the end
- // of the string SubString will already point to NULL.
- //
- *SubString = '\0';
- SubString++;
- }
-
- CreateDevice = TRUE;
- if (RemainingDevicePath != NULL) {
- CreateDevice = FALSE;
- //
- // Check if RemainingDevicePath is the End of Device Path Node,
- // if yes, don't create any child device
- //
- if (!IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath isn't the End of Device Path Node,
- // check its validation
- //
- Node = (UNIX_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;
- if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&
- Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&
- DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)
- ) {
- if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&
- Node->Instance == Count
- ) {
- CreateDevice = TRUE;
- }
- }
- }
- }
-
- if (CreateDevice) {
- //
- // Allocate instance structure, and fill in parent information.
- //
- UnixDevice = AllocateMemory (sizeof (UNIX_IO_DEVICE));
- if (UnixDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- UnixDevice->Handle = NULL;
- UnixDevice->ControllerHandle = ControllerHandle;
- UnixDevice->ParentDevicePath = ParentDevicePath;
-
- UnixDevice->UnixIo.UnixThunk = UnixThunk;
-
- //
- // Plus 2 to account for the NULL at the end of the Unicode string
- //
- StringSize = (UINTN) ((UINT8 *) SubString - (UINT8 *) StartString) + sizeof (CHAR16);
- UnixDevice->UnixIo.EnvString = AllocateMemory (StringSize);
- if (UnixDevice->UnixIo.EnvString != NULL) {
- CopyMem (UnixDevice->UnixIo.EnvString, StartString, StringSize);
- }
-
- UnixDevice->ControllerNameTable = NULL;
-
- // FIXME: check size
- StrCpy(ComponentName, UnixDevice->UnixIo.EnvString);
-
- UnixDevice->DevicePath = UnixBusCreateDevicePath (
- ParentDevicePath,
- mPcdEnvironment[Index].DevicePathGuid,
- Count
- );
- if (UnixDevice->DevicePath == NULL) {
- gBS->FreePool (UnixDevice);
- return EFI_OUT_OF_RESOURCES;
- }
-
- AddUnicodeString (
- "eng",
- gUnixBusDriverComponentName.SupportedLanguages,
- &UnixDevice->ControllerNameTable,
- ComponentName
- );
-
- UnixDevice->UnixIo.TypeGuid = mPcdEnvironment[Index].DevicePathGuid;
- UnixDevice->UnixIo.InstanceNumber = Count;
-
- UnixDevice->Signature = UNIX_IO_DEVICE_SIGNATURE;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &UnixDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- UnixDevice->DevicePath,
- &gEfiUnixIoProtocolGuid,
- &UnixDevice->UnixIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (UnixDevice->ControllerNameTable);
- gBS->FreePool (UnixDevice);
- } else {
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- (VOID **)&UnixThunk,
- This->DriverBindingHandle,
- UnixDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (!EFI_ERROR (Status)) {
- InstallStatus = EFI_SUCCESS;
- }
- }
- }
-
- //
- // Parse Next sub string. This will point to '\0' if we are at the end.
- //
- Count++;
- StartString = SubString;
- }
-
- gBS->FreePool (TempStr);
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UNIX_BUS_DEVICE *UnixBusDevice;
- UNIX_IO_DEVICE *UnixDevice;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gUnixBusDriverGuid,
- (VOID **)&UnixBusDevice,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gUnixBusDriverGuid,
- UnixBusDevice,
- NULL
- );
-
- FreeUnicodeStringTable (UnixBusDevice->ControllerNameTable);
-
- gBS->FreePool (UnixBusDevice);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
-
- UnixDevice = UNIX_IO_DEVICE_FROM_THIS (UnixIo);
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- This->DriverBindingHandle,
- UnixDevice->Handle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- UnixDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- UnixDevice->DevicePath,
- &gEfiUnixIoProtocolGuid,
- &UnixDevice->UnixIo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- (VOID **) &UnixThunk,
- This->DriverBindingHandle,
- UnixDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- //
- // Close the child handle
- //
- FreeUnicodeStringTable (UnixDevice->ControllerNameTable);
- gBS->FreePool (UnixDevice);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-UnixBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- )
-/*++
-
-Routine Description:
- Create a device path node using Guid and InstanceNumber and append it to
- the passed in RootDevicePath
-
-Arguments:
- RootDevicePath - Root of the device path to return.
-
- Guid - GUID to use in vendor device path node.
-
- InstanceNumber - Instance number to use in the vendor device path. This
- argument is needed to make sure each device path is unique.
-
-Returns:
-
- EFI_DEVICE_PATH_PROTOCOL
-
---*/
-{
- UNIX_VENDOR_DEVICE_PATH_NODE DevicePath;
-
- DevicePath.VendorDevicePath.Header.Type = HARDWARE_DEVICE_PATH;
- DevicePath.VendorDevicePath.Header.SubType = HW_VENDOR_DP;
- SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (UNIX_VENDOR_DEVICE_PATH_NODE));
-
- //
- // The GUID defines the Class
- //
- CopyMem (&DevicePath.VendorDevicePath.Guid, Guid, sizeof (EFI_GUID));
-
- //
- // Add an instance number so we can make sure there are no Device Path
- // duplication.
- //
- DevicePath.Instance = InstanceNumber;
-
- return AppendDevicePathNode (
- RootDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &DevicePath
- );
-}
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h
deleted file mode 100644
index bf3f6f937f..0000000000
--- a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixBusDriver.h
-
-Abstract:
-
-This following section documents the PCD for the Unix
-build. These variables are used to define the (virtual) hardware
-configuration of the Unix environment
-
-A ! can be used to seperate multiple instances in a variable. Each
-instance represents a seperate hardware device.
-
-EFI_UNIX_PHYSICAL_DISKS - maps to drives on your system
-EFI_UNIX_VIRTUAL_DISKS - maps to a device emulated by a file
-EFI_UNIX_FILE_SYSTEM - mouts a directory as a file system
-EFI_UNIX_CONSOLE - make a logical comand line window (only one!)
-EFI_UNIX_UGA - Builds UGA Windows of Width and Height
-EFI_UNIX_SERIAL_PORT - maps physical serial ports
-EFI_UNIX_PASS_THRU - associates a device with our PCI support
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- UNIX envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_UNIX_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_UNIX_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_UNIX_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_UNIX_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use UNIX to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_UNIX_PHYSICAL_DISKS=Z:RO;307200;2048
-
- EFI_UNIX_FILE_SYSTEM =
- <directory path>[!...]
-
- Mounting the two directories C:\FOO and C:\BAR would look like:
- EFI_UNIX_FILE_SYSTEM=c:\foo!c:\bar
-
- EFI_UNIX_CONSOLE =
- <window title>
-
- Declaring a text console window with the title "My EFI Console" woild look like:
- EFI_UNIX_CONSOLE=My EFI Console
-
- EFI_UNIX_UGA =
- <width> <height>[!...]
-
- Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
- Example : EFI_UNIX_UGA=800 600!1024 768
-
- EFI_UNIX_SERIAL_PORT =
- <port name>[!...]
-
- Declaring two serial ports on COM1 and COM2 would look like:
- Example : EFI_UNIX_SERIAL_PORT=COM1!COM2
-
- EFI_UNIX_PASS_THROUGH =
- <BaseAddress>;<Bus#>;<Device#>;<Function#>
-
- Declaring a base address of 0xE0000000 (used for PCI Express devices)
- and having NT32 talk to a device located at bus 0, device 1, function 0:
- Example : EFI_UNIX_PASS_THROUGH=E000000;0;1;0
-
----*/
-
-#ifndef __UNIX_BUS_DRIVER_H__
-#define __UNIX_BUS_DRIVER_H__
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Protocol/Pcd.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/PcdLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName;
-
-//
-// Unix Bus Driver Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName;
-
-//
-// Unix Bus Controller Structure
-//
-#define UNIX_BUS_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'B', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} UNIX_BUS_DEVICE;
-
-//
-// Unix Child Device Controller Structure
-//
-#define UNIX_IO_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'V', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE Handle;
- EFI_UNIX_IO_PROTOCOL UnixIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // Private data about the parent
- //
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} UNIX_IO_DEVICE;
-
-#define UNIX_IO_DEVICE_FROM_THIS(a) \
- CR(a, UNIX_IO_DEVICE, UnixIo, UNIX_IO_DEVICE_SIGNATURE)
-
-//
-// This is the largest env variable we can parse
-//
-#define MAX_UNIX_ENVIRNMENT_VARIABLE_LENGTH 512
-
-typedef struct {
- UINTN Token;
- EFI_GUID *DevicePathGuid;
-} UNIX_PCD_ENTRY;
-
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Instance;
-} UNIX_VENDOR_DEVICE_PATH_NODE;
-
-EFI_STATUS
-EFIAPI
-CpuIoInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Driver Binding Protocol function prototypes
-//
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ParentHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ParentHandle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Unix Bus Driver private worker functions
-//
-EFI_DEVICE_PATH_PROTOCOL *
-UnixBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootDevicePath - TODO: add argument description
- Guid - TODO: add argument description
- InstanceNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-
-#endif
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
deleted file mode 100644
index b5eb940f42..0000000000
--- a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
+++ /dev/null
@@ -1,94 +0,0 @@
-## @file
-# Unix Bus driver
-#
-# This following section documents the envirnoment variables for the Win NT
-# build. These variables are used to define the (virtual) hardware
-# configuration of the NT environment
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixBusDriver
- FILE_GUID = f320d656-8985-11db-90e0-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixBusDriver
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixBusDriverBinding
-# COMPONENT_NAME = gUnixBusDriverComponentName
-#
-
-[Sources]
- ComponentName.c
- UnixBusDriver.c
- UnixBusDriver.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- DevicePathLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- PcdLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiUnixConsoleGuid # ALWAYS_CONSUMED
- gEfiUnixUgaGuid # ALWAYS_CONSUMED
- gEfiUnixGopGuid # ALWAYS_CONSUMED
- gEfiUnixSerialPortGuid # ALWAYS_CONSUMED
- gEfiUnixFileSystemGuid # ALWAYS_CONSUMED
- gEfiUnixPhysicalDisksGuid # ALWAYS_CONSUMED
- gEfiUnixVirtualDisksGuid # ALWAYS_CONSUMED
- gEfiUnixCPUModelGuid
- gEfiUnixCPUSpeedGuid
- gEfiUnixMemoryGuid
- gEfiUnixNetworkGuid
-
-
-[Protocols]
- gPcdProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiDevicePathProtocolGuid # PROTOCOL TO_START
- gEfiUnixThunkProtocolGuid # PROTOCOL TO_START
- gEfiUnixIoProtocolGuid # PROTOCOL BY_START
-
-
-[Pcd]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel
- gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk
- gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem
- gEfiUnixPkgTokenSpaceGuid.PcdUnixUga
- gEfiUnixPkgTokenSpaceGuid.PcdUnixGop
- gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole
- gEfiUnixPkgTokenSpaceGuid.PcdUnixNetworkInterface
-
diff --git a/UnixPkg/UnixConsoleDxe/ComponentName.c b/UnixPkg/UnixConsoleDxe/ComponentName.c
deleted file mode 100644
index f9bd509826..0000000000
--- a/UnixPkg/UnixConsoleDxe/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++
-
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "Console.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixConsoleComponentName = {
- UnixConsoleComponentNameGetDriverName,
- UnixConsoleComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixConsoleDriverNameTable[] = {
- { "eng", L"Unix Text Console Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UnixConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixConsoleComponentName.SupportedLanguages,
- mUnixConsoleDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixConsoleDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get out context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (void *)&SimpleTextOut,
- gUnixConsoleDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);
-
- return LookupUnicodeString (
- Language,
- gUnixConsoleComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixConsoleDxe/Console.c b/UnixPkg/UnixConsoleDxe/Console.c
deleted file mode 100644
index d96646c596..0000000000
--- a/UnixPkg/UnixConsoleDxe/Console.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Console.c
-
-Abstract:
-
- Console based on Posix APIs.
-
---*/
-
-#include "Console.h"
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixConsoleDriverBinding = {
- UnixConsoleDriverBindingSupported,
- UnixConsoleDriverBindingStart,
- UnixConsoleDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (void *)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure that the Unix Thunk Protocol is valid
- //
- Status = EFI_UNSUPPORTED;
- if (UnixIo->UnixThunk->Signature == EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) {
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (CompareGuid (UnixIo->TypeGuid, &gEfiUnixConsoleGuid)) {
- Status = EFI_SUCCESS;
- }
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // Grab the IO abstraction we need to get any work done
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (void *)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_SIMPLE_TEXT_PRIVATE_DATA),
- (void *)&Private
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- ZeroMem (Private, sizeof (UNIX_SIMPLE_TEXT_PRIVATE_DATA));
-
- Private->Signature = UNIX_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->UnixIo = UnixIo;
- Private->UnixThunk = UnixIo->UnixThunk;
-
- UnixSimpleTextOutOpenWindow (Private);
- UnixSimpleTextInAttachToWindow (Private);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOut,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- return Status;
- }
-
-Done:
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- if (Private != NULL) {
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
-#if 0
- if (Private->NtOutHandle != NULL) {
- Private->UnixThunk->CloseHandle (Private->NtOutHandle);
- }
-#endif
-
- if (Private->SimpleTextIn.WaitForKey != NULL) {
- gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- }
-
- gBS->FreePool (Private);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixConsoleDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_UNSUPPORTED - TODO: Add description for return value
-
---*/
-{
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
- EFI_STATUS Status;
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // Kick people off our interface???
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- (void *)&SimpleTextOut,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);
-
- ASSERT (Private->Handle == Handle);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOut,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
-
- //
- // Shut down our device
- //
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- ASSERT_EFI_ERROR (Status);
-
-#if 0
- Private->UnixThunk->CloseHandle (Private->NtOutHandle);
-#endif
- //
- // DO NOT close Private->NtInHandle. It points to StdIn and not
- // the Private->NtOutHandle is StdIn and should not be closed!
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- gBS->FreePool (Private);
- }
-
- return Status;
-}
diff --git a/UnixPkg/UnixConsoleDxe/Console.h b/UnixPkg/UnixConsoleDxe/Console.h
deleted file mode 100644
index dd80a637e0..0000000000
--- a/UnixPkg/UnixConsoleDxe/Console.h
+++ /dev/null
@@ -1,519 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Console.h
-
-Abstract:
-
- Console based on Posix APIs.
-
- This file attaches a SimpleTextIn protocol to a previously open window.
-
- The constructor for this protocol depends on an open window. Currently
- the SimpleTextOut protocol creates a window when it's constructor is called.
- Thus this code must run after the constructor for the SimpleTextOut
- protocol
-
---*/
-
-#ifndef _CONSOLE_H_
-#define _CONSOLE_H_
-
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include <Protocol/UnixIo.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextOut.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixConsoleDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixConsoleComponentName;
-
-#define UNIX_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE \
- SIGNATURE_32('U','X','s','c')
-
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
-
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutMode;
-
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
-
- //
- // SimpleTextOut Private Data including Posix types.
- //
- // HANDLE NtOutHandle;
- // HANDLE NtInHandle;
-
- //COORD MaxScreenSize;
- //COORD Position;
- //WORD Attribute;
- BOOLEAN CursorEnable;
-
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} UNIX_SIMPLE_TEXT_PRIVATE_DATA;
-
-#define UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UNIX_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextOut, UNIX_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)
-
-#define UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UNIX_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextIn, UNIX_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)
-
-//
-// Console Globale Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixConsoleDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixConsoleComponentName;
-
-typedef struct {
- UINTN ColumnsX;
- UINTN RowsY;
-} UNIX_SIMPLE_TEXT_OUT_MODE;
-
-#if 0
-//
-// Simple Text Out protocol member functions
-//
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutReset (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
- Columns - TODO: add argument description
- Rows - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Attribute - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Column - TODO: add argument description
- Row - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
-//
-// Simple Text Out constructor and destructor.
-//
-EFI_STATUS
-UnixSimpleTextOutOpenWindow (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixSimpleTextOutCloseWindow (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#if 0
-//
-// Simple Text In protocol member functions.
-//
-EFI_STATUS
-EFIAPI
-UnixSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-EFIAPI
-UnixSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
-//
-// Simple Text In constructor
-//
-EFI_STATUS
-UnixSimpleTextInAttachToWindow (
- IN UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Main Entry Point
-//
-EFI_STATUS
-EFIAPI
-InitializeUnixConsole (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-AppendDevicePathInstanceToVar (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- VariableName - TODO: add argument description
- DevicePathInstance - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/UnixPkg/UnixConsoleDxe/ConsoleIn.c b/UnixPkg/UnixConsoleDxe/ConsoleIn.c
deleted file mode 100644
index 08100bc000..0000000000
--- a/UnixPkg/UnixConsoleDxe/ConsoleIn.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*++
-
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleIn.c
-
-Abstract:
-
- Console based on Posix APIs.
-
- This file attaches a SimpleTextIn protocol to a previously open window.
-
- The constructor for this protocol depends on an open window. Currently
- the SimpleTextOut protocol creates a window when it's constructor is called.
- Thus this code must run after the constructor for the SimpleTextOut
- protocol
-
---*/
-
-#include "Console.h"
-#include <sys/poll.h>
-
-//
-// Private worker functions
-//
-EFI_STATUS
-UnixSimpleTextInCheckKey (
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- );
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UnixConvertInputRecordToEfiKey (
- IN char c,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- InputRecord - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Key->ScanCode = 0;
- if (c == '\n')
- c = '\r';
- Key->UnicodeChar = c;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
- char c;
-
- Private = UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);
-
- Status = UnixSimpleTextInCheckKey (Private);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Private->UnixThunk->Read (0, &c, 1) != 1)
- return EFI_NOT_READY;
- Status = UnixConvertInputRecordToEfiKey (c, Key);
-
- return Status;
-}
-
-VOID
-EFIAPI
-UnixSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
- EFI_STATUS Status;
-
- Private = (UNIX_SIMPLE_TEXT_PRIVATE_DATA *) Context;
- Status = UnixSimpleTextInCheckKey (Private);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (Event);
- }
-}
-
-EFI_STATUS
-UnixSimpleTextInCheckKey (
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- struct pollfd pfd;
-
- pfd.fd = 0;
- pfd.events = POLLIN;
- if (Private->UnixThunk->Poll (&pfd, 1, 0) <= 0) {
- return EFI_NOT_READY;
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UnixSimpleTextInAttachToWindow (
- IN UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- Private->SimpleTextIn.Reset = UnixSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = UnixSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/UnixPkg/UnixConsoleDxe/ConsoleOut.c b/UnixPkg/UnixConsoleDxe/ConsoleOut.c
deleted file mode 100644
index 0244e0bdc5..0000000000
--- a/UnixPkg/UnixConsoleDxe/ConsoleOut.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*++
-
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleOut.c
-
-Abstract:
-
- Console based on Posix APIs.
-
- This file creates an Posix window and attaches a SimpleTextOut protocol.
-
---*/
-
-#include "Console.h"
-//
-// Private worker functions.
-//
-
-#if 0
-VOID
-UnixSimpleTextOutScrollScreen (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console
- );
-
-#endif
-VOID
-UnixSimpleTextOutPutChar (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console,
- IN CHAR16 Char
- );
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
- );
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber
- );
-
-//
-// Modeule Global for Simple Text Out Mode.
-//
-#define MAX_SIMPLE_TEXT_OUT_MODE \
- (sizeof(mUnixSimpleTextOutSupportedModes)/sizeof(UNIX_SIMPLE_TEXT_OUT_MODE))
-
-UNIX_SIMPLE_TEXT_OUT_MODE mUnixSimpleTextOutSupportedModes[] = {
- { 80, 25 },
-#if 0
- { 80, 50 },
- { 80, 43 },
- { 100, 100 },
- { 100, 999 }
-#endif
-};
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutReset (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- UnixSimpleTextOutSetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
-
- UnixSimpleTextOutSetMode (This, 0);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
- CHAR16 *Str;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- for (Str = String; *Str != '\0'; Str++) {
- switch (*Str) {
-#if 0
- case '\n':
- if (Private->Position.Y == (Private->MaxScreenSize.Y - 1)) {
- UnixSimpleTextOutScrollScreen (Private);
- }
-
- if (Private->Position.Y < (Private->MaxScreenSize.Y - 1)) {
- Private->Position.Y++;
- This->Mode->CursorRow++;
- }
- break;
-
- case '\r':
- Private->Position.X = 0;
- This->Mode->CursorColumn = 0;
- break;
-
- case '\b':
- if (Private->Position.X > 0) {
- Private->Position.X--;
- This->Mode->CursorColumn--;
- }
- break;
-
-#endif
- default:
- UnixSimpleTextOutPutChar (Private, *Str);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-UnixSimpleTextOutPutChar (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console,
- IN CHAR16 Char
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
- Char - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- char c = Char;
- Console->UnixThunk->Write (1, &c, 1);
-}
-
-#if 0
-VOID
-UnixSimpleTextOutScrollScreen (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
-}
-#endif
-
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // BugBug: The correct answer would be a function of what code pages
- // are currently loaded? For now we will just return success.
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
- Columns - TODO: add argument description
- Rows - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Columns = mUnixSimpleTextOutSupportedModes[ModeNumber].ColumnsX;
- *Rows = mUnixSimpleTextOutSupportedModes[ModeNumber].RowsY;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {
- return EFI_INVALID_PARAMETER;
- }
-
-
- This->Mode->Mode = (INT32) ModeNumber;
-
- This->EnableCursor (This, TRUE);
- This->ClearScreen (This);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Attribute - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
-#if 0
- Private->Attribute = (WORD) Attribute;
-#endif
- This->Mode->Attribute = (INT32) Attribute;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
- // DWORD ConsoleWindow;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- This->SetCursorPosition (This, 0, 0);
- Private->UnixThunk->Write (1, "\e[2J", 4);
-
-
-#if 0
- Private->UnixThunk->FillConsoleOutputCharacter (
- Private->NtOutHandle,
- ' ',
- Private->MaxScreenSize.X * Private->MaxScreenSize.Y,
- Private->Possition,
- &ConsoleWindow
- );
- Private->UnixThunk->FillConsoleOutputAttribute (
- Private->NtOutHandle,
- Private->Attribute,
- Private->MaxScreenSize.X * Private->MaxScreenSize.Y,
- Private->Possition,
- &ConsoleWindow
- );
-#endif
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Column - TODO: add argument description
- Row - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- char buf[12];
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
-#if 0
- Private->Position.X = (WORD) Column;
-#endif
- This->Mode->CursorColumn = (INT32) Column;
-
-#if 0
- Private->Position.Y = (WORD) Row;
-#endif
- This->Mode->CursorRow = (INT32) Row;
-#if 0
- Private->UnixThunk->SetConsoleCursorPosition (Private->NtOutHandle, Private->Possition);
-#endif
-
- buf[0] = '\e';
- buf[1] = '[';
- buf[2] = '0' + ((Row / 100) % 10);
- buf[3] = '0' + ((Row / 10) % 10);
- buf[4] = '0' + ((Row / 1) % 10);
- buf[5] = ';';
- buf[6] = '0' + ((Column / 100) % 10);
- buf[7] = '0' + ((Column / 10) % 10);
- buf[8] = '0' + ((Column / 1) % 10);
- buf[9] = 'H';
- Private->UnixThunk->Write (1, buf, 10);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private;
-#if 0
- CONSOLE_CURSOR_INFO Info;
-#endif
-
- Private = UNIX_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
- Private->CursorEnable = Enable;
- This->Mode->CursorVisible = Enable;
-
-#if 0
- Private->UnixThunk->GetConsoleCursorInfo (Private->NtOutHandle, &Info);
- Info.bVisible = Enable;
- Private->UnixThunk->SetConsoleCursorInfo (Private->NtOutHandle, &Info);
-#endif
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UnixSimpleTextOutOpenWindow (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
- CHAR16 *WindowName;
-
- //WindowName = Private->UnixIo->EnvString;
-#if 0
- Private->Attribute = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
- if (*WindowName == '?') {
- Private->Attribute = BACKGROUND_RED | FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN;
- WindowName = L"EFI Emulator Error Console";
- }
-#endif
- WindowName = L"EFI Emulator Error Console";
-
- AddUnicodeString (
- "eng",
- gUnixConsoleComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WindowName
- );
-
- //
- // Fill in protocol member functions
- //
- SimpleTextOut = &Private->SimpleTextOut;
- SimpleTextOut->Reset = UnixSimpleTextOutReset;
- SimpleTextOut->OutputString = UnixSimpleTextOutOutputString;
- SimpleTextOut->TestString = UnixSimpleTextOutTestString;
- SimpleTextOut->QueryMode = UnixSimpleTextOutQueryMode;
- SimpleTextOut->SetMode = UnixSimpleTextOutSetMode;
- SimpleTextOut->SetAttribute = UnixSimpleTextOutSetAttribute;
- SimpleTextOut->ClearScreen = UnixSimpleTextOutClearScreen;
- SimpleTextOut->SetCursorPosition = UnixSimpleTextOutSetCursorPosition;
- SimpleTextOut->EnableCursor = UnixSimpleTextOutEnableCursor;
-
- //
- // Initialize SimpleTextOut protocol mode structure
- //
- SimpleTextOut->Mode = &Private->SimpleTextOutMode;
- SimpleTextOut->Mode->MaxMode = MAX_SIMPLE_TEXT_OUT_MODE;
- SimpleTextOut->Mode->Attribute = 0; //FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
-
-#if 0
- //
- // Open the window an initialize it!
- //
- Private->NtOutHandle = Private->UnixThunk->CreateConsoleScreenBuffer (
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL,
- CONSOLE_TEXTMODE_BUFFER,
- NULL
- );
- Private->UnixThunk->SetConsoleTitle (WindowName);
-#endif
-
- return SimpleTextOut->SetMode (SimpleTextOut, 0);
-}
-
-EFI_STATUS
-UnixSimpleTextOutCloseWindow (
- IN OUT UNIX_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
-#if 0
- Console->UnixThunk->CloseHandle (Console->NtOutHandle);
-#endif
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/UnixConsoleDxe/EntryPoint.c b/UnixPkg/UnixConsoleDxe/EntryPoint.c
deleted file mode 100644
index 62d80138bf..0000000000
--- a/UnixPkg/UnixConsoleDxe/EntryPoint.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-
-
-#include "Console.h"
-
-/**
- The user Entry Point for module UnixConsole. The user code starts with this function.
-
- @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
-InitializeUnixConsole(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixConsoleDriverBinding,
- ImageHandle,
- &gUnixConsoleComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixConsoleDxe/UnixConsole.inf b/UnixPkg/UnixConsoleDxe/UnixConsole.inf
deleted file mode 100644
index a3e1313734..0000000000
--- a/UnixPkg/UnixConsoleDxe/UnixConsole.inf
+++ /dev/null
@@ -1,65 +0,0 @@
-## @file
-# Console Dxe driver
-#
-# Simulate console with Unix API
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixConsole
- FILE_GUID = f314a8cc-8985-11db-9f69-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixConsole
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixConsoleDriverBinding
-# COMPONENT_NAME = gUnixConsoleComponentName
-#
-
-[Sources]
- ComponentName.c
- ConsoleOut.c
- ConsoleIn.c
- Console.c
- Console.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Protocols]
- gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
- gEfiSimpleTextOutProtocolGuid # PROTOCOL BY_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
-[Guids]
- gEfiUnixConsoleGuid
diff --git a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c b/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c
deleted file mode 100644
index b135f6dc28..0000000000
--- a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- UnixFwh.c
-
-Abstract:
- PEIM to abstract construction of firmware volume in an Unix environment.
-
-Revision History
-
---*/
-
-#include "PiPei.h"
-#include <Ppi/UnixFwh.h>
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/PcdLib.h>
-
-EFI_STATUS
-EFIAPI
-PeimInitializeUnixFwh (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
- Perform a call-back into the SEC simulator to get address of the Firmware Hub
-
-Arguments:
- FfsHeader - Ffs Header availible to every PEIM
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- UNIX_FWH_PPI *FwhPpi;
- EFI_PHYSICAL_ADDRESS FdBase;
- EFI_PHYSICAL_ADDRESS FdFixUp;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- UINT64 FdSize;
- UINTN Index;
-
- DEBUG ((EFI_D_ERROR, "Unix Firmware Volume PEIM Loaded\n"));
-
- //
- // Get the Fwh Information PPI
- //
- Status = (**PeiServices).LocatePpi (
- PeiServices,
- &gUnixFwhPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&FwhPpi // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Index = 0;
- do {
- //
- // Get information about all the FD's in the system
- //
- Status = FwhPpi->UnixFwh (Index, &FdBase, &FdSize, &FdFixUp);
- if (!EFI_ERROR (Status)) {
- //
- // Assume the FD starts with an FV header
- //
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;
-
- //
- // Make an FV Hob for the first FV in the FD
- //
- BuildFvHob (FdBase, FvHeader->FvLength);
-
- if (Index == 0) {
- //
- // Assume the first FD was produced by the NT32.DSC
- // All these strange offests are needed to keep in
- // sync with the FlashMap and NT32.dsc file
- //
- BuildResourceDescriptorHob (
- EFI_RESOURCE_FIRMWARE_DEVICE,
- (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),
- FdBase,
- (
- FvHeader->FvLength +
- PcdGet32 (PcdFlashNvStorageVariableSize) +
- PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
- PcdGet32 (PcdFlashNvStorageFtwSpareSize) +
- PcdGet32 (PcdUnixFlashNvStorageEventLogSize)
- )
- );
-
- //
- // Hard code the address of the spare block and variable services.
- // Assume it's a hard coded offset from FV0 in FD0.
- //
- FdSize =
- PcdGet32 (PcdFlashNvStorageVariableSize) +
- PcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
- PcdGet32 (PcdFlashNvStorageFtwSpareSize) +
- PcdGet32 (PcdUnixFlashNvStorageEventLogSize);
-
- BuildFvHob (FdFixUp + PcdGet64 (PcdUnixFlashNvStorageVariableBase), FdSize);
- } else {
- //
- // For other FD's just map them in.
- //
- BuildResourceDescriptorHob (
- EFI_RESOURCE_FIRMWARE_DEVICE,
- (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),
- FdBase,
- FdSize
- );
- }
- }
-
- Index++;
- } while (!EFI_ERROR (Status));
-
- return Status;
-}
diff --git a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf b/UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
deleted file mode 100644
index b5f68d7c9d..0000000000
--- a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# Component description file for WinNtFwh module
-#
-# This PEIM will produce the HOB to describe Firmware Volume, Firmware Devices
-# on the NT32 emulator.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixFwh
- FILE_GUID = f40b7864-8985-11db-af21-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = PeimInitializeUnixFwh
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixFwh.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-[Pcd]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
-
-[Ppis]
- gUnixFwhPpiGuid # PPI ALWAYS_CONSUMED
-
-[Depex]
- gUnixFwhPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
-
diff --git a/UnixPkg/UnixFlashMapPei/FlashMap.c b/UnixPkg/UnixFlashMapPei/FlashMap.c
deleted file mode 100644
index 786fdd0bdc..0000000000
--- a/UnixPkg/UnixFlashMapPei/FlashMap.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FlashMap.c
-
-Abstract:
-
- PEIM to build GUIDed HOBs for platform specific flash map
-
---*/
-
-
-#include "PiPei.h"
-
-#include <Guid/SystemNvDataGuid.h>
-#include <Ppi/UnixFwh.h>
-#include <Protocol/FirmwareVolumeBlock.h>
-
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PcdLib.h>
-
-EFI_STATUS
-EFIAPI
-PeimInitializeFlashMap (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
- Build GUIDed HOBs for platform specific flash map
-
-Arguments:
- FfsHeader - A pointer to the EFI_FFS_FILE_HEADER structure.
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
- EFI_STATUS
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_FWH_PPI *UnixFwhPpi;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- EFI_PHYSICAL_ADDRESS FdBase;
- EFI_PHYSICAL_ADDRESS FdFixUp;
- UINT64 FdSize;
-
- DEBUG ((EFI_D_ERROR, "UnixPkg Flash Map PEIM Loaded\n"));
-
- //
- // Get the Fwh Information PPI
- //
- Status = PeiServicesLocatePpi (
- &gUnixFwhPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&UnixFwhPpi // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Assume that FD0 contains the Flash map.
- //
- Status = UnixFwhPpi->UnixFwh (0, &FdBase, &FdSize, &FdFixUp);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdUnixFlashNvStorageVariableBase) + FdFixUp);
- PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdUnixFlashNvStorageFtwWorkingBase) + FdFixUp);
- PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdUnixFlashNvStorageFtwSpareBase) + FdFixUp);
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/UnixFlashMapPei/FlashMap.inf b/UnixPkg/UnixFlashMapPei/FlashMap.inf
deleted file mode 100644
index da9f86182b..0000000000
--- a/UnixPkg/UnixFlashMapPei/FlashMap.inf
+++ /dev/null
@@ -1,70 +0,0 @@
-## @file
-# Component description file for FlashMap PEI module
-#
-# This module installs FlashMap PPI which is used to get flash layout information.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = PeiFlashMap
- FILE_GUID = f417814a-8985-11db-8983-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeFlashMap
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- FlashMap.c
-
-[Packages]
- MdeModulePkg/MdeModulePkg.dec
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- PcdLib
- BaseMemoryLib
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-[Protocols]
- gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-
-[Ppis]
- gUnixFwhPpiGuid # PPI ALWAYS_CONSUMED
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
-
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase
-
-[Depex]
- gPcdPpiGuid
-
diff --git a/UnixPkg/UnixGopDxe/ComponentName.c b/UnixPkg/UnixGopDxe/ComponentName.c
deleted file mode 100644
index 468a80504d..0000000000
--- a/UnixPkg/UnixGopDxe/ComponentName.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixGop.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixGopComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixGopComponentName = {
- UnixGopComponentNameGetDriverName,
- UnixGopComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUnixGopComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UnixGopComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UnixGopComponentNameGetControllerName,
- "en"
-};
-
-
-EFI_UNICODE_STRING_TABLE mUnixGopDriverNameTable[] = {
- { "eng", L"Unix GOP Driver" },
- { NULL , NULL }
-};
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 4646 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mUnixGopDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gUnixGopComponentName)
- );
-}
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 4646 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- GOP_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixGopDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **)&GraphicsOutput,
- gUnixGopDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gUnixGopComponentName)
- );
-
-}
diff --git a/UnixPkg/UnixGopDxe/UnixGop.h b/UnixPkg/UnixGopDxe/UnixGop.h
deleted file mode 100644
index bd29b69538..0000000000
--- a/UnixPkg/UnixGopDxe/UnixGop.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixGop.h
-
-Abstract:
-
- Private data for the Gop driver that is bound to the Unix Thunk protocol
-
---*/
-
-#ifndef _UNIX_UGA_H_
-#define _UNIX_UGA_H_
-
-#include <PiDxe.h>
-#include "UnixDxe.h"
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/GraphicsOutput.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/SimplePointer.h>
-#include "Protocol/UnixUgaIo.h"
-
-#include <Guid/EventGroup.h>
-
-
-
-#define MAX_Q 256
-
-typedef struct {
- UINTN Front;
- UINTN Rear;
- UINTN Count;
- EFI_INPUT_KEY Q[MAX_Q];
-} GOP_QUEUE_FIXED;
-
-#define UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n')
-typedef struct _UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
- UINTN Signature;
- EFI_KEY_DATA KeyData;
- EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
- EFI_EVENT Event;
- LIST_ENTRY NotifyEntry;
-} UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY;
-
-#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
-
-typedef struct {
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
-} GOP_MODE_DATA;
-
-
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixGopComponentName;
-
-#define UNIX_UGA_CLASS_NAME L"UnixGopWindow"
-
-#define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('G', 'o', 'p', 'N')
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
- EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
-
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- EFI_SIMPLE_POINTER_MODE PointerMode;
- //
- // GOP Private Data for QueryMode ()
- //
- GOP_MODE_DATA *ModeData;
-
-
- //
- // UGA Private Data knowing when to start hardware
- //
- BOOLEAN HardwareNeedsStarting;
-
- CHAR16 *WindowName;
-
- GOP_QUEUE_FIXED Queue;
-
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx;
- EFI_KEY_STATE KeyState;
- LIST_ENTRY NotifyList;
-
-
-} GOP_PRIVATE_DATA;
-
-
-#define GOP_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
-
-#define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
-
-#define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
-
-#define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
-
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixGopComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gUnixGopComponentName2;
-
-//
-// Gop Hardware abstraction internal worker functions
-//
-EFI_STATUS
-UnixGopSupported (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- UnixIo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixGopConstructor (
- IN GOP_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixGopDestructor (
- IN GOP_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// EFI 1.1 driver model prototypes for Win UNIX UGA
-//
-
-EFI_STATUS
-EFIAPI
-UnixGopInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GopPrivateAddQ (
- IN GOP_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixGopInitializeSimplePointerForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-#endif
diff --git a/UnixPkg/UnixGopDxe/UnixGop.inf b/UnixPkg/UnixGopDxe/UnixGop.inf
deleted file mode 100644
index e11a709e7c..0000000000
--- a/UnixPkg/UnixGopDxe/UnixGop.inf
+++ /dev/null
@@ -1,73 +0,0 @@
-## @file
-# Uga driver
-#
-# UGA is short hand for Universal Graphics Abstraction protocol.
-# This file is a verision of UgaIo the uses UnixThunk system calls as an IO
-# abstraction. For a PCI device UnixIo would be replaced with
-# a PCI IO abstraction that abstracted a specific PCI device.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixUga
- FILE_GUID = f33cad86-8985-11db-8040-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixGop
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixUgaDriverBinding
-# COMPONENT_NAME = gUnixUgaComponentName
-#
-
-[Sources]
- ComponentName.c
- UnixGopScreen.c
- UnixGopDriver.c
- UnixGopInput.c
- UnixGop.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiEventExitBootServicesGuid # SOMETIMES_CONSUMED Create Event: EVENT_GROUP_GUID
- gEfiUnixGopGuid # ALWAYS_CONSUMED
-
-
-[Protocols]
- gEfiGraphicsOutputProtocolGuid
- gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
- gEfiSimpleTextInputExProtocolGuid # PROTOCOL BY_START
- gEfiSimplePointerProtocolGuid # PROTOCOL BY_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
diff --git a/UnixPkg/UnixGopDxe/UnixGopDriver.c b/UnixPkg/UnixGopDxe/UnixGopDriver.c
deleted file mode 100644
index dd3cd4a54e..0000000000
--- a/UnixPkg/UnixGopDxe/UnixGopDriver.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixGopDriver.c
-
-Abstract:
-
- This file implements the EFI 1.1 Device Driver model requirements for UGA
-
- UGA is short hand for Universal Graphics Abstraction protocol.
-
- This file is a verision of UgaIo the uses UnixThunk system calls as an IO
- abstraction. For a PCI device UnixIo would be replaced with
- a PCI IO abstraction that abstracted a specific PCI device.
-
---*/
-
-#include "UnixGop.h"
-
-
-EFI_STATUS
-FreeNotifyList (
- IN OUT LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- ListHead - The list head
-
-Returns:
-
- EFI_SUCCESS - Free the notify list successfully
- EFI_INVALID_PARAMETER - ListHead is invalid.
-
---*/
-{
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode;
-
- if (ListHead == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- while (!IsListEmpty (ListHead)) {
- NotifyNode = CR (
- ListHead->ForwardLink,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- RemoveEntryList (ListHead->ForwardLink);
- gBS->FreePool (NotifyNode);
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = UnixGopSupported (UnixIo);
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Allocate Private context data for SGO inteface.
- //
- Private = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (GOP_PRIVATE_DATA),
- (VOID **)&Private
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Set up context record
- //
- Private->Signature = GOP_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->UnixThunk = UnixIo->UnixThunk;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gUnixGopComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- UnixIo->EnvString
- );
- AddUnicodeString2 (
- "en",
- gUnixGopComponentName2.SupportedLanguages,
- &Private->ControllerNameTable,
- UnixIo->EnvString,
- FALSE
- );
-
- Private->WindowName = UnixIo->EnvString;
-
- Status = UnixGopConstructor (Private);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Publish the Gop interface to the world
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
- &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
- &gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
-// &gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- if (Private != NULL) {
- //
- // On Error Free back private data
- //
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
- if (Private->SimpleTextIn.WaitForKey != NULL) {
- gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- }
- if (Private->SimpleTextInEx.WaitForKeyEx != NULL) {
- gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);
- }
- FreeNotifyList (&Private->NotifyList);
-
- gBS->FreePool (Private);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixGopDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_NOT_STARTED - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **)&GraphicsOutput,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // If the GOP interface does not exist the driver is not started
- //
- return EFI_NOT_STARTED;
- }
-
- //
- // Get our private context information
- //
- Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
- //
- // Remove the SGO interface from the system
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
- &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
- &gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
-// &gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Shutdown the hardware
- //
- Status = UnixGopDestructor (Private);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);
- ASSERT_EFI_ERROR (Status);
-
- FreeNotifyList (&Private->NotifyList);
-
- gBS->FreePool (Private);
-
- }
-
- return Status;
-}
-
-
-
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixGopDriverBinding = {
- UnixGopDriverBindingSupported,
- UnixGopDriverBindingStart,
- UnixGopDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-
-/**
- The user Entry Point for module UnixGop. The user code starts with this function.
-
- @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
-InitializeUnixGop (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gUnixGopDriverBinding,
- ImageHandle,
- &gUnixGopComponentName,
- &gUnixGopComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
-
diff --git a/UnixPkg/UnixGopDxe/UnixGopInput.c b/UnixPkg/UnixGopDxe/UnixGopInput.c
deleted file mode 100644
index 89087d0160..0000000000
--- a/UnixPkg/UnixGopDxe/UnixGopInput.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
---*/
-
-#include "UnixGop.h"
-
-
-BOOLEAN
-GopPrivateIsKeyRegistered (
- IN EFI_KEY_DATA *RegsiteredData,
- IN EFI_KEY_DATA *InputData
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- RegsiteredData - A pointer to a buffer that is filled in with the keystroke
- state data for the key that was registered.
- InputData - A pointer to a buffer that is filled in with the keystroke
- state data for the key that was pressed.
-
-Returns:
- TRUE - Key be pressed matches a registered key.
- FLASE - Match failed.
-
---*/
-{
- ASSERT (RegsiteredData != NULL && InputData != NULL);
-
- if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
- (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {
- return FALSE;
- }
-
- //
- // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
- //
- if (RegsiteredData->KeyState.KeyShiftState != 0 &&
- RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {
- return FALSE;
- }
- if (RegsiteredData->KeyState.KeyToggleState != 0 &&
- RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {
- return FALSE;
- }
-
- return TRUE;
-
-}
-
-
-VOID
-EFIAPI
-GopPrivateInvokeRegisteredFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- )
-{
- LIST_ENTRY *Link;
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
- GOP_PRIVATE_DATA *Private = (GOP_PRIVATE_DATA *)Context;
-
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
- CurrentNotify = CR (
- Link,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {
- // We could be called at a high TPL so signal an event to call the registered function
- // at a lower TPL.
- gBS->SignalEvent (CurrentNotify->Event);
- }
- }
-}
-
-
-
-//
-// Simple Text In implementation.
-//
-
-/**
- Reset the input device and optionally run diagnostics
-
- @param This Protocol instance pointer.
- @param ExtendedVerification Driver may perform diagnostics on reset.
-
- @retval EFI_SUCCESS The device was reset.
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_KEY_DATA KeyData;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->UgaIo->UgaGetKey (Private->UgaIo, &KeyData) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-
-/**
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existence of a keystroke via WaitForEvent () call.
-
- @param This Protocol instance pointer.
- @param Key A pointer to a buffer that is filled in with the keystroke
- information for the key that was pressed.
-
- @retval EFI_SUCCESS The keystroke information was returned.
- @retval EFI_NOT_READY There was no keystroke data available.
- @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
- hardware errors.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- EFI_KEY_DATA KeyData;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaGetKey(Private->UgaIo, &KeyData);
- CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-
-/**
- SimpleTextIn and SimpleTextInEx Notify Wait Event
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to GOP_PRIVATE_DATA.
-
-**/
-VOID
-EFIAPI
-UnixGopSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (GOP_PRIVATE_DATA *) Context;
- if (Private->UgaIo == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaCheckKey (Private->UgaIo);
- if (!EFI_ERROR (Status)) {
- //
- // If a there is a key in the queue signal our event.
- //
- gBS->SignalEvent (Event);
- }
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-
-//
-// Simple Text Input Ex protocol functions
-//
-
-
-/**
- The Reset() function resets the input device hardware. As part
- of initialization process, the firmware/device will make a quick
- but reasonable attempt to verify that the device is functioning.
- If the ExtendedVerification flag is TRUE the firmware may take
- an extended amount of time to verify the device is operating on
- reset. Otherwise the reset operation is to occur as quickly as
- possible. The hardware verification process is not defined by
- this specification and is left up to the platform firmware or
- driver to implement.
-
- @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
-
- @param ExtendedVerification Indicates that the driver may
- perform a more exhaustive
- verification operation of the
- device during reset.
-
-
- @retval EFI_SUCCESS The device was reset.
-
- @retval EFI_DEVICE_ERROR The device is not functioning
- correctly and could not be reset.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInExResetEx (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the input device and optionaly run diagnostics
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
-
---*/
-{
- GOP_PRIVATE_DATA *Private;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);
-
- return EFI_SUCCESS;
-}
-
-
-
-/**
- The function reads the next keystroke from the input device. If
- there is no pending keystroke the function returns
- EFI_NOT_READY. If there is a pending keystroke, then
- KeyData.Key.ScanCode is the EFI scan code defined in Error!
- Reference source not found. The KeyData.Key.UnicodeChar is the
- actual printable character or is zero if the key does not
- represent a printable character (control key, function key,
- etc.). The KeyData.KeyState is shift state for the character
- reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
- When interpreting the data from this function, it should be
- noted that if a class of printable characters that are
- normally adjusted by shift modifiers (e.g. Shift Key + "f"
- key) would be presented solely as a KeyData.Key.UnicodeChar
- without the associated shift state. So in the previous example
- of a Shift Key + "f" key being pressed, the only pertinent
- data returned would be KeyData.Key.UnicodeChar with the value
- of "F". This of course would not typically be the case for
- non-printable characters such as the pressing of the Right
- Shift Key + F10 key since the corresponding returned data
- would be reflected both in the KeyData.KeyState.KeyShiftState
- and KeyData.Key.ScanCode values. UEFI drivers which implement
- the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
- KeyData.Key and KeyData.KeyState values. These drivers must
- always return the most current state of
- KeyData.KeyState.KeyShiftState and
- KeyData.KeyState.KeyToggleState. It should also be noted that
- certain input devices may not be able to produce shift or toggle
- state information, and in those cases the high order bit in the
- respective Toggle and Shift state fields should not be active.
-
-
- @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
-
- @param KeyData A pointer to a buffer that is filled in with
- the keystroke state data for the key that was
- pressed.
-
-
- @retval EFI_SUCCESS The keystroke information was
- returned.
-
- @retval EFI_NOT_READY There was no keystroke data available.
- EFI_DEVICE_ERROR The keystroke
- information was not returned due to
- hardware errors.
-
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInExReadKeyStrokeEx (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- OUT EFI_KEY_DATA *KeyData
- )
-/*++
-
- Routine Description:
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existance of a keystroke via WaitForEvent () call.
-
- Arguments:
- This - Protocol instance pointer.
- KeyData - A pointer to a buffer that is filled in with the keystroke
- state data for the key that was pressed.
-
- Returns:
- EFI_SUCCESS - The keystroke information was returned.
- EFI_NOT_READY - There was no keystroke data availiable.
- EFI_DEVICE_ERROR - The keystroke information was not returned due to
- hardware errors.
- EFI_INVALID_PARAMETER - KeyData is NULL.
-
---*/
-{
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
- EFI_TPL OldTpl;
-
-
- if (KeyData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaGetKey(Private->UgaIo, KeyData);
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-
-/**
- The SetState() function allows the input device hardware to
- have state settings adjusted.
-
- @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
-
- @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
- set the state for the input device.
-
-
- @retval EFI_SUCCESS The device state was set appropriately.
-
- @retval EFI_DEVICE_ERROR The device is not functioning
- correctly and could not have the
- setting adjusted.
-
- @retval EFI_UNSUPPORTED The device does not support the
- ability to have its state set.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInExSetState (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaKeySetState (Private->UgaIo, KeyToggleState);
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-/**
- SimpleTextIn and SimpleTextInEx Notify Wait Event
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to GOP_PRIVATE_DATA.
-
-**/
-VOID
-EFIAPI
-UnixGopRegisterKeyCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *ExNotify = (UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)Context;
-
- ExNotify->KeyNotificationFn (&ExNotify->KeyData);
-}
-
-
-
-/**
- The RegisterKeystrokeNotify() function registers a function
- which will be called when a specified keystroke will occur.
-
- @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
-
- @param KeyData A pointer to a buffer that is filled in with
- the keystroke information for the key that was
- pressed.
-
- @param KeyNotificationFunction Points to the function to be
- called when the key sequence
- is typed specified by KeyData.
-
-
- @param NotifyHandle Points to the unique handle assigned to
- the registered notification.
-
- @retval EFI_SUCCESS The device state was set
- appropriately.
-
- @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
- data structures.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInExRegisterKeyNotify (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN EFI_KEY_DATA *KeyData,
- IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
- OUT VOID **NotifyHandle
- )
-{
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
- LIST_ENTRY *Link;
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify;
-
- if (KeyData == NULL || KeyNotificationFunction == NULL || NotifyHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);
-
- //
- // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.
- //
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
- CurrentNotify = CR (
- Link,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {
- if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {
- *NotifyHandle = CurrentNotify;
- return EFI_SUCCESS;
- }
- }
- }
-
- //
- // Allocate resource to save the notification function
- //
- NewNotify = (UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY));
- if (NewNotify == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewNotify->Signature = UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE;
- NewNotify->KeyNotificationFn = KeyNotificationFunction;
- CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData));
- InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry);
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- UnixGopRegisterKeyCallback,
- NewNotify,
- NewNotify->Event
- );
- ASSERT_EFI_ERROR (Status);
-
-
- *NotifyHandle = NewNotify;
-
- return EFI_SUCCESS;
-
-}
-
-
-/**
- The UnregisterKeystrokeNotify() function removes the
- notification which was previously registered.
-
- @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
-
- @param NotificationHandle The handle of the notification
- function being unregistered.
-
- @retval EFI_SUCCESS The device state was set appropriately.
-
- @retval EFI_INVALID_PARAMETER The NotificationHandle is
- invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimpleTextInExUnregisterKeyNotify (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN VOID *NotificationHandle
- )
-/*++
-
- Routine Description:
- Remove a registered notification function from a particular keystroke.
-
- Arguments:
- This - Protocol instance pointer.
- NotificationHandle - The handle of the notification function being unregistered.
-
- Returns:
- EFI_SUCCESS - The notification function was unregistered successfully.
- EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
-
---*/
-{
- GOP_PRIVATE_DATA *Private;
- LIST_ENTRY *Link;
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
-
- if (NotificationHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (((UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) NotificationHandle)->Signature != UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);
-
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
- CurrentNotify = CR (
- Link,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- if (CurrentNotify == NotificationHandle) {
- //
- // Remove the notification function from NotifyList and free resources
- //
- RemoveEntryList (&CurrentNotify->NotifyEntry);
-
- gBS->CloseEvent (CurrentNotify->Event);
-
- gBS->FreePool (CurrentNotify);
- return EFI_SUCCESS;
- }
- }
-
- //
- // Can not find the specified Notification Handle
- //
- return EFI_INVALID_PARAMETER;
-}
-
-
-
-/**
- Initialize SimplelTextIn and SimpleTextInEx protocols in the Private
- context structure.
-
- @param Private Context structure to fill in.
-
- @return EFI_SUCCESS Initialization was a success
-
-**/
-EFI_STATUS
-UnixGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- EFI_STATUS Status;
-
- //
- // Initialize Simple Text In protoocol
- //
- Private->SimpleTextIn.Reset = UnixGopSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = UnixGopSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixGopSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
- ASSERT_EFI_ERROR (Status);
-
-
- //
- // Initialize Simple Text In Ex
- //
-
- Private->SimpleTextInEx.Reset = UnixGopSimpleTextInExResetEx;
- Private->SimpleTextInEx.ReadKeyStrokeEx = UnixGopSimpleTextInExReadKeyStrokeEx;
- Private->SimpleTextInEx.SetState = UnixGopSimpleTextInExSetState;
- Private->SimpleTextInEx.RegisterKeyNotify = UnixGopSimpleTextInExRegisterKeyNotify;
- Private->SimpleTextInEx.UnregisterKeyNotify = UnixGopSimpleTextInExUnregisterKeyNotify;
-
- Private->SimpleTextInEx.Reset (&Private->SimpleTextInEx, FALSE);
-
- InitializeListHead (&Private->NotifyList);
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixGopSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextInEx.WaitForKeyEx
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
-
-
-
-
-
-
-
-//
-// Simple Pointer implementation.
-//
-
-
-/**
- Resets the pointer device hardware.
-
- @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
- instance.
- @param ExtendedVerification Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
-
- @retval EFI_SUCCESS The device was reset.
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimplePointerReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_SIMPLE_POINTER_STATE State;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->UgaIo->UgaGetPointerState (Private->UgaIo, &State) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-
-/**
- Retrieves the current state of a pointer device.
-
- @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
- instance.
- @param State A pointer to the state information on the pointer device.
-
- @retval EFI_SUCCESS The state of the pointer device was returned in State.
- @retval EFI_NOT_READY The state of the pointer device has not changed since the last call to
- GetState().
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's
- current state.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixGopSimplePointerGetState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN OUT EFI_SIMPLE_POINTER_STATE *State
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaGetPointerState (Private->UgaIo, State);
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-/**
- SimplePointer Notify Wait Event
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to GOP_PRIVATE_DATA.
-
-**/
-VOID
-EFIAPI
-UnixGopSimplePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (GOP_PRIVATE_DATA *) Context;
- if (Private->UgaIo == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaCheckPointer (Private->UgaIo);
- if (!EFI_ERROR (Status)) {
- //
- // If the pointer state has changed, signal our event.
- //
- gBS->SignalEvent (Event);
- }
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-
-/**
- SimplePointer constructor
-
- @param Private Context structure to fill in.
-
- @retval EFI_SUCCESS Constructor had success
-
-**/
-EFI_STATUS
-UnixGopInitializeSimplePointerForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- EFI_STATUS Status;
-
- //
- // Initialize Simple Pointer protoocol
- //
- Private->PointerMode.ResolutionX = 1;
- Private->PointerMode.ResolutionY = 1;
- Private->PointerMode.ResolutionZ = 1;
- Private->PointerMode.LeftButton = TRUE;
- Private->PointerMode.RightButton = TRUE;
-
- Private->SimplePointer.Reset = UnixGopSimplePointerReset;
- Private->SimplePointer.GetState = UnixGopSimplePointerGetState;
- Private->SimplePointer.Mode = &Private->PointerMode;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixGopSimplePointerWaitForInput,
- Private,
- &Private->SimplePointer.WaitForInput
- );
-
- return Status;
-}
diff --git a/UnixPkg/UnixGopDxe/UnixGopScreen.c b/UnixPkg/UnixGopDxe/UnixGopScreen.c
deleted file mode 100644
index ed2a3e7942..0000000000
--- a/UnixPkg/UnixGopDxe/UnixGopScreen.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixGopScreen.c
-
-Abstract:
-
- This file produces the graphics abstration of UGA. It is called by
- UnixGopDriver.c file which deals with the EFI 1.1 driver model.
- This file just does graphics.
-
---*/
-
-#include "UnixGop.h"
-
-EFI_UNIX_THUNK_PROTOCOL *mUnix;
-EFI_EVENT mGopScreenExitBootServicesEvent;
-
-GOP_MODE_DATA mGopModeData[] = {
- { 800, 600, 0, 0 },
- { 640, 480, 0, 0 },
- { 720, 400, 0, 0 },
- {1024, 768, 0, 0 },
- {1280, 1024, 0, 0 }
- };
-
-
-EFI_STATUS
-UnixGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- );
-
-VOID
-EFIAPI
-KillUgaGopThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// UGA Protocol Member Functions
-//
-
-EFI_STATUS
-EFIAPI
-UnixGopQuerytMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
- )
-{
- GOP_PRIVATE_DATA *Private;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
- if (*Info == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-
- (*Info)->Version = 0;
- (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;
- (*Info)->VerticalResolution = Private->ModeData[ModeNumber].VerticalResolution;
- (*Info)->PixelFormat = PixelBltOnly;
- (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-UnixGopSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
- GOP_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber >= This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
-
- ModeData = &Private->ModeData[ModeNumber];
- This->Mode->Mode = ModeNumber;
- Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
- Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution;
- Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution;
-
- if (Private->HardwareNeedsStarting) {
- Status = UnixGopStartWindow (
- Private,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- ModeData->ColorDepth,
- ModeData->RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareNeedsStarting = FALSE;
- }
-
-
- Status = Private->UgaIo->UgaSize(
- Private->UgaIo,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution
- );
-
-
- Fill.Red = 0x7f;
- Fill.Green = 0x7F;
- Fill.Blue = 0x7f;
- This->Blt (
- This,
- &Fill,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- ModeData->HorizontalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-UnixGopBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_TPL OriginalTPL;
- EFI_STATUS Status;
- UGA_BLT_ARGS GopBltArgs;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // If Delta is zero, then the entire BltBuffer is being used, so Delta
- // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
- // the number of bytes in each row can be computed.
- //
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_UGA_PIXEL);
- }
-
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // Pack UGA Draw protocol parameters to UGA_BLT_ARGS structure to adapt to
- // GopBlt() API of Unix UGA IO protocol.
- //
- GopBltArgs.DestinationX = DestinationX;
- GopBltArgs.DestinationY = DestinationY;
- GopBltArgs.Height = Height;
- GopBltArgs.Width = Width;
- GopBltArgs.SourceX = SourceX;
- GopBltArgs.SourceY = SourceY;
- GopBltArgs.Delta = Delta;
- Status = Private->UgaIo->UgaBlt (
- Private->UgaIo,
- (EFI_UGA_PIXEL *)BltBuffer,
- (EFI_UGA_BLT_OPERATION)BltOperation,
- &GopBltArgs
- );
-
- gBS->RestoreTPL (OriginalTPL);
-
- return Status;
-}
-
-
-//
-// Construction and Destruction functions
-//
-
-EFI_STATUS
-UnixGopSupported (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: UnixIo - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- //
- // Check to see if the IO abstraction represents a device type we support.
- //
- // This would be replaced a check of PCI subsystem ID, etc.
- //
- if (!CompareGuid (UnixIo->TypeGuid, &gEfiUnixGopGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-EFIAPI
-GopPrivateInvokeRegisteredFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-
-EFI_STATUS
-UnixGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-{
- EFI_STATUS Status;
-
- mUnix = Private->UnixThunk;
-
- //
- // Register to be notified on exit boot services so we can destroy the window.
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_CALLBACK,
- KillUgaGopThread,
- Private,
- &mGopScreenExitBootServicesEvent
- );
-
- Status = Private->UnixThunk->UgaCreate (&Private->UgaIo, Private->WindowName);
- if (!EFI_ERROR (Status)) {
- // Register callback to support RegisterKeyNotify()
- Status = Private->UgaIo->UgaRegisterKeyNotify (Private->UgaIo, GopPrivateInvokeRegisteredFunction, Private);
- ASSERT_EFI_ERROR (Status);
- }
- return Status;
-}
-
-EFI_STATUS
-UnixGopConstructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- Private->ModeData = mGopModeData;
-
- Private->GraphicsOutput.QueryMode = UnixGopQuerytMode;
- Private->GraphicsOutput.SetMode = UnixGopSetMode;
- Private->GraphicsOutput.Blt = UnixGopBlt;
-
- //
- // Allocate buffer for Graphics Output Protocol mode information
- //
- Private->GraphicsOutput.Mode = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE));
- if (Private->GraphicsOutput.Mode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
- if (Private->GraphicsOutput.Mode->Info == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
- //
- // Till now, we have no idea about the window size.
- //
- Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
- Private->GraphicsOutput.Mode->Info->Version = 0;
- Private->GraphicsOutput.Mode->Info->HorizontalResolution = 0;
- Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
- Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
- Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
- Private->GraphicsOutput.Mode->FrameBufferSize = 0;
-
- Private->HardwareNeedsStarting = TRUE;
- Private->UgaIo = NULL;
-
- UnixGopInitializeSimpleTextInForWindow (Private);
-
- UnixGopInitializeSimplePointerForWindow (Private);
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-UnixGopDestructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- if (!Private->HardwareNeedsStarting) {
- Private->UgaIo->UgaClose (Private->UgaIo);
- Private->UgaIo = NULL;
- }
-
- //
- // Free graphics output protocol occupied resource
- //
- if (Private->GraphicsOutput.Mode != NULL) {
- if (Private->GraphicsOutput.Mode->Info != NULL) {
- FreePool (Private->GraphicsOutput.Mode->Info);
- }
- FreePool (Private->GraphicsOutput.Mode);
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-KillUgaGopThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- This is the UGA screen's callback notification function for exit-boot-services.
- All we do here is call UnixGopDestructor().
-
-Arguments:
-
- Event - not used
- Context - pointer to the Private structure.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- Status = UnixGopDestructor (Context);
-}
diff --git a/UnixPkg/UnixPkg.dec b/UnixPkg/UnixPkg.dec
deleted file mode 100644
index 7f7d516b43..0000000000
--- a/UnixPkg/UnixPkg.dec
+++ /dev/null
@@ -1,82 +0,0 @@
-## @file
-#
-# This is the Unix Emulation Environment Platform
-#
-# Reference platform implementation using an emulator.
-# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials are licensed and made available
-# under the terms and conditions of the BSD License which accompanies this distribution.
-# The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
-# 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 = EdkUnixPkg
- PACKAGE_GUID = f2805c44-8985-11db-9e98-0040d02b1835
- PACKAGE_VERSION = 0.1
-
-[Includes]
- Include
-
-[LibraryClasses]
- UnixLib|Include/Library/UnixLib.h
-
-[Guids]
- gEfiUnixPkgTokenSpaceGuid = {0xf2b6838c, 0x8985, 0x11db, {0x9d, 0x1c, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixVirtualDisksGuid = {0xf2ba331a, 0x8985, 0x11db, {0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixPhysicalDisksGuid = {0xf2bdcc96, 0x8985, 0x11db, {0x87, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixFileSystemGuid = {0xf2c16b9e, 0x8985, 0x11db, {0x92, 0xc8, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixUgaGuid = {0xf2c8b80e, 0x8985, 0x11db, {0x93, 0xf1, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixGopGuid = {0xbace07c2, 0x8987, 0x11db, {0xa5, 0x9a, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixConsoleGuid = {0xf2cc5d06, 0x8985, 0x11db, {0xbb, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixMemoryGuid = {0xf2d006cc, 0x8985, 0x11db, {0xa4, 0x72, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixCPUModelGuid = {0xf2d3b330, 0x8985, 0x11db, {0x8a, 0xa3, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixCPUSpeedGuid = {0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixSerialPortGuid = {0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x02, 0x15, 0x86, 0x14, 0x90, 0xf3}}
- gEfiUnixSystemConfigGuid = {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
- gEfiUnixNetworkGuid = {0x081603B4, 0x0F1D, 0x4022, {0xB6, 0xFD, 0x4C, 0xE3, 0x5E, 0x09, 0xA1, 0xA6}}
-
-[Ppis]
- gPeiUnixAutoScanPpiGuid = {0xf2ed3d14, 0x8985, 0x11db, {0xb0, 0x57, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gUnixFwhPpiGuid = {0xf2f0dc30, 0x8985, 0x11db, {0xa1, 0x5b, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gUnixPeiLoadFilePpiGuid = {0xf2f48768, 0x8985, 0x11db, {0xb8, 0xda, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gPeiUnixThunkPpiGuid = {0xf2f830f2, 0x8985, 0x11db, {0x80, 0x6b, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
-
-[Protocols]
- gEfiUnixIoProtocolGuid = {0xf2e23f54, 0x8985, 0x11db, {0xac, 0x79, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixUgaIoProtocolGuid = {0xf2e5e2c6, 0x8985, 0x11db, {0xa1, 0x91, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
- gEfiUnixThunkProtocolGuid = {0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
-
-[PcdsFixedAtBuild]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|0x0|UINT64|0x00001014
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|0x0|UINT64|0x00001015
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|0x0|UINT64|0x00001016
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress|0x0|UINT64|0x00001017
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|0x0|UINT64|0x0000100e
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize|0x0|UINT32|0x0000100f
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|0x0|UINT64|0x00001010
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize|0x0|UINT32|0x00001011
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize|0x0|UINT32|0x00001012
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize|0|UINT32|0x00001013
-
-[PcdsFixedAtBuild, PcdsPatchableInModule]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode|1|UINT32|0x00001006
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume|L"..\\Fv\\Fv_Recovery.fd"|VOID*|0x00001009
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySizeForSecMain|L"64!64"|VOID*|0x0000100c
-
-[PcdsDynamic, PcdsDynamicEx]
- gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512"|VOID*|0x00001000
- gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"FW;40960;512"|VOID*|0x00001001
- gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window"|VOID*|0x00001003
- gEfiUnixPkgTokenSpaceGuid.PcdUnixGop|L"GOP Window"|VOID*|0x00001018
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!..\\..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"|VOID*|0x00001004
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"64!64"|VOID*|0x00001005
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model"|VOID*|0x00001007
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000"|VOID*|0x00001008
- gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window"|VOID*|0x0000100a
- gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0"|VOID*|0x00001002
- gEfiUnixPkgTokenSpaceGuid.PcdUnixNetworkInterface|L"en0"|VOID*|0x0000100d
diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc
deleted file mode 100644
index 1ea4eb8b11..0000000000
--- a/UnixPkg/UnixPkg.dsc
+++ /dev/null
@@ -1,337 +0,0 @@
-## @file
-#
-# EFI/Framework Emulation Platform with UEFI HII interface supported.
-#
-# The Emulation Platform can be used to debug individual modules, prior to creating
-# a real platform. This also provides an example for how an DSC is created.
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = Unix
- PLATFORM_GUID = 7b3c1fb4-8986-11db-b5b2-0040d02b1835
- PLATFORM_VERSION = 0.3
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/Unix
- SUPPORTED_ARCHITECTURES = IA32
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = UnixPkg/UnixPkg.fdf
-
-################################################################################
-#
-# SKU Identification section - list of all SKU IDs supported by this Platform.
-#
-################################################################################
-[SkuIds]
- 0|DEFAULT
-
-################################################################################
-#
-# Library Class section - list of all Library Classes needed by this Platform.
-#
-################################################################################
-[LibraryClasses]
- #
- # Entry point
- #
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- #
- # Basic
- #
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- #
- # UEFI & PI
- #
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- #
- # Generic Modules
- #
- UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
- NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
- IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
- UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
- DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
- #
- # Platform
- #
- PlatformBdsLib|UnixPkg/Library/UnixBdsLib/PlatformBds.inf
- #
- # Misc
- #
- DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
-
-[LibraryClasses.common.USER_DEFINED]
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-
-[LibraryClasses.common.PEIM, LibraryClasses.common.PEI_CORE]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- PeCoffGetEntryPointLib|UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
-[LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
-
-[LibraryClasses.common.PEI_CORE]
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
-
-[LibraryClasses.common.DXE_SMM_DRIVER]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
-
-[LibraryClasses.X64]
- BaseLib|UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
-#
-################################################################################
-[PcdsFeatureFlag]
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseOEM|TRUE
-
-[PcdsFixedAtBuild]
- gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize|0x002a0000
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize|0x10000
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume|L"../FV/FV_RECOVERY.fd"
-
-################################################################################
-#
-# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsDynamicDefault.common.DEFAULT]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
-
- gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!../../../../EdkShellBinPkg/Bin/Ia32/Apps"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"disk1.img:FW"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"128!128"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixNetworkInterface|L"en0"
-
-[PcdsDynamicHii.common.DEFAULT]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiGlobalVariableGuid|0x0|80
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"SetupConsoleConfig"|gEfiGlobalVariableGuid|0x4|25
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
-
-###################################################################################################
-#
-# 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]
- ##
- # SEC Phase modules
- ##
- UnixPkg/Sec/SecMain.inf
-
- ##
- # PEI Phase modules
- ##
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- UnixPkg/BootModePei/BootModePei.inf
- UnixPkg/UnixFlashMapPei/FlashMap.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
- UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
- UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
- ##
- # DXE Phase modules
- ##
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- }
- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
-
- UnixPkg/MetronomeDxe/Metronome.inf
- UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
- UnixPkg/ResetRuntimeDxe/Reset.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
- MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
- UnixPkg/UnixThunkDxe/UnixThunk.inf
- UnixPkg/CpuRuntimeDxe/Cpu.inf
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
- UnixPkg/TimerDxe/Timer.inf
- IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
- MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
- IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
- UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
-
- UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
- UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
- UnixPkg/UnixUgaDxe/UnixUga.inf
- UnixPkg/UnixGopDxe/UnixGop.inf
-
- UnixPkg/UnixConsoleDxe/UnixConsole.inf
- UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
- MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
- #
- # Network stack drivers
- #
-!if $(NETWORK_SUPPORT)
- UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
-!endif
- MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
- MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
- MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
- MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
-
-!if $(COMPILE_BINS)
- FatPkg/EnhancedFatDxe/Fat.inf
-!endif
-
diff --git a/UnixPkg/UnixPkg.fdf b/UnixPkg/UnixPkg.fdf
deleted file mode 100644
index 42e73a2fd9..0000000000
--- a/UnixPkg/UnixPkg.fdf
+++ /dev/null
@@ -1,384 +0,0 @@
-## @file
-# This is Unix FDF file with UEFI HII features enabled
-#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-[FD.Fv_Recovery]
-#
-# In OS X PEIMs are really XIP, so we need to make this address match the malloced
-# buffer for the FD (0x41000000). If this address does not match the FV will get
-# relocated in place (works, but not a great idea).
-#
-BaseAddress = 0x41000000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress #The base address of the FLASH Device.
-Size = 0x00300000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize #The size in bytes of the FLASH Device
-ErasePolarity = 1
-BlockSize = 0x10000
-NumBlocks = 0x30
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-0x00000000|0x002e0000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize
-FV = FvRecovery
-
-0x002e0000|0x0000c000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
-#NV_VARIABLE_STORE
-DATA = {
- ## This is the EFI_FIRMWARE_VOLUME_HEADER
- # ZeroVector []
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- # FileSystemGuid: gEfiSystemNvDataFvGuid =
- # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
- 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
- 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
- # FvLength: 0x20000
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- # Signature "_FVH" #Attributes
- 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
- # HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision
- 0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02,
- # Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
- # Blockmap[1]: End
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- ## This is the VARIABLE_STORE_HEADER
- #Signature: gEfiVariableGuid =
- # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
- 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41,
- 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d,
- #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8
- # This can speed up the Variable Dispatch a bit.
- 0xB8, 0xBF, 0x00, 0x00,
- #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
- 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-}
-
-0x002ec000|0x00002000
-#NV_EVENT_LOG
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize
-
-0x002ee000|0x00002000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
-#NV_FTW_WORKING
-DATA = {
- # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEfiSystemNvDataFvGuid =
- # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
- 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
- 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
- # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
- 0x77, 0x13, 0x9B, 0xD7, 0xFE, 0xFF, 0xFF, 0xFF,
- # WriteQueueSize: UINT64
- 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-}
-
-0x002f0000|0x00010000
-#NV_FTW_SPARE
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-[FV.FvRecovery]
-FvAlignment = 16 #FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
-################################################################################
-#
-# The INF statements point to EDK component and EDK II module INF files, which will be placed into this FV image.
-# Parsing tools will scan the INF file to determine the type of component or module.
-# The component or module type is used to reference the standard rules
-# defined elsewhere in the FDF file.
-#
-# The format for INF statements is:
-# INF $(PathAndInfFileName)
-#
-################################################################################
-##
-# PEI Phase modules
-##
-##
-# PEI Apriori file example, more PEIM module added later.
-##
-APRIORI PEI {
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- }
-APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
- INF UnixPkg/MetronomeDxe/Metronome.inf
- }
-INF MdeModulePkg/Core/Pei/PeiMain.inf
-INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
-INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
-INF UnixPkg/BootModePei/BootModePei.inf
-INF UnixPkg/UnixFlashMapPei/FlashMap.inf
-INF UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
-INF UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
-INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
-INF UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
-INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
-##
-# DXE Phase modules
-##
-INF MdeModulePkg/Core/Dxe/DxeMain.inf
-INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF UnixPkg/MetronomeDxe/Metronome.inf
-INF UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
-INF UnixPkg/ResetRuntimeDxe/Reset.inf
-INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-INF UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
-INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
-INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
-INF UnixPkg/UnixThunkDxe/UnixThunk.inf
-INF UnixPkg/CpuRuntimeDxe/Cpu.inf
-INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-INF UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
-INF UnixPkg/TimerDxe/Timer.inf
-INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
-INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
-INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
-INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
-INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
-INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
-INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
-INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
-INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
-INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
-INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
-INF UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
-
-INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-INF UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
-INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
-#INF UnixPkg/UnixUgaDxe/UnixUga.inf
-INF UnixPkg/UnixGopDxe/UnixGop.inf
-
-#INF UnixPkg/UnixConsoleDxe/UnixConsole.inf
-INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
-INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
-INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
-INF UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
-INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
-INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
-#
-# Network stack drivers
-#
-!if $(NETWORK_SUPPORT)
-INF UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
-!endif
-INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
-INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-
-#
-# Build from source or use checked in binary
-#
-!if $(COMPILE_BINS)
-INF FatPkg/EnhancedFatDxe/Fat.inf
-!else
-INF RuleOverride = BINARY USE = IA32 FatBinPkg/EnhancedFatDxe/Fat.inf
-!endif
-
-# If you build GccShellPkg you can source level debug shell
-#FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) {
-# SECTION PE32 =Build/GccShellPkg/DEBUG_XCODE32/IA32/ShellFull.efi
-#}
-INF RuleOverride = BINARY USE = IA32 EdkShellBinPkg/FullShell/FullShell.inf
-
-
-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- COMPRESS PI_STD {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
diff --git a/UnixPkg/UnixPkgX64.dsc b/UnixPkg/UnixPkgX64.dsc
deleted file mode 100644
index a2e5452cf5..0000000000
--- a/UnixPkg/UnixPkgX64.dsc
+++ /dev/null
@@ -1,345 +0,0 @@
-## @file
-#
-# EFI/Framework Emulation Platform with UEFI HII interface supported.
-#
-# The Emulation Platform can be used to debug individual modules, prior to creating
-# a real platform. This also provides an example for how an DSC is created.
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = Unix
- PLATFORM_GUID = 7b3c1fb4-8986-11db-b5b2-0040d02b1835
- PLATFORM_VERSION = 0.3
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/UnixX64
- SUPPORTED_ARCHITECTURES = X64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = UnixPkg/UnixPkgX64.fdf
-
-################################################################################
-#
-# SKU Identification section - list of all SKU IDs supported by this Platform.
-#
-################################################################################
-[SkuIds]
- 0|DEFAULT
-
-################################################################################
-#
-# Library Class section - list of all Library Classes needed by this Platform.
-#
-################################################################################
-[LibraryClasses]
- #
- # Entry point
- #
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- #
- # Basic
- #
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- #
- # UEFI & PI
- #
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- #
- # Generic Modules
- #
- UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
- NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
- IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
- UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
- DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
- OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
- GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
- SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
- CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
- #
- # Platform
- #
- PlatformBdsLib|UnixPkg/Library/UnixBdsLib/PlatformBds.inf
- #
- # Misc
- #
- DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
- LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
-
-[LibraryClasses.common.USER_DEFINED]
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-
-[LibraryClasses.common.PEIM, LibraryClasses.common.PEI_CORE]
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- PeCoffGetEntryPointLib|UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
-
-[LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf
-
-[LibraryClasses.common.PEI_CORE]
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
-
-[LibraryClasses.common.DXE_SMM_DRIVER]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-
-[LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
- OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
- PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
-
-[LibraryClasses.X64]
- # turn off CR3 write so that DXE IPL will not crash emulator
- BaseLib|UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
-#
-################################################################################
-[PcdsFeatureFlag]
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseOEM|TRUE
-
-[PcdsFixedAtBuild]
- gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize|0x002a0000
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize|0x10000
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume|L"../FV/FV_RECOVERY.fd"
-
-################################################################################
-#
-# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
-#
-################################################################################
-
-[PcdsDynamicDefault.common.DEFAULT]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
- gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!../../../../EdkShellBinPkg/Bin/Ia32/Apps"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"disk1.img:FW"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"128!128"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"
- gEfiUnixPkgTokenSpaceGuid.PcdUnixNetworkInterface|L"en0"
-
-[PcdsDynamicHii.common.DEFAULT]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiGlobalVariableGuid|0x0|80
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"SetupConsoleConfig"|gEfiGlobalVariableGuid|0x4|25
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
-
-[BuildOptions]
- # Magic to make system include files work
- XCODE:*_XCLANG_*_CC_FLAGS = -U __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -D __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1060 -D __APPLE__ -I/System/Library/Frameworks -I/Library/Frameworks
- XCODE:*_XCLANG_*_PP_FLAGS = -U __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -D __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1060 -D __APPLE__ -I/System/Library/Frameworks -I/Library/Frameworks
-
-
-###################################################################################################
-#
-# 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]
-!if $(SEC_ONLY)
- ##
- # SEC Phase modules
- ##
- UnixPkg/Sec/SecMain.inf
-!else
- ##
- # PEI Phase modules
- ##
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- UnixPkg/BootModePei/BootModePei.inf
- UnixPkg/UnixFlashMapPei/FlashMap.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
- UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
- UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
- ##
- # DXE Phase modules
- ##
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
- NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
- }
- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
-
- UnixPkg/MetronomeDxe/Metronome.inf
- UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
- UnixPkg/ResetRuntimeDxe/Reset.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
- MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
- UnixPkg/UnixThunkDxe/UnixThunk.inf
- UnixPkg/CpuRuntimeDxe/Cpu.inf
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
- UnixPkg/TimerDxe/Timer.inf
- IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
- MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
- MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
- MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
- MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
- MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
- MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
- MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
- MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
- MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
- IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
- UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
-
- UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
- UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
- UnixPkg/UnixUgaDxe/UnixUga.inf
- UnixPkg/UnixGopDxe/UnixGop.inf
- UnixPkg/UnixConsoleDxe/UnixConsole.inf
- UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
- MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
- #
- # Network stack drivers
- #
-!if $(NETWORK_SUPPORT)
- UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
-!endif
- MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
- MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
- MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
- MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
- MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
- MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
- MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
- MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
-
-!if $(COMPILE_BINS)
- FatPkg/EnhancedFatDxe/Fat.inf
-!endif
-!endif
diff --git a/UnixPkg/UnixPkgX64.fdf b/UnixPkg/UnixPkgX64.fdf
deleted file mode 100644
index 6ac1cdc8a6..0000000000
--- a/UnixPkg/UnixPkgX64.fdf
+++ /dev/null
@@ -1,380 +0,0 @@
-## @file
-# This is Unix FDF file with UEFI HII features enabled
-#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-################################################################################
-#
-# FD Section
-# The [FD] Section is made up of the definition statements and a
-# description of what goes into the Flash Device Image. Each FD section
-# defines one flash "device" image. A flash device image may be one of
-# the following: Removable media bootable image (like a boot floppy
-# image,) an Option ROM image (that would be "flashed" into an add-in
-# card,) a System "Flash" image (that would be burned into a system's
-# flash) or an Update ("Capsule") image that will be used to update and
-# existing system flash.
-#
-################################################################################
-[FD.Fv_Recovery]
-#
-# In OS X PEIMs are really XIP, so we need to make this address match the malloced
-# buffer for the FD (0x41000000). If this address does not match the FV will get
-# relocated in place (works, but not a great idea).
-#
-BaseAddress = 0x102000000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress #The base address of the FLASH Device.
-Size = 0x005a0000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize #The size in bytes of the FLASH Device
-ErasePolarity = 1
-BlockSize = 0x10000
-NumBlocks = 0x5a
-
-################################################################################
-#
-# Following are lists of FD Region layout which correspond to the locations of different
-# images within the flash device.
-#
-# Regions must be defined in ascending order and may not overlap.
-#
-# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
-# the pipe "|" character, followed by the size of the region, also in hex with the leading
-# "0x" characters. Like:
-# Offset|Size
-# PcdOffsetCName|PcdSizeCName
-# RegionType <FV, DATA, or FILE>
-#
-################################################################################
-0x00000000|0x00580000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize
-FV = FvRecovery
-
-0x00580000|0x0000c000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
-#NV_VARIABLE_STORE
-DATA = {
- ## This is the EFI_FIRMWARE_VOLUME_HEADER
- # ZeroVector []
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- # FileSystemGuid: gEfiSystemNvDataFvGuid =
- # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
- 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
- 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
- # FvLength: 0x20000
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- # Signature "_FVH" #Attributes
- 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
- # HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision
- 0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02,
- # Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
- # Blockmap[1]: End
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- ## This is the VARIABLE_STORE_HEADER
- #Signature: gEfiVariableGuid =
- # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
- 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41,
- 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d,
- #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8
- # This can speed up the Variable Dispatch a bit.
- 0xB8, 0xBF, 0x00, 0x00,
- #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
- 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-}
-
-0x0058c000|0x00002000
-#NV_EVENT_LOG
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize
-
-0x0058e000|0x00002000
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
-#NV_FTW_WORKING
-DATA = {
- # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEfiSystemNvDataFvGuid =
- # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
- 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
- 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
- # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
- 0x77, 0x13, 0x9B, 0xD7, 0xFE, 0xFF, 0xFF, 0xFF,
- # WriteQueueSize: UINT64
- 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-}
-
-0x00590000|0x00010000
-#NV_FTW_SPARE
-gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-
-################################################################################
-#
-# FV Section
-#
-# [FV] section is used to define what components or modules are placed within a flash
-# device file. This section also defines order the components and modules are positioned
-# within the image. The [FV] section consists of define statements, set statements and
-# module statements.
-#
-################################################################################
-[FV.FvRecovery]
-FvAlignment = 16 #FV alignment and FV attributes setting.
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-
-################################################################################
-#
-# The INF statements point to EDK component and EDK II module INF files, which will be placed into this FV image.
-# Parsing tools will scan the INF file to determine the type of component or module.
-# The component or module type is used to reference the standard rules
-# defined elsewhere in the FDF file.
-#
-# The format for INF statements is:
-# INF $(PathAndInfFileName)
-#
-################################################################################
-##
-# PEI Phase modules
-##
-##
-# PEI Apriori file example, more PEIM module added later.
-##
-APRIORI PEI {
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- }
-APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
- INF UnixPkg/MetronomeDxe/Metronome.inf
- }
-INF MdeModulePkg/Core/Pei/PeiMain.inf
-INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
-INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
-INF UnixPkg/BootModePei/BootModePei.inf
-INF UnixPkg/UnixFlashMapPei/FlashMap.inf
-INF UnixPkg/UnixAutoScanPei/UnixAutoScan.inf
-INF UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf
-INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
-INF UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
-INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
-##
-# DXE Phase modules
-##
-INF MdeModulePkg/Core/Dxe/DxeMain.inf
-INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF UnixPkg/MetronomeDxe/Metronome.inf
-INF UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
-INF UnixPkg/ResetRuntimeDxe/Reset.inf
-INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-INF UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf
-INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
-INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
-INF UnixPkg/UnixThunkDxe/UnixThunk.inf
-INF UnixPkg/CpuRuntimeDxe/Cpu.inf
-INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-INF UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
-INF UnixPkg/TimerDxe/Timer.inf
-INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
-INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
-INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
-INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
-INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
-INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
-INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
-INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
-INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
-INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
-INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
-INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
-INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
-INF UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
-
-INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-INF UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
-INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
-#INF UnixPkg/UnixUgaDxe/UnixUga.inf
-INF UnixPkg/UnixGopDxe/UnixGop.inf
-#INF UnixPkg/UnixConsoleDxe/UnixConsole.inf
-INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
-INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
-INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
-INF UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
-INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
-INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
-#
-# Network stack drivers
-#
-!if $(NETWORK_SUPPORT)
-INF UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
-!endif
-INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
-INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-
-
-!if $(COMPILE_BINS)
-INF FatPkg/EnhancedFatDxe/Fat.inf
-
- FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) {
- SECTION PE32 =Build/GccShellPkg/DEBUG_UNIXPKG/X64/ShellFull.efi
- }
-!else
-# Used checked in Visual Studio binaries
-INF RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
-INF RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
-!endif
-
-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
- }
-
-
-################################################################################
-#
-# Rules are use with the [FV] section's module INF type to define
-# how an FFS file is created for a given INF file. The following Rule are the default
-# rules for the different module type. User can add the customized rules to define the
-# content of the FFS file.
-#
-################################################################################
-
-
-############################################################################
-# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
-############################################################################
-#
-#[Rule.Common.DXE_DRIVER]
-# FILE DRIVER = $(NAMED_GUID) {
-# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
-# COMPRESS PI_STD {
-# GUIDED {
-# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
-# UI STRING="$(MODULE_NAME)" Optional
-# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
-# }
-# }
-# }
-#
-############################################################################
-
-[Rule.Common.PEI_CORE]
- FILE PEI_CORE = $(NAMED_GUID) {
- PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING ="$(MODULE_NAME)" Optional
- VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.PEIM]
- FILE PEIM = $(NAMED_GUID) {
- PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.DXE_CORE]
- FILE DXE_CORE = $(NAMED_GUID) {
- COMPRESS PI_STD {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
-
-[Rule.Common.UEFI_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.DXE_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.DXE_RUNTIME_DRIVER]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.UEFI_APPLICATION]
- FILE APPLICATION = $(NAMED_GUID) {
- COMPRESS PI_STD {
- GUIDED {
- PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
- }
- }
-
-[Rule.Common.UEFI_DRIVER.BINARY]
- FILE DRIVER = $(NAMED_GUID) {
- DXE_DEPEX DXE_DEPEX Optional |.depex
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
-[Rule.Common.UEFI_APPLICATION.BINARY]
- FILE APPLICATION = $(NAMED_GUID) {
- PE32 PE32 |.efi
- UI STRING="$(MODULE_NAME)" Optional
- VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
- }
-
diff --git a/UnixPkg/UnixSerialIoDxe/ComponentName.c b/UnixPkg/UnixSerialIoDxe/ComponentName.c
deleted file mode 100644
index 833be2e4a5..0000000000
--- a/UnixPkg/UnixSerialIoDxe/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixSerialIo.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixSerialIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixSerialIoComponentName = {
- UnixSerialIoComponentNameGetDriverName,
- UnixSerialIoComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixSerialIoDriverNameTable[] = {
- { "eng", L"Unix Serial I/O Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixSerialIoComponentName.SupportedLanguages,
- mUnixSerialIoDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixSerialIoDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // This is a bus driver, so ChildHandle must not be NULL.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID**)&SerialIo,
- gUnixSerialIoDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);
-
- return LookupUnicodeString (
- Language,
- gUnixSerialIoComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixSerialIoDxe/EntryPoint.c b/UnixPkg/UnixSerialIoDxe/EntryPoint.c
deleted file mode 100644
index 06056df1f9..0000000000
--- a/UnixPkg/UnixSerialIoDxe/EntryPoint.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-#include "UnixSerialIo.h"
-
-/**
- The user Entry Point for module UnixSerialIo. The user code starts with this function.
-
- @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
-InitializeUnixSerialIo(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixSerialIoDriverBinding,
- ImageHandle,
- &gUnixSerialIoComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
deleted file mode 100644
index b197ae624a..0000000000
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
+++ /dev/null
@@ -1,1704 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSerialIo.c
-
-Abstract:
-
- Our DriverBinding member functions operate on the handles
- created by the NT Bus driver.
-
- Handle(1) - UnixIo - DevicePath(1)
-
- If a serial port is added to the system this driver creates a new handle.
- The new handle is required, since the serial device must add an UART device
- pathnode.
-
- Handle(2) - SerialIo - DevicePath(1)\UART
-
- The driver then adds a gEfiUnixSerialPortGuid as a protocol to Handle(1).
- The instance data for this protocol is the private data used to create
- Handle(2).
-
- Handle(1) - UnixIo - DevicePath(1) - UnixSerialPort
-
- If the driver is unloaded Handle(2) is removed from the system and
- gEfiUnixSerialPortGuid is removed from Handle(1).
-
- Note: Handle(1) is any handle created by the Win NT Bus driver that is passed
- into the DriverBinding member functions of this driver. This driver requires
- a Handle(1) to contain a UnixIo protocol, a DevicePath protocol, and
- the TypeGuid in the UnixIo must be gEfiUnixSerialPortGuid.
-
- If Handle(1) contains a gEfiUnixSerialPortGuid protocol then the driver is
- loaded on the device.
-
---*/
-
-#include "UnixSerialIo.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = {
- UnixSerialIoDriverBindingSupported,
- UnixSerialIoDriverBindingStart,
- UnixSerialIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-/**
- Check the device path node whether it's the Flow Control node or not.
-
- @param[in] FlowControl The device path node to be checked.
-
- @retval TRUE It's the Flow Control node.
- @retval FALSE It's not.
-
-**/
-BOOLEAN
-IsUartFlowControlNode (
- IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
- )
-{
- return (BOOLEAN) (
- (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
- (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
- );
-}
-
-/**
- Check the device path node whether it contains Flow Control node or not.
-
- @param[in] DevicePath The device path to be checked.
-
- @retval TRUE It contains the Flow Control node.
- @retval FALSE It doesn't.
-
-**/
-BOOLEAN
-ContainsFlowControl (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- while (!IsDevicePathEnd (DevicePath)) {
- if (IsUartFlowControlNode ((UART_FLOW_CONTROL_DEVICE_PATH *) DevicePath)) {
- return TRUE;
- }
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- return FALSE;
-}
-
-UINTN
-ConvertBaud2Unix (
- UINT64 BaudRate
- )
-{
- switch (BaudRate) {
- case 0:
- return 0; // Don't use B0 as it is also used in EFI #includes as a name so termios.h #define
- // can break the build.
- case 50:
- return B50;
- case 75:
- return B75;
- case 110:
- return B110;
- case 134:
- return B134;
- case 150:
- return B150;
- case 200:
- return B200;
- case 300:
- return B300;
- case 600:
- return B600;
- case 1200:
- return B1200;
- case 1800:
- return B1800;
- case 2400:
- return B2400;
- case 4800:
- return B4800;
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- case __MAX_BAUD:
- default:
- DEBUG ((EFI_D_ERROR, "Invalid Baud Rate Parameter!\r\n"));
- }
- return -1;
-}
-
-UINTN
-ConvertByteSize2Unix (
- UINT8 DataBit
- )
-{
- switch (DataBit) {
- case 5:
- return CS5;
- case 6:
- return CS6;
- case 7:
- return CS7;
- case 8:
- return CS8;
- default:
- DEBUG ((EFI_D_ERROR, "Invalid Data Size Parameter!\r\n"));
- }
- return -1;
-}
-
-VOID
-ConvertParity2Unix (
- struct termios *Options,
- EFI_PARITY_TYPE Parity
- )
-{
- switch (Parity) {
- case NoParity:
- Options->c_cflag &= ~PARENB;
- break;
- case EvenParity:
- Options->c_cflag |= PARENB;
- break;
- case OddParity:
- Options->c_cflag |= PARENB;
- Options->c_cflag |= PARODD;
- break;
- case MarkParity:
- Options->c_cflag = PARENB | CMSPAR | PARODD;
- break;
- case SpaceParity:
- Options->c_cflag |= PARENB | CMSPAR;
- Options->c_cflag &= ~PARODD;
- break;
- default:
- DEBUG ((EFI_D_ERROR, "Invalid Parity Parameter!\r\n"));
- }
-}
-
-VOID
-ConvertStopBit2Unix (
- struct termios *Options,
- EFI_STOP_BITS_TYPE StopBits
- )
-{
- switch (StopBits) {
- case TwoStopBits:
- Options->c_cflag |= CSTOPB;
- break;
- case OneStopBit:
- case OneFiveStopBits:
- case DefaultStopBits:
- Options->c_cflag &= ~CSTOPB;
- }
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- The implementation of EFI_DRIVER_BINDING_PROTOCOL.EFI_DRIVER_BINDING_SUPPORTED.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UART_DEVICE_PATH *UartNode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- BOOLEAN RemainingDevicePathContainsFlowControl;
-
- //
- // Check RemainingDevicePath validation
- //
- if (RemainingDevicePath != NULL) {
- //
- // Check if RemainingDevicePath is the End of Device Path Node,
- // if yes, go on checking other conditions
- //
- if (!IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath isn't the End of Device Path Node,
- // check its validation
- //
- Status = EFI_UNSUPPORTED;
- UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;
- if (UartNode->Header.Type != MESSAGING_DEVICE_PATH ||
- UartNode->Header.SubType != MSG_UART_DP ||
- DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) {
- goto Error;
- }
- if (UartNode->BaudRate < 0 || UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {
- goto Error;
- }
- if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) {
- goto Error;
- }
- if (UartNode->DataBits < 5 || UartNode->DataBits > 8) {
- goto Error;
- }
- if (UartNode->StopBits < OneStopBit || UartNode->StopBits > TwoStopBits) {
- goto Error;
- }
- if ((UartNode->DataBits == 5) && (UartNode->StopBits == TwoStopBits)) {
- goto Error;
- }
- if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {
- goto Error;
- }
-
- FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (UartNode);
- if (IsUartFlowControlNode (FlowControlNode)) {
- //
- // If the second node is Flow Control Node,
- // return error when it request other than hardware flow control.
- //
- if ((FlowControlNode->FlowControlMap & ~UART_FLOW_CONTROL_HARDWARE) != 0) {
- goto Error;
- }
- }
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID**)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- if (RemainingDevicePath == NULL || IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath is NULL or is the End of Device Path Node
- //
- return EFI_SUCCESS;
- }
- //
- // When the driver has produced device path with flow control node but RemainingDevicePath only contains UART node,
- // return unsupported, and vice versa.
- //
- Status = gBS->OpenProtocolInformation (
- Handle,
- &gEfiUnixIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // See if RemainingDevicePath has a Flow Control device path node
- //
- RemainingDevicePathContainsFlowControl = ContainsFlowControl (RemainingDevicePath);
-
- for (Index = 0; Index < EntryCount; Index++) {
- if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- if (RemainingDevicePathContainsFlowControl ^ ContainsFlowControl (DevicePath)) {
- Status = EFI_UNSUPPORTED;
- }
- }
- break;
- }
- }
- FreePool (OpenInfoBuffer);
- return Status;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Open the EFI Device Path protocol needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&ParentDevicePath,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close protocol, don't use device path protocol in the Support() function
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Make sure that the Unix Thunk Protocol is valid
- //
- if (UnixIo->UnixThunk->Signature != EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) {
- Status = EFI_UNSUPPORTED;
- goto Error;
- }
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (!CompareGuid (UnixIo->TypeGuid, &gEfiUnixSerialPortGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Error;
- }
-
- return EFI_SUCCESS;
-
-Error:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UINTN UnixHandle;
- UART_DEVICE_PATH UartNode;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- CHAR8 AsciiDevName[1024];
- UART_DEVICE_PATH *Uart;
- UINT32 FlowControlMap;
- UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- UINT32 Control;
-
- DEBUG ((EFI_D_INFO, "SerialIo drive binding start!\r\n"));
- Private = NULL;
- UnixHandle = -1;
-
- //
- // Get the Parent Device Path
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&ParentDevicePath,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- //
- // Grab the IO abstraction we need to get any work done
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID**)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
- }
-
- if (Status == EFI_ALREADY_STARTED) {
-
- if (RemainingDevicePath == NULL || IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath is NULL or is the End of Device Path Node
- //
- return EFI_SUCCESS;
- }
-
- //
- // Make sure a child handle does not already exist. This driver can only
- // produce one child per serial port.
- //
- Status = gBS->OpenProtocolInformation (
- Handle,
- &gEfiUnixIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EFI_ALREADY_STARTED;
- for (Index = 0; Index < EntryCount; Index++) {
- if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID**)&SerialIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Uart = (UART_DEVICE_PATH *) RemainingDevicePath;
- Status = SerialIo->SetAttributes (
- SerialIo,
- Uart->BaudRate,
- SerialIo->Mode->ReceiveFifoDepth,
- SerialIo->Mode->Timeout,
- (EFI_PARITY_TYPE) Uart->Parity,
- Uart->DataBits,
- (EFI_STOP_BITS_TYPE) Uart->StopBits
- );
-
- FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart);
- if (!EFI_ERROR (Status) && IsUartFlowControlNode (FlowControl)) {
- Status = SerialIo->GetControl (SerialIo, &Control);
- if (!EFI_ERROR (Status)) {
- if (FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) {
- Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
- } else {
- Control &= ~EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
- }
- //
- // Clear the bits that are not allowed to pass to SetControl
- //
- Control &= (EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
- EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
- EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE);
- Status = SerialIo->SetControl (SerialIo, Control);
- }
- }
- }
- break;
- }
- }
-
- FreePool (OpenInfoBuffer);
- return Status;
- }
-
- FlowControl = NULL;
- FlowControlMap = 0;
- if (RemainingDevicePath == NULL) {
- //
- // Build the device path by appending the UART node to the ParentDevicePath
- // from the UnixIo handle. The Uart setings are zero here, since
- // SetAttribute() will update them to match the default setings.
- //
- ZeroMem (&UartNode, sizeof (UART_DEVICE_PATH));
- UartNode.Header.Type = MESSAGING_DEVICE_PATH;
- UartNode.Header.SubType = MSG_UART_DP;
- SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &UartNode, sizeof (UART_DEVICE_PATH));
-
- } else if (!IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath isn't the End of Device Path Node,
- // only scan the specified device by RemainingDevicePath
- //
- //
- // Match the configuration of the RemainingDevicePath. IsHandleSupported()
- // already checked to make sure the RemainingDevicePath contains settings
- // that we can support.
- //
- CopyMem (&UartNode, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
- FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (RemainingDevicePath);
- if (IsUartFlowControlNode (FlowControl)) {
- FlowControlMap = FlowControl->FlowControlMap;
- } else {
- FlowControl = NULL;
- }
-
- } else {
- //
- // If RemainingDevicePath is the End of Device Path Node,
- // skip enumerate any device and return EFI_SUCESSS
- //
- return EFI_SUCCESS;
- }
-
- //
- // Check to see if we can access the hardware device. If it's Open in Unix we
- // will not get access.
- //
- UnicodeStrToAsciiStr(UnixIo->EnvString, AsciiDevName);
- UnixHandle = UnixIo->UnixThunk->Open (AsciiDevName, O_RDWR | O_NOCTTY, 0);
-
- if (UnixHandle == -1) {
- DEBUG ((EFI_D_INFO, "Failed to open serial device, %s!\r\n", UnixIo->EnvString ));
- UnixIo->UnixThunk->Perror (AsciiDevName);
- Status = EFI_DEVICE_ERROR;
- goto Error;
- }
- DEBUG ((EFI_D_INFO, "Success to open serial device %s, Hanle = 0x%x \r\n", UnixIo->EnvString, UnixHandle));
-
- //
- // Construct Private data
- //
- Private = AllocatePool (sizeof (UNIX_SERIAL_IO_PRIVATE_DATA));
- if (Private == NULL) {
- goto Error;
- }
-
- //
- // This signature must be valid before any member function is called
- //
- Private->Signature = UNIX_SERIAL_IO_PRIVATE_DATA_SIGNATURE;
- Private->UnixHandle = UnixHandle;
- Private->ControllerHandle = Handle;
- Private->Handle = NULL;
- Private->UnixThunk = UnixIo->UnixThunk;
- Private->ParentDevicePath = ParentDevicePath;
- Private->ControllerNameTable = NULL;
-
- Private->SoftwareLoopbackEnable = FALSE;
- Private->HardwareLoopbackEnable = FALSE;
- Private->HardwareFlowControl = (BOOLEAN) (FlowControlMap == UART_FLOW_CONTROL_HARDWARE);
- Private->Fifo.First = 0;
- Private->Fifo.Last = 0;
- Private->Fifo.Surplus = SERIAL_MAX_BUFFER_SIZE;
-
- CopyMem (&Private->UartDevicePath, &UartNode, sizeof (UART_DEVICE_PATH));
-
- AddUnicodeString (
- "eng",
- gUnixSerialIoComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- UnixIo->EnvString
- );
-
- Private->SerialIo.Revision = SERIAL_IO_INTERFACE_REVISION;
- Private->SerialIo.Reset = UnixSerialIoReset;
- Private->SerialIo.SetAttributes = UnixSerialIoSetAttributes;
- Private->SerialIo.SetControl = UnixSerialIoSetControl;
- Private->SerialIo.GetControl = UnixSerialIoGetControl;
- Private->SerialIo.Write = UnixSerialIoWrite;
- Private->SerialIo.Read = UnixSerialIoRead;
- Private->SerialIo.Mode = &Private->SerialIoMode;
-
-
-
- //
- // Build the device path by appending the UART node to the ParentDevicePath
- // from the UnixIo handle. The Uart setings are zero here, since
- // SetAttribute() will update them to match the current setings.
- //
- Private->DevicePath = AppendDevicePathNode (
- ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
- );
- //
- // Only produce the FlowControl node when remaining device path has it
- //
- if (FlowControl != NULL) {
- TempDevicePath = Private->DevicePath;
- if (TempDevicePath != NULL) {
- Private->DevicePath = AppendDevicePathNode (
- TempDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) FlowControl
- );
- FreePool (TempDevicePath);
- }
- }
- if (Private->DevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- //
- // Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.
- //
- Private->SerialIoMode.ControlMask = SERIAL_CONTROL_MASK;
- Private->SerialIoMode.Timeout = SERIAL_TIMEOUT_DEFAULT;
- Private->SerialIoMode.BaudRate = Private->UartDevicePath.BaudRate;
- Private->SerialIoMode.ReceiveFifoDepth = SERIAL_FIFO_DEFAULT;
- Private->SerialIoMode.DataBits = Private->UartDevicePath.DataBits;
- Private->SerialIoMode.Parity = Private->UartDevicePath.Parity;
- Private->SerialIoMode.StopBits = Private->UartDevicePath.StopBits;
-
- //
- // Issue a reset to initialize the COM port
- //
- Status = Private->SerialIo.Reset (&Private->SerialIo);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Create new child handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiSerialIoProtocolGuid,
- &Private->SerialIo,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID**)&UnixIo,
- This->DriverBindingHandle,
- Private->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- return EFI_SUCCESS;
-
-Error:
- //
- // Use the Stop() function to free all resources allocated in Start()
- //
- if (Private != NULL) {
- if (Private->Handle != NULL) {
- This->Stop (This, Handle, 1, &Private->Handle);
- } else {
- if (UnixHandle != -1) {
- Private->UnixThunk->Close (UnixHandle);
- }
-
- if (Private->DevicePath != NULL) {
- FreePool (Private->DevicePath);
- }
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
- }
-
- This->Stop (This, Handle, 0, NULL);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiSerialIoProtocolGuid,
- (VOID**)&SerialIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);
-
- ASSERT (Private->Handle == ChildHandleBuffer[Index]);
-
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiSerialIoProtocolGuid,
- &Private->SerialIo,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **) &UnixIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- Private->UnixThunk->Close (Private->UnixHandle);
-
- FreePool (Private->DevicePath);
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Serial IO Protocol member functions
-//
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoReset (
- IN EFI_SERIAL_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- EFI_TPL Tpl;
- UINTN UnixStatus;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- UnixStatus = Private->UnixThunk->Tcflush (
- Private->UnixHandle,
- TCIOFLUSH
- );
- switch (UnixStatus) {
- case EBADF:
- DEBUG ((EFI_D_ERROR, "Invalid handle of serial device!\r\n"));
- return EFI_DEVICE_ERROR;
- case EINVAL:
- DEBUG ((EFI_D_ERROR, "Invalid queue selector!\r\n"));
- return EFI_DEVICE_ERROR;
- case ENOTTY:
- DEBUG ((EFI_D_ERROR, "The file associated with serial's handle is not a terminal!\r\n"));
- return EFI_DEVICE_ERROR;
- default:
- DEBUG ((EFI_D_ERROR, "The serial IO device is reset successfully!\r\n"));
- }
-
- gBS->RestoreTPL (Tpl);
-
- return This->SetAttributes (
- This,
- This->Mode->BaudRate,
- This->Mode->ReceiveFifoDepth,
- This->Mode->Timeout,
- This->Mode->Parity,
- (UINT8) This->Mode->DataBits,
- This->Mode->StopBits
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoSetAttributes (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-/*++
-
-Routine Description:
-
- This function is used to set the attributes.
-
-Arguments:
-
- This - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue.
- BaudRate - The Baud rate of the serial device.
- ReceiveFifoDepth - The request depth of fifo on receive side.
- Timeout - the request timeout for a single charact.
- Parity - The type of parity used in serial device.
- DataBits - Number of deata bits used in serial device.
- StopBits - Number of stop bits used in serial device.
-
-Returns:
- Status code
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UART_DEVICE_PATH *Uart;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Some of our arguments have defaults if a null value is passed in, and
- // we must set the default values if a null argument is passed in.
- //
- if (BaudRate == 0) {
- BaudRate = SERIAL_BAUD_DEFAULT;
- }
-
- if (ReceiveFifoDepth == 0) {
- ReceiveFifoDepth = SERIAL_FIFO_DEFAULT;
- }
-
- if (Timeout == 0) {
- Timeout = SERIAL_TIMEOUT_DEFAULT;
- }
-
- if (Parity == DefaultParity) {
- Parity = NoParity;
- }
-
- if (DataBits == 0) {
- DataBits = SERIAL_DATABITS_DEFAULT;
- }
-
- if (StopBits == DefaultStopBits) {
- StopBits = OneStopBit;
- }
-
- //
- // See if the new attributes already match the current attributes
- //
- if (Private->UartDevicePath.BaudRate == BaudRate &&
- Private->UartDevicePath.DataBits == DataBits &&
- Private->UartDevicePath.Parity == Parity &&
- Private->UartDevicePath.StopBits == StopBits &&
- Private->SerialIoMode.ReceiveFifoDepth == ReceiveFifoDepth &&
- Private->SerialIoMode.Timeout == Timeout ) {
- gBS->RestoreTPL(Tpl);
- return EFI_SUCCESS;
- }
-
- //
- // Try to get options from serial device.
- //
- if (Private->UnixThunk->Tcgetattr (Private->UnixHandle, &Private->UnixTermios) == -1) {
- Private->UnixThunk->Perror ("IoSetAttributes");
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Setting Baud Rate
- //
- Private->UnixThunk->Cfsetispeed (&Private->UnixTermios, ConvertBaud2Unix(BaudRate));
- Private->UnixThunk->Cfsetospeed (&Private->UnixTermios, ConvertBaud2Unix(BaudRate));
- //
- // Setting DataBits
- //
- Private->UnixTermios.c_cflag &= ~CSIZE;
- Private->UnixTermios.c_cflag |= ConvertByteSize2Unix (DataBits);
- //
- // Setting Parity
- //
- ConvertParity2Unix (&Private->UnixTermios, Parity);
- //
- // Setting StopBits
- //
- ConvertStopBit2Unix (&Private->UnixTermios, StopBits);
- //
- // Raw input
- //
- Private->UnixTermios.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
- //
- // Raw output
- //
- Private->UnixTermios.c_oflag &= ~OPOST;
- //
- // Support hardware flow control
- //
- Private->UnixTermios.c_cflag &= ~CRTSCTS;;
- //
- // Time out
- //
- Private->UnixTermios.c_cc[VMIN] = 0;
- Private->UnixTermios.c_cc[VTIME] = (Timeout/1000000) * 10;
-
- //
- // Set the options
- //
- if (-1 == Private->UnixThunk->Tcsetattr (
- Private->UnixHandle,
- TCSANOW,
- &Private->UnixTermios
- )) {
- DEBUG ((EFI_D_INFO, "Fail to set options for serial device!\r\n"));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Update mode
- //
- Private->SerialIoMode.BaudRate = BaudRate;
- Private->SerialIoMode.ReceiveFifoDepth = ReceiveFifoDepth;
- Private->SerialIoMode.Timeout = Timeout;
- Private->SerialIoMode.Parity = Parity;
- Private->SerialIoMode.DataBits = DataBits;
- Private->SerialIoMode.StopBits = StopBits;
-
- //
- // See if Device Path Node has actually changed
- //
- if (Private->UartDevicePath.BaudRate == BaudRate &&
- Private->UartDevicePath.DataBits == DataBits &&
- Private->UartDevicePath.Parity == Parity &&
- Private->UartDevicePath.StopBits == StopBits ) {
- gBS->RestoreTPL(Tpl);
- return EFI_SUCCESS;
- }
-
- //
- // Update the device path
- //
- Private->UartDevicePath.BaudRate = BaudRate;
- Private->UartDevicePath.DataBits = DataBits;
- Private->UartDevicePath.Parity = (UINT8) Parity;
- Private->UartDevicePath.StopBits = (UINT8) StopBits;
-
- Status = EFI_SUCCESS;
- if (Private->Handle != NULL) {
- Uart = (UART_DEVICE_PATH *) (
- (UINTN) Private->DevicePath
- + GetDevicePathSize (Private->ParentDevicePath)
- - END_DEVICE_PATH_LENGTH
- );
- CopyMem (Uart, &Private->UartDevicePath, sizeof (UART_DEVICE_PATH));
- Status = gBS->ReinstallProtocolInterface (
- Private->Handle,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- Private->DevicePath
- );
- }
-
- gBS->RestoreTPL (Tpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoSetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT32 Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UINTN Result;
- UINTN IoStatus;
- struct termios Options;
- EFI_TPL Tpl;
- UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
- EFI_STATUS Status;
-
- //
- // first determine the parameter is invalid
- //
- if (Control & (~(EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
- EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
- EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE))) {
- return EFI_UNSUPPORTED;
- }
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMGET, &IoStatus);
-
- if (Result == -1) {
- Private->UnixThunk->Perror ("SerialSetControl");
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareFlowControl = FALSE;
- Private->SoftwareLoopbackEnable = FALSE;
- Private->HardwareLoopbackEnable = FALSE;
-
- if (Control & EFI_SERIAL_REQUEST_TO_SEND) {
- Options.c_cflag |= TIOCM_RTS;
- }
-
- if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {
- Options.c_cflag |= TIOCM_DTR;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {
- Private->HardwareFlowControl = TRUE;
- }
-
- if (Control & EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE) {
- Private->SoftwareLoopbackEnable = TRUE;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {
- Private->HardwareLoopbackEnable = TRUE;
- }
-
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMSET, &IoStatus);
-
- if (Result == -1) {
- Private->UnixThunk->Perror ("SerialSetControl");
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- Status = EFI_SUCCESS;
- if (Private->Handle != NULL) {
- FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) (
- (UINTN) Private->DevicePath
- + GetDevicePathSize (Private->ParentDevicePath)
- - END_DEVICE_PATH_LENGTH
- + sizeof (UART_DEVICE_PATH)
- );
- if (IsUartFlowControlNode (FlowControl) &&
- ((FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) ^ Private->HardwareFlowControl)) {
- //
- // Flow Control setting is changed, need to reinstall device path protocol
- //
- FlowControl->FlowControlMap = Private->HardwareFlowControl ? UART_FLOW_CONTROL_HARDWARE : 0;
- Status = gBS->ReinstallProtocolInterface (
- Private->Handle,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- Private->DevicePath
- );
- }
- }
-
- gBS->RestoreTPL (Tpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoGetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- OUT UINT32 *Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UINTN Result;
- UINTN Status;
- UINT32 Bits;
- EFI_TPL Tpl;
- UINTN Bytes;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMGET, &Status);
- if (Result == -1) {
- Private->UnixThunk->Perror ("SerialGetControl");
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- Bits = 0;
- if ((Status & TIOCM_CTS) == TIOCM_CTS) {
- Bits |= EFI_SERIAL_CLEAR_TO_SEND;
- }
-
- if ((Status & TIOCM_DSR) == TIOCM_DSR) {
- Bits |= EFI_SERIAL_DATA_SET_READY;
- }
-
- if ((Status & TIOCM_DTR) == TIOCM_DTR) {
- Bits |= EFI_SERIAL_DATA_TERMINAL_READY;
- }
-
- if ((Status & TIOCM_RTS) == TIOCM_RTS) {
- Bits |= EFI_SERIAL_REQUEST_TO_SEND;
- }
-
- if ((Status & TIOCM_RNG) == TIOCM_RNG) {
- Bits |= EFI_SERIAL_RING_INDICATE;
- }
-
- if ((Status & TIOCM_CAR) == TIOCM_CAR) {
- Bits |= EFI_SERIAL_CARRIER_DETECT;
- }
-
- if (Private->HardwareFlowControl) {
- Bits |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
- }
-
- if (Private->SoftwareLoopbackEnable) {
- Bits |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
- }
-
- if (Private->HardwareLoopbackEnable) {
- Bits |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
- }
-
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, FIONREAD, &Bytes);
- if (Result == -1) {
- Private->UnixThunk->Perror ("SerialGetControl");
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- if (Bytes == 0) {
- Bits |= EFI_SERIAL_INPUT_BUFFER_EMPTY;
- }
-
- *Control = Bits;
-
- gBS->RestoreTPL (Tpl);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoWrite (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- UINT8 *ByteBuffer;
- UINT32 TotalBytesWritten;
- UINT32 BytesToGo;
- UINT32 BytesWritten;
- UINT32 Index;
- UINT32 Control;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- ByteBuffer = (UINT8 *) Buffer;
- Status = EFI_SUCCESS;
- TotalBytesWritten = 0;
-
- if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {
- for (Index = 0; Index < *BufferSize; Index++) {
- if (IsaSerialFifoAdd (&Private->Fifo, ByteBuffer[Index]) == EFI_SUCCESS) {
- TotalBytesWritten++;
- } else {
- break;
- }
- }
- } else {
- BytesToGo = (*BufferSize);
-
- do {
- if (Private->HardwareFlowControl) {
- //
- // Send RTS
- //
- UnixSerialIoGetControl (&Private->SerialIo, &Control);
- Control |= EFI_SERIAL_REQUEST_TO_SEND;
- UnixSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- //
- // Do the write
- //
- BytesWritten = Private->UnixThunk->Write (
- Private->UnixHandle,
- &ByteBuffer[TotalBytesWritten],
- BytesToGo
- );
- if (BytesWritten == -1) {
- Status = EFI_DEVICE_ERROR;
- break;
- }
-
- if (Private->HardwareFlowControl) {
- //
- // Assert RTS
- //
- UnixSerialIoGetControl (&Private->SerialIo, &Control);
- Control &= ~ (UINT32) EFI_SERIAL_REQUEST_TO_SEND;
- UnixSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- TotalBytesWritten += BytesWritten;
- BytesToGo -= BytesWritten;
- } while (BytesToGo > 0);
- }
-
- *BufferSize = TotalBytesWritten;
-
- gBS->RestoreTPL (Tpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoRead (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
-
---*/
-{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UINT32 BytesRead;
- EFI_STATUS Status;
- UINT32 Index;
- UINT8 Data;
- UINT32 Control;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Do the read
- //
- if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {
- for (Index = 0, BytesRead = 0; Index < *BufferSize; Index++) {
- if (IsaSerialFifoRemove (&Private->Fifo, &Data) == EFI_SUCCESS) {
- ((UINT8 *) Buffer)[Index] = Data;
- BytesRead++;
- } else {
- break;
- }
- }
- } else {
- if (Private->HardwareFlowControl) {
- UnixSerialIoGetControl (&Private->SerialIo, &Control);
- Control |= EFI_SERIAL_DATA_TERMINAL_READY;
- UnixSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- BytesRead = Private->UnixThunk->Read (Private->UnixHandle, Buffer, *BufferSize);
- if (Private->HardwareFlowControl) {
- UnixSerialIoGetControl (&Private->SerialIo, &Control);
- Control &= ~ (UINT32) EFI_SERIAL_DATA_TERMINAL_READY;
- UnixSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- }
-
- if (BytesRead != *BufferSize) {
- Status = EFI_TIMEOUT;
- } else {
- Status = EFI_SUCCESS;
- }
-
- *BufferSize = (UINTN) BytesRead;
-
- gBS->RestoreTPL (Tpl);
-
- return Status;
-}
-
-BOOLEAN
-IsaSerialFifoFull (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
- Routine Description:
- Detect whether specific FIFO is full or not
-
- Arguments:
- Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
-
- Returns:
- TRUE: the FIFO is full
- FALSE: the FIFO is not full
-
---*/
-{
- if (Fifo->Surplus == 0) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-IsaSerialFifoEmpty (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
- Routine Description:
- Detect whether specific FIFO is empty or not
-
- Arguments:
- Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
-
- Returns:
- TRUE: the FIFO is empty
- FALSE: the FIFO is not empty
-
---*/
-{
- if (Fifo->Surplus == SERIAL_MAX_BUFFER_SIZE) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-IsaSerialFifoAdd (
- IN SERIAL_DEV_FIFO *Fifo,
- IN UINT8 Data
- )
-/*++
-
- Routine Description:
- Add data to specific FIFO
-
- Arguments:
- Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
- Data UINT8: the data added to FIFO
-
- Returns:
- EFI_SUCCESS: Add data to specific FIFO successfully
- EFI_OUT_RESOURCE: Failed to add data because FIFO is already full
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- //
- // if FIFO full can not add data
- //
- if (IsaSerialFifoFull (Fifo)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // FIFO is not full can add data
- //
- Fifo->Data[Fifo->Last] = Data;
- Fifo->Surplus--;
- Fifo->Last++;
- if (Fifo->Last >= SERIAL_MAX_BUFFER_SIZE) {
- Fifo->Last = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-IsaSerialFifoRemove (
- IN SERIAL_DEV_FIFO *Fifo,
- OUT UINT8 *Data
- )
-/*++
-
- Routine Description:
- Remove data from specific FIFO
-
- Arguments:
- Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
- Data UINT8*: the data removed from FIFO
-
- Returns:
- EFI_SUCCESS: Remove data from specific FIFO successfully
- EFI_OUT_RESOURCE: Failed to remove data because FIFO is empty
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- //
- // if FIFO is empty, no data can remove
- //
- if (IsaSerialFifoEmpty (Fifo)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // FIFO is not empty, can remove data
- //
- *Data = Fifo->Data[Fifo->First];
- Fifo->Surplus++;
- Fifo->First++;
- if (Fifo->First >= SERIAL_MAX_BUFFER_SIZE) {
- Fifo->First = 0;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h
deleted file mode 100644
index 704b54e234..0000000000
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h
+++ /dev/null
@@ -1,571 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSerialIo.h
-
-Abstract:
-
-
---*/
-
-#ifndef _UNIXPKG_SERIAL_IO_
-#define _UNIXPKG_SERIAL_IO_
-
-#include <Common/UnixInclude.h>
-
-#include <Uefi.h>
-#include <Protocol/SerialIo.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include "UnixDxe.h"
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixSerialIoComponentName;
-
-#define SERIAL_MAX_BUFFER_SIZE 256
-#define TIMEOUT_STALL_INTERVAL 10
-
-typedef struct {
- UINT32 First;
- UINT32 Last;
- UINT32 Surplus;
- UINT8 Data[SERIAL_MAX_BUFFER_SIZE];
-} SERIAL_DEV_FIFO;
-
-#define UNIX_SERIAL_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('U', 'N', 's', 'i')
-typedef struct {
- UINT64 Signature;
-
- //
- // Protocol data for the new handle we are going to add
- //
- EFI_HANDLE Handle;
- EFI_SERIAL_IO_PROTOCOL SerialIo;
- EFI_SERIAL_IO_MODE SerialIoMode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // Private Data
- //
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- UART_DEVICE_PATH UartDevicePath;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- //
- // Private NT type Data;
- //
- UINTN UnixHandle;
- struct termios UnixTermios;
-
- BOOLEAN SoftwareLoopbackEnable;
- BOOLEAN HardwareFlowControl;
- BOOLEAN HardwareLoopbackEnable;
-
- SERIAL_DEV_FIFO Fifo;
-
-} UNIX_SERIAL_IO_PRIVATE_DATA;
-
-#define UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UNIX_SERIAL_IO_PRIVATE_DATA, SerialIo, UNIX_SERIAL_IO_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixSerialIoComponentName;
-
-//
-// Macros to convert EFI serial types to NT serial types.
-//
-
-//
-// one second
-//
-#define SERIAL_TIMEOUT_DEFAULT (1000 * 1000)
-#define SERIAL_BAUD_DEFAULT 115200
-#define SERIAL_FIFO_DEFAULT 14
-#define SERIAL_DATABITS_DEFAULT 8
-#define SERIAL_PARITY_DEFAULT DefaultParity
-#define SERIAL_STOPBITS_DEFAULT DefaultStopBits
-
-#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
- EFI_SERIAL_DATA_SET_READY | \
- EFI_SERIAL_RING_INDICATE | \
- EFI_SERIAL_CARRIER_DETECT | \
- EFI_SERIAL_REQUEST_TO_SEND | \
- EFI_SERIAL_DATA_TERMINAL_READY | \
- EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
- EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
- EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
- EFI_SERIAL_INPUT_BUFFER_EMPTY)
-
-#define ConvertBaud2Nt(x) (DWORD) x
-#define ConvertData2Nt(x) (BYTE) x
-
-#define ConvertParity2Nt(x) \
- (BYTE) ( \
- x == DefaultParity ? NOPARITY : \
- x == NoParity ? NOPARITY : \
- x == EvenParity ? EVENPARITY : \
- x == OddParity ? ODDPARITY : \
- x == MarkParity ? MARKPARITY : \
- x == SpaceParity ? SPACEPARITY : 0 \
- )
-
-#define ConvertStop2Nt(x) \
- (BYTE) ( \
- x == DefaultParity ? ONESTOPBIT : \
- x == OneFiveStopBits ? ONE5STOPBITS : \
- x == TwoStopBits ? TWOSTOPBITS : 0 \
- )
-
-#define ConvertTime2Nt(x) ((x) / 1000)
-
-//
-// 115400 baud with rounding errors
-//
-#define SERIAL_PORT_MAX_BAUD_RATE 115400
-
-//
-// Fix the differences issue of linux header files termios.h
-//
-#ifndef B460800
-#define B460800 0010004
-#endif
-#ifndef B500000
-#define B500000 0010005
-#endif
-#ifndef B576000
-#define B576000 0010006
-#endif
-#ifndef B921600
-#define B921600 0010007
-#endif
-#ifndef B1000000
-#define B1000000 0010010
-#endif
-#ifndef B1152000
-#define B1152000 0010011
-#endif
-#ifndef B1500000
-#define B1500000 0010012
-#endif
-#ifndef B2000000
-#define B2000000 0010013
-#endif
-#ifndef B2500000
-#define B2500000 0010014
-#endif
-#ifndef B3000000
-#define B3000000 0010015
-#endif
-#ifndef B3500000
-#define B3500000 0010016
-#endif
-#ifndef B4000000
-#define B4000000 0010017
-#endif
-#ifndef __MAX_BAUD
-#define __MAX_BAUD B4000000
-#endif
-#ifndef CMSPAR
-#define CMSPAR 010000000000 /* mark or space (stick) parity */
-#endif
-#ifndef FIONREAD
-#define FIONREAD 0x541B
-#endif
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeUnixSerialIo (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoReset (
- IN EFI_SERIAL_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoSetAttributes (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BaudRate - TODO: add argument description
- ReceiveFifoDepth - TODO: add argument description
- Timeout - TODO: add argument description
- Parity - TODO: add argument description
- DataBits - TODO: add argument description
- StopBits - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoSetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT32 Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoGetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- OUT UINT32 *Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoWrite (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSerialIoRead (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsaSerialFifoFull (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsaSerialFifoEmpty (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialFifoAdd (
- IN SERIAL_DEV_FIFO *Fifo,
- IN UINT8 Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialFifoRemove (
- IN SERIAL_DEV_FIFO *Fifo,
- OUT UINT8 *Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialReceiveTransmit (
- UNIX_SERIAL_IO_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
deleted file mode 100644
index 01b3d2fe9a..0000000000
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
+++ /dev/null
@@ -1,67 +0,0 @@
-## @file
-# Serial I/O driver
-#
-# Our DriverBinding member functions operate on the handles
-# created by the Unix Bus driver
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixSerialIo
- FILE_GUID = 600F2BF2-63A7-48ca-9FD0-A3450B87EE05
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixSerialIo
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-# DRIVER_BINDING = gUnixSerialIoDriverBinding
-# COMPONENT_NAME = gUnixSerialIoComponentName
-#
-
-[Sources]
- ComponentName.c
- UnixSerialIo.c
- UnixSerialIo.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- MemoryAllocationLib
- DevicePathLib
- UefiBootServicesTableLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiUnixSerialPortGuid # ALWAYS_CONSUMED
- gEfiUartDevicePathGuid # BY_START
-
-[Protocols]
- gEfiSerialIoProtocolGuid # PROTOCOL BY_START
- gEfiDevicePathProtocolGuid # PROTOCOL TO_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/ComponentName.c b/UnixPkg/UnixSimpleFileSystemDxe/ComponentName.c
deleted file mode 100644
index dce6435bba..0000000000
--- a/UnixPkg/UnixSimpleFileSystemDxe/ComponentName.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixSimpleFileSystem.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixSimpleFileSystemComponentName = {
- UnixSimpleFileSystemComponentNameGetDriverName,
- UnixSimpleFileSystemComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixSimpleFileSystemDriverNameTable[] = {
- {
- "eng",
- L"Unix Simple File System Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixSimpleFileSystemComponentName.SupportedLanguages,
- mUnixSimpleFileSystemDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixSimpleFileSystemDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID**)&SimpleFileSystem,
- gUnixSimpleFileSystemDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-
- return LookupUnicodeString (
- Language,
- gUnixSimpleFileSystemComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/EntryPoint.c b/UnixPkg/UnixSimpleFileSystemDxe/EntryPoint.c
deleted file mode 100644
index 4002ffd265..0000000000
--- a/UnixPkg/UnixSimpleFileSystemDxe/EntryPoint.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-
-
-#include "UnixSimpleFileSystem.h"
-
-/**
- The user Entry Point for module UnixSimpleFileSystem. The user code starts with this function.
-
- @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
-InitializeUnixSimpleFileSystem(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixSimpleFileSystemDriverBinding,
- ImageHandle,
- &gUnixSimpleFileSystemComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c b/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c
deleted file mode 100644
index 0bd1c65c2a..0000000000
--- a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c
+++ /dev/null
@@ -1,2193 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSimpleFileSystem.c
-
-Abstract:
-
- Produce Simple File System abstractions for directories on your PC using Posix APIs.
- The configuration of what devices to mount or emulate comes from UNIX
- environment variables. The variables must be visible to the Microsoft*
- Developer Studio for them to work.
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#include "UnixSimpleFileSystem.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixSimpleFileSystemDriverBinding = {
- UnixSimpleFileSystemDriverBindingSupported,
- UnixSimpleFileSystemDriverBindingStart,
- UnixSimpleFileSystemDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-CHAR16 *
-EfiStrChr (
- IN CHAR16 *Str,
- IN CHAR16 Chr
- )
-/*++
-
-Routine Description:
-
- Locate the first occurance of a character in a string.
-
-Arguments:
-
- Str - Pointer to NULL terminated unicode string.
- Chr - Character to locate.
-
-Returns:
-
- If Str is NULL, then NULL is returned.
- If Chr is not contained in Str, then NULL is returned.
- If Chr is contained in Str, then a pointer to the first occurance of Chr in Str is returned.
-
---*/
-{
- if (Str == NULL) {
- return Str;
- }
-
- while (*Str != '\0' && *Str != Chr) {
- ++Str;
- }
-
- return (*Str == Chr) ? Str : NULL;
-}
-
-BOOLEAN
-IsZero (
- IN VOID *Buffer,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Buffer - TODO: add argument description
- Length - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- if (Buffer == NULL || Length == 0) {
- return FALSE;
- }
-
- if (*(UINT8 *) Buffer != 0) {
- return FALSE;
- }
-
- if (Length > 1) {
- if (!CompareMem (Buffer, (UINT8 *) Buffer + 1, Length - 1)) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-VOID
-CutPrefix (
- IN CHAR8 *Str,
- IN UINTN Count
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Str - TODO: add argument description
- Count - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- CHAR8 *Pointer;
-
- if (AsciiStrLen (Str) < Count) {
- ASSERT (0);
- }
-
- for (Pointer = Str; *(Pointer + Count); Pointer++) {
- *Pointer = *(Pointer + Count);
- }
-
- *Pointer = *(Pointer + Count);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Check to see if the driver supports a given controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to test.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
- specified by This.
-
- EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- the driver specified by This.
-
- EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- a different driver or an application that requires exclusive access.
-
- EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
- driver specified by This.
-
---*/
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure GUID is for a File System handle.
- //
- Status = EFI_UNSUPPORTED;
- if (CompareGuid (UnixIo->TypeGuid, &gEfiUnixFileSystemGuid)) {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Starts a device controller or a bus controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to start.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device or bus controller has been started.
-
- EFI_DEVICE_ERROR - The device could not be started due to a device failure.
-
- EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
-
---*/
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- INTN i;
-
- Private = NULL;
-
- //
- // Open the IO Abstraction(s) needed
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Validate GUID
- //
- if (!CompareGuid (UnixIo->TypeGuid, &gEfiUnixFileSystemGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_SIMPLE_FILE_SYSTEM_PRIVATE),
- (VOID **)&Private
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Private->Signature = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
- Private->UnixThunk = UnixIo->UnixThunk;
- Private->FilePath = NULL;
- Private->VolumeLabel = NULL;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrLen (UnixIo->EnvString) + 1,
- (VOID **)&Private->FilePath
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- for (i = 0; UnixIo->EnvString[i] != 0; i++)
- Private->FilePath[i] = UnixIo->EnvString[i];
- Private->FilePath[i] = 0;
-
- Private->VolumeLabel = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (L"EFI_EMULATED"),
- (VOID **)&Private->VolumeLabel
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- StrCpy (Private->VolumeLabel, L"EFI_EMULATED");
-
- Private->SimpleFileSystem.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- Private->SimpleFileSystem.OpenVolume = UnixSimpleFileSystemOpenVolume;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gUnixSimpleFileSystemComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- UnixIo->EnvString
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &Private->SimpleFileSystem,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- if (Private != NULL) {
-
- if (Private->VolumeLabel != NULL)
- gBS->FreePool (Private->VolumeLabel);
- if (Private->FilePath != NULL)
- gBS->FreePool (Private->FilePath);
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- gBS->FreePool (Private);
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - A handle to the device to be stopped.
-
- NumberOfChildren - The number of child device handles in ChildHandleBuffer.
-
- ChildHandleBuffer - An array of child device handles to be freed.
-
-Returns:
-
- EFI_SUCCESS - The device has been stopped.
-
- EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
-
---*/
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID **)&SimpleFileSystem,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-
- //
- // Uninstall the Simple File System Protocol from ControllerHandle
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &Private->SimpleFileSystem,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- gBS->FreePool (Private);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- )
-/*++
-
-Routine Description:
-
- Open the root directory on a volume.
-
-Arguments:
-
- This - A pointer to the volume to open.
-
- Root - A pointer to storage for the returned opened file handle of the root directory.
-
-Returns:
-
- EFI_SUCCESS - The volume was opened.
-
- EFI_UNSUPPORTED - The volume does not support the requested file system type.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || Root == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);
-
- PrivateFile = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_EFI_FILE_PRIVATE),
- (VOID **)&PrivateFile
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- PrivateFile->FileName = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrSize (Private->FilePath),
- (VOID **)&PrivateFile->FileName
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy (PrivateFile->FileName, Private->FilePath);
- PrivateFile->Signature = UNIX_EFI_FILE_PRIVATE_SIGNATURE;
- PrivateFile->UnixThunk = Private->UnixThunk;
- PrivateFile->SimpleFileSystem = This;
- PrivateFile->IsRootDirectory = TRUE;
- PrivateFile->IsDirectoryPath = TRUE;
- PrivateFile->IsOpenedByRead = TRUE;
- PrivateFile->EfiFile.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- PrivateFile->EfiFile.Open = UnixSimpleFileSystemOpen;
- PrivateFile->EfiFile.Close = UnixSimpleFileSystemClose;
- PrivateFile->EfiFile.Delete = UnixSimpleFileSystemDelete;
- PrivateFile->EfiFile.Read = UnixSimpleFileSystemRead;
- PrivateFile->EfiFile.Write = UnixSimpleFileSystemWrite;
- PrivateFile->EfiFile.GetPosition = UnixSimpleFileSystemGetPosition;
- PrivateFile->EfiFile.SetPosition = UnixSimpleFileSystemSetPosition;
- PrivateFile->EfiFile.GetInfo = UnixSimpleFileSystemGetInfo;
- PrivateFile->EfiFile.SetInfo = UnixSimpleFileSystemSetInfo;
- PrivateFile->EfiFile.Flush = UnixSimpleFileSystemFlush;
- PrivateFile->fd = -1;
- PrivateFile->Dir = NULL;
- PrivateFile->Dirent = NULL;
-
- *Root = &PrivateFile->EfiFile;
-
- PrivateFile->Dir = PrivateFile->UnixThunk->OpenDir(PrivateFile->FileName);
-
- if (PrivateFile->Dir == NULL) {
- Status = EFI_ACCESS_DENIED;
- }
- else {
- Status = EFI_SUCCESS;
- }
-
-Done:
- if (EFI_ERROR (Status)) {
- if (PrivateFile) {
- if (PrivateFile->FileName) {
- gBS->FreePool (PrivateFile->FileName);
- }
-
- gBS->FreePool (PrivateFile);
- }
-
- *Root = NULL;
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Open a file relative to the source file location.
-
-Arguments:
-
- This - A pointer to the source file location.
-
- NewHandle - Pointer to storage for the new file handle.
-
- FileName - Pointer to the file name to be opened.
-
- OpenMode - File open mode information.
-
- Attributes - File creation attributes.
-
-Returns:
-
- EFI_SUCCESS - The file was opened.
-
- EFI_NOT_FOUND - The file could not be found in the volume.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_WRITE_PROTECTED - The volume or file is write protected.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
-
- EFI_VOLUME_FULL - There is not enough space left to create the new file.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_FILE_PROTOCOL *Root;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- UNIX_EFI_FILE_PRIVATE *NewPrivateFile;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- EFI_STATUS Status;
- CHAR16 *Src;
- char *Dst;
- CHAR8 *RealFileName;
- char *ParseFileName;
- char *GuardPointer;
- CHAR8 TempChar;
- UINTN Count;
- BOOLEAN TrailingDash;
- BOOLEAN LoopFinish;
- UINTN InfoSize;
- EFI_FILE_INFO *Info;
-
- TrailingDash = FALSE;
-
- //
- // Check for obvious invalid parameters.
- //
- if (This == NULL || NewHandle == NULL || FileName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (OpenMode) {
- case EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:
- if (Attributes &~EFI_FILE_VALID_ATTR) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Attributes & EFI_FILE_READ_ONLY) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // fall through
- //
- case EFI_FILE_MODE_READ:
- case EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
- NewPrivateFile = NULL;
-
- //
- // BUGBUG: assume an open of root
- // if current location, return current data
- //
- if (StrCmp (FileName, L"\\") == 0
- || (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
- //
- // BUGBUG: assume an open root
- //
-OpenRoot:
- Status = UnixSimpleFileSystemOpenVolume (PrivateFile->SimpleFileSystem, &Root);
- NewPrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);
- goto Done;
- }
-
- if (FileName[StrLen (FileName) - 1] == L'\\') {
- TrailingDash = TRUE;
- FileName[StrLen (FileName) - 1] = 0;
- }
-
- //
- // Attempt to open the file
- //
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UNIX_EFI_FILE_PRIVATE),
- (VOID **)&NewPrivateFile
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- CopyMem (NewPrivateFile, PrivateFile, sizeof (UNIX_EFI_FILE_PRIVATE));
-
- NewPrivateFile->FileName = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrSize (PrivateFile->FileName) + 1 + StrLen (FileName) + 1,
- (VOID **)&NewPrivateFile->FileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (*FileName == L'\\') {
- AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
- // Skip first '\'.
- Src = FileName + 1;
- } else {
- AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName);
- Src = FileName;
- }
- Dst = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName);
- GuardPointer = NewPrivateFile->FileName + AsciiStrLen(PrivateRoot->FilePath);
- *Dst++ = '/';
- // Convert unicode to ascii and '\' to '/'
- while (*Src) {
- if (*Src == '\\')
- *Dst++ = '/';
- else
- *Dst++ = *Src;
- Src++;
- }
- *Dst = 0;
-
-
- //
- // Get rid of . and .., except leading . or ..
- //
-
- //
- // GuardPointer protect simplefilesystem root path not be destroyed
- //
-
- LoopFinish = FALSE;
-
- while (!LoopFinish) {
-
- LoopFinish = TRUE;
-
- for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
- if (*ParseFileName == '.' &&
- (*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == '/') &&
- *(ParseFileName - 1) == '/'
- ) {
-
- //
- // cut /.
- //
- CutPrefix (ParseFileName - 1, 2);
- LoopFinish = FALSE;
- break;
- }
-
- if (*ParseFileName == '.' &&
- *(ParseFileName + 1) == '.' &&
- (*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == '/') &&
- *(ParseFileName - 1) == '/'
- ) {
-
- ParseFileName--;
- Count = 3;
-
- while (ParseFileName != GuardPointer) {
- ParseFileName--;
- Count++;
- if (*ParseFileName == '/') {
- break;
- }
- }
-
- //
- // cut /.. and its left directory
- //
- CutPrefix (ParseFileName, Count);
- LoopFinish = FALSE;
- break;
- }
- }
- }
-
- if (AsciiStrCmp (NewPrivateFile->FileName, PrivateRoot->FilePath) == 0) {
- NewPrivateFile->IsRootDirectory = TRUE;
- gBS->FreePool (NewPrivateFile->FileName);
- gBS->FreePool (NewPrivateFile);
- goto OpenRoot;
- }
-
- RealFileName = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName) - 1;
- while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/')
- RealFileName--;
-
- TempChar = *(RealFileName - 1);
- *(RealFileName - 1) = 0;
-
- *(RealFileName - 1) = TempChar;
-
-
-
- //
- // Test whether file or directory
- //
- NewPrivateFile->IsRootDirectory = FALSE;
- NewPrivateFile->fd = -1;
- NewPrivateFile->Dir = NULL;
- if (OpenMode & EFI_FILE_MODE_CREATE) {
- if (Attributes & EFI_FILE_DIRECTORY) {
- NewPrivateFile->IsDirectoryPath = TRUE;
- } else {
- NewPrivateFile->IsDirectoryPath = FALSE;
- }
- } else {
- STAT_FIX finfo;
- int res = NewPrivateFile->UnixThunk->Stat (NewPrivateFile->FileName, &finfo);
- if (res == 0 && S_ISDIR(finfo.st_mode))
- NewPrivateFile->IsDirectoryPath = TRUE;
- else
- NewPrivateFile->IsDirectoryPath = FALSE;
- }
-
- if (OpenMode & EFI_FILE_MODE_WRITE) {
- NewPrivateFile->IsOpenedByRead = FALSE;
- } else {
- NewPrivateFile->IsOpenedByRead = TRUE;
- }
-
- Status = EFI_SUCCESS;
-
- //
- // deal with directory
- //
- if (NewPrivateFile->IsDirectoryPath) {
-
- if ((OpenMode & EFI_FILE_MODE_CREATE)) {
- //
- // Create a directory
- //
- if (NewPrivateFile->UnixThunk->MkDir (NewPrivateFile->FileName, 0777) != 0) {
- INTN LastError;
-
- LastError = PrivateFile->UnixThunk->GetErrno ();
- if (LastError != EEXIST) {
- //gBS->FreePool (TempFileName);
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- }
- }
-
- NewPrivateFile->Dir = NewPrivateFile->UnixThunk->OpenDir
- (NewPrivateFile->FileName);
-
- if (NewPrivateFile->Dir == NULL) {
- if (PrivateFile->UnixThunk->GetErrno () == EACCES) {
- Status = EFI_ACCESS_DENIED;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
- goto Done;
- }
-
- } else {
- //
- // deal with file
- //
- NewPrivateFile->fd = NewPrivateFile->UnixThunk->Open
- (NewPrivateFile->FileName,
- ((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0)
- | (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR),
- 0666);
- if (NewPrivateFile->fd < 0) {
- if (PrivateFile->UnixThunk->GetErrno () == ENOENT) {
- Status = EFI_NOT_FOUND;
- } else {
- Status = EFI_ACCESS_DENIED;
- }
- }
- }
-
- if ((OpenMode & EFI_FILE_MODE_CREATE) && Status == EFI_SUCCESS) {
- //
- // Set the attribute
- //
- InfoSize = 0;
- Info = NULL;
-
- Status = UnixSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
-
- if (Status != EFI_BUFFER_TOO_SMALL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- InfoSize,
- (VOID **)&Info
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = UnixSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Info->Attribute = Attributes;
-
- UnixSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);
- }
-
-Done: ;
- if (TrailingDash) {
- FileName[StrLen (FileName) + 1] = 0;
- FileName[StrLen (FileName)] = L'\\';
- }
-
- if (EFI_ERROR (Status)) {
- if (NewPrivateFile) {
- if (NewPrivateFile->FileName) {
- gBS->FreePool (NewPrivateFile->FileName);
- }
-
- gBS->FreePool (NewPrivateFile);
- }
- } else {
- *NewHandle = &NewPrivateFile->EfiFile;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemClose (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Close the specified file handle.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle has been closed.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- if (PrivateFile->fd >= 0) {
- PrivateFile->UnixThunk->Close (PrivateFile->fd);
- }
- if (PrivateFile->Dir != NULL) {
- PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
- }
-
- PrivateFile->fd = -1;
- PrivateFile->Dir = NULL;
-
- if (PrivateFile->FileName) {
- gBS->FreePool (PrivateFile->FileName);
- }
-
- gBS->FreePool (PrivateFile);
-
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDelete (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Close and delete a file.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle was closed and deleted.
-
- EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = EFI_WARN_DELETE_FAILURE;
-
- if (PrivateFile->IsDirectoryPath) {
- if (PrivateFile->Dir != NULL) {
- PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
- PrivateFile->Dir = NULL;
- }
-
- if (PrivateFile->UnixThunk->RmDir (PrivateFile->FileName) == 0) {
- Status = EFI_SUCCESS;
- }
- } else {
- PrivateFile->UnixThunk->Close (PrivateFile->fd);
- PrivateFile->fd = -1;
-
- if (!PrivateFile->IsOpenedByRead) {
- if (!PrivateFile->UnixThunk->UnLink (PrivateFile->FileName)) {
- Status = EFI_SUCCESS;
- }
- }
- }
-
- gBS->FreePool (PrivateFile->FileName);
- gBS->FreePool (PrivateFile);
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-VOID
-UnixSystemTimeToEfiTime (
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk,
- IN time_t SystemTime,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SystemTime - TODO: add argument description
- TimeZone - TODO: add argument description
- Time - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- struct tm *tm;
- tm = UnixThunk->GmTime (&SystemTime);
- Time->Year = tm->tm_year;
- Time->Month = tm->tm_mon + 1;
- Time->Day = tm->tm_mday;
- Time->Hour = tm->tm_hour;
- Time->Minute = tm->tm_min;
- Time->Second = tm->tm_sec;
- Time->Nanosecond = 0;
-
- Time->TimeZone = UnixThunk->GetTimeZone ();
-
- if (UnixThunk->GetDayLight ()) {
- Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
- }
-}
-
-EFI_STATUS
-UnixSimpleFileSystemFileInfo (
- UNIX_EFI_FILE_PRIVATE *PrivateFile,
- IN CHAR8 *FileName,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PrivateFile - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- EFI_FILE_INFO *Info;
- CHAR8 *RealFileName;
- CHAR8 *TempPointer;
- CHAR16 *BufferFileName;
- STAT_FIX buf;
-
- if (FileName != NULL) {
- RealFileName = FileName;
- }
- else if (PrivateFile->IsRootDirectory) {
- RealFileName = "";
- } else {
- RealFileName = PrivateFile->FileName;
- }
-
- TempPointer = RealFileName;
- while (*TempPointer) {
- if (*TempPointer == '/') {
- RealFileName = TempPointer + 1;
- }
-
- TempPointer++;
- }
-
- Size = SIZE_OF_EFI_FILE_INFO;
- NameSize = AsciiStrSize (RealFileName) * 2;
- ResultSize = Size + NameSize;
-
- if (*BufferSize < ResultSize) {
- *BufferSize = ResultSize;
- return EFI_BUFFER_TOO_SMALL;
- }
- if (PrivateFile->UnixThunk->Stat (
- FileName == NULL ? PrivateFile->FileName : FileName,
- &buf) < 0)
- return EFI_DEVICE_ERROR;
-
- Status = EFI_SUCCESS;
-
- Info = Buffer;
- ZeroMem (Info, ResultSize);
-
- Info->Size = ResultSize;
- Info->FileSize = buf.st_size;
- Info->PhysicalSize = MultU64x32 (buf.st_blocks, buf.st_blksize);
-
- UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_ctime, &Info->CreateTime);
- UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_atime, &Info->LastAccessTime);
- UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_mtime, &Info->ModificationTime);
-
- if (!(buf.st_mode & S_IWUSR)) {
- Info->Attribute |= EFI_FILE_READ_ONLY;
- }
-
- if (S_ISDIR(buf.st_mode)) {
- Info->Attribute |= EFI_FILE_DIRECTORY;
- }
-
-
- BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size);
- while (*RealFileName)
- *BufferFileName++ = *RealFileName++;
- *BufferFileName = 0;
-
- *BufferSize = ResultSize;
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemRead (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read data from a file.
-
-Arguments:
-
- This - Pointer to a returned open file handle.
-
- BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
-
- Buffer - Pointer to the first byte of the read Buffer.
-
-Returns:
-
- EFI_SUCCESS - The data was read.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
- *BufferSize has been updated with the size needed to complete the request.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- INTN Res;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- CHAR8 *FullFileName;
- EFI_TPL OldTpl;
-
- if (This == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((*BufferSize != 0) && (Buffer == NULL)) {
- // Buffer can be NULL if *BufferSize is zero
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (!PrivateFile->IsDirectoryPath) {
-
- if (PrivateFile->fd < 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Res = PrivateFile->UnixThunk->Read (
- PrivateFile->fd,
- Buffer,
- *BufferSize);
- if (Res < 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- *BufferSize = Res;
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Read on a directory.
- //
- if (PrivateFile->Dir == NULL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (PrivateFile->Dirent == NULL) {
- PrivateFile->Dirent = PrivateFile->UnixThunk->ReadDir (PrivateFile->Dir);
- if (PrivateFile->Dirent == NULL) {
- *BufferSize = 0;
- Status = EFI_SUCCESS;
- goto Done;
- }
- }
-
- Size = SIZE_OF_EFI_FILE_INFO;
- NameSize = AsciiStrLen (PrivateFile->Dirent->d_name) + 1;
- ResultSize = Size + 2 * NameSize;
-
- if (*BufferSize < ResultSize) {
- *BufferSize = ResultSize;
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
- Status = EFI_SUCCESS;
-
- *BufferSize = ResultSize;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrLen(PrivateFile->FileName) + 1 + NameSize,
- (VOID **)&FullFileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy(FullFileName, PrivateFile->FileName);
- AsciiStrCat(FullFileName, "/");
- AsciiStrCat(FullFileName, PrivateFile->Dirent->d_name);
- Status = UnixSimpleFileSystemFileInfo (PrivateFile,
- FullFileName,
- BufferSize,
- Buffer);
- gBS->FreePool (FullFileName);
-
- PrivateFile->Dirent = NULL;
-
-Done:
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemWrite (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Write data to a file.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
- of data written to the file.
-
- Buffer - Pointer to the first by of data in the buffer to write to the file.
-
-Returns:
-
- EFI_SUCCESS - The data was written to the file.
-
- EFI_UNSUPPORTED - Writes to an open directory are not supported.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- UINTN Res;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- if (This == NULL || BufferSize == NULL || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->fd < 0) {
- return EFI_DEVICE_ERROR;
- }
-
- if (PrivateFile->IsDirectoryPath) {
- return EFI_UNSUPPORTED;
- }
-
- if (PrivateFile->IsOpenedByRead) {
- return EFI_ACCESS_DENIED;
- }
-
- Res = PrivateFile->UnixThunk->Write (
- PrivateFile->fd,
- Buffer,
- *BufferSize);
- if (Res == (UINTN)-1) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- *BufferSize = Res;
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-
- //
- // bugbug: need to access unix error reporting
- //
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemSetPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-/*++
-
-Routine Description:
-
- Set a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - The byte position from the start of the file to set.
-
-Returns:
-
- EFI_SUCCESS - The file position has been changed.
-
- EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- UINT64 Pos;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- if (Position != 0) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (PrivateFile->Dir == NULL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- PrivateFile->UnixThunk->RewindDir (PrivateFile->Dir);
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- if (Position == (UINT64) -1) {
- Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_END);
- } else {
- Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, Position, SEEK_SET);
- }
- Status = (Pos == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemGetPosition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-/*++
-
-Routine Description:
-
- Get a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - Pointer to storage for the current position.
-
-Returns:
-
- EFI_SUCCESS - The file position has been reported.
-
- EFI_UNSUPPORTED - Not valid for directories.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || Position == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_UNSUPPORTED;
- } else {
- *Position = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_CUR);
- Status = (*Position == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
- }
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Return information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID describing the type of information to be returned.
-
- BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
- information buffer.
-
- Buffer - Pointer to the first byte of the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The requested information has been written into the buffer.
-
- EFI_UNSUPPORTED - The InformationType is not known.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
- been updated with the size needed to complete the requested operation.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
- INTN UnixStatus;
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- struct statfs buf;
- EFI_TPL OldTpl;
-
- if (This == NULL || InformationType == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
-
- Status = EFI_UNSUPPORTED;
-
- if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
- Status = UnixSimpleFileSystemFileInfo (PrivateFile, NULL, BufferSize, Buffer);
- } else if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
- if (*BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {
- *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
- UnixStatus = PrivateFile->UnixThunk->StatFs (PrivateFile->FileName, &buf);
- if (UnixStatus < 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
- FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- FileSystemInfoBuffer->ReadOnly = FALSE;
-
- //
- // Succeeded
- //
- FileSystemInfoBuffer->VolumeSize = MultU64x32 (buf.f_blocks, buf.f_bsize);
- FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
- FileSystemInfoBuffer->BlockSize = buf.f_bsize;
-
-
- StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
- *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_SUCCESS;
- } else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
- StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel);
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_SUCCESS;
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemSetInfo (
- IN EFI_FILE_PROTOCOL*This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Set information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID identifying the type of information to set.
-
- BufferSize - Number of bytes of data in the information buffer.
-
- Buffer - Pointer to the first byte of data in the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The file or volume information has been updated.
-
- EFI_UNSUPPORTED - The information identifier is not recognised.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
- EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_INFO *OldFileInfo;
- EFI_FILE_INFO *NewFileInfo;
- EFI_STATUS Status;
- UINTN OldInfoSize;
- EFI_TPL OldTpl;
- mode_t NewAttr;
- STAT_FIX OldAttr;
- CHAR8 *OldFileName;
- CHAR8 *NewFileName;
- CHAR8 *CharPointer;
- BOOLEAN AttrChangeFlag;
- BOOLEAN NameChangeFlag;
- BOOLEAN SizeChangeFlag;
- BOOLEAN TimeChangeFlag;
- struct tm NewLastAccessSystemTime;
- struct tm NewLastWriteSystemTime;
- EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
- CHAR8 *AsciiFilePtr;
- CHAR16 *UnicodeFilePtr;
- INTN UnixStatus;
-
- //
- // Check for invalid parameters.
- //
- if (This == NULL || InformationType == NULL || BufferSize == 0 || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- //
- // Initialise locals.
- //
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
-
- Status = EFI_UNSUPPORTED;
- OldFileInfo = NewFileInfo = NULL;
- OldFileName = NewFileName = NULL;
- AttrChangeFlag = NameChangeFlag = SizeChangeFlag = TimeChangeFlag = FALSE;
-
- //
- // Set file system information.
- //
- if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
- if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;
-
- gBS->FreePool (PrivateRoot->VolumeLabel);
-
- PrivateRoot->VolumeLabel = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewFileSystemInfo->VolumeLabel),
- (VOID **)&PrivateRoot->VolumeLabel
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel);
-
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Set volume label information.
- //
- if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- if (BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *) Buffer);
-
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- if (!CompareGuid (InformationType, &gEfiFileInfoGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (BufferSize < SIZE_OF_EFI_FILE_INFO) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- //
- // Set file/directory information.
- //
-
- //
- // Check for invalid set file information parameters.
- //
- NewFileInfo = (EFI_FILE_INFO *) Buffer;
-
- if ((NewFileInfo->Size <= SIZE_OF_EFI_FILE_INFO) ||
- (NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
- (sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // bugbug: - This is not safe. We need something like EfiStrMaxSize()
- // that would have an additional parameter that would be the size
- // of the string array just in case there are no NULL characters in
- // the string array.
- //
- //
- // Get current file information so we can determine what kind
- // of change request this is.
- //
- OldInfoSize = 0;
- Status = UnixSimpleFileSystemFileInfo (PrivateFile, NULL, &OldInfoSize, NULL);
-
- if (Status != EFI_BUFFER_TOO_SMALL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize,
- (VOID **)&OldFileInfo);
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = UnixSimpleFileSystemFileInfo (PrivateFile, NULL, &OldInfoSize, OldFileInfo);
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrSize (PrivateFile->FileName),
- (VOID **)&OldFileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy (OldFileName, PrivateFile->FileName);
-
- //
- // Make full pathname from new filename and rootpath.
- //
- if (NewFileInfo->FileName[0] == '\\') {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrLen (PrivateRoot->FilePath) + 1 + StrLen (NewFileInfo->FileName) + 1,
- (VOID **)&NewFileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
- AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
- UnicodeFilePtr = NewFileInfo->FileName + 1;
- *AsciiFilePtr++ ='/';
- } else {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1,
- (VOID **)&NewFileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
- AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
- if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) {
- // make sure there is a / between Root FilePath and NewFileInfo Filename
- AsciiFilePtr[0] = '/';
- AsciiFilePtr[1] = '\0';
- AsciiFilePtr++;
- }
- UnicodeFilePtr = NewFileInfo->FileName;
- }
- // Convert to ascii.
- while (*UnicodeFilePtr) {
- *AsciiFilePtr++ = *UnicodeFilePtr++;
- }
- *AsciiFilePtr = 0;
-
-
- //
- // Is there an attribute change request?
- //
- if (NewFileInfo->Attribute != OldFileInfo->Attribute) {
- if ((NewFileInfo->Attribute & EFI_FILE_DIRECTORY) != (OldFileInfo->Attribute & EFI_FILE_DIRECTORY)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- AttrChangeFlag = TRUE;
- }
-
- //
- // Is there a name change request?
- // bugbug: - Need EfiStrCaseCmp()
- //
- if (StrCmp (NewFileInfo->FileName, OldFileInfo->FileName)) {
- NameChangeFlag = TRUE;
- }
-
- //
- // Is there a size change request?
- //
- if (NewFileInfo->FileSize != OldFileInfo->FileSize) {
- SizeChangeFlag = TRUE;
- }
-
- //
- // Is there a time stamp change request?
- //
- if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- } else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- } else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- }
-
- //
- // All done if there are no change requests being made.
- //
- if (!(AttrChangeFlag || NameChangeFlag || SizeChangeFlag || TimeChangeFlag)) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Set file or directory information.
- //
- if (PrivateFile->UnixThunk->Stat (OldFileName, &OldAttr) != 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- //
- // Name change.
- //
- if (NameChangeFlag) {
- //
- // Close the handles first
- //
- if (PrivateFile->IsOpenedByRead) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- for (CharPointer = NewFileName; *CharPointer != 0 && *CharPointer != L'/'; CharPointer++) {
- }
-
- if (*CharPointer != 0) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- UnixStatus = PrivateFile->UnixThunk->Rename (OldFileName, NewFileName);
-
- if (UnixStatus == 0) {
- //
- // modify file name
- //
- gBS->FreePool (PrivateFile->FileName);
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- AsciiStrSize (NewFileName),
- (VOID **)&PrivateFile->FileName
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AsciiStrCpy (PrivateFile->FileName, NewFileName);
- } else {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- }
-
- //
- // Size change
- //
- if (SizeChangeFlag) {
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (PrivateFile->IsOpenedByRead || OldFileInfo->Attribute & EFI_FILE_READ_ONLY) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- if (PrivateFile->UnixThunk->FTruncate (PrivateFile->fd, NewFileInfo->FileSize) != 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- }
-
- //
- // Time change
- //
- if (TimeChangeFlag) {
- struct utimbuf utime;
-
- NewLastAccessSystemTime.tm_year = NewFileInfo->LastAccessTime.Year;
- NewLastAccessSystemTime.tm_mon = NewFileInfo->LastAccessTime.Month;
- NewLastAccessSystemTime.tm_mday = NewFileInfo->LastAccessTime.Day;
- NewLastAccessSystemTime.tm_hour = NewFileInfo->LastAccessTime.Hour;
- NewLastAccessSystemTime.tm_min = NewFileInfo->LastAccessTime.Minute;
- NewLastAccessSystemTime.tm_sec = NewFileInfo->LastAccessTime.Second;
- NewLastAccessSystemTime.tm_isdst = 0;
-
- utime.actime = PrivateFile->UnixThunk->MkTime (&NewLastAccessSystemTime);
-
- NewLastWriteSystemTime.tm_year = NewFileInfo->ModificationTime.Year;
- NewLastWriteSystemTime.tm_mon = NewFileInfo->ModificationTime.Month;
- NewLastWriteSystemTime.tm_mday = NewFileInfo->ModificationTime.Day;
- NewLastWriteSystemTime.tm_hour = NewFileInfo->ModificationTime.Hour;
- NewLastWriteSystemTime.tm_min = NewFileInfo->ModificationTime.Minute;
- NewLastWriteSystemTime.tm_sec = NewFileInfo->ModificationTime.Second;
- NewLastWriteSystemTime.tm_isdst = 0;
-
- utime.modtime = PrivateFile->UnixThunk->MkTime (&NewLastWriteSystemTime);
-
- if (utime.actime == (time_t)-1 || utime.modtime == (time_t)-1) {
- goto Done;
- }
-
- if (PrivateFile->UnixThunk->UTime (PrivateFile->FileName, &utime) == -1) {
- goto Done;
- }
- }
-
- //
- // No matter about AttrChangeFlag, Attribute must be set.
- // Because operation before may cause attribute change.
- //
- NewAttr = OldAttr.st_mode;
-
- if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {
- NewAttr &= ~(S_IRUSR | S_IRGRP | S_IROTH);
- } else {
- NewAttr |= S_IRUSR;
- }
-
- UnixStatus = PrivateFile->UnixThunk->Chmod (NewFileName, NewAttr);
- if (UnixStatus != 0) {
- Status = EFI_DEVICE_ERROR;
- }
-
-Done:
- if (OldFileInfo != NULL) {
- gBS->FreePool (OldFileInfo);
- }
-
- if (OldFileName != NULL) {
- gBS->FreePool (OldFileName);
- }
-
- if (NewFileName != NULL) {
- gBS->FreePool (NewFileName);
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemFlush (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Flush all modified data to the media.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The data has been flushed.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- UNIX_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_SUCCESS;
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
-
- if (PrivateFile->IsDirectoryPath) {
- goto Done;
- }
-
- if (PrivateFile->IsOpenedByRead) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- if (PrivateFile->fd < 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- PrivateFile->UnixThunk->FSync (PrivateFile->fd) == 0 ? EFI_SUCCESS : EFI_DEVICE_ERROR;
-
-Done:
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-
- //
- // bugbug: - Use Unix error reporting.
- //
-}
-
-
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.h b/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.h
deleted file mode 100644
index e4d4d3097e..0000000000
--- a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.h
+++ /dev/null
@@ -1,599 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSimpleFileSystem.h
-
-Abstract:
-
- Produce Simple File System abstractions for a directory on your PC using Unix APIs.
- The configuration of what devices to mount or emulate comes from
- environment variables.
-
---*/
-
-#ifndef _UNIX_SIMPLE_FILE_SYSTEM_H_
-#define _UNIX_SIMPLE_FILE_SYSTEM_H_
-
-#include "PiDxe.h"
-#include <Guid/FileSystemInfo.h>
-#include <Guid/FileInfo.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
-#include <Protocol/SimpleFileSystem.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include "UnixDxe.h"
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixSimpleFileSystemDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixSimpleFileSystemComponentName;
-
-
-#define UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('L', 'X', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
- CHAR8 *FilePath;
- CHAR16 *VolumeLabel;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} UNIX_SIMPLE_FILE_SYSTEM_PRIVATE;
-
-#define UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE, \
- SimpleFileSystem, \
- UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
- )
-
-#define UNIX_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('l', 'o', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EFI_FILE_PROTOCOL EfiFile;
- INTN fd;
- DIR *Dir;
- BOOLEAN IsRootDirectory;
- BOOLEAN IsDirectoryPath;
- BOOLEAN IsOpenedByRead;
- char *FileName;
- struct dirent *Dirent;
-} UNIX_EFI_FILE_PRIVATE;
-
-#define UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- UNIX_EFI_FILE_PRIVATE, \
- EfiFile, \
- UNIX_EFI_FILE_PRIVATE_SIGNATURE \
- )
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixSimpleFileSystemDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixSimpleFileSystemComponentName;
-
-//
-// Driver Binding protocol member functions
-//
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Check to see if the driver supports a given controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to test.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
- specified by This.
-
- EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- the driver specified by This.
-
- EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- a different driver or an application that requires exclusive access.
-
- EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
- driver specified by This.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Starts a device controller or a bus controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to start.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device or bus controller has been started.
-
- EFI_DEVICE_ERROR - The device could not be started due to a device failure.
-
- EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - A handle to the device to be stopped.
-
- NumberOfChildren - The number of child device handles in ChildHandleBuffer.
-
- ChildHandleBuffer - An array of child device handles to be freed.
-
-Returns:
-
- EFI_SUCCESS - The device has been stopped.
-
- EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
-
---*/
-;
-
-//
-// Simple File System protocol member functions
-//
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- )
-/*++
-
-Routine Description:
-
- Open the root directory on a volume.
-
-Arguments:
-
- This - A pointer to the volume to open.
-
- Root - A pointer to storage for the returned opened file handle of the root directory.
-
-Returns:
-
- EFI_SUCCESS - The volume was opened.
-
- EFI_UNSUPPORTED - The volume does not support the requested file system type.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Open a file relative to the source file location.
-
-Arguments:
-
- This - A pointer to the source file location.
-
- NewHandle - Pointer to storage for the new file handle.
-
- FileName - Pointer to the file name to be opened.
-
- OpenMode - File open mode information.
-
- Attributes - File creation attributes.
-
-Returns:
-
- EFI_SUCCESS - The file was opened.
-
- EFI_NOT_FOUND - The file could not be found in the volume.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_WRITE_PROTECTED - The volume or file is write protected.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
-
- EFI_VOLUME_FULL - There is not enough space left to create the new file.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemClose (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Close the specified file handle.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle has been closed.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemDelete (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Close and delete a file.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle was closed and deleted.
-
- EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemRead (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read data from a file.
-
-Arguments:
-
- This - Pointer to a returned open file handle.
-
- BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
-
- Buffer - Pointer to the first byte of the read Buffer.
-
-Returns:
-
- EFI_SUCCESS - The data was read.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
- *BufferSize has been updated with the size needed to complete the request.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemWrite (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Write data to a file.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
- of data written to the file.
-
- Buffer - Pointer to the first by of data in the buffer to write to the file.
-
-Returns:
-
- EFI_SUCCESS - The data was written to the file.
-
- EFI_UNSUPPORTED - Writes to an open directory are not supported.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemSetPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-/*++
-
-Routine Description:
-
- Set a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - The byte position from the start of the file to set.
-
-Returns:
-
- EFI_SUCCESS - The file position has been changed.
-
- EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemGetPosition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-/*++
-
-Routine Description:
-
- Get a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - Pointer to storage for the current position.
-
-Returns:
-
- EFI_SUCCESS - The file position has been reported.
-
- EFI_UNSUPPORTED - Not valid for directories.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Return information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID describing the type of information to be returned.
-
- BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
- information buffer.
-
- Buffer - Pointer to the first byte of the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The requested information has been written into the buffer.
-
- EFI_UNSUPPORTED - The InformationType is not known.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
- been updated with the size needed to complete the requested operation.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Set information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID identifying the type of information to set.
-
- BufferSize - Number of bytes of data in the information buffer.
-
- Buffer - Pointer to the first byte of data in the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The file or volume information has been updated.
-
- EFI_UNSUPPORTED - The information identifier is not recognised.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
- EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixSimpleFileSystemFlush (
- IN EFI_FILE_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Flush all modified data to the media.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The data has been flushed.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-;
-
-#endif /* _UNIX_SIMPLE_FILE_SYSTEM_H_ */
-
-/* eof - UnixSimpleFileSystem.h */
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf b/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
deleted file mode 100644
index 44d0362d0c..0000000000
--- a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
+++ /dev/null
@@ -1,69 +0,0 @@
-## @file
-# Simple filesystem driver
-#
-# Produce Simple File System abstractions for directories on your PC using Unix APIs.
-# The configuration of what devices to mount or emulate comes from
-# environment variables.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixSimpleFileSystem
- FILE_GUID = f330834e-8985-11db-a295-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixSimpleFileSystem
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixSimpleFileSystemDriverBinding
-# COMPONENT_NAME = gUnixSimpleFileSystemComponentName
-#
-
-[Sources]
- ComponentName.c
- UnixSimpleFileSystem.c
- UnixSimpleFileSystem.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
- gEfiFileInfoGuid # SOMETIMES_CONSUMED
- gEfiFileSystemInfoGuid # SOMETIMES_CONSUMED
- gEfiUnixFileSystemGuid # ALWAYS_CONSUMED
-
-
-[Protocols]
- gEfiSimpleFileSystemProtocolGuid # PROTOCOL BY_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
diff --git a/UnixPkg/UnixSnpDxe/ComponentName.c b/UnixPkg/UnixSnpDxe/ComponentName.c
deleted file mode 100644
index ce2880b51d..0000000000
--- a/UnixPkg/UnixSnpDxe/ComponentName.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/** @file
-
- Copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
--**/
-
-#include "UnixSnp.h"
-
-//
-// EFI Component Name Functions
-//
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 4646 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 4646 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-
-//
-// EFI Component Name Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUnixSnpDriverComponentName = {
- UnixSnpDriverComponentNameGetDriverName,
- UnixSnpDriverComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUnixSnpDriverComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UnixSnpDriverComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UnixSnpDriverComponentNameGetControllerName,
- "en"
-};
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUnixSnpDriverNameTable[] = {
- {
- "eng;en",
- L"Unix SNP Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 4646 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mUnixSnpDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gUnixSnpDriverComponentName)
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 4646 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/UnixPkg/UnixSnpDxe/UnixSnp.c b/UnixPkg/UnixSnpDxe/UnixSnp.c
deleted file mode 100644
index b910041911..0000000000
--- a/UnixPkg/UnixSnpDxe/UnixSnp.c
+++ /dev/null
@@ -1,1791 +0,0 @@
-/** @file
-
- Copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSnp.c
-
-Abstract:
-
--**/
-
-#include <Library/PrintLib.h>
-
-#include "UnixSnp.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixSnpDriverBinding =
-{
- UnixSnpDriverBindingSupported,
- UnixSnpDriverBindingStart,
- UnixSnpDriverBindingStop,
- 0xA,
- NULL,
- NULL
-};
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStart(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- );
-
-/**
- Changes the state of a network interface from "started" to "stopped".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStop(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- );
-
-/**
- Resets a network adapter and allocates the transmit and receive buffers
- required by the network interface; optionally, also requests allocation
- of additional transmit and receive buffers.
-
- @param This Protocol instance pointer.
- @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
- that the driver should allocate for the network interface.
- Some network interfaces will not be able to use the extra
- buffer, and the caller will not know if it is actually
- being used.
- @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
- that the driver should allocate for the network interface.
- Some network interfaces will not be able to use the extra
- buffer, and the caller will not know if it is actually
- being used.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpInitialize(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- );
-
-/**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
-
- @param This Protocol instance pointer.
- @param ExtendedVerification Indicates that the driver may perform a more
- exhaustive verification operation of the device
- during reset.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReset(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN ExtendedVerification
- );
-
-/**
- Resets a network adapter and leaves it in a state that is safe for
- another driver to initialize.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpShutdown(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- );
-
-/**
- Manages the multicast receive filters of a network interface.
-
- @param This Protocol instance pointer.
- @param EnableBits A bit mask of receive filters to enable on the network interface.
- @param DisableBits A bit mask of receive filters to disable on the network interface.
- @param ResetMcastFilter Set to TRUE to reset the contents of the multicast receive
- filters on the network interface to their default values.
- @param McastFilterCount Number of multicast HW MAC addresses in the new
- MCastFilter list. This value must be less than or equal to
- the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This
- field is optional if ResetMCastFilter is TRUE.
- @param McastFilter A pointer to a list of new multicast receive filter HW MAC
- addresses. This list will replace any existing multicast
- HW MAC address list. This field is optional if
- ResetMCastFilter is TRUE.
-
- @retval EFI_SUCCESS The multicast receive filter list was updated.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReceiveFilters(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINT32 EnableBits,
- IN UINT32 DisableBits,
- IN BOOLEAN ResetMcastFilter,
- IN UINTN McastFilterCount OPTIONAL,
- IN EFI_MAC_ADDRESS* McastFilter OPTIONAL
- );
-
-/**
- Modifies or resets the current station address, if supported.
-
- @param This Protocol instance pointer.
- @param Reset Flag used to reset the station address to the network interfaces
- permanent address.
- @param NewMacAddr New station address to be used for the network interface.
-
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStationAddress(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS* NewMacAddr OPTIONAL
- );
-
-/**
- Resets or collects the statistics on a network interface.
-
- @param This Protocol instance pointer.
- @param Reset Set to TRUE to reset the statistics for the network interface.
- @param StatisticsSize On input the size, in bytes, of StatisticsTable. On
- output the size, in bytes, of the resulting table of
- statistics.
- @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
- contains the statistics.
-
- @retval EFI_SUCCESS The statistics were collected from the network interface.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
- size needed to hold the statistics is returned in
- StatisticsSize.
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStatistics(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Reset,
- IN OUT UINTN* StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS* StatisticsTable OPTIONAL
- );
-
-/**
- Converts a multicast IP address to a multicast HW MAC address.
-
- @param This Protocol instance pointer.
- @param Ipv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
- to FALSE if the multicast IP address is IPv4 [RFC 791].
- @param Ip The multicast IP address that is to be converted to a multicast
- HW MAC address.
- @param Mac The multicast HW MAC address that is to be generated from IP.
-
- @retval EFI_SUCCESS The multicast IP address was mapped to the multicast
- HW MAC address.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
- size needed to hold the statistics is returned in
- StatisticsSize.
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpMcastIptoMac(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Ipv6,
- IN EFI_IP_ADDRESS* Ip,
- OUT EFI_MAC_ADDRESS* Mac
- );
-
-/**
- Performs read and write operations on the NVRAM device attached to a
- network interface.
-
- @param This Protocol instance pointer.
- @param ReadOrWrite TRUE for read operations, FALSE for write operations.
- @param Offset Byte offset in the NVRAM device at which to start the read or
- write operation. This must be a multiple of NvRamAccessSize and
- less than NvRamSize.
- @param BufferSize The number of bytes to read or write from the NVRAM device.
- This must also be a multiple of NvramAccessSize.
- @param Buffer A pointer to the data buffer.
-
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpNvdata(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN ReadOrWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID* Buffer
- );
-
-/**
- Reads the current interrupt status and recycled transmit buffer status from
- a network interface.
-
- @param This Protocol instance pointer.
- @param InterruptStatus A pointer to the bit mask of the currently active interrupts
- If this is NULL, the interrupt status will not be read from
- the device. If this is not NULL, the interrupt status will
- be read from the device. When the interrupt status is read,
- it will also be cleared. Clearing the transmit interrupt
- does not empty the recycled transmit buffer array.
- @param TxBuffer Recycled transmit buffer address. The network interface will
- not transmit if its internal recycled transmit buffer array
- is full. Reading the transmit buffer does not clear the
- transmit interrupt. If this is NULL, then the transmit buffer
- status will not be read. If there are no transmit buffers to
- recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpGetStatus(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- OUT UINT32* InterruptStatus,
- OUT VOID** TxBuffer
- );
-
-/**
- Places a packet in the transmit queue of a network interface.
-
- @param This Protocol instance pointer.
- @param HeaderSize The size, in bytes, of the media header to be filled in by
- the Transmit() function. If HeaderSize is non-zero, then it
- must be equal to This->Mode->MediaHeaderSize and the DestAddr
- and Protocol parameters must not be NULL.
- @param BufferSize The size, in bytes, of the entire packet (media header and
- data) to be transmitted through the network interface.
- @param Buffer A pointer to the packet (media header followed by data) to be
- transmitted. This parameter cannot be NULL. If HeaderSize is zero,
- then the media header in Buffer must already be filled in by the
- caller. If HeaderSize is non-zero, then the media header will be
- filled in by the Transmit() function.
- @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
- is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
- This->Mode->CurrentAddress is used for the source HW MAC address.
- @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this
- parameter is ignored.
- @param Protocol The type of header to build. If HeaderSize is zero, then this
- parameter is ignored. See RFC 1700, section "Ether Types", for
- examples.
-
- @retval EFI_SUCCESS The packet was placed on the transmit queue.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_ACCESS_DENIED Error acquire global lock for operation.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpTransmit(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINTN HeaderSize,
- IN UINTN BufferSize,
- IN VOID* Buffer,
- IN EFI_MAC_ADDRESS* SrcAddr OPTIONAL,
- IN EFI_MAC_ADDRESS* DestAddr OPTIONAL,
- IN UINT16* Protocol OPTIONAL
- );
-
-/**
- Receives a packet from a network interface.
-
- @param This Protocol instance pointer.
- @param HeaderSize The size, in bytes, of the media header received on the network
- interface. If this parameter is NULL, then the media header size
- will not be returned.
- @param BuffSize On entry, the size, in bytes, of Buffer. On exit, the size, in
- bytes, of the packet that was received on the network interface.
- @param Buffer A pointer to the data buffer to receive both the media header and
- the data.
- @param SourceAddr The source HW MAC address. If this parameter is NULL, the
- HW MAC source address will not be extracted from the media
- header.
- @param DestinationAddr The destination HW MAC address. If this parameter is NULL,
- the HW MAC destination address will not be extracted from the
- media header.
- @param Protocol The media header type. If this parameter is NULL, then the
- protocol will not be extracted from the media header. See
- RFC 1700 section "Ether Types" for examples.
-
- @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
- been updated to the number of bytes received.
- @retval EFI_NOT_READY The network interface is too busy to accept this transmit
- request.
- @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_ACCESS_DENIED Error acquire global lock for operation.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReceive(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- OUT UINTN* HeaderSize OPTIONAL,
- IN OUT UINTN* BuffSize,
- OUT VOID* Buffer,
- OUT EFI_MAC_ADDRESS* SourceAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS* DestinationAddr OPTIONAL,
- OUT UINT16* Protocol OPTIONAL
- );
-
-VOID
-EFIAPI
-UnixSnpWaitForPacketNotify(
- IN EFI_EVENT Event,
- IN VOID* Private
- );
-
-//
-// Strange, but there doesn't appear to be any structure for the Ethernet header in edk2...
-//
-
-typedef struct
-{
- UINT8 DstAddr[ NET_ETHER_ADDR_LEN ];
- UINT8 SrcAddr[ NET_ETHER_ADDR_LEN ];
- UINT16 Type;
-} EthernetHeader;
-
-UNIX_SNP_PRIVATE_DATA gUnixSnpPrivateTemplate =
-{
- UNIX_SNP_PRIVATE_DATA_SIGNATURE, // Signature
- NULL, // UnixThunk
- NULL, // DeviceHandle
- NULL, // DevicePath
- { 0 }, // MacAddress
- NULL, // InterfaceName
- 0, // ReadBufferSize
- NULL, // ReadBuffer
- NULL, // CurrentReadPointer
- NULL, // EndReadPointer
- 0, // BpfFd
- { // Snp
- EFI_SIMPLE_NETWORK_PROTOCOL_REVISION, // Revision
- UnixSnpStart, // Start
- UnixSnpStop, // Stop
- UnixSnpInitialize, // Initialize
- UnixSnpReset, // Reset
- UnixSnpShutdown, // Shutdown
- UnixSnpReceiveFilters, // ReceiveFilters
- UnixSnpStationAddress, // StationAddress
- UnixSnpStatistics, // Statistics
- UnixSnpMcastIptoMac, // MCastIpToMac
- UnixSnpNvdata, // NvData
- UnixSnpGetStatus, // GetStatus
- UnixSnpTransmit, // Transmit
- UnixSnpReceive, // Receive
- NULL, // WaitForPacket
- NULL // Mode
- },
- { // Mode
- EfiSimpleNetworkStopped, // State
- NET_ETHER_ADDR_LEN, // HwAddressSize
- NET_ETHER_HEADER_SIZE, // MediaHeaderSize
- 1500, // MaxPacketSize
- 0, // NvRamSize
- 0, // NvRamAccessSize
- 0, // ReceiveFilterMask
- 0, // ReceiveFilterSetting
- MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
- 0, // MCastFilterCount
- {
- 0
- }, // MCastFilter
- {
- 0
- }, // CurrentAddress
- {
- 0
- }, // BroadcastAddress
- {
- 0
- }, // PermanentAddress
- NET_IFTYPE_ETHERNET, // IfType
- FALSE, // MacAddressChangeable
- FALSE, // MultipleTxSupported
- FALSE, // MediaPresentSupported
- TRUE // MediaPresent
- }
-};
-
-STATIC EFI_STATUS
-GetInterfaceMacAddr(
- IN UNIX_SNP_PRIVATE_DATA* Private,
- IN EFI_UNIX_IO_PROTOCOL* UnixIo
- )
-{
- struct ifaddrs* IfAddrs;
- struct ifaddrs* If;
- struct sockaddr_dl* IfSdl;
- EFI_STATUS Status;
- INTN Result;
-
- Result = UnixIo->UnixThunk->GetIfAddrs( &IfAddrs );
- if ( Result != 0 )
- {
- return( EFI_UNSUPPORTED );
- }
-
- //
- // Convert the interface name to ASCII so we can find it.
- //
- Private->InterfaceName = AllocateZeroPool( StrLen( UnixIo->EnvString ) );
-
- if ( !Private->InterfaceName )
- {
- Status = EFI_OUT_OF_RESOURCES;
- goto Exit;
- }
-
- UnicodeStrToAsciiStr( UnixIo->EnvString, Private->InterfaceName );
-
- If = IfAddrs;
-
- while ( If != NULL )
- {
- IfSdl = ( struct sockaddr_dl * ) If->ifa_addr;
-
- if ( IfSdl->sdl_family == AF_LINK )
- {
- if ( !AsciiStrCmp( Private->InterfaceName, If->ifa_name ) )
- {
- CopyMem( &Private->MacAddress, LLADDR( IfSdl ), NET_ETHER_ADDR_LEN );
-
- Status = EFI_SUCCESS;
- break;
- }
- }
-
- If = If->ifa_next;
- }
-
-Exit:
- ( VOID ) UnixIo->UnixThunk->FreeIfAddrs( IfAddrs );
-
- return( Status );
-}
-
-
-STATIC EFI_STATUS
-OpenBpfFileDescriptor(
- IN UNIX_SNP_PRIVATE_DATA* Private,
- OUT INTN* Fd
- )
-{
- CHAR8 BfpDeviceName[ 256 ];
- INTN Index;
- EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
- INTN Result;
-
- //
- // Open a Berkeley Packet Filter device. This must be done as root, so this is probably
- // the place which is most likely to fail...
- //
- for ( Index = 0; TRUE; Index++ )
- {
- AsciiSPrint( BfpDeviceName, sizeof( BfpDeviceName ), "/dev/bpf%d", Index );
-
- *Fd = Private->UnixThunk->Open( BfpDeviceName, O_RDWR, 0 );
-
- if ( *Fd >= 0 )
- {
- Status = EFI_SUCCESS;
- break;
- }
-
- Result = Private->UnixThunk->GetErrno();
- if ( Result == EACCES )
- {
- DEBUG( ( EFI_D_ERROR, "Permissions on '%a' are incorrect. Fix with 'sudo chmod 666 %a'.\n",
- BfpDeviceName, BfpDeviceName ) );
- }
- if ( Result != EBUSY )
- {
- break;
- }
- }
-
- return( Status );
-}
-
-
-/**
- Test to see if this driver supports ControllerHandle. This service
- is called by the EFI boot service ConnectController(). In
- order to make drivers as small as possible, there are a few calling
- restrictions for this service. ConnectController() must
- follow these calling restrictions. If any other agent wishes to call
- Supported() it must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to test
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver supports this device
- @retval EFI_UNSUPPORTED This driver does not support this device
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingSupported(
- IN EFI_DRIVER_BINDING_PROTOCOL* This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL* RemainingDevicePath OPTIONAL
- )
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL* UnixIo;
-
- //
- // Open the I/O abstraction needed to perform the supported test.
- //
- Status = gBS->OpenProtocol(
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- ( VOID ** ) &UnixIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if ( EFI_ERROR( Status ) )
- {
- return( Status );
- }
-
- //
- // Validate GUID
- //
- Status = EFI_UNSUPPORTED;
- if ( CompareGuid( UnixIo->TypeGuid, &gEfiUnixNetworkGuid ) )
- {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close the I/O abstraction used to perform the supported test.
- //
- gBS->CloseProtocol(
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return( Status );
-}
-
-
-/**
- Start this driver on ControllerHandle. This service is called by the
- EFI boot service ConnectController(). In order to make
- drivers as small as possible, there are a few calling restrictions for
- this service. ConnectController() must follow these
- calling restrictions. If any other agent wishes to call Start() it
- must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to bind driver to
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingStart(
- IN EFI_DRIVER_BINDING_PROTOCOL* This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL* RemainingDevicePath OPTIONAL
- )
-{
- MAC_ADDR_DEVICE_PATH Node;
- EFI_DEVICE_PATH_PROTOCOL* ParentDevicePath = NULL;
- EFI_UNIX_IO_PROTOCOL* UnixIo;
- UNIX_SNP_PRIVATE_DATA* Private = NULL;
- EFI_STATUS Status;
- BOOLEAN CreateDevice;
-
- //
- // Grab the protocols we need.
- //
- Status = gBS->OpenProtocol(
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- ( VOID ** ) &ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
-
- //
- // Open the I/O abstraction needed to perform the supported test.
- //
- Status = gBS->OpenProtocol(
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- ( VOID ** ) &UnixIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
-
- //
- // Validate GUID
- //
- if ( !CompareGuid( UnixIo->TypeGuid, &gEfiUnixNetworkGuid ) )
- {
- Status = EFI_UNSUPPORTED;
- goto ErrorExit;
- }
-
- CreateDevice = TRUE;
- if ( ( RemainingDevicePath != NULL ) && IsDevicePathEnd( RemainingDevicePath ) )
- {
- CreateDevice = FALSE;
- }
-
- if ( CreateDevice )
- {
- //
- // Allocate the private data.
- //
- Private = AllocateCopyPool( sizeof( UNIX_SNP_PRIVATE_DATA ), &gUnixSnpPrivateTemplate );
- if ( Private == NULL )
- {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- Status = GetInterfaceMacAddr( Private, UnixIo );
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
-
- Private->UnixThunk = UnixIo->UnixThunk;
-
- Private->Snp.Mode = &Private->Mode;
-
- //
- // Set the broadcast address.
- //
- SetMem( &Private->Mode.BroadcastAddress, sizeof( EFI_MAC_ADDRESS ), 0xFF );
-
- CopyMem( &Private->Mode.CurrentAddress, &Private->MacAddress, sizeof( EFI_MAC_ADDRESS ) );
- CopyMem( &Private->Mode.PermanentAddress, &Private->MacAddress, sizeof( EFI_MAC_ADDRESS ) );
-
- //
- // Since the fake SNP is based on a real NIC, to avoid conflict with the host NIC
- // network stack, we use a different MAC address.
- // So just change the last byte of the MAC address for the real NIC.
- //
- Private->Mode.CurrentAddress.Addr[ NET_ETHER_ADDR_LEN - 1 ]++;
-
- //
- // Build the device path by appending the MAC node to the ParentDevicePath
- // from the UnixIo handle.
- //
- ZeroMem( &Node, sizeof( MAC_ADDR_DEVICE_PATH ) );
-
- Node.Header.Type = MESSAGING_DEVICE_PATH;
- Node.Header.SubType = MSG_MAC_ADDR_DP;
- Node.IfType = Private->Mode.IfType;
-
- SetDevicePathNodeLength( ( EFI_DEVICE_PATH_PROTOCOL * ) &Node, sizeof( MAC_ADDR_DEVICE_PATH ) );
-
- CopyMem( &Node.MacAddress, &Private->Mode.CurrentAddress, sizeof( EFI_MAC_ADDRESS ) );
-
- //
- // Build the device path by appending the MAC node to the ParentDevicePath from the UnixIo handle.
- //
- Private->DevicePath = AppendDevicePathNode( ParentDevicePath, ( EFI_DEVICE_PATH_PROTOCOL * ) &Node );
- if ( Private->DevicePath == NULL )
- {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Private->DeviceHandle,
- &gEfiSimpleNetworkProtocolGuid,
- &Private->Snp,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
-
- Status = gBS->OpenProtocol(
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- ( VOID ** ) &UnixIo,
- This->DriverBindingHandle,
- Private->DeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
- }
- return( Status );
-
-ErrorExit:
- if ( Private->InterfaceName != NULL )
- {
- FreePool( Private->InterfaceName );
- Private->InterfaceName = NULL;
- }
- if ( Private != NULL )
- {
- FreePool( Private );
- }
- if ( ParentDevicePath != NULL )
- {
- gBS->CloseProtocol(
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return( Status );
-}
-
-/**
- Stop this driver on ControllerHandle. This service is called by the
- EFI boot service DisconnectController(). In order to
- make drivers as small as possible, there are a few calling
- restrictions for this service. DisconnectController()
- must follow these calling restrictions. If any other agent wishes
- to call Stop() it must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to stop driver on
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
- children is zero stop the entire bus driver.
- @param ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingStop(
- IN EFI_DRIVER_BINDING_PROTOCOL* This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE* ChildHandleBuffer
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private = NULL;
- EFI_SIMPLE_NETWORK_PROTOCOL* Snp;
- EFI_STATUS Status;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol(
- ControllerHandle,
- &gEfiSimpleNetworkProtocolGuid,
- ( VOID ** ) &Snp,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if ( EFI_ERROR( Status ) )
- {
- return( EFI_UNSUPPORTED );
- }
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( Snp );
-
- Status = gBS->CloseProtocol(
- ControllerHandle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Private->DeviceHandle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces(
- Private->DeviceHandle,
- &gEfiSimpleNetworkProtocolGuid,
- &Private->Snp,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
-
- FreePool( Private->InterfaceName );
- FreePool( Private->DevicePath );
- FreePool( Private );
-
- return( EFI_SUCCESS );
-}
-
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStart(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- )
-{
- STATIC struct bpf_insn FilterInstructionTemplate[] =
- {
- // Load 4 bytes from the destination MAC address.
- BPF_STMT( BPF_LD + BPF_W + BPF_ABS, OFFSET_OF( EthernetHeader, DstAddr[ 0 ] ) ),
-
- // Compare to first 4 bytes of fake MAC address.
- BPF_JUMP( BPF_JMP + BPF_JEQ + BPF_K, 0x12345678, 0, 3 ),
-
- // Load remaining 2 bytes from the destination MAC address.
- BPF_STMT( BPF_LD + BPF_H + BPF_ABS, OFFSET_OF( EthernetHeader, DstAddr[ 4 ] ) ),
-
- // Compare to remaining 2 bytes of fake MAC address.
- BPF_JUMP( BPF_JMP + BPF_JEQ + BPF_K, 0x9ABC, 5, 0 ),
-
- // Load 4 bytes from the destination MAC address.
- BPF_STMT( BPF_LD + BPF_W + BPF_ABS, OFFSET_OF( EthernetHeader, DstAddr[ 0 ] ) ),
-
- // Compare to first 4 bytes of broadcast MAC address.
- BPF_JUMP( BPF_JMP + BPF_JEQ + BPF_K, 0xFFFFFFFF, 0, 2 ),
-
- // Load remaining 2 bytes from the destination MAC address.
- BPF_STMT( BPF_LD + BPF_H + BPF_ABS, OFFSET_OF( EthernetHeader, DstAddr[ 4 ] ) ),
-
- // Compare to remaining 2 bytes of broadcast MAC address.
- BPF_JUMP( BPF_JMP + BPF_JEQ + BPF_K, 0xFFFF, 1, 0 ),
-
- // Reject packet.
- BPF_STMT( BPF_RET + BPF_K, 0 ),
-
- // Receive entire packet.
- BPF_STMT( BPF_RET + BPF_K, -1 )
- };
- struct ifreq BoundIf;
- struct bpf_program BpfProgram;
- struct bpf_insn* FilterProgram;
- UNIX_SNP_PRIVATE_DATA* Private;
- EFI_STATUS Status;
- UINT32 Temp32;
- INTN Fd;
- INTN Result;
- INTN Value;
- UINT16 Temp16;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- switch ( Private->Snp.Mode->State )
- {
- case EfiSimpleNetworkStopped:
- break;
-
- case EfiSimpleNetworkStarted:
- case EfiSimpleNetworkInitialized:
- return( EFI_ALREADY_STARTED );
- break;
-
- default:
- return( EFI_DEVICE_ERROR );
- break;
- }
-
- if ( Private->BpfFd == 0 )
- {
- Status = OpenBpfFileDescriptor( Private, &Fd );
-
- if ( EFI_ERROR( Status ) )
- {
- goto ErrorExit;
- }
-
- Private->BpfFd = Fd;
-
- //
- // Associate our interface with this BPF file descriptor.
- //
- AsciiStrCpy( BoundIf.ifr_name, Private->InterfaceName );
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCSETIF, &BoundIf );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
- //
- // Enable immediate mode and find out the buffer size.
- //
- Value = 1;
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCIMMEDIATE, &Value );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
- //
- // Enable non-blocking I/O.
- //
-
- Value = Private->UnixThunk->Fcntl( Private->BpfFd, F_GETFL, 0 );
-
- if ( Value == -1 )
- {
- goto DeviceErrorExit;
- }
-
- Value |= O_NONBLOCK;
-
- Result = Private->UnixThunk->Fcntl( Private->BpfFd, F_SETFL, (void *) Value );
-
- if ( Result == -1 )
- {
- goto DeviceErrorExit;
- }
-
- //
- // Disable "header complete" flag. This means the supplied source MAC address is
- // what goes on the wire.
- //
- Value = 1;
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCSHDRCMPLT, &Value );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCGBLEN, &Value );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
- //
- // Allocate read buffer.
- //
- Private->ReadBufferSize = Value;
- Private->ReadBuffer = AllocateZeroPool( Private->ReadBufferSize );
- if ( Private->ReadBuffer == NULL )
- {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer;
-
- //
- // Install our packet filter: successful reads should only produce broadcast or unitcast
- // packets directed to our fake MAC address.
- //
- FilterProgram = AllocateCopyPool( sizeof( FilterInstructionTemplate ), &FilterInstructionTemplate );
- if ( FilterProgram == NULL )
- {
- goto ErrorExit;
- }
-
- //
- // Insert out fake MAC address into the filter. The data has to be host endian.
- //
- CopyMem( &Temp32, &Private->Mode.CurrentAddress.Addr[ 0 ], sizeof( UINT32 ) );
- FilterProgram[ 1 ].k = NTOHL( Temp32 );
- CopyMem( &Temp16, &Private->Mode.CurrentAddress.Addr[ 4 ], sizeof( UINT16 ) );
- FilterProgram[ 3 ].k = NTOHS( Temp16 );
-
- BpfProgram.bf_len = sizeof( FilterInstructionTemplate ) / sizeof( struct bpf_insn );
- BpfProgram.bf_insns = FilterProgram;
-
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCSETF, &BpfProgram );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
- FreePool( FilterProgram );
-
- //
- // Enable promiscuous mode.
- //
-
- Result = Private->UnixThunk->IoCtl( Private->BpfFd, BIOCPROMISC, 0 );
-
- if ( Result < 0 )
- {
- goto DeviceErrorExit;
- }
-
-
- Private->Snp.Mode->State = EfiSimpleNetworkStarted;
- }
-
- return( Status );
-
-DeviceErrorExit:
- Status = EFI_DEVICE_ERROR;
-ErrorExit:
- if ( Private->ReadBuffer != NULL )
- {
- FreePool( Private->ReadBuffer );
- Private->ReadBuffer = NULL;
- }
- return( Status );
-}
-
-
-/**
- Changes the state of a network interface from "started" to "stopped".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStop(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private = EFI_SUCCESS;
- EFI_STATUS Status;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- switch ( Private->Snp.Mode->State )
- {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return( EFI_NOT_STARTED );
- break;
-
- default:
- return( EFI_DEVICE_ERROR );
- break;
- }
-
- if ( Private->BpfFd != 0 )
- {
- Private->UnixThunk->Close( Private->BpfFd );
- Private->BpfFd = 0;
- }
-
- if ( Private->ReadBuffer != NULL )
- {
- FreePool( Private->ReadBuffer );
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer = NULL;
- }
-
- Private->Snp.Mode->State = EfiSimpleNetworkStopped;
-
- return( Status );
-}
-
-
-/**
- Resets a network adapter and allocates the transmit and receive buffers
- required by the network interface; optionally, also requests allocation
- of additional transmit and receive buffers.
-
- @param This Protocol instance pointer.
- @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
- that the driver should allocate for the network interface.
- Some network interfaces will not be able to use the extra
- buffer, and the caller will not know if it is actually
- being used.
- @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
- that the driver should allocate for the network interface.
- Some network interfaces will not be able to use the extra
- buffer, and the caller will not know if it is actually
- being used.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpInitialize(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private = EFI_SUCCESS;
- EFI_STATUS Status;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- switch ( Private->Snp.Mode->State )
- {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return( EFI_NOT_STARTED );
- break;
-
- default:
- return( EFI_DEVICE_ERROR );
- break;
- }
-
-#if 0
- Status = gBS->CreateEvent(
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixSnpWaitForPacketNotify,
- Private,
- &Private->Snp.WaitForPacket
- );
-#endif
-
- if ( !EFI_ERROR( Status ) )
- {
- Private->Mode.MCastFilterCount = 0;
- Private->Mode.ReceiveFilterSetting = 0;
- ZeroMem( Private->Mode.MCastFilter, sizeof( Private->Mode.MCastFilter ) );
-
- Private->Snp.Mode->State = EfiSimpleNetworkInitialized;
- }
-
- return( Status );
-}
-
-/**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
-
- @param This Protocol instance pointer.
- @param ExtendedVerification Indicates that the driver may perform a more
- exhaustive verification operation of the device
- during reset.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReset(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN ExtendedVerification
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
- EFI_STATUS Success = EFI_SUCCESS;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- switch ( Private->Snp.Mode->State )
- {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return( EFI_NOT_STARTED );
- break;
-
- default:
- return( EFI_DEVICE_ERROR );
- break;
- }
-
- return( Success );
-}
-
-/**
- Resets a network adapter and leaves it in a state that is safe for
- another driver to initialize.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpShutdown(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
- EFI_STATUS Success = EFI_SUCCESS;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- switch ( Private->Snp.Mode->State )
- {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return( EFI_NOT_STARTED );
- break;
-
- default:
- return( EFI_DEVICE_ERROR );
- break;
- }
-
- Private->Snp.Mode->State = EfiSimpleNetworkStarted;
-
- Private->Mode.ReceiveFilterSetting = 0;
- Private->Mode.MCastFilterCount = 0;
- ZeroMem( Private->Mode.MCastFilter, sizeof( Private->Mode.MCastFilter ) );
-
- if ( Private->Snp.WaitForPacket != NULL )
- {
- gBS->CloseEvent( Private->Snp.WaitForPacket );
- Private->Snp.WaitForPacket = NULL;
- }
-
- if ( Private->BpfFd != 0 )
- {
- Private->UnixThunk->Close( Private->BpfFd );
- Private->BpfFd = 0;
- }
-
- if ( Private->ReadBuffer != NULL )
- {
- FreePool( Private->ReadBuffer );
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer = NULL;
- }
-
- return( Success );
-}
-
-/**
- Manages the multicast receive filters of a network interface.
-
- @param This Protocol instance pointer.
- @param EnableBits A bit mask of receive filters to enable on the network interface.
- @param DisableBits A bit mask of receive filters to disable on the network interface.
- @param ResetMcastFilter Set to TRUE to reset the contents of the multicast receive
- filters on the network interface to their default values.
- @param McastFilterCount Number of multicast HW MAC addresses in the new
- MCastFilter list. This value must be less than or equal to
- the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This
- field is optional if ResetMCastFilter is TRUE.
- @param McastFilter A pointer to a list of new multicast receive filter HW MAC
- addresses. This list will replace any existing multicast
- HW MAC address list. This field is optional if
- ResetMCastFilter is TRUE.
-
- @retval EFI_SUCCESS The multicast receive filter list was updated.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReceiveFilters(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINT32 EnableBits,
- IN UINT32 DisableBits,
- IN BOOLEAN ResetMcastFilter,
- IN UINTN McastFilterCount OPTIONAL,
- IN EFI_MAC_ADDRESS* McastFilter OPTIONAL
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
-// ReturnValue = GlobalData->NtNetUtilityTable.SetReceiveFilter (
-// Instance->InterfaceInfo.InterfaceIndex,
-// EnableBits,
-// McastFilterCount,
-// McastFilter
-// );
-
- // For now, just succeed...
- return( EFI_SUCCESS );
-}
-
-/**
- Modifies or resets the current station address, if supported.
-
- @param This Protocol instance pointer.
- @param Reset Flag used to reset the station address to the network interfaces
- permanent address.
- @param NewMacAddr New station address to be used for the network interface.
-
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStationAddress(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS* NewMacAddr OPTIONAL
- )
-{
- return( EFI_UNSUPPORTED );
-}
-
-/**
- Resets or collects the statistics on a network interface.
-
- @param This Protocol instance pointer.
- @param Reset Set to TRUE to reset the statistics for the network interface.
- @param StatisticsSize On input the size, in bytes, of StatisticsTable. On
- output the size, in bytes, of the resulting table of
- statistics.
- @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
- contains the statistics.
-
- @retval EFI_SUCCESS The statistics were collected from the network interface.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
- size needed to hold the statistics is returned in
- StatisticsSize.
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpStatistics(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Reset,
- IN OUT UINTN* StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS* StatisticsTable OPTIONAL
- )
-{
- return( EFI_UNSUPPORTED );
-}
-
-/**
- Converts a multicast IP address to a multicast HW MAC address.
-
- @param This Protocol instance pointer.
- @param Ipv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
- to FALSE if the multicast IP address is IPv4 [RFC 791].
- @param Ip The multicast IP address that is to be converted to a multicast
- HW MAC address.
- @param Mac The multicast HW MAC address that is to be generated from IP.
-
- @retval EFI_SUCCESS The multicast IP address was mapped to the multicast
- HW MAC address.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
- size needed to hold the statistics is returned in
- StatisticsSize.
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpMcastIptoMac(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN Ipv6,
- IN EFI_IP_ADDRESS* Ip,
- OUT EFI_MAC_ADDRESS* Mac
- )
-{
- return( EFI_UNSUPPORTED );
-}
-
-
-/**
- Performs read and write operations on the NVRAM device attached to a
- network interface.
-
- @param This Protocol instance pointer.
- @param ReadOrWrite TRUE for read operations, FALSE for write operations.
- @param Offset Byte offset in the NVRAM device at which to start the read or
- write operation. This must be a multiple of NvRamAccessSize and
- less than NvRamSize.
- @param BufferSize The number of bytes to read or write from the NVRAM device.
- This must also be a multiple of NvramAccessSize.
- @param Buffer A pointer to the data buffer.
-
- @retval EFI_UNSUPPORTED Not supported yet.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpNvdata(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN BOOLEAN ReadOrWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID* Buffer
- )
-{
- return( EFI_UNSUPPORTED );
-}
-
-
-/**
- Reads the current interrupt status and recycled transmit buffer status from
- a network interface.
-
- @param This Protocol instance pointer.
- @param InterruptStatus A pointer to the bit mask of the currently active interrupts
- If this is NULL, the interrupt status will not be read from
- the device. If this is not NULL, the interrupt status will
- be read from the device. When the interrupt status is read,
- it will also be cleared. Clearing the transmit interrupt
- does not empty the recycled transmit buffer array.
- @param TxBuffer Recycled transmit buffer address. The network interface will
- not transmit if its internal recycled transmit buffer array
- is full. Reading the transmit buffer does not clear the
- transmit interrupt. If this is NULL, then the transmit buffer
- status will not be read. If there are no transmit buffers to
- recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpGetStatus(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- OUT UINT32* InterruptStatus,
- OUT VOID** TxBuffer
- )
-{
- if ( TxBuffer != NULL )
- {
- *( ( UINT8 ** ) TxBuffer ) = ( UINT8 * ) 1;
- }
-
- if ( InterruptStatus != NULL )
- {
- *InterruptStatus = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
- }
-
- return( EFI_SUCCESS );
-}
-
-
-/**
- Places a packet in the transmit queue of a network interface.
-
- @param This Protocol instance pointer.
- @param HeaderSize The size, in bytes, of the media header to be filled in by
- the Transmit() function. If HeaderSize is non-zero, then it
- must be equal to This->Mode->MediaHeaderSize and the DestAddr
- and Protocol parameters must not be NULL.
- @param BufferSize The size, in bytes, of the entire packet (media header and
- data) to be transmitted through the network interface.
- @param Buffer A pointer to the packet (media header followed by data) to be
- transmitted. This parameter cannot be NULL. If HeaderSize is zero,
- then the media header in Buffer must already be filled in by the
- caller. If HeaderSize is non-zero, then the media header will be
- filled in by the Transmit() function.
- @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
- is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
- This->Mode->CurrentAddress is used for the source HW MAC address.
- @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this
- parameter is ignored.
- @param Protocol The type of header to build. If HeaderSize is zero, then this
- parameter is ignored. See RFC 1700, section "Ether Types", for
- examples.
-
- @retval EFI_SUCCESS The packet was placed on the transmit queue.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_NOT_STARTED The network interface has not been started.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpTransmit(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- IN UINTN HeaderSize,
- IN UINTN BufferSize,
- IN VOID* Buffer,
- IN EFI_MAC_ADDRESS* SrcAddr OPTIONAL,
- IN EFI_MAC_ADDRESS* DestAddr OPTIONAL,
- IN UINT16* Protocol OPTIONAL
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
- EthernetHeader* EnetHeader;
- INTN Result;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- if ( This->Mode->State < EfiSimpleNetworkStarted )
- {
- return( EFI_NOT_STARTED );
- }
-
- if ( HeaderSize != 0 )
- {
- if ( ( DestAddr == NULL ) || ( Protocol == NULL ) || ( HeaderSize != This->Mode->MediaHeaderSize ) )
- {
- return( EFI_INVALID_PARAMETER );
- }
-
- if ( SrcAddr == NULL )
- {
- SrcAddr = &This->Mode->CurrentAddress;
- }
-
- EnetHeader = ( EthernetHeader * ) Buffer;
-
- CopyMem( EnetHeader->DstAddr, DestAddr, NET_ETHER_ADDR_LEN );
- CopyMem( EnetHeader->SrcAddr, SrcAddr, NET_ETHER_ADDR_LEN );
-
- EnetHeader->Type = HTONS( *Protocol );
- }
-
- Result = Private->UnixThunk->Write( Private->BpfFd, Buffer, BufferSize );
-
- if ( Result < 0 )
- {
- return( EFI_DEVICE_ERROR );
- }
- else
- {
- return( EFI_SUCCESS );
- }
-}
-
-/**
- Receives a packet from a network interface.
-
- @param This Protocol instance pointer.
- @param HeaderSize The size, in bytes, of the media header received on the network
- interface. If this parameter is NULL, then the media header size
- will not be returned.
- @param BuffSize On entry, the size, in bytes, of Buffer. On exit, the size, in
- bytes, of the packet that was received on the network interface.
- @param Buffer A pointer to the data buffer to receive both the media header and
- the data.
- @param SourceAddr The source HW MAC address. If this parameter is NULL, the
- HW MAC source address will not be extracted from the media
- header.
- @param DestinationAddr The destination HW MAC address. If this parameter is NULL,
- the HW MAC destination address will not be extracted from the
- media header.
- @param Protocol The media header type. If this parameter is NULL, then the
- protocol will not be extracted from the media header. See
- RFC 1700 section "Ether Types" for examples.
-
- @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
- been updated to the number of bytes received.
- @retval EFI_NOT_READY The network interface is too busy to accept this transmit
- request.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpReceive(
- IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- OUT UINTN* HeaderSize OPTIONAL,
- IN OUT UINTN* BuffSize,
- OUT VOID* Buffer,
- OUT EFI_MAC_ADDRESS* SourceAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS* DestinationAddr OPTIONAL,
- OUT UINT16* Protocol OPTIONAL
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
- struct bpf_hdr* BpfHeader;
- EthernetHeader* EnetHeader;
- EFI_STATUS Status = EFI_SUCCESS;
- INTN Result;
-
- if ( This->Mode->State < EfiSimpleNetworkStarted )
- {
- return( EFI_NOT_STARTED );
- }
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( This );
-
- //
- // Do we have any remaining packets from the previous read?
- //
- if ( Private->CurrentReadPointer >= Private->EndReadPointer )
- {
- Result = Private->UnixThunk->Read( Private->BpfFd, Private->ReadBuffer, Private->ReadBufferSize );
-
- if ( Result < 0 )
- {
- Result = Private->UnixThunk->GetErrno();
-
- //
- // EAGAIN means that there's no I/O outstanding against this file descriptor.
- //
- if ( Result == EAGAIN )
- {
- return( EFI_NOT_READY );
- }
- else
- {
- return( EFI_DEVICE_ERROR );
- }
- }
-
- if ( Result == 0 )
- {
- return( EFI_NOT_READY );
- }
-
- Private->CurrentReadPointer = Private->ReadBuffer;
- Private->EndReadPointer = Private->CurrentReadPointer + Result;
- }
-
- BpfHeader = Private->CurrentReadPointer;
- EnetHeader = Private->CurrentReadPointer + BpfHeader->bh_hdrlen;
-
- if ( BpfHeader->bh_caplen > *BuffSize )
- {
- *BuffSize = BpfHeader->bh_caplen;
- return( EFI_BUFFER_TOO_SMALL );
- }
-
- CopyMem( Buffer, EnetHeader, BpfHeader->bh_caplen );
- *BuffSize = BpfHeader->bh_caplen;
-
- if ( HeaderSize != NULL )
- {
- *HeaderSize = sizeof( EthernetHeader );
- }
-
- if ( DestinationAddr != NULL )
- {
- ZeroMem( DestinationAddr, sizeof( EFI_MAC_ADDRESS ) );
- CopyMem( DestinationAddr, EnetHeader->DstAddr, NET_ETHER_ADDR_LEN );
- }
-
- if ( SourceAddr != NULL )
- {
- ZeroMem( SourceAddr, sizeof( EFI_MAC_ADDRESS ) );
- CopyMem( SourceAddr, EnetHeader->SrcAddr, NET_ETHER_ADDR_LEN );
- }
-
- if ( Protocol != NULL )
- {
- *Protocol = NTOHS( EnetHeader->Type );
- }
-
- Private->CurrentReadPointer += BPF_WORDALIGN( BpfHeader->bh_hdrlen + BpfHeader->bh_caplen );
-
- return( Status );
-}
-
-
-VOID
-EFIAPI
-UnixSnpWaitForPacketNotify(
- IN EFI_EVENT Event,
- IN VOID* Context
- )
-{
- UNIX_SNP_PRIVATE_DATA* Private;
-
- Private = UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS( Context );
-
- if ( Private->Snp.Mode->State < EfiSimpleNetworkStarted )
- {
- return;
- }
-}
-
-
-/**
- This is the declaration of an EFI image entry point. This entry point is
- the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
- both device drivers and bus drivers.
-
- @param ImageHandle The firmware allocated handle for the UEFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The operation completed successfully.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-InitializeUnixSnpDriver(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE* SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install the Driver Protocols
- //
-
- Status = EfiLibInstallDriverBindingComponentName2(
- ImageHandle,
- SystemTable,
- &gUnixSnpDriverBinding,
- ImageHandle,
- &gUnixSnpDriverComponentName,
- &gUnixSnpDriverComponentName2
- );
-
- return( Status );
-}
diff --git a/UnixPkg/UnixSnpDxe/UnixSnp.h b/UnixPkg/UnixSnpDxe/UnixSnp.h
deleted file mode 100644
index 532119afa4..0000000000
--- a/UnixPkg/UnixSnpDxe/UnixSnp.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/** @file
-
- Copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixSnp.h
-
-Abstract:
-
--**/
-
-#ifndef _UNIX_SNP_H_
-#define _UNIX_SNP_H_
-
-#include <Uefi.h>
-
-#include <Protocol/SimpleNetwork.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/UnixIo.h>
-
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/NetLib.h>
-
-#define NET_ETHER_HEADER_SIZE 14
-
-//
-// Private data for driver.
-//
-#define UNIX_SNP_PRIVATE_DATA_SIGNATURE SIGNATURE_32( 'U', 'S', 'N', 'P' )
-
-typedef struct
-{
- UINT32 Signature;
-
- EFI_UNIX_THUNK_PROTOCOL* UnixThunk;
-
- EFI_HANDLE DeviceHandle;
- EFI_DEVICE_PATH_PROTOCOL* DevicePath;
-
- EFI_MAC_ADDRESS MacAddress;
-
- CHAR8* InterfaceName;
- INTN ReadBufferSize;
- VOID* ReadBuffer;
- //
- // Two walking pointers to manage the multiple packets that can be returned
- // in a single read.
- //
- VOID* CurrentReadPointer;
- VOID* EndReadPointer;
-
- INTN BpfFd;
-
- EFI_SIMPLE_NETWORK_PROTOCOL Snp;
- EFI_SIMPLE_NETWORK_MODE Mode;
-} UNIX_SNP_PRIVATE_DATA;
-
-#define UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
- CR( a, UNIX_SNP_PRIVATE_DATA, Snp, UNIX_SNP_PRIVATE_DATA_SIGNATURE )
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixSnpDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixSnpDriverComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gUnixSnpDriverComponentName2;
-
-/**
- Test to see if this driver supports ControllerHandle. This service
- is called by the EFI boot service ConnectController(). In
- order to make drivers as small as possible, there are a few calling
- restrictions for this service. ConnectController() must
- follow these calling restrictions. If any other agent wishes to call
- Supported() it must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to test
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver supports this device
- @retval EFI_UNSUPPORTED This driver does not support this device
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-/**
- Start this driver on ControllerHandle. This service is called by the
- EFI boot service ConnectController(). In order to make
- drivers as small as possible, there are a few calling restrictions for
- this service. ConnectController() must follow these
- calling restrictions. If any other agent wishes to call Start() it
- must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to bind driver to
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-/**
- Stop this driver on ControllerHandle. This service is called by the
- EFI boot service DisconnectController(). In order to
- make drivers as small as possible, there are a few calling
- restrictions for this service. DisconnectController()
- must follow these calling restrictions. If any other agent wishes
- to call Stop() it must also follow these calling restrictions.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to stop driver on
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
- children is zero stop the entire bus driver.
- @param ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixSnpDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-#endif // _UNIX_SNP_H_
diff --git a/UnixPkg/UnixSnpDxe/UnixSnpDxe.inf b/UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
deleted file mode 100644
index 21e833bc7a..0000000000
--- a/UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file
-# Component name for module UnixSnpDxe
-#
-# Copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 = UnixSnpDxe
- FILE_GUID = 20BAF49B-036D-4CA6-8FAF-583ED2737F95
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixSnpDriver
-# UNLOAD_IMAGE = UnixSnpUnload
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources.common]
- ComponentName.c
- UnixSnp.h
- UnixSnp.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UnixPkg/UnixPkg.dec
-
-[LibraryClasses]
- DevicePathLib
- UefiLib
- UefiBootServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiDriverEntryPoint
- NetLib
-
-[Protocols]
- gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiUnixIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-[Guids]
- gEfiUnixNetworkGuid # GUID ALWAYS_CONSUMED
diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.c b/UnixPkg/UnixThunkDxe/UnixThunk.c
deleted file mode 100644
index d9a857d8a3..0000000000
--- a/UnixPkg/UnixThunkDxe/UnixThunk.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixThunk.c
-
-Abstract:
-
- Produce UnixThunk protocol and it's associated device path and controller
- state protocols. UnixThunk is to the emulation environment as
- PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver is the child of this
- driver.
-
- Since we are a root hardware abstraction we do not install a Driver Binding
- protocol on this handle. This driver can only support one one UnixThunk protocol
- in the system, since the device path is hard coded.
-
---*/
-#include "PiDxe.h"
-#include "UnixDxe.h"
-#include "UnixThunk.h"
-#include <Protocol/DevicePath.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UnixLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-
-//
-// WinNtThunk Device Path Protocol Instance
-//
-UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- EFI_UNIX_THUNK_PROTOCOL_GUID,
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
- }
-};
-
-
-EFI_STATUS
-EFIAPI
-InitializeUnixThunk (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Install UnixThunk Protocol and it's associated Device Path protocol
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
- EFI_SUCEESS - UnixThunk protocol is added or error status from
- gBS->InstallMultiProtocolInterfaces().
-
---*/
-// TODO: ImageHandle - add argument and description to function comment
-// TODO: SystemTable - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_HANDLE ControllerHandle;
-
- ControllerHandle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiUnixThunkProtocolGuid,
- gUnix,
- &gEfiDevicePathProtocolGuid,
- &mUnixThunkDevicePath,
- NULL
- );
-
- return Status;
-}
diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.h b/UnixPkg/UnixThunkDxe/UnixThunk.h
deleted file mode 100644
index c41f86822d..0000000000
--- a/UnixPkg/UnixThunkDxe/UnixThunk.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixThunk.h
-
-Abstract:
-
---*/
-
-// TODO: add protective #ifndef
-
-
-//
-// WinNtThunk Device Path Protocol Instance Type
-//
-typedef struct {
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} UNIX_THUNK_DEVICE_PATH;
-
diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.inf b/UnixPkg/UnixThunkDxe/UnixThunk.inf
deleted file mode 100644
index 67decf5372..0000000000
--- a/UnixPkg/UnixThunkDxe/UnixThunk.inf
+++ /dev/null
@@ -1,60 +0,0 @@
-## @file
-# A DXE driver to produce EFI_UNIX_THUNK_PROTOCOL
-#
-# EFI_UNIX_THUNK_PROTOCOL is a table of pointers to various Unix APIs used by various drivers to accomplish certain task in a Unix emulator.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixThunk
- FILE_GUID = f38610fc-8985-11db-82d4-0040d02b1835
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixThunk
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixThunk.c
- UnixThunk.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UnixLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- DevicePathLib
-
-
-
-[Protocols]
- gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.c b/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.c
deleted file mode 100644
index 81cb210311..0000000000
--- a/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixStuff.c
-
-Abstract:
-
- Tiano PEIM to abstract construction of firmware volume in a Unix environment.
-
-Revision History
-
---*/
-
-#include "PiPei.h"
-#include <Ppi/UnixThunk.h>
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-
-EFI_STATUS
-EFIAPI
-PeimInitializeUnixStuff (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Perform a call-back into the SEC simulator to get Unix Stuff
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
- None
-
---*/
-// TODO: FfsHeader - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- PEI_UNIX_THUNK_PPI *PeiUnixService;
- VOID *Ptr;
-
- DEBUG ((EFI_D_ERROR, "Unix Stuff PEIM Loaded\n"));
-
- Status = (**PeiServices).LocatePpi (
- PeiServices,
- &gPeiUnixThunkPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&PeiUnixService // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Ptr = PeiUnixService->UnixThunk ();
-
- BuildGuidDataHob (
- &gEfiUnixThunkProtocolGuid, // Guid
- &Ptr, // Buffer
- sizeof (VOID *) // Sizeof Buffer
- );
- return Status;
-}
diff --git a/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf b/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
deleted file mode 100644
index 79f73e7718..0000000000
--- a/UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# Stuff driver
-#
-# Tiano PEIM to abstract construction of firmware volume in a Unix environment.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixThunkPpiToProtocol
- FILE_GUID = f4239aa2-8985-11db-af82-0040d02b1835
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeUnixStuff
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UnixThunkPpiToProtocol.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-
-[Protocols]
- gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-
-[Ppis]
- gPeiUnixThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-
-[Depex]
- gPeiUnixThunkPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
-
diff --git a/UnixPkg/UnixUgaDxe/ComponentName.c b/UnixPkg/UnixUgaDxe/ComponentName.c
deleted file mode 100644
index 4ba081b234..0000000000
--- a/UnixPkg/UnixUgaDxe/ComponentName.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UnixUga.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UnixUgaComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UnixUgaComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUnixUgaComponentName = {
- UnixUgaComponentNameGetDriverName,
- UnixUgaComponentNameGetControllerName,
- "eng"
-};
-
-EFI_UNICODE_STRING_TABLE mUnixUgaDriverNameTable[] = {
- { "eng", L"Unix Universal Graphics Adapter Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UnixUgaComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUnixUgaComponentName.SupportedLanguages,
- mUnixUgaDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UGA_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUnixUgaDriverBinding.DriverBindingHandle,
- &gEfiUnixIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **)&UgaDraw,
- gUnixUgaDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);
-
- return LookupUnicodeString (
- Language,
- gUnixUgaComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/UnixPkg/UnixUgaDxe/EntryPoint.c b/UnixPkg/UnixUgaDxe/EntryPoint.c
deleted file mode 100644
index 857f475d36..0000000000
--- a/UnixPkg/UnixUgaDxe/EntryPoint.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**@file
- Entry Point Source file.
-
- This file contains the user entry point
-
- Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-#include "UnixUga.h"
-
-/**
- The user Entry Point for module UnixUga. The user code starts with this function.
-
- @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
-InitializeUnixUga(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gUnixUgaDriverBinding,
- ImageHandle,
- &gUnixUgaComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/UnixPkg/UnixUgaDxe/UnixUga.h b/UnixPkg/UnixUgaDxe/UnixUga.h
deleted file mode 100644
index e1e61f72f9..0000000000
--- a/UnixPkg/UnixUgaDxe/UnixUga.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixUga.h
-
-Abstract:
-
- Private data for the Uga driver that is bound to the Unix Thunk protocol
-
---*/
-
-#ifndef _UNIX_UGA_H_
-#define _UNIX_UGA_H_
-
-#include "PiDxe.h"
-#include <Guid/EventGroup.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimplePointer.h>
-#include <Protocol/UgaDraw.h>
-#include "Protocol/UnixUgaIo.h"
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include "UnixDxe.h"
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixUgaDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixUgaComponentName;
-
-#define UNIX_UGA_CLASS_NAME L"UnixUgaWindow"
-
-#define UGA_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'g', 'o', 'N')
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
- EFI_UGA_DRAW_PROTOCOL UgaDraw;
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
- EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
-
- EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- //
- // UGA Private Data for GetMode ()
- //
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
-
- EFI_SIMPLE_POINTER_MODE PointerMode;
-
- //
- // UGA Private Data knowing when to start hardware
- //
- BOOLEAN HardwareNeedsStarting;
-
- CHAR16 *WindowName;
-
- EFI_UNIX_UGA_IO_PROTOCOL *UgaIo;
-
-} UGA_PRIVATE_DATA;
-
-#define UGA_DRAW_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UGA_PRIVATE_DATA, UgaDraw, UGA_PRIVATE_DATA_SIGNATURE)
-
-#define UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
- CR(a, UGA_PRIVATE_DATA, SimpleTextIn, UGA_PRIVATE_DATA_SIGNATURE)
-
-#define UGA_PRIVATE_DATA_FROM_POINTER_THIS(a) \
- CR(a, UGA_PRIVATE_DATA, SimplePointer, UGA_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUnixUgaDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUnixUgaComponentName;
-
-//
-// Uga Hardware abstraction internal worker functions
-//
-EFI_STATUS
-UnixUgaSupported (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- UnixIo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixUgaConstructor (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixUgaDestructor (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// EFI 1.1 driver model prototypes for Win UNIX UGA
-//
-
-EFI_STATUS
-EFIAPI
-UnixUgaInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UgaPrivateAddQ (
- IN UGA_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixUgaInitializeSimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UnixUgaInitializeSimplePointerForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-#endif
diff --git a/UnixPkg/UnixUgaDxe/UnixUga.inf b/UnixPkg/UnixUgaDxe/UnixUga.inf
deleted file mode 100644
index 5cba6580da..0000000000
--- a/UnixPkg/UnixUgaDxe/UnixUga.inf
+++ /dev/null
@@ -1,73 +0,0 @@
-## @file
-# Uga driver
-#
-# UGA is short hand for Universal Graphics Abstraction protocol.
-# This file is a verision of UgaIo the uses UnixThunk system calls as an IO
-# abstraction. For a PCI device UnixIo would be replaced with
-# a PCI IO abstraction that abstracted a specific PCI device.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 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 = UnixUga
- FILE_GUID = f33cad86-8985-11db-8040-0040d02b1835
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeUnixUga
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gUnixUgaDriverBinding
-# COMPONENT_NAME = gUnixUgaComponentName
-#
-
-[Sources]
- ComponentName.c
- UnixUgaScreen.c
- UnixUgaDriver.c
- UnixUgaInput.c
- UnixUga.h
- EntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- UnixPkg/UnixPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiEventExitBootServicesGuid # SOMETIMES_CONSUMED Create Event: EVENT_GROUP_GUID
- gEfiUnixUgaGuid # ALWAYS_CONSUMED
-
-
-[Protocols]
- gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
- gEfiSimplePointerProtocolGuid # PROTOCOL BY_START
- gEfiUnixUgaIoProtocolGuid # PROTOCOL BY_START
- gEfiUgaDrawProtocolGuid # PROTOCOL BY_START
- gEfiUnixIoProtocolGuid # PROTOCOL TO_START
-
diff --git a/UnixPkg/UnixUgaDxe/UnixUgaDriver.c b/UnixPkg/UnixUgaDxe/UnixUgaDriver.c
deleted file mode 100644
index 99aa115038..0000000000
--- a/UnixPkg/UnixUgaDxe/UnixUgaDriver.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixUgaDriver.c
-
-Abstract:
-
- This file implements the EFI 1.1 Device Driver model requirements for UGA
-
- UGA is short hand for Universal Graphics Abstraction protocol.
-
- This file is a verision of UgaIo the uses UnixThunk system calls as an IO
- abstraction. For a PCI device UnixIo would be replaced with
- a PCI IO abstraction that abstracted a specific PCI device.
-
---*/
-
-#include "UnixUga.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gUnixUgaDriverBinding = {
- UnixUgaDriverBindingSupported,
- UnixUgaDriverBindingStart,
- UnixUgaDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = UnixUgaSupported (UnixIo);
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- (VOID **)&UnixIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Allocate Private context data for SGO inteface.
- //
- Private = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UGA_PRIVATE_DATA),
- (VOID **)&Private
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Set up context record
- //
- Private->Signature = UGA_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->UnixThunk = UnixIo->UnixThunk;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gUnixUgaComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- UnixIo->EnvString
- );
-
- Private->WindowName = UnixIo->EnvString;
-
- Status = UnixUgaConstructor (Private);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Publish the Uga interface to the world
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- &gEfiSimplePointerProtocolGuid,
- &Private->SimplePointer,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- if (Private != NULL) {
- //
- // On Error Free back private data
- //
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
-
- gBS->FreePool (Private);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_NOT_STARTED - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **)&UgaDraw,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // If the UGA interface does not exist the driver is not started
- //
- return EFI_NOT_STARTED;
- }
-
- //
- // Get our private context information
- //
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);
-
- //
- // Remove the SGO interface from the system
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- &gEfiSimplePointerProtocolGuid,
- &Private->SimplePointer,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Shutdown the hardware
- //
- Status = UnixUgaDestructor (Private);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEfiUnixIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- gBS->FreePool (Private);
-
- }
-
- return Status;
-}
-
diff --git a/UnixPkg/UnixUgaDxe/UnixUgaInput.c b/UnixPkg/UnixUgaDxe/UnixUgaInput.c
deleted file mode 100644
index be38379397..0000000000
--- a/UnixPkg/UnixUgaDxe/UnixUgaInput.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixUgaInput.c
-
-Abstract:
-
- This file produces the Simple Text In for an Uga window.
-
- This stuff is linked at the hip to the Window, since the window
- processing is done in a thread kicked off in UnixUgaImplementation.c
-
- Since the window information is processed in an other thread we need
- a keyboard Queue to pass data about. The Simple Text In code just
- takes data off the Queue. The WinProc message loop takes keyboard input
- and places it in the Queue.
-
---*/
-
-#include "UnixUga.h"
-
-//
-// Simple Text In implementation.
-//
-
-EFI_STATUS
-EFIAPI
-UnixUgaSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_KEY_DATA Key;
- EFI_TPL OldTpl;
-
- Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->UgaIo->UgaGetKey (Private->UgaIo, &Key) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- EFI_KEY_DATA KeyData;
-
- Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaGetKey(Private->UgaIo, &KeyData);
- CopyMem (Key, &KeyData, sizeof (EFI_INPUT_KEY));
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-VOID
-EFIAPI
-UnixUgaSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (UGA_PRIVATE_DATA *) Context;
- if (Private->UgaIo == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaCheckKey(Private->UgaIo);
- if (!EFI_ERROR (Status)) {
- //
- // If a there is a key in the queue signal our event.
- //
- gBS->SignalEvent (Event);
- }
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-//
-// Simple Pointer implementation.
-//
-
-EFI_STATUS
-EFIAPI
-UnixUgaSimplePointerReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_SIMPLE_POINTER_STATE State;
- EFI_TPL OldTpl;
-
- Private = UGA_PRIVATE_DATA_FROM_POINTER_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->UgaIo->UgaGetPointerState(Private->UgaIo, &State) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaSimplePointerGetState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN OUT EFI_SIMPLE_POINTER_STATE *State
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = UGA_PRIVATE_DATA_FROM_POINTER_THIS (This);
- if (Private->UgaIo == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaGetPointerState(Private->UgaIo, State);
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-VOID
-EFIAPI
-UnixUgaSimplePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (UGA_PRIVATE_DATA *) Context;
- if (Private->UgaIo == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->UgaIo->UgaCheckPointer(Private->UgaIo);
- if (!EFI_ERROR (Status)) {
- //
- // If the pointer state has changed, signal our event.
- //
- gBS->SignalEvent (Event);
- }
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-EFI_STATUS
-UnixUgaInitializeSimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Initialize Simple Text In protoocol
- //
- Private->SimpleTextIn.Reset = UnixUgaSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = UnixUgaSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixUgaSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
-
- return Status;
-}
-
-EFI_STATUS
-UnixUgaInitializeSimplePointerForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Initialize Simple Pointer protoocol
- //
- Private->PointerMode.ResolutionX = 1;
- Private->PointerMode.ResolutionY = 1;
- Private->PointerMode.LeftButton = TRUE;
- Private->PointerMode.RightButton = TRUE;
-
- Private->SimplePointer.Reset = UnixUgaSimplePointerReset;
- Private->SimplePointer.GetState = UnixUgaSimplePointerGetState;
- Private->SimplePointer.Mode = &Private->PointerMode;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UnixUgaSimplePointerWaitForInput,
- Private,
- &Private->SimplePointer.WaitForInput
- );
-
- return Status;
-}
diff --git a/UnixPkg/UnixUgaDxe/UnixUgaScreen.c b/UnixPkg/UnixUgaDxe/UnixUgaScreen.c
deleted file mode 100644
index 470a788a10..0000000000
--- a/UnixPkg/UnixUgaDxe/UnixUgaScreen.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnixUgaScreen.c
-
-Abstract:
-
- This file produces the graphics abstration of UGA. It is called by
- UnixUgaDriver.c file which deals with the EFI 1.1 driver model.
- This file just does graphics.
-
---*/
-
-#include "UnixUga.h"
-
-EFI_UNIX_THUNK_PROTOCOL *mUnix;
-EFI_EVENT mUgaScreenExitBootServicesEvent;
-
-EFI_STATUS
-UnixUgaStartWindow (
- IN UGA_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- );
-
-VOID
-EFIAPI
-KillNtUgaThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// UGA Protocol Member Functions
-//
-
-EFI_STATUS
-EFIAPI
-UnixUgaGetMode (
- EFI_UGA_DRAW_PROTOCOL *This,
- UINT32 *HorizontalResolution,
- UINT32 *VerticalResolution,
- UINT32 *ColorDepth,
- UINT32 *RefreshRate
- )
-/*++
-
- Routine Description:
- Return the current video mode information.
-
- Arguments:
- This - Protocol instance pointer.
- HorizontalResolution - Current video horizontal resolution in pixels
- VerticalResolution - Current video Vertical resolution in pixels
- ColorDepth - Current video color depth in bits per pixel
- RefreshRate - Current video refresh rate in Hz.
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
- EFI_INVALID_PARAMETER - One of the input args was NULL.
-
---*/
-// TODO: ADD IN/OUT description here
-{
- UGA_PRIVATE_DATA *Private;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- return EFI_NOT_STARTED;
- }
-
- if ((HorizontalResolution == NULL) ||
- (VerticalResolution == NULL) ||
- (ColorDepth == NULL) ||
- (RefreshRate == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *HorizontalResolution = Private->HorizontalResolution;
- *VerticalResolution = Private->VerticalResolution;
- *ColorDepth = Private->ColorDepth;
- *RefreshRate = Private->RefreshRate;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaSetMode (
- EFI_UGA_DRAW_PROTOCOL *This,
- UINT32 HorizontalResolution,
- UINT32 VerticalResolution,
- UINT32 ColorDepth,
- UINT32 RefreshRate
- )
-/*++
-
- Routine Description:
- Return the current video mode information.
-
- Arguments:
- This - Protocol instance pointer.
- HorizontalResolution - Current video horizontal resolution in pixels
- VerticalResolution - Current video Vertical resolution in pixels
- ColorDepth - Current video color depth in bits per pixel
- RefreshRate - Current video refresh rate in Hz.
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
- EFI_INVALID_PARAMETER - One of the input args was NULL.
-
---*/
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: ADD IN/OUT description here
-{
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
- EFI_UGA_PIXEL Fill;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- Status = UnixUgaStartWindow (
- Private,
- HorizontalResolution,
- VerticalResolution,
- ColorDepth,
- RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareNeedsStarting = FALSE;
- }
- Status = Private->UgaIo->UgaSize(Private->UgaIo,
- HorizontalResolution,
- VerticalResolution);
-
- Private->HorizontalResolution = HorizontalResolution;
- Private->VerticalResolution = VerticalResolution;
- Private->ColorDepth = ColorDepth;
- Private->RefreshRate = RefreshRate;
-
- Fill.Red = 0x7f;
- Fill.Green = 0x7F;
- Fill.Blue = 0x7f;
- This->Blt (
- This,
- &Fill,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- HorizontalResolution,
- VerticalResolution,
- HorizontalResolution * sizeof (EFI_UGA_PIXEL)
- );
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UnixUgaBlt (
- IN EFI_UGA_DRAW_PROTOCOL *This,
- IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-/*++
-
- Routine Description:
- Blt pixels from the rectangle (Width X Height) formed by the BltBuffer
- onto the graphics screen starting a location (X, Y). (0, 0) is defined as
- the upper left hand side of the screen. (X, Y) can be outside of the
- current screen geometry and the BltBuffer will be cliped when it is
- displayed. X and Y can be negative or positive. If Width or Height is
- bigger than the current video screen the image will be clipped.
-
- Arguments:
- This - Protocol instance pointer.
- X - X location on graphics screen.
- Y - Y location on the graphics screen.
- Width - Width of BltBuffer.
- Height - Hight of BltBuffer
- BltOperation - Operation to perform on BltBuffer and video memory
- BltBuffer - Buffer containing data to blt into video buffer. This
- buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
- SourceX - If the BltOperation is a EfiCopyBlt this is the source
- of the copy. For other BLT operations this argument is not
- used.
- SourceX - If the BltOperation is a EfiCopyBlt this is the source
- of the copy. For other BLT operations this argument is not
- used.
-
- Returns:
- EFI_SUCCESS - The palette is updated with PaletteArray.
- EFI_INVALID_PARAMETER - BltOperation is not valid.
- EFI_DEVICE_ERROR - A hardware error occured writting to the video
- buffer.
-
---*/
-// TODO: SourceY - add argument and description to function comment
-// TODO: DestinationX - add argument and description to function comment
-// TODO: DestinationY - add argument and description to function comment
-// TODO: Delta - add argument and description to function comment
-{
- UGA_PRIVATE_DATA *Private;
- EFI_TPL OriginalTPL;
- EFI_STATUS Status;
- UGA_BLT_ARGS UgaBltArgs;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // If Delta is zero, then the entire BltBuffer is being used, so Delta
- // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
- // the number of bytes in each row can be computed.
- //
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_UGA_PIXEL);
- }
-
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // Pack UGA Draw protocol parameters to UGA_BLT_ARGS structure to adapt to
- // UgaBlt() API of Unix UGA IO protocol.
- //
- UgaBltArgs.DestinationX = DestinationX;
- UgaBltArgs.DestinationY = DestinationY;
- UgaBltArgs.Height = Height;
- UgaBltArgs.Width = Width;
- UgaBltArgs.SourceX = SourceX;
- UgaBltArgs.SourceY = SourceY;
- UgaBltArgs.Delta = Delta;
- Status = Private->UgaIo->UgaBlt (Private->UgaIo,
- BltBuffer,
- BltOperation,
- &UgaBltArgs
- );
-
- gBS->RestoreTPL (OriginalTPL);
-
- return Status;
-}
-
-
-//
-// Construction and Destruction functions
-//
-
-EFI_STATUS
-UnixUgaSupported (
- IN EFI_UNIX_IO_PROTOCOL *UnixIo
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: UnixIo - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- //
- // Check to see if the IO abstraction represents a device type we support.
- //
- // This would be replaced a check of PCI subsystem ID, etc.
- //
- if (!CompareGuid (UnixIo->TypeGuid, &gEfiUnixUgaGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-UnixUgaStartWindow (
- IN UGA_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- HorizontalResolution - TODO: add argument description
- VerticalResolution - TODO: add argument description
- ColorDepth - TODO: add argument description
- RefreshRate - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- mUnix = Private->UnixThunk;
-
- Private->HorizontalResolution = HorizontalResolution;
- Private->VerticalResolution = VerticalResolution;
-
- //
- // Register to be notified on exit boot services so we can destroy the window.
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_CALLBACK,
- KillNtUgaThread,
- Private,
- &mUgaScreenExitBootServicesEvent
- );
-
- Status = Private->UnixThunk->UgaCreate(&Private->UgaIo, Private->WindowName);
- return Status;
-}
-
-EFI_STATUS
-UnixUgaConstructor (
- UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- Private->UgaDraw.GetMode = UnixUgaGetMode;
- Private->UgaDraw.SetMode = UnixUgaSetMode;
- Private->UgaDraw.Blt = UnixUgaBlt;
-
- Private->HardwareNeedsStarting = TRUE;
- Private->UgaIo = NULL;
-
- UnixUgaInitializeSimpleTextInForWindow (Private);
-
- UnixUgaInitializeSimplePointerForWindow (Private);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UnixUgaDestructor (
- UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- if (!Private->HardwareNeedsStarting) {
- Private->UgaIo->UgaClose(Private->UgaIo);
- Private->UgaIo = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-KillNtUgaThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- This is the UGA screen's callback notification function for exit-boot-services.
- All we do here is call UnixUgaDestructor().
-
-Arguments:
-
- Event - not used
- Context - pointer to the Private structure.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- Status = UnixUgaDestructor (Context);
-}
diff --git a/UnixPkg/Xcode/xcode_project/XcodeBuild.sh b/UnixPkg/Xcode/xcode_project/XcodeBuild.sh
deleted file mode 100755
index 453aac1896..0000000000
--- a/UnixPkg/Xcode/xcode_project/XcodeBuild.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-#
-# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
-#
-
-# force exit on error
-set -e
-
-#
-# Source the workspace and set up the environment variables we need
-#
-cd ../..
-./build.sh $1 $2 $3 $4 $5 $6 $8
diff --git a/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/default.pbxuser b/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/default.pbxuser
deleted file mode 100644
index f3db667599..0000000000
--- a/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/default.pbxuser
+++ /dev/null
@@ -1,191 +0,0 @@
-// !$*UTF8*$!
-{
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- activeBuildConfigurationName = Debug;
- activeExecutable = BA11A1010FB10BCE00D06FEC /* SecMain.dll */;
- activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
- breakpoints = (
- BA11A11A0FB10E0700D06FEC /* SecGdbScriptBreak */,
- );
- codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
- executables = (
- BA11A1010FB10BCE00D06FEC /* SecMain.dll */,
- );
- perUserDictionary = {
- "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 20,
- 20,
- 198,
- 20,
- 99,
- 99,
- 29,
- 20,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXBreakpointsDataSource_ActionID,
- PBXBreakpointsDataSource_TypeID,
- PBXBreakpointsDataSource_BreakpointID,
- PBXBreakpointsDataSource_UseID,
- PBXBreakpointsDataSource_LocationID,
- PBXBreakpointsDataSource_ConditionID,
- PBXBreakpointsDataSource_IgnoreCountID,
- PBXBreakpointsDataSource_ContinueID,
- );
- };
- PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 22,
- 300,
- 229,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXExecutablesDataSource_ActiveFlagID,
- PBXExecutablesDataSource_NameID,
- PBXExecutablesDataSource_CommentsID,
- );
- };
- PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 20,
- 341,
- 20,
- 48,
- 43,
- 43,
- 20,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXFileDataSource_FiletypeID,
- PBXFileDataSource_Filename_ColumnID,
- PBXFileDataSource_Built_ColumnID,
- PBXFileDataSource_ObjectSize_ColumnID,
- PBXFileDataSource_Errors_ColumnID,
- PBXFileDataSource_Warnings_ColumnID,
- PBXFileDataSource_Target_ColumnID,
- );
- };
- PBXPerProjectTemplateStateSaveDate = 263260969;
- PBXWorkspaceStateSaveDate = 263260969;
- };
- sourceControlManager = BA11A0FD0FB10B4800D06FEC /* Source Control */;
- userBuildSettings = {
- };
- };
- BA11A0FD0FB10B4800D06FEC /* Source Control */ = {
- isa = PBXSourceControlManager;
- fallbackIsa = XCSourceControlManager;
- isSCMEnabled = 0;
- repositoryNamesForRoots = {
- };
- scmConfiguration = {
- };
- };
- BA11A0FE0FB10B4800D06FEC /* Code sense */ = {
- isa = PBXCodeSenseManager;
- indexTemplatePath = "";
- };
- BA11A1010FB10BCE00D06FEC /* SecMain.dll */ = {
- isa = PBXExecutable;
- activeArgIndices = (
- );
- argumentStrings = (
- );
- autoAttachOnCrash = 1;
- breakpointsEnabled = 1;
- configStateDict = {
- "PBXLSLaunchAction-0" = {
- PBXLSLaunchAction = 0;
- PBXLSLaunchStartAction = 1;
- PBXLSLaunchStdioStyle = 2;
- PBXLSLaunchStyle = 0;
- class = PBXLSRunLaunchConfig;
- commandLineArgs = (
- );
- displayName = "Executable Runner";
- environment = {
- };
- identifier = com.apple.Xcode.launch.runConfig;
- remoteHostInfo = "";
- startActionInfo = "";
- };
- "PBXLSLaunchAction-1" = {
- PBXLSLaunchAction = 1;
- PBXLSLaunchStartAction = 1;
- PBXLSLaunchStdioStyle = 2;
- PBXLSLaunchStyle = 0;
- class = PBXGDB_LaunchConfig;
- commandLineArgs = (
- );
- displayName = GDB;
- environment = {
- };
- identifier = com.apple.Xcode.launch.GDBMI_Config;
- remoteHostInfo = "";
- startActionInfo = "";
- };
- };
- customDataFormattersEnabled = 0;
- dataTipCustomDataFormattersEnabled = 1;
- dataTipShowTypeColumn = 1;
- dataTipSortType = 0;
- debuggerPlugin = GDBDebugging;
- disassemblyDisplayState = 0;
- dylibVariantSuffix = "";
- enableDebugStr = 1;
- environmentEntries = (
- );
- executableSystemSymbolLevel = 0;
- executableUserSymbolLevel = 0;
- launchableReference = BA11A1020FB10BCE00D06FEC /* SecMain.dll */;
- libgmallocEnabled = 0;
- name = SecMain.dll;
- savedGlobals = {
- };
- showTypeColumn = 0;
- sourceDirectories = (
- );
- startupPath = ../../../Build/Unix/DEBUG_XCODE32/IA32;
- };
- BA11A1020FB10BCE00D06FEC /* SecMain.dll */ = {
- isa = PBXFileReference;
- lastKnownFileType = "compiled.mach-o.executable";
- name = SecMain.dll;
- path = ../../../Build/Unix/DEBUG_XCODE32/IA32/SecMain;
- sourceTree = SOURCE_ROOT;
- };
- BA11A11A0FB10E0700D06FEC /* SecGdbScriptBreak */ = {
- isa = PBXSymbolicBreakpoint;
- actions = (
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
- );
- breakpointStyle = 1;
- continueAfterActions = 1;
- countType = 0;
- delayBeforeContinue = 0;
- hitCount = 0;
- ignoreCount = 0;
- location = SecMain;
- modificationTime = 263261853.260195;
- originalNumberOfMultipleMatches = 1;
- state = 1;
- symbolName = SecGdbScriptBreak;
- };
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
- isa = XCBreakpointCommandAction;
- command = "source SecMain.gdb";
- fallbackIsa = XCBreakpointAction;
- logCommand = 0;
- useDebuggerSideImplementation = 1;
- };
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- activeExec = 0;
- };
-}
diff --git a/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/project.pbxproj b/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/project.pbxproj
deleted file mode 100644
index 87eb84de33..0000000000
--- a/UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,117 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXGroup section */
- 08FB7794FE84155DC02AAC07 /* xcode_project */ = {
- isa = PBXGroup;
- children = (
- );
- name = xcode_project;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXLegacyTarget section */
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- isa = PBXLegacyTarget;
- buildArgumentsString = "$(ACTION)";
- buildConfigurationList = 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */;
- buildPhases = (
- );
- buildToolPath = ./XcodeBuild.sh;
- buildWorkingDirectory = "";
- dependencies = (
- );
- name = xcode_project;
- passBuildSettingsInEnvironment = 1;
- productName = xcode_project;
- };
-/* End PBXLegacyTarget section */
-
-/* Begin PBXProject section */
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */;
- compatibilityVersion = "Xcode 3.1";
- hasScannedForEncodings = 1;
- mainGroup = 08FB7794FE84155DC02AAC07 /* xcode_project */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- D28A88AD04BDD90700651E21 /* xcode_project */,
- );
- };
-/* End PBXProject section */
-
-/* Begin XCBuildConfiguration section */
- 1DEB919008733D9F0010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = xcode_project;
- };
- name = Debug;
- };
- 1DEB919108733D9F0010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- PRODUCT_NAME = xcode_project;
- };
- name = Release;
- };
- 1DEB919408733D9F0010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
- SDKROOT = macosx10.6;
- };
- name = Debug;
- };
- 1DEB919508733D9F0010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- PREBINDING = NO;
- SDKROOT = macosx10.6;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB919008733D9F0010E9CD /* Debug */,
- 1DEB919108733D9F0010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB919408733D9F0010E9CD /* Debug */,
- 1DEB919508733D9F0010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
diff --git a/UnixPkg/Xcode/xcode_project64/XcodeBuild.sh b/UnixPkg/Xcode/xcode_project64/XcodeBuild.sh
deleted file mode 100755
index 0ccda8f9ef..0000000000
--- a/UnixPkg/Xcode/xcode_project64/XcodeBuild.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-#
-# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
-#
-
-# force exit on error
-set -e
-
-#
-# Source the workspace and set up the environment variables we need
-#
-cd ../..
-echo `pwd`
-./build64.sh $1 $2 $3 $4 $5 $6 $8
diff --git a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser b/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser
deleted file mode 100644
index c0d31981fd..0000000000
--- a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser
+++ /dev/null
@@ -1,191 +0,0 @@
-// !$*UTF8*$!
-{
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- activeBuildConfigurationName = Debug;
- activeExecutable = BA11A1010FB10BCE00D06FEC /* SecMain.dll */;
- activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
- breakpoints = (
- BA11A11A0FB10E0700D06FEC /* SecGdbScriptBreak */,
- );
- codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
- executables = (
- BA11A1010FB10BCE00D06FEC /* SecMain.dll */,
- );
- perUserDictionary = {
- "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 20,
- 20,
- 198,
- 20,
- 99,
- 99,
- 29,
- 20,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXBreakpointsDataSource_ActionID,
- PBXBreakpointsDataSource_TypeID,
- PBXBreakpointsDataSource_BreakpointID,
- PBXBreakpointsDataSource_UseID,
- PBXBreakpointsDataSource_LocationID,
- PBXBreakpointsDataSource_ConditionID,
- PBXBreakpointsDataSource_IgnoreCountID,
- PBXBreakpointsDataSource_ContinueID,
- );
- };
- PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 22,
- 300,
- 229,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXExecutablesDataSource_ActiveFlagID,
- PBXExecutablesDataSource_NameID,
- PBXExecutablesDataSource_CommentsID,
- );
- };
- PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
- PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
- PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
- PBXFileTableDataSourceColumnWidthsKey = (
- 20,
- 341,
- 20,
- 48,
- 43,
- 43,
- 20,
- );
- PBXFileTableDataSourceColumnsKey = (
- PBXFileDataSource_FiletypeID,
- PBXFileDataSource_Filename_ColumnID,
- PBXFileDataSource_Built_ColumnID,
- PBXFileDataSource_ObjectSize_ColumnID,
- PBXFileDataSource_Errors_ColumnID,
- PBXFileDataSource_Warnings_ColumnID,
- PBXFileDataSource_Target_ColumnID,
- );
- };
- PBXPerProjectTemplateStateSaveDate = 263260969;
- PBXWorkspaceStateSaveDate = 263260969;
- };
- sourceControlManager = BA11A0FD0FB10B4800D06FEC /* Source Control */;
- userBuildSettings = {
- };
- };
- BA11A0FD0FB10B4800D06FEC /* Source Control */ = {
- isa = PBXSourceControlManager;
- fallbackIsa = XCSourceControlManager;
- isSCMEnabled = 0;
- repositoryNamesForRoots = {
- };
- scmConfiguration = {
- };
- };
- BA11A0FE0FB10B4800D06FEC /* Code sense */ = {
- isa = PBXCodeSenseManager;
- indexTemplatePath = "";
- };
- BA11A1010FB10BCE00D06FEC /* SecMain.dll */ = {
- isa = PBXExecutable;
- activeArgIndices = (
- );
- argumentStrings = (
- );
- autoAttachOnCrash = 1;
- breakpointsEnabled = 1;
- configStateDict = {
- "PBXLSLaunchAction-0" = {
- PBXLSLaunchAction = 0;
- PBXLSLaunchStartAction = 1;
- PBXLSLaunchStdioStyle = 2;
- PBXLSLaunchStyle = 0;
- class = PBXLSRunLaunchConfig;
- commandLineArgs = (
- );
- displayName = "Executable Runner";
- environment = {
- };
- identifier = com.apple.Xcode.launch.runConfig;
- remoteHostInfo = "";
- startActionInfo = "";
- };
- "PBXLSLaunchAction-1" = {
- PBXLSLaunchAction = 1;
- PBXLSLaunchStartAction = 1;
- PBXLSLaunchStdioStyle = 2;
- PBXLSLaunchStyle = 0;
- class = PBXGDB_LaunchConfig;
- commandLineArgs = (
- );
- displayName = GDB;
- environment = {
- };
- identifier = com.apple.Xcode.launch.GDBMI_Config;
- remoteHostInfo = "";
- startActionInfo = "";
- };
- };
- customDataFormattersEnabled = 0;
- dataTipCustomDataFormattersEnabled = 1;
- dataTipShowTypeColumn = 1;
- dataTipSortType = 0;
- debuggerPlugin = GDBDebugging;
- disassemblyDisplayState = 0;
- dylibVariantSuffix = "";
- enableDebugStr = 1;
- environmentEntries = (
- );
- executableSystemSymbolLevel = 0;
- executableUserSymbolLevel = 0;
- launchableReference = BA11A1020FB10BCE00D06FEC /* SecMain.dll */;
- libgmallocEnabled = 0;
- name = SecMain.dll;
- savedGlobals = {
- };
- showTypeColumn = 0;
- sourceDirectories = (
- );
- startupPath = ../../../Build/UnixX64/DEBUG_UNIXPKG/X64;
- };
- BA11A1020FB10BCE00D06FEC /* SecMain.dll */ = {
- isa = PBXFileReference;
- lastKnownFileType = "compiled.mach-o.executable";
- name = SecMain.dll;
- path = ../../../Build/UnixX64/DEBUG_UNIXPKG/X64/SecMain;
- sourceTree = SOURCE_ROOT;
- };
- BA11A11A0FB10E0700D06FEC /* SecGdbScriptBreak */ = {
- isa = PBXSymbolicBreakpoint;
- actions = (
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
- );
- breakpointStyle = 1;
- continueAfterActions = 1;
- countType = 0;
- delayBeforeContinue = 0;
- hitCount = 0;
- ignoreCount = 0;
- location = SecMain;
- modificationTime = 263261853.260195;
- originalNumberOfMultipleMatches = 1;
- state = 1;
- symbolName = SecGdbScriptBreak;
- };
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
- isa = XCBreakpointCommandAction;
- command = "source SecMain.gdb";
- fallbackIsa = XCBreakpointAction;
- logCommand = 0;
- useDebuggerSideImplementation = 1;
- };
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- activeExec = 0;
- };
-}
diff --git a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj b/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj
deleted file mode 100644
index fd9b2e80f9..0000000000
--- a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,117 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXGroup section */
- 08FB7794FE84155DC02AAC07 /* xcode_project */ = {
- isa = PBXGroup;
- children = (
- );
- name = xcode_project;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXLegacyTarget section */
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- isa = PBXLegacyTarget;
- buildArgumentsString = "$(ACTION)";
- buildConfigurationList = 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */;
- buildPhases = (
- );
- buildToolPath = ./XcodeBuild.sh;
- buildWorkingDirectory = "";
- dependencies = (
- );
- name = xcode_project;
- passBuildSettingsInEnvironment = 1;
- productName = xcode_project;
- };
-/* End PBXLegacyTarget section */
-
-/* Begin PBXProject section */
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */;
- compatibilityVersion = "Xcode 3.1";
- hasScannedForEncodings = 1;
- mainGroup = 08FB7794FE84155DC02AAC07 /* xcode_project */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- D28A88AD04BDD90700651E21 /* xcode_project */,
- );
- };
-/* End PBXProject section */
-
-/* Begin XCBuildConfiguration section */
- 1DEB919008733D9F0010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = xcode_project;
- };
- name = Debug;
- };
- 1DEB919108733D9F0010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- PRODUCT_NAME = xcode_project;
- };
- name = Release;
- };
- 1DEB919408733D9F0010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
- SDKROOT = macosx10.6;
- };
- name = Debug;
- };
- 1DEB919508733D9F0010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- PREBINDING = NO;
- SDKROOT = macosx10.6;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB919008733D9F0010E9CD /* Debug */,
- 1DEB919108733D9F0010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB919408733D9F0010E9CD /* Debug */,
- 1DEB919508733D9F0010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
diff --git a/UnixPkg/build.sh b/UnixPkg/build.sh
deleted file mode 100755
index 5d3d8a5e52..0000000000
--- a/UnixPkg/build.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 -e
-shopt -s nocasematch
-
-
-#
-# Setup workspace if it is not set
-#
-if [ -z "$WORKSPACE" ]
-then
- echo Initializing workspace
- if [ ! -e `pwd`/edksetup.sh ]
- then
- cd ..
- fi
-# This version is for the tools in the BaseTools project.
-# this assumes svn pulls have the same root dir
-# export EDK_TOOLS_PATH=`pwd`/../BaseTools
-# This version is for the tools source in edk2
- export EDK_TOOLS_PATH=`pwd`/BaseTools
- echo $EDK_TOOLS_PATH
- source edksetup.sh BaseTools
-else
- echo Building from: $WORKSPACE
-fi
-
-#
-# Pick a default tool type for a given OS
-#
-TARGET_TOOLS=MYTOOLS
-NETWORK_SUPPORT=
-case `uname` in
- CYGWIN*) echo Cygwin not fully supported yet. ;;
- Darwin*)
- Major=$(uname -r | cut -f 1 -d '.')
- if [[ $Major == 9 ]]
- then
- echo UnixPkg requires Snow Leopard or later OS
- exit 1
- else
- TARGET_TOOLS=XCODE32
- fi
- NETWORK_SUPPORT="-D NETWORK_SUPPORT"
- ;;
- Linux*) TARGET_TOOLS=ELFGCC ;;
-
-esac
-
-BUILD_ROOT_ARCH=$WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32
-
-if [[ ! -f `which build` || ! -f `which GenFv` ]];
-then
- # build the tools if they don't yet exist. Bin scheme
- echo Building tools as they are not in the path
- make -C $WORKSPACE/BaseTools
-elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
-then
- # build the tools if they don't yet exist. BinWrapper scheme
- echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
- make -C $WORKSPACE/BaseTools
-else
- echo using prebuilt tools
-fi
-
-
-for arg in "$@"
-do
- if [[ $arg == run ]]; then
- case `uname` in
- Darwin*)
- #
- # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
- # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
- # images that get loaded in SecMain
- #
- cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32
- ;;
- esac
-
- /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH
- exit
- fi
-
- if [[ $arg == cleanall ]]; then
- make -C $WORKSPACE/BaseTools clean
- build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 clean
- exit $?
- fi
-
- if [[ $arg == clean ]]; then
- build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 clean
- exit $?
- fi
-
- if [[ $arg == shell ]]; then
- build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 $2 $3 $4 $5 $6 $7 $8
- exit $?
- fi
-done
-
-
-#
-# Build the edk2 UnixPkg
-#
-echo $PATH
-echo `which build`
-build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
-echo NOTE: UnixPkg is deprecated. Please see UnixPkg/Deprecated.txt for more information.
-exit $?
-
diff --git a/UnixPkg/build64.sh b/UnixPkg/build64.sh
deleted file mode 100755
index 7f2206f3fc..0000000000
--- a/UnixPkg/build64.sh
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# 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 -e
-shopt -s nocasematch
-
-
-#
-# Setup workspace if it is not set
-#
-if [ -z "$WORKSPACE" ]
-then
- echo Initializing workspace
- if [ ! -e `pwd`/edksetup.sh ]
- then
- cd ..
- fi
-# This version is for the tools in the BaseTools project.
-# this assumes svn pulls have the same root dir
-# export EDK_TOOLS_PATH=`pwd`/../BaseTools
-# This version is for the tools source in edk2
- export EDK_TOOLS_PATH=`pwd`/BaseTools
- echo $EDK_TOOLS_PATH
- source edksetup.sh BaseTools
-else
- echo Building from: $WORKSPACE
-fi
-
-#
-# Pick a default tool type for a given OS
-#
-TARGET_TOOLS=MYTOOLS
-UNIXPKG_TOOLS=GCC44
-NETWORK_SUPPORT=
-case `uname` in
- CYGWIN*) echo Cygwin not fully supported yet. ;;
- Darwin*)
- Major=$(uname -r | cut -f 1 -d '.')
- if [[ $Major == 9 ]]
- then
- echo UnixPkg requires Snow Leopard or later OS
- exit 1
- else
- TARGET_TOOLS=XCODE32
- UNIXPKG_TOOLS=XCLANG
- fi
- NETWORK_SUPPORT="-D NETWORK_SUPPORT"
- ;;
- Linux*) TARGET_TOOLS=ELFGCC ;;
-
-esac
-
-BUILD_ROOT_ARCH=$WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
-
-if [[ ! -f `which build` || ! -f `which GenFv` ]];
-then
- # build the tools if they don't yet exist. Bin scheme
- echo Building tools as they are not in the path
- make -C $WORKSPACE/BaseTools
-elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
-then
- # build the tools if they don't yet exist. BinWrapper scheme
- echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
- make -C $WORKSPACE/BaseTools
-else
- echo using prebuilt tools
-fi
-
-
-for arg in "$@"
-do
- if [[ $arg == run ]]; then
- case `uname` in
- Darwin*)
- #
- # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
- # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
- # images that get loaded in SecMain
- #
- cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
- ;;
- esac
-
- /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH
- exit
- fi
-
- if [[ $arg == cleanall ]]; then
- make -C $WORKSPACE/BaseTools clean
- build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
- build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
- exit $?
- fi
-
- if [[ $arg == clean ]]; then
- build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
- build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
- exit $?
- fi
-
- if [[ $arg == shell ]]; then
- build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 $2 $3 $4 $5 $6 $7 $8
- exit $?
- fi
-done
-
-
-#
-# Build the edk2 UnixPkg
-#
-echo $PATH
-echo `which build`
-build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules
-build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
-cp $WORKSPACE/Build/UnixX64/DEBUG_"$TARGET_TOOLS"/X64/SecMain $WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
-echo NOTE: UnixPkg is deprecated. Please see UnixPkg/Deprecated.txt for more information.
-exit $?
-
diff --git a/UnixPkg/readme.txt b/UnixPkg/readme.txt
deleted file mode 100644
index 4166306d27..0000000000
--- a/UnixPkg/readme.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-Deprecation Notice
-==================
-UnixPkg is deprecated. Please see UnixPkg/Deprecated.txt for more information.
-
-Unix Simulation Platform
-========================
-
-UnixPkg is one of platform package which can be built to a platform's firmware from UnixPkg.dsc file.
-And this package provide a simulation platform under *INUX environment in IA32 architecture.
-
-- Same points between real platform and simulation platform:
- 1) Unix simulation platform also run with firmware device image built from UnixPkg
- 2) The working flow of simulation platform also contains SEC/PEI/DXE phase.
-
-- Different points between real platform and simulation platform:
- 1) The SEC phase in simulation platform in fact is a *INUX native application which can be run from *INUX shell;
- 2) The device in simulation platform is not real hardware but simulation component in API level;
- 3) The ThunkBus driver in simulation platform will get virtual device's desription from PCD and create virtual Device
-
-Build
-=====
-UnixPkg is built with following command:
- build -p UnixPkg/UnixPkg.dsc -a IA32 -t ELFGCC
- Notes: ELFGCC is defined in <Workspace>/Conf/tools_def.txt file. This tool chain use native gcc/binutil instead of
- cross-compiler like UNIXGCC tool chain.
-
-On Mac OS X you can cd into UnixPkg directory and execute ./build.sh to build. This does not require
-setting up the environment like running the build command. Note Snow Leopard or later is required.
-This script should also work for any *INUX, but has not been tested.
-
-./build.sh run will lanuch the emulator in gdb so you can source level debug via gdb.
-
-
-Notes:
-=====
-On Mac OS X Snow Leopard you can use Xcode 3.2 as a GUI debugger.
-Launch Xcode and open UnixPkg/Xcode/xcode_project/xcode_project.xcodeproj
-Under the build menu chose build and debug. shift-cmd-B shows the build results.
-
-Under most *INUX the EFI executables are placed in the emulated EFI memory by the EFI PE/COFF loader
-but dlopen() is used to also load the image into the process to support source level debug.
-The entry point for the image is moved from the EFI emulator memory into the dlopen() image. This
-is not the case for Mac OS X. On Mac OS X a debugger script is used and the real EFI images in
-the emulator are the ones being debugged.
-
-Also on Mac OS X the stack alignment requirements for IA-32 are 16 bytes and this is more strict
-than the EFI ABI. To work around this gasket code was introduced to ensure the stack is always
-16 byte aligned when making any POSIX call on Mac OS X.
-
-To build PE/COFF images with Xcode 3.2 and extra tool call mtoc is required to convert Mach-O
-images into PE/COFF images. The tool only supports EFI PE/COFF images and the instructions on
-how to download it are on the edk2 website.
-
-FAQ
-===
-1, I fail to build UnixPkg due to "X11/extensions/XShm.h: No such file or directory"?
- The display adapter in UnixPkg is a virtual device written in X11 API. The library of x11proto-xext-dev is required
- for building.
-
-2, I fail to build UnixPkg due to "/usr/bin/ld: cannot find -lXext"?
- libxext-dev library is required for building.
-