summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-22 18:21:16 +0800
committerGuo Mang <mang.guo@intel.com>2016-12-26 19:14:59 +0800
commitba6b3842b7946bd0835f69006b9d4199b2c654e2 (patch)
tree7def81bf5c84f8d9334f6435fca464b277fe5536
parent5dce0991864ec5a10add570dca2f8dd850ea29bf (diff)
downloadedk2-platforms-ba6b3842b7946bd0835f69006b9d4199b2c654e2.tar.xz
EmulatorPkg: Remove unused Package
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
-rw-r--r--EmulatorPkg/AutoScanPei/AutoScanPei.c109
-rw-r--r--EmulatorPkg/AutoScanPei/AutoScanPei.inf58
-rw-r--r--EmulatorPkg/BootModePei/BootModePei.c94
-rw-r--r--EmulatorPkg/BootModePei/BootModePei.inf59
-rw-r--r--EmulatorPkg/Contributions.txt218
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/Cpu.c480
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/Cpu.inf73
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/CpuDriver.h242
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/CpuIo.c330
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/MpService.c1410
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/ComponentName.c354
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/DriverConfiguration.c338
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/DriverDiagnostics.c219
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c747
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.h84
-rw-r--r--EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf69
-rw-r--r--EmulatorPkg/EmuBusDriverDxe/ComponentName.c247
-rw-r--r--EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c529
-rw-r--r--EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.h116
-rw-r--r--EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf63
-rw-r--r--EmulatorPkg/EmuGopDxe/ComponentName.c250
-rw-r--r--EmulatorPkg/EmuGopDxe/EmuGopDxe.inf69
-rw-r--r--EmulatorPkg/EmuGopDxe/Gop.h195
-rw-r--r--EmulatorPkg/EmuGopDxe/GopDriver.c443
-rw-r--r--EmulatorPkg/EmuGopDxe/GopInput.c900
-rw-r--r--EmulatorPkg/EmuGopDxe/GopScreen.c416
-rw-r--r--EmulatorPkg/EmuSimpleFileSystemDxe/ComponentName.c244
-rw-r--r--EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c917
-rw-r--r--EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.h80
-rw-r--r--EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf55
-rw-r--r--EmulatorPkg/EmuSnpDxe/ComponentName.c318
-rw-r--r--EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c986
-rw-r--r--EmulatorPkg/EmuSnpDxe/EmuSnpDxe.h488
-rw-r--r--EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf57
-rw-r--r--EmulatorPkg/EmuThunkDxe/EmuThunk.c89
-rw-r--r--EmulatorPkg/EmuThunkDxe/EmuThunk.inf59
-rw-r--r--EmulatorPkg/EmulatorPkg.dec106
-rw-r--r--EmulatorPkg/EmulatorPkg.dsc412
-rw-r--r--EmulatorPkg/EmulatorPkg.fdf321
-rw-r--r--EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.c130
-rw-r--r--EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf60
-rw-r--r--EmulatorPkg/FlashMapPei/FlashMapPei.c83
-rw-r--r--EmulatorPkg/FlashMapPei/FlashMapPei.inf68
-rw-r--r--EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c1356
-rw-r--r--EmulatorPkg/FvbServicesRuntimeDxe/FvbInfo.c154
-rw-r--r--EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf80
-rw-r--r--EmulatorPkg/FvbServicesRuntimeDxe/FwBlockService.h219
-rw-r--r--EmulatorPkg/Include/Guid/EmuPhysicalDisk.h24
-rw-r--r--EmulatorPkg/Include/Guid/EmuSystemConfig.h36
-rw-r--r--EmulatorPkg/Include/Guid/EmuVirtualDisk.h24
-rw-r--r--EmulatorPkg/Include/Library/EmuMagicPageLib.h38
-rw-r--r--EmulatorPkg/Include/Library/EmuThunkLib.h42
-rw-r--r--EmulatorPkg/Include/Library/KeyMapLib.h43
-rw-r--r--EmulatorPkg/Include/Library/PpiListLib.h21
-rw-r--r--EmulatorPkg/Include/Library/SmbiosLib.h202
-rw-r--r--EmulatorPkg/Include/Library/ThunkPpiList.h33
-rw-r--r--EmulatorPkg/Include/Library/ThunkProtocolList.h35
-rw-r--r--EmulatorPkg/Include/Ppi/EmuThunk.h127
-rw-r--r--EmulatorPkg/Include/Protocol/EmuBlockIo.h192
-rw-r--r--EmulatorPkg/Include/Protocol/EmuFileSystem.h140
-rw-r--r--EmulatorPkg/Include/Protocol/EmuGraphicsWindow.h134
-rw-r--r--EmulatorPkg/Include/Protocol/EmuIoThunk.h51
-rw-r--r--EmulatorPkg/Include/Protocol/EmuSnp.h459
-rw-r--r--EmulatorPkg/Include/Protocol/EmuThread.h103
-rw-r--r--EmulatorPkg/Include/Protocol/EmuThunk.h264
-rw-r--r--EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.c183
-rw-r--r--EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.inf48
-rw-r--r--EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c128
-rw-r--r--EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf44
-rw-r--r--EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c88
-rw-r--r--EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf46
-rw-r--r--EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.c103
-rw-r--r--EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf48
-rw-r--r--EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.c207
-rw-r--r--EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf41
-rw-r--r--EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.c123
-rw-r--r--EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf40
-rw-r--r--EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c206
-rw-r--r--EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf51
-rw-r--r--EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c557
-rw-r--r--EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h99
-rw-r--r--EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf66
-rw-r--r--EmulatorPkg/Library/EmuBdsLib/PlatformData.c73
-rw-r--r--EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf42
-rw-r--r--EmulatorPkg/Library/GuardUefiMemoryAllocationLib/MemoryAllocationLib.c819
-rw-r--r--EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.c50
-rw-r--r--EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf39
-rw-r--r--EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiCoreServicesTablePointerLib.inf41
-rw-r--r--EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiServicesTablePointer.c117
-rw-r--r--EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.c107
-rw-r--r--EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf49
-rw-r--r--EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.c297
-rw-r--r--EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf49
-rw-r--r--EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.c139
-rw-r--r--EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf46
-rw-r--r--EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c162
-rw-r--r--EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf46
-rw-r--r--EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointer.c101
-rw-r--r--EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf44
-rw-r--r--EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c174
-rw-r--r--EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf47
-rw-r--r--EmulatorPkg/Library/SecPeiServicesLib/FwVol.c281
-rw-r--r--EmulatorPkg/Library/SecPeiServicesLib/PeiServicesLib.c567
-rw-r--r--EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf49
-rw-r--r--EmulatorPkg/Library/SecPpiListLib/PpiListLib.c17
-rw-r--r--EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf31
-rw-r--r--EmulatorPkg/Library/SmbiosLib/SmbiosLib.c352
-rw-r--r--EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf47
-rw-r--r--EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.c76
-rw-r--r--EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf38
-rw-r--r--EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c138
-rw-r--r--EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf36
-rw-r--r--EmulatorPkg/License.txt25
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.unibin2214 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c57
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c161
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendor.unibin1588 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c88
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c196
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c33
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c68
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.unibin1774 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c45
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c131
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscDevicePath.h175
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c38
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c233
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscOemString.unibin1312 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringData.c32
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c75
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.unibin8914 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c99
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c172
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c42
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c71
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h132
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf103
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.unibin2004 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c78
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c200
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.unibin1314 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c33
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c80
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.unibin1772 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c57
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c135
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.unibin1308 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c32
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c77
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.unibin1322 -> 0 bytes
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c52
-rw-r--r--EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c92
-rw-r--r--EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c136
-rw-r--r--EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf55
-rw-r--r--EmulatorPkg/PlatformSmbiosDxe/SmbiosTable.c448
-rw-r--r--EmulatorPkg/README35
-rw-r--r--EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c305
-rw-r--r--EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf57
-rw-r--r--EmulatorPkg/ResetRuntimeDxe/Reset.c114
-rw-r--r--EmulatorPkg/ResetRuntimeDxe/Reset.inf57
-rw-r--r--EmulatorPkg/Sec/Ia32/SwitchRam.S95
-rw-r--r--EmulatorPkg/Sec/Ia32/SwitchRam.asm94
-rw-r--r--EmulatorPkg/Sec/Ia32/TempRam.c65
-rw-r--r--EmulatorPkg/Sec/Sec.c149
-rw-r--r--EmulatorPkg/Sec/Sec.h51
-rw-r--r--EmulatorPkg/Sec/Sec.inf53
-rw-r--r--EmulatorPkg/Sec/X64/SwitchRam.S72
-rw-r--r--EmulatorPkg/Sec/X64/SwitchRam.asm76
-rw-r--r--EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c74
-rw-r--r--EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf55
-rw-r--r--EmulatorPkg/TimerDxe/Timer.c352
-rw-r--r--EmulatorPkg/TimerDxe/Timer.h73
-rw-r--r--EmulatorPkg/TimerDxe/Timer.inf59
-rw-r--r--EmulatorPkg/Unix/.gdbinit8
-rw-r--r--EmulatorPkg/Unix/GdbRun79
-rw-r--r--EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c1111
-rw-r--r--EmulatorPkg/Unix/Host/BlockIo.c708
-rw-r--r--EmulatorPkg/Unix/Host/EmuThunk.c440
-rw-r--r--EmulatorPkg/Unix/Host/Gasket.h651
-rw-r--r--EmulatorPkg/Unix/Host/Host.c1286
-rw-r--r--EmulatorPkg/Unix/Host/Host.h356
-rw-r--r--EmulatorPkg/Unix/Host/Host.inf148
-rw-r--r--EmulatorPkg/Unix/Host/Ia32/Gasket.S1492
-rw-r--r--EmulatorPkg/Unix/Host/Ia32/SwitchStack.c74
-rw-r--r--EmulatorPkg/Unix/Host/LinuxPacketFilter.c604
-rw-r--r--EmulatorPkg/Unix/Host/MemoryAllocationLib.c145
-rw-r--r--EmulatorPkg/Unix/Host/PosixFileSystem.c1556
-rw-r--r--EmulatorPkg/Unix/Host/Pthreads.c235
-rw-r--r--EmulatorPkg/Unix/Host/X11GraphicsWindow.c1028
l---------EmulatorPkg/Unix/Host/X11IncludeHack1
-rw-r--r--EmulatorPkg/Unix/Host/X64/Gasket.S1631
-rw-r--r--EmulatorPkg/Unix/Host/X64/SwitchStack.S53
-rwxr-xr-xEmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh23
-rw-r--r--EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/default.pbxuser191
-rw-r--r--EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/project.pbxproj124
-rwxr-xr-xEmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh23
-rw-r--r--EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser191
-rw-r--r--EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj124
-rwxr-xr-xEmulatorPkg/Unix/lldbefi.py540
-rw-r--r--EmulatorPkg/Unix/lldbinit3
-rwxr-xr-xEmulatorPkg/build.sh272
201 files changed, 0 insertions, 40898 deletions
diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c b/EmulatorPkg/AutoScanPei/AutoScanPei.c
deleted file mode 100644
index 78a40db3a2..0000000000
--- a/EmulatorPkg/AutoScanPei/AutoScanPei.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "PiPei.h"
-#include <Ppi/EmuThunk.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
-PeimInitializeAutoScanPei (
- 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;
- EMU_THUNK_PPI *Thunk;
- UINT64 MemorySize;
- EFI_PHYSICAL_ADDRESS MemoryBase;
- UINTN Index;
- EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
-
-
- DEBUG ((EFI_D_ERROR, "Emu Autoscan PEIM Loaded\n"));
-
- //
- // Get the PEI UNIX Autoscan PPI
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&Thunk // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Index = 0;
- do {
- Status = Thunk->MemoryAutoScan (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/EmulatorPkg/AutoScanPei/AutoScanPei.inf b/EmulatorPkg/AutoScanPei/AutoScanPei.inf
deleted file mode 100644
index 0a5d5f52e8..0000000000
--- a/EmulatorPkg/AutoScanPei/AutoScanPei.inf
+++ /dev/null
@@ -1,58 +0,0 @@
-## @file
-# Component description file for EmuAutoScan module
-#
-# This module abstracts memory auto-scan in a Emu environment.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AutoScanPei
- FILE_GUID = 2D6F6BCC-9681-8E42-8579-B57DCD0060F0
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeAutoScanPei
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- AutoScanPei.c
-
-[Packages]
- MdePkg/MdePkg.dec
-# MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- BaseMemoryLib
- BaseLib
- PeimEntryPoint
- DebugLib
-
-
-[Ppis]
- gEfiPeiMemoryDiscoveredPpiGuid # PPI ALWAYS_PRODUCED
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-
-[Depex]
- gEmuThunkPpiGuid AND gEfiPeiMasterBootModePpiGuid
-
diff --git a/EmulatorPkg/BootModePei/BootModePei.c b/EmulatorPkg/BootModePei/BootModePei.c
deleted file mode 100644
index 892e1c6f04..0000000000
--- a/EmulatorPkg/BootModePei/BootModePei.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-
-//
-// The package level header files this module uses
-//
-#include <PiPei.h>
-
-#include <Library/PcdLib.h>
-#include <Library/PeiServicesLib.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
-
-**/
-{
- EFI_STATUS Status;
- EFI_BOOT_MODE BootMode;
-
- DEBUG ((EFI_D_ERROR, "Emu Boot Mode PEIM Loaded\n"));
-
- BootMode = FixedPcdGet32 (PcdEmuBootMode);
-
- Status = PeiServicesSetBootMode (BootMode);
- ASSERT_EFI_ERROR (Status);
-
- Status = PeiServicesInstallPpi (&mPpiListBootMode);
- ASSERT_EFI_ERROR (Status);
-
- if (BootMode == BOOT_IN_RECOVERY_MODE) {
- Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
- ASSERT_EFI_ERROR (Status);
- }
-
- return Status;
-}
diff --git a/EmulatorPkg/BootModePei/BootModePei.inf b/EmulatorPkg/BootModePei/BootModePei.inf
deleted file mode 100644
index b7d17da97e..0000000000
--- a/EmulatorPkg/BootModePei/BootModePei.inf
+++ /dev/null
@@ -1,59 +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>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BootModePei
- FILE_GUID = 64196C76-58E3-0B4D-9484-B54F7C4349CA
- 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
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- BaseLib
- PeimEntryPoint
- DebugLib
-
-
-[Ppis]
- gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
- gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
-
-[FixedPcd]
- gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode
-
-[Depex]
- TRUE
-
diff --git a/EmulatorPkg/Contributions.txt b/EmulatorPkg/Contributions.txt
deleted file mode 100644
index f87cbd73c6..0000000000
--- a/EmulatorPkg/Contributions.txt
+++ /dev/null
@@ -1,218 +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.
-5. It is preferred that contributions are submitted using the same
- copyright license as the base project. When that is not possible,
- then contributions using the following licenses can be accepted:
- * BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
- * BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
- * MIT: http://opensource.org/licenses/MIT
- * Python-2.0: http://opensource.org/licenses/Python-2.0
- * Zlib: http://opensource.org/licenses/Zlib
-
- Contributions of code put into the public domain can also be
- accepted.
-
- Contributions using other licenses might be accepted, but further
- review will be required.
-
-=====================================================
-= Change Description / Commit Message / Patch Email =
-=====================================================
-
-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 =
-
-=== Start of sample patch email message ===
-
-From: Contributor Name <contributor@example.com>
-Subject: [PATCH] CodeModule: Brief-single-line-summary
-
-Full-commit-message
-
-Contributed-under: TianoCore Contribution Agreement 1.0
-Signed-off-by: Contributor Name <contributor@example.com>
----
-
-An extra message for the patch email which will not be considered part
-of the commit message can be added here.
-
-Patch content inline or attached
-
-=== End of sample patch email message ===
-
-=== Notes for sample patch email ===
-
-* The first line of commit message is taken from the email's subject
- line following [PATCH]. The remaining portion of the commit message
- is the email's content until the '---' line.
-* git format-patch is one way to create this format
-
-=== Definitions for sample patch email ===
-
-* "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.
-
-========================================
-= 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/EmulatorPkg/CpuRuntimeDxe/Cpu.c b/EmulatorPkg/CpuRuntimeDxe/Cpu.c
deleted file mode 100644
index fb8520afc1..0000000000
--- a/EmulatorPkg/CpuRuntimeDxe/Cpu.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*++ @file
- Emu driver to produce CPU Architectural Protocol.
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011 - 2012, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "CpuDriver.h"
-
-UINT64 mTimerPeriod;
-
-CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
- CPU_ARCH_PROT_PRIVATE_SIGNATURE,
- NULL,
- {
- EmuFlushCpuDataCache,
- EmuEnableInterrupt,
- EmuDisableInterrupt,
- EmuGetInterruptState,
- EmuInit,
- EmuRegisterInterruptHandler,
- EmuGetTimerValue,
- EmuSetMemoryAttributes,
- 0,
- 4
- },
- {
- {
- CpuMemoryServiceRead,
- CpuMemoryServiceWrite
- },
- {
- CpuIoServiceRead,
- CpuIoServiceWrite
- }
- },
- TRUE
-};
-
-#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
-
-SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
- { EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
- 1, // Socket String
- ProcessorOther, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
- ProcessorFamilyOther, // ProcessorFamily; ///< The enumeration value from PROCESSOR_FAMILY_DATA.
- 2, // ProcessorManufacture String;
- { // ProcessorId;
- { // PROCESSOR_SIGNATURE
- 0, // ProcessorSteppingId:4;
- 0, // ProcessorModel: 4;
- 0, // ProcessorFamily: 4;
- 0, // ProcessorType: 2;
- 0, // ProcessorReserved1: 2;
- 0, // ProcessorXModel: 4;
- 0, // ProcessorXFamily: 8;
- 0, // ProcessorReserved2: 4;
- },
- { // PROCESSOR_FEATURE_FLAGS
- 0, // ProcessorFpu :1;
- 0, // ProcessorVme :1;
- 0, // ProcessorDe :1;
- 0, // ProcessorPse :1;
- 0, // ProcessorTsc :1;
- 0, // ProcessorMsr :1;
- 0, // ProcessorPae :1;
- 0, // ProcessorMce :1;
- 0, // ProcessorCx8 :1;
- 0, // ProcessorApic :1;
- 0, // ProcessorReserved1 :1;
- 0, // ProcessorSep :1;
- 0, // ProcessorMtrr :1;
- 0, // ProcessorPge :1;
- 0, // ProcessorMca :1;
- 0, // ProcessorCmov :1;
- 0, // ProcessorPat :1;
- 0, // ProcessorPse36 :1;
- 0, // ProcessorPsn :1;
- 0, // ProcessorClfsh :1;
- 0, // ProcessorReserved2 :1;
- 0, // ProcessorDs :1;
- 0, // ProcessorAcpi :1;
- 0, // ProcessorMmx :1;
- 0, // ProcessorFxsr :1;
- 0, // ProcessorSse :1;
- 0, // ProcessorSse2 :1;
- 0, // ProcessorSs :1;
- 0, // ProcessorReserved3 :1;
- 0, // ProcessorTm :1;
- 0, // ProcessorReserved4 :2;
- }
- },
- 3, // ProcessorVersion String;
- { // Voltage;
- 1, // ProcessorVoltageCapability5V :1;
- 1, // ProcessorVoltageCapability3_3V :1;
- 1, // ProcessorVoltageCapability2_9V :1;
- 0, // ProcessorVoltageCapabilityReserved :1; ///< Bit 3, must be zero.
- 0, // ProcessorVoltageReserved :3; ///< Bits 4-6, must be zero.
- 0 // ProcessorVoltageIndicateLegacy :1;
- },
- 0, // ExternalClock;
- 0, // MaxSpeed;
- 0, // CurrentSpeed;
- 0x41, // Status;
- ProcessorUpgradeOther, // ProcessorUpgrade; ///< The enumeration value from PROCESSOR_UPGRADE.
- 0, // L1CacheHandle;
- 0, // L2CacheHandle;
- 0, // L3CacheHandle;
- 4, // SerialNumber;
- 5, // AssetTag;
- 6, // PartNumber;
- 0, // CoreCount;
- 0, // EnabledCoreCount;
- 0, // ThreadCount;
- 0, // ProcessorCharacteristics;
- 0, // ProcessorFamily2;
-};
-
-CHAR8 *mCpuSmbiosType4Strings[] = {
- "Socket",
- "http://www.tianocore.org/edk2/",
- "Emulated Processor",
- "1.0",
- "1.0",
- "1.0",
- NULL
-};
-
-
-/**
- Create SMBIOS record.
-
- Converts a fixed SMBIOS structure and an array of pointers to strings into
- an SMBIOS record where the strings are cat'ed on the end of the fixed record
- and terminated via a double NULL and add to SMBIOS table.
-
- SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
- { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
- 1 // StringCount
- };
- CHAR8 *gSmbiosType12Strings[] = {
- "Not Found",
- NULL
- };
-
- ...
- LogSmbiosData (
- (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,
- gSmbiosType12Strings
- );
-
- @param Template Fixed SMBIOS structure, required.
- @param StringArray Array of strings to convert to an SMBIOS string pack.
- NULL is OK.
-
-**/
-EFI_STATUS
-LogSmbiosData (
- IN EFI_SMBIOS_TABLE_HEADER *Template,
- IN CHAR8 **StringPack
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_SMBIOS_TABLE_HEADER *Record;
- UINTN Index;
- UINTN StringSize;
- UINTN Size;
- CHAR8 *Str;
-
- //
- // Locate Smbios protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- // Calculate the size of the fixed record and optional string pack
- Size = Template->Length;
- if (StringPack == NULL) {
- // At least a double null is required
- Size += 2;
- } else {
- for (Index = 0; StringPack[Index] != NULL; Index++) {
- StringSize = AsciiStrSize (StringPack[Index]);
- Size += StringSize;
- }
- if (StringPack[0] == NULL) {
- // At least a double null is required
- Size += 1;
- }
- // Don't forget the terminating double null
- Size += 1;
- }
-
- // Copy over Template
- Record = (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size);
- if (Record == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (Record, Template, Template->Length);
-
- // Append string pack
- Str = ((CHAR8 *)Record) + Record->Length;
- for (Index = 0; StringPack[Index] != NULL; Index++) {
- StringSize = AsciiStrSize (StringPack[Index]);
- CopyMem (Str, StringPack[Index], StringSize);
- Str += StringSize;
- }
- *Str = 0;
-
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = Smbios->Add (
- Smbios,
- gImageHandle,
- &SmbiosHandle,
- Record
- );
- ASSERT_EFI_ERROR (Status);
-
- FreePool (Record);
- return Status;
-}
-
-
-
-
-VOID
-CpuUpdateSmbios (
- IN UINTN MaxCpus
- )
-{
- mCpuSmbiosType4.CoreCount = (UINT8) MaxCpus;
- mCpuSmbiosType4.EnabledCoreCount = (UINT8) MaxCpus;
- mCpuSmbiosType4.ThreadCount = (UINT8) MaxCpus;
-
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);
-}
-
-
-//
-// Service routines for the driver
-//
-EFI_STATUS
-EFIAPI
-EmuFlushCpuDataCache (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 Length,
- IN EFI_CPU_FLUSH_TYPE FlushType
- )
-{
- if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
- //
- // Only WB flush is supported. We actually need do nothing on Emu emulator
- // environment. Classify this to follow EFI spec
- //
- return EFI_SUCCESS;
- }
- //
- // Other flush types are not supported by Emu emulator
- //
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EmuEnableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- )
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- Private->InterruptState = TRUE;
- gEmuThunk->EnableInterrupt ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuDisableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- )
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- Private->InterruptState = FALSE;
- gEmuThunk->DisableInterrupt ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuGetInterruptState (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- OUT BOOLEAN *State
- )
-{
- 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
-EmuInit (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_CPU_INIT_TYPE InitType
- )
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EmuRegisterInterruptHandler (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- )
-{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
-
- //
- // Do parameter checking for EFI spec conformance
- //
- if (InterruptType < 0 || InterruptType > 0xff) {
- return EFI_UNSUPPORTED;
- }
- //
- // Do nothing for Emu emulation
- //
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EmuGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
- )
-{
- if (TimerValue == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (TimerIndex != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- *TimerValue = gEmuThunk->QueryPerformanceCounter ();
-
- if (TimerPeriod != NULL) {
- *TimerPeriod = mTimerPeriod;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-EmuSetMemoryAttributes (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- )
-{
- 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;
-}
-
-
-
-
-/**
- Callback function for idle events.
-
- @param Event Event whose notification function is being invoked.
- @param Context The pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-IdleLoopEventCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- gEmuThunk->CpuSleep ();
-}
-
-
-EFI_STATUS
-EFIAPI
-InitializeCpu (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- UINT64 Frequency;
- EFI_EVENT IdleLoopEvent;
- UINTN MaxCpu;
-
- //
- // Retrieve the frequency of the performance counter in Hz.
- //
- Frequency = gEmuThunk->QueryPerformanceFrequency ();
-
- //
- // Convert frequency in Hz to a clock period in femtoseconds.
- //
- mTimerPeriod = DivU64x64Remainder (1000000000000000ULL, Frequency, NULL);
-
- CpuMpServicesInit (&MaxCpu);
-
- CpuUpdateSmbios (MaxCpu);
-
-
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- IdleLoopEventCallback,
- NULL,
- &gIdleLoopEventGuid,
- &IdleLoopEvent
- );
- ASSERT_EFI_ERROR (Status);
-
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mCpuTemplate.Handle,
- &gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
- &gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EmulatorPkg/CpuRuntimeDxe/Cpu.inf b/EmulatorPkg/CpuRuntimeDxe/Cpu.inf
deleted file mode 100644
index b8e8ebd8e2..0000000000
--- a/EmulatorPkg/CpuRuntimeDxe/Cpu.inf
+++ /dev/null
@@ -1,73 +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 - 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 = 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
- MpService.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiDriverEntryPoint
- UefiLib
- HiiLib
- DebugLib
- BaseLib
- EmuThunkLib
- PcdLib
-
-[Protocols]
- gEmuIoThunkProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
- gEfiCpuIo2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEmuThreadThunkProtocolGuid
- gEfiMpServiceProtocolGuid
-
-[Guids]
- gIdleLoopEventGuid ## CONSUMES ## GUID
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdEmuMpServicesPollingInterval
-
-[Depex]
- gEfiSmbiosProtocolGuid
diff --git a/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h b/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h
deleted file mode 100644
index 9442786713..0000000000
--- a/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
-#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
-
-
-#include <PiDxe.h>
-#include <IndustryStandard/SmBios.h>
-
-#include <Protocol/Cpu.h>
-#include <Protocol/Smbios.h>
-#include <Protocol/MpService.h>
-#include <Protocol/EmuThread.h>
-#include <Protocol/CpuIo2.h>
-
-#include <Guid/IdleLoopEvent.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/UefiLib.h>
-#include <Library/PcdLib.h>
-
-
-
-//
-// 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 \
- )
-
-
-
-typedef enum {
- CPU_STATE_IDLE,
- CPU_STATE_BLOCKED,
- CPU_STATE_READY,
- CPU_STATE_BUSY,
- CPU_STATE_FINISHED
-} PROCESSOR_STATE;
-
-
-//
-// Define Individual Processor Data block.
-//
-typedef struct {
- EFI_PROCESSOR_INFORMATION Info;
- EFI_AP_PROCEDURE Procedure;
- VOID *Parameter;
- VOID *StateLock;
- VOID *ProcedureLock;
- PROCESSOR_STATE State;
- EFI_EVENT CheckThisAPEvent;
-} PROCESSOR_DATA_BLOCK;
-
-
-//
-// Define MP data block which consumes individual processor block.
-//
-typedef struct {
- UINTN NumberOfProcessors;
- UINTN NumberOfEnabledProcessors;
- EFI_EVENT CheckAllAPsEvent;
- EFI_EVENT WaitEvent;
- UINTN FinishCount;
- UINTN StartCount;
- EFI_AP_PROCEDURE Procedure;
- VOID *ProcedureArgument;
- BOOLEAN SingleThread;
- UINTN StartedNumber;
- PROCESSOR_DATA_BLOCK *ProcessorData;
- UINTN Timeout;
- UINTN *FailedList;
- UINTN FailedListIndex;
- BOOLEAN TimeoutActive;
-} MP_SYSTEM_DATA;
-
-
-
-
-
-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
-EmuFlushCpuDataCache (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 Length,
- IN EFI_CPU_FLUSH_TYPE FlushType
- );
-
-EFI_STATUS
-EFIAPI
-EmuEnableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-EmuDisableInterrupt (
- IN EFI_CPU_ARCH_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-EmuGetInterruptState (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- OUT BOOLEAN *State
- );
-
-EFI_STATUS
-EFIAPI
-EmuInit (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_CPU_INIT_TYPE InitType
- );
-
-EFI_STATUS
-EFIAPI
-EmuRegisterInterruptHandler (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- );
-
-EFI_STATUS
-EFIAPI
-EmuGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-EmuSetMemoryAttributes (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- );
-
-EFI_STATUS
-CpuMpServicesInit (
- OUT UINTN *MaxCores
- );
-
-EFI_STATUS
-EFIAPI
-CpuMpServicesWhoAmI (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *ProcessorNumber
- );
-
-extern EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate;
-
-
-#endif
diff --git a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c b/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
deleted file mode 100644
index 37905f892a..0000000000
--- a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*++ @file
- 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.
-
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-#include <Protocol/Cpu.h>
-#include <Protocol/CpuIo2.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.
-
-**/
-{
- 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.
-
-**/
-{
- 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.
-**/
-{
- 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.
-
-**/
-{
- 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;
-}
-
-
-/*++
-
-Routine 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
-
-**/
-EFI_STATUS
-CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
- )
-{
- 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 + LShiftU64 (Count, Width)) > Limit) {
- return EFI_UNSUPPORTED;
- }
-
- AlignMask = (1 << Width) - 1;
- if ((UINTN) Buffer & AlignMask) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c b/EmulatorPkg/CpuRuntimeDxe/MpService.c
deleted file mode 100644
index 36fa68f3e8..0000000000
--- a/EmulatorPkg/CpuRuntimeDxe/MpService.c
+++ /dev/null
@@ -1,1410 +0,0 @@
-/** @file
- Construct MP Services Protocol on top of the EMU Thread protocol.
- This code makes APs show up in the emulator. PcdEmuApCount is the
- number of APs the emulator should produce.
-
- The MP Services Protocol provides a generalized way of performing following tasks:
- - Retrieving information of multi-processor environment and MP-related status of
- specific processors.
- - Dispatching user-provided function to APs.
- - Maintain MP-related processor status.
-
- The MP Services Protocol must be produced on any system with more than one logical
- processor.
-
- The Protocol is available only during boot time.
-
- MP Services Protocol is hardware-independent. Most of the logic of this protocol
- is architecturally neutral. It abstracts the multi-processor environment and
- status of processors, and provides interfaces to retrieve information, maintain,
- and dispatch.
-
- MP Services Protocol may be consumed by ACPI module. The ACPI module may use this
- protocol to retrieve data that are needed for an MP platform and report them to OS.
- MP Services Protocol may also be used to program and configure processors, such
- as MTRR synchronization for memory space attributes setting in DXE Services.
- MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot
- by taking advantage of the processing capabilities of the APs, for example, using
- APs to help test system memory in parallel with other device initialization.
- Diagnostics applications may also use this protocol for multi-processor.
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portitions Copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#include "CpuDriver.h"
-
-
-MP_SYSTEM_DATA gMPSystem;
-EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
-EFI_EVENT gReadToBootEvent;
-BOOLEAN gReadToBoot = FALSE;
-UINTN gPollInterval;
-
-
-BOOLEAN
-IsBSP (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN ProcessorNumber;
-
- Status = CpuMpServicesWhoAmI (&mMpServicesTemplate, &ProcessorNumber);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return (gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0;
-}
-
-
-VOID
-SetApProcedure (
- IN PROCESSOR_DATA_BLOCK *Processor,
- IN EFI_AP_PROCEDURE Procedure,
- IN VOID *ProcedureArgument
- )
-{
- gThread->MutexLock (Processor->ProcedureLock);
- Processor->Parameter = ProcedureArgument;
- Processor->Procedure = Procedure;
- gThread->MutexUnlock (Processor->ProcedureLock);
-}
-
-
-EFI_STATUS
-GetNextBlockedNumber (
- OUT UINTN *NextNumber
- )
-{
- UINTN Number;
- PROCESSOR_STATE ProcessorState;
- PROCESSOR_DATA_BLOCK *Data;
-
- for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
- Data = &gMPSystem.ProcessorData[Number];
- if ((Data->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0) {
- // Skip BSP
- continue;
- }
-
- gThread->MutexLock (Data->StateLock);
- ProcessorState = Data->State;
- gThread->MutexUnlock (Data->StateLock);
-
- if (ProcessorState == CPU_STATE_BLOCKED) {
- *NextNumber = Number;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- * Calculated and stalled the interval time by BSP to check whether
- * the APs have finished.
- *
- * @param[in] Timeout The time limit in microseconds for
- * APs to return from Procedure.
- *
- * @retval StallTime Time of execution stall.
-**/
-UINTN
-CalculateAndStallInterval (
- IN UINTN Timeout
- )
-{
- UINTN StallTime;
-
- if (Timeout < gPollInterval && Timeout != 0) {
- StallTime = Timeout;
- } else {
- StallTime = gPollInterval;
- }
- gBS->Stall (StallTime);
-
- return StallTime;
-}
-
-/**
- This service retrieves the number of logical processor in the platform
- and the number of those logical processors that are enabled on this boot.
- This service may only be called from the BSP.
-
- This function is used to retrieve the following information:
- - The number of logical processors that are present in the system.
- - The number of enabled logical processors in the system at the instant
- this call is made.
-
- Because MP Service Protocol provides services to enable and disable processors
- dynamically, the number of enabled logical processors may vary during the
- course of a boot session.
-
- If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
- If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
- EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
- is returned in NumberOfProcessors, the number of currently enabled processor
- is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
- instance.
- @param[out] NumberOfProcessors Pointer to the total number of logical
- processors in the system, including the BSP
- and disabled APs.
- @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
- processors that exist in system, including
- the BSP.
-
- @retval EFI_SUCCESS The number of logical processors and enabled
- logical processors was retrieved.
- @retval EFI_DEVICE_ERROR The calling processor is an AP.
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
- @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesGetNumberOfProcessors (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *NumberOfProcessors,
- OUT UINTN *NumberOfEnabledProcessors
- )
-{
- if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- *NumberOfProcessors = gMPSystem.NumberOfProcessors;
- *NumberOfEnabledProcessors = gMPSystem.NumberOfEnabledProcessors;
- return EFI_SUCCESS;
-}
-
-
-
-/**
- Gets detailed MP-related information on the requested processor at the
- instant this call is made. This service may only be called from the BSP.
-
- This service retrieves detailed MP-related information about any processor
- on the platform. Note the following:
- - The processor information may change during the course of a boot session.
- - The information presented here is entirely MP related.
-
- Information regarding the number of caches and their sizes, frequency of operation,
- slot numbers is all considered platform-related information and is not provided
- by this service.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
- instance.
- @param[in] ProcessorNumber The handle number of processor.
- @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
- the requested processor is deposited.
-
- @retval EFI_SUCCESS Processor information was returned.
- @retval EFI_DEVICE_ERROR The calling processor is an AP.
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
- @retval EFI_NOT_FOUND The processor with the handle specified by
- ProcessorNumber does not exist in the platform.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesGetProcessorInfo (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
- )
-{
- if (ProcessorInfoBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- if (ProcessorNumber >= gMPSystem.NumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- CopyMem (ProcessorInfoBuffer, &gMPSystem.ProcessorData[ProcessorNumber], sizeof (EFI_PROCESSOR_INFORMATION));
- return EFI_SUCCESS;
-}
-
-
-/**
- This service executes a caller provided function on all enabled APs. APs can
- run either simultaneously or one at a time in sequence. This service supports
- both blocking and non-blocking requests. The non-blocking requests use EFI
- events so the BSP can detect when the APs have finished. This service may only
- be called from the BSP.
-
- This function is used to dispatch all the enabled APs to the function specified
- by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned
- immediately and Procedure is not started on any AP.
-
- If SingleThread is TRUE, all the enabled APs execute the function specified by
- Procedure one by one, in ascending order of processor handle number. Otherwise,
- all the enabled APs execute the function specified by Procedure simultaneously.
-
- If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all
- APs finish or TimeoutInMicroseconds expires. Otherwise, execution is in non-blocking
- mode, and the BSP returns from this service without waiting for APs. If a
- non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
- is signaled, then EFI_UNSUPPORTED must be returned.
-
- If the timeout specified by TimeoutInMicroseconds expires before all APs return
- from Procedure, then Procedure on the failed APs is terminated. All enabled APs
- are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
- and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its
- content points to the list of processor handle numbers in which Procedure was
- terminated.
-
- Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
- to make sure that the nature of the code that is executed on the BSP and the
- dispatched APs is well controlled. The MP Services Protocol does not guarantee
- that the Procedure function is MP-safe. Hence, the tasks that can be run in
- parallel are limited to certain independent tasks and well-controlled exclusive
- code. EFI services and protocols may not be called by APs unless otherwise
- specified.
-
- In blocking execution mode, BSP waits until all APs finish or
- TimeoutInMicroseconds expires.
-
- In non-blocking execution mode, BSP is freed to return to the caller and then
- proceed to the next task without having to wait for APs. The following
- sequence needs to occur in a non-blocking execution mode:
-
- -# The caller that intends to use this MP Services Protocol in non-blocking
- mode creates WaitEvent by calling the EFI CreateEvent() service. The caller
- invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent
- is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests
- the function specified by Procedure to be started on all the enabled APs,
- and releases the BSP to continue with other tasks.
- -# The caller can use the CheckEvent() and WaitForEvent() services to check
- the state of the WaitEvent created in step 1.
- -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP
- Service signals WaitEvent by calling the EFI SignalEvent() function. If
- FailedCpuList is not NULL, its content is available when WaitEvent is
- signaled. If all APs returned from Procedure prior to the timeout, then
- FailedCpuList is set to NULL. If not all APs return from Procedure before
- the timeout, then FailedCpuList is filled in with the list of the failed
- APs. The buffer is allocated by MP Service Protocol using AllocatePool().
- It is the caller's responsibility to free the buffer with FreePool() service.
- -# This invocation of SignalEvent() function informs the caller that invoked
- EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed
- the specified task or a timeout occurred. The contents of FailedCpuList
- can be examined to determine which APs did not complete the specified task
- prior to the timeout.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
- instance.
- @param[in] Procedure A pointer to the function to be run on
- enabled APs of the system. See type
- EFI_AP_PROCEDURE.
- @param[in] SingleThread If TRUE, then all the enabled APs execute
- the function specified by Procedure one by
- one, in ascending order of processor handle
- number. If FALSE, then all the enabled APs
- execute the function specified by Procedure
- simultaneously.
- @param[in] WaitEvent The event created by the caller with CreateEvent()
- service. If it is NULL, then execute in
- blocking mode. BSP waits until all APs finish
- or TimeoutInMicroseconds expires. If it's
- not NULL, then execute in non-blocking mode.
- BSP requests the function specified by
- Procedure to be started on all the enabled
- APs, and go on executing immediately. If
- all return from Procedure, or TimeoutInMicroseconds
- expires, this event is signaled. The BSP
- can use the CheckEvent() or WaitForEvent()
- services to check the state of event. Type
- EFI_EVENT is defined in CreateEvent() in
- the Unified Extensible Firmware Interface
- Specification.
- @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
- APs to return from Procedure, either for
- blocking or non-blocking mode. Zero means
- infinity. If the timeout expires before
- all APs return from Procedure, then Procedure
- on the failed APs is terminated. All enabled
- APs are available for next function assigned
- by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
- or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
- If the timeout expires in blocking mode,
- BSP returns EFI_TIMEOUT. If the timeout
- expires in non-blocking mode, WaitEvent
- is signaled with SignalEvent().
- @param[in] ProcedureArgument The parameter passed into Procedure for
- all APs.
- @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,
- if all APs finish successfully, then its
- content is set to NULL. If not all APs
- finish before timeout expires, then its
- content is set to address of the buffer
- holding handle numbers of the failed APs.
- The buffer is allocated by MP Service Protocol,
- and it's the caller's responsibility to
- free the buffer with FreePool() service.
- In blocking mode, it is ready for consumption
- when the call returns. In non-blocking mode,
- it is ready when WaitEvent is signaled. The
- list of failed CPU is terminated by
- END_OF_CPU_LIST.
-
- @retval EFI_SUCCESS In blocking mode, all APs have finished before
- the timeout expired.
- @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
- to all enabled APs.
- @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
- UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
- signaled.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_STARTED No enabled APs exist in the system.
- @retval EFI_NOT_READY Any enabled APs are busy.
- @retval EFI_TIMEOUT In blocking mode, the timeout expired before
- all enabled APs have finished.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesStartupAllAps (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN BOOLEAN SingleThread,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroseconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT UINTN **FailedCpuList OPTIONAL
- )
-{
- EFI_STATUS Status;
- PROCESSOR_DATA_BLOCK *ProcessorData;
- UINTN Number;
- UINTN NextNumber;
- PROCESSOR_STATE APInitialState;
- PROCESSOR_STATE ProcessorState;
- UINTN Timeout;
-
-
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- if (gMPSystem.NumberOfProcessors == 1) {
- return EFI_NOT_STARTED;
- }
-
- if (Procedure == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((WaitEvent != NULL) && gReadToBoot) {
- return EFI_UNSUPPORTED;
- }
-
- for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
- ProcessorData = &gMPSystem.ProcessorData[Number];
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- continue;
- }
- gThread->MutexLock(ProcessorData->StateLock);
- if (ProcessorData->State != CPU_STATE_IDLE) {
- gThread->MutexUnlock (ProcessorData->StateLock);
- return EFI_NOT_READY;
- }
- gThread->MutexUnlock(ProcessorData->StateLock);
- }
-
- if (FailedCpuList != NULL) {
- gMPSystem.FailedList = AllocatePool ((gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN));
- if (gMPSystem.FailedList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- SetMemN (gMPSystem.FailedList, (gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN), END_OF_CPU_LIST);
- gMPSystem.FailedListIndex = 0;
- *FailedCpuList = gMPSystem.FailedList;
- }
-
- Timeout = TimeoutInMicroseconds;
-
- ProcessorData = NULL;
-
- gMPSystem.FinishCount = 0;
- gMPSystem.StartCount = 0;
- gMPSystem.SingleThread = SingleThread;
- APInitialState = CPU_STATE_READY;
-
- for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
- ProcessorData = &gMPSystem.ProcessorData[Number];
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Number;
- continue;
- }
-
- //
- // Get APs prepared, and put failing APs into FailedCpuList
- // if "SingleThread", only 1 AP will put to ready state, other AP will be put to ready
- // state 1 by 1, until the previous 1 finished its task
- // if not "SingleThread", all APs are put to ready state from the beginning
- //
- gThread->MutexLock(ProcessorData->StateLock);
- ASSERT (ProcessorData->State == CPU_STATE_IDLE);
- ProcessorData->State = APInitialState;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- gMPSystem.StartCount++;
- if (SingleThread) {
- APInitialState = CPU_STATE_BLOCKED;
- }
- }
-
- if (WaitEvent != NULL) {
- for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
- ProcessorData = &gMPSystem.ProcessorData[Number];
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- continue;
- }
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorState = ProcessorData->State;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- if (ProcessorState == CPU_STATE_READY) {
- SetApProcedure (ProcessorData, Procedure, ProcedureArgument);
- }
- }
-
- //
- // Save data into private data structure, and create timer to poll AP state before exiting
- //
- gMPSystem.Procedure = Procedure;
- gMPSystem.ProcedureArgument = ProcedureArgument;
- gMPSystem.WaitEvent = WaitEvent;
- gMPSystem.Timeout = TimeoutInMicroseconds;
- gMPSystem.TimeoutActive = (BOOLEAN)(TimeoutInMicroseconds != 0);
- Status = gBS->SetTimer (
- gMPSystem.CheckAllAPsEvent,
- TimerPeriodic,
- gPollInterval
- );
- return Status;
-
- }
-
- while (TRUE) {
- for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
- ProcessorData = &gMPSystem.ProcessorData[Number];
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- continue;
- }
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorState = ProcessorData->State;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- switch (ProcessorState) {
- case CPU_STATE_READY:
- SetApProcedure (ProcessorData, Procedure, ProcedureArgument);
- break;
-
- case CPU_STATE_FINISHED:
- gMPSystem.FinishCount++;
- if (SingleThread) {
- Status = GetNextBlockedNumber (&NextNumber);
- if (!EFI_ERROR (Status)) {
- gThread->MutexLock (gMPSystem.ProcessorData[NextNumber].StateLock);
- gMPSystem.ProcessorData[NextNumber].State = CPU_STATE_READY;
- gThread->MutexUnlock (gMPSystem.ProcessorData[NextNumber].StateLock);
- }
- }
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_IDLE;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- break;
-
- default:
- break;
- }
- }
-
- if (gMPSystem.FinishCount == gMPSystem.StartCount) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {
- Status = EFI_TIMEOUT;
- goto Done;
- }
-
- Timeout -= CalculateAndStallInterval (Timeout);
- }
-
-Done:
- if (FailedCpuList != NULL) {
- if (gMPSystem.FailedListIndex == 0) {
- FreePool (*FailedCpuList);
- *FailedCpuList = NULL;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- This service lets the caller get one enabled AP to execute a caller-provided
- function. The caller can request the BSP to either wait for the completion
- of the AP or just proceed with the next task by using the EFI event mechanism.
- See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking
- execution support. This service may only be called from the BSP.
-
- This function is used to dispatch one enabled AP to the function specified by
- Procedure passing in the argument specified by ProcedureArgument. If WaitEvent
- is NULL, execution is in blocking mode. The BSP waits until the AP finishes or
- TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.
- BSP proceeds to the next task without waiting for the AP. If a non-blocking mode
- is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,
- then EFI_UNSUPPORTED must be returned.
-
- If the timeout specified by TimeoutInMicroseconds expires before the AP returns
- from Procedure, then execution of Procedure by the AP is terminated. The AP is
- available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and
- EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
- instance.
- @param[in] Procedure A pointer to the function to be run on
- enabled APs of the system. See type
- EFI_AP_PROCEDURE.
- @param[in] ProcessorNumber The handle number of the AP. The range is
- from 0 to the total number of logical
- processors minus 1. The total number of
- logical processors can be retrieved by
- EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
- @param[in] WaitEvent The event created by the caller with CreateEvent()
- service. If it is NULL, then execute in
- blocking mode. BSP waits until all APs finish
- or TimeoutInMicroseconds expires. If it's
- not NULL, then execute in non-blocking mode.
- BSP requests the function specified by
- Procedure to be started on all the enabled
- APs, and go on executing immediately. If
- all return from Procedure or TimeoutInMicroseconds
- expires, this event is signaled. The BSP
- can use the CheckEvent() or WaitForEvent()
- services to check the state of event. Type
- EFI_EVENT is defined in CreateEvent() in
- the Unified Extensible Firmware Interface
- Specification.
- @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
- APs to return from Procedure, either for
- blocking or non-blocking mode. Zero means
- infinity. If the timeout expires before
- all APs return from Procedure, then Procedure
- on the failed APs is terminated. All enabled
- APs are available for next function assigned
- by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
- or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
- If the timeout expires in blocking mode,
- BSP returns EFI_TIMEOUT. If the timeout
- expires in non-blocking mode, WaitEvent
- is signaled with SignalEvent().
- @param[in] ProcedureArgument The parameter passed into Procedure for
- all APs.
- @param[out] Finished If NULL, this parameter is ignored. In
- blocking mode, this parameter is ignored.
- In non-blocking mode, if AP returns from
- Procedure before the timeout expires, its
- content is set to TRUE. Otherwise, the
- value is set to FALSE. The caller can
- determine if the AP returned from Procedure
- by evaluating this value.
-
- @retval EFI_SUCCESS In blocking mode, specified AP finished before
- the timeout expires.
- @retval EFI_SUCCESS In non-blocking mode, the function has been
- dispatched to specified AP.
- @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
- UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
- signaled.
- @retval EFI_DEVICE_ERROR The calling processor is an AP.
- @retval EFI_TIMEOUT In blocking mode, the timeout expired before
- the specified AP has finished.
- @retval EFI_NOT_READY The specified AP is busy.
- @retval EFI_NOT_FOUND The processor with the handle specified by
- ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesStartupThisAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN UINTN ProcessorNumber,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroseconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT BOOLEAN *Finished OPTIONAL
- )
-{
- UINTN Timeout;
-
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- if (Procedure == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ProcessorNumber >= gMPSystem.NumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- gThread->MutexLock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
- gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- return EFI_NOT_READY;
- }
- gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
-
- if ((WaitEvent != NULL) && gReadToBoot) {
- return EFI_UNSUPPORTED;
- }
-
- Timeout = TimeoutInMicroseconds;
-
- gMPSystem.StartCount = 1;
- gMPSystem.FinishCount = 0;
-
- SetApProcedure (&gMPSystem.ProcessorData[ProcessorNumber], Procedure, ProcedureArgument);
-
- if (WaitEvent != NULL) {
- // Non Blocking
- gMPSystem.WaitEvent = WaitEvent;
- gBS->SetTimer (
- gMPSystem.ProcessorData[ProcessorNumber].CheckThisAPEvent,
- TimerPeriodic,
- gPollInterval
- );
- return EFI_SUCCESS;
- }
-
- // Blocking
- while (TRUE) {
- gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- if (gMPSystem.ProcessorData[ProcessorNumber].State == CPU_STATE_FINISHED) {
- gMPSystem.ProcessorData[ProcessorNumber].State = CPU_STATE_IDLE;
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- break;
- }
-
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
-
- if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {
- return EFI_TIMEOUT;
- }
-
- Timeout -= CalculateAndStallInterval (Timeout);
- }
-
- return EFI_SUCCESS;
-
-}
-
-
-/**
- This service switches the requested AP to be the BSP from that point onward.
- This service changes the BSP for all purposes. This call can only be performed
- by the current BSP.
-
- This service switches the requested AP to be the BSP from that point onward.
- This service changes the BSP for all purposes. The new BSP can take over the
- execution of the old BSP and continue seamlessly from where the old one left
- off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
- is signaled.
-
- If the BSP cannot be switched prior to the return from this service, then
- EFI_UNSUPPORTED must be returned.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param[in] ProcessorNumber The handle number of AP that is to become the new
- BSP. The range is from 0 to the total number of
- logical processors minus 1. The total number of
- logical processors can be retrieved by
- EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
- @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
- enabled AP. Otherwise, it will be disabled.
-
- @retval EFI_SUCCESS BSP successfully switched.
- @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
- this service returning.
- @retval EFI_UNSUPPORTED Switching the BSP is not supported.
- @retval EFI_SUCCESS The calling processor is an AP.
- @retval EFI_NOT_FOUND The processor with the handle specified by
- ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
- a disabled AP.
- @retval EFI_NOT_READY The specified AP is busy.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesSwitchBSP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableOldBSP
- )
-{
- UINTN Index;
-
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- if (ProcessorNumber >= gMPSystem.NumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
- if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0) {
- break;
- }
- }
- ASSERT (Index != gMPSystem.NumberOfProcessors);
-
- gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- return EFI_NOT_READY;
- }
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
-
- // Skip for now as we need switch a bunch of stack stuff around and it's complex
- // May not be worth it?
- return EFI_NOT_READY;
-}
-
-
-/**
- This service lets the caller enable or disable an AP from this point onward.
- This service may only be called from the BSP.
-
- This service allows the caller enable or disable an AP from this point onward.
- The caller can optionally specify the health status of the AP by Health. If
- an AP is being disabled, then the state of the disabled AP is implementation
- dependent. If an AP is enabled, then the implementation must guarantee that a
- complete initialization sequence is performed on the AP, so the AP is in a state
- that is compatible with an MP operating system. This service may not be supported
- after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.
-
- If the enable or disable AP operation cannot be completed prior to the return
- from this service, then EFI_UNSUPPORTED must be returned.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param[in] ProcessorNumber The handle number of AP that is to become the new
- BSP. The range is from 0 to the total number of
- logical processors minus 1. The total number of
- logical processors can be retrieved by
- EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
- @param[in] EnableAP Specifies the new state for the processor for
- enabled, FALSE for disabled.
- @param[in] HealthFlag If not NULL, a pointer to a value that specifies
- the new health status of the AP. This flag
- corresponds to StatusFlag defined in
- EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
- the PROCESSOR_HEALTH_STATUS_BIT is used. All other
- bits are ignored. If it is NULL, this parameter
- is ignored.
-
- @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
- @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed
- prior to this service returning.
- @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
- @retval EFI_DEVICE_ERROR The calling processor is an AP.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
- does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesEnableDisableAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableAP,
- IN UINT32 *HealthFlag OPTIONAL
- )
-{
- if (!IsBSP ()) {
- return EFI_DEVICE_ERROR;
- }
-
- if (ProcessorNumber >= gMPSystem.NumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
- return EFI_UNSUPPORTED;
- }
- gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
-
- if (EnableAP) {
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
- gMPSystem.NumberOfEnabledProcessors++;
- }
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_ENABLED_BIT;
- } else {
- if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == PROCESSOR_ENABLED_BIT ) {
- gMPSystem.NumberOfEnabledProcessors--;
- }
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_ENABLED_BIT;
- }
-
- if (HealthFlag != NULL) {
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_HEALTH_STATUS_BIT;
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= (*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- This return the handle number for the calling processor. This service may be
- called from the BSP and APs.
-
- This service returns the processor handle number for the calling processor.
- The returned value is in the range from 0 to the total number of logical
- processors minus 1. The total number of logical processors can be retrieved
- with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
- called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
- is returned. Otherwise, the current processors handle number is returned in
- ProcessorNumber, and EFI_SUCCESS is returned.
-
- @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param[in] ProcessorNumber The handle number of AP that is to become the new
- BSP. The range is from 0 to the total number of
- logical processors minus 1. The total number of
- logical processors can be retrieved by
- EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
-
- @retval EFI_SUCCESS The current processor handle number was returned
- in ProcessorNumber.
- @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMpServicesWhoAmI (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *ProcessorNumber
- )
-{
- UINTN Index;
- UINT64 ProcessorId;
-
- if (ProcessorNumber == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ProcessorId = gThread->Self ();
- for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
- if (gMPSystem.ProcessorData[Index].Info.ProcessorId == ProcessorId) {
- break;
- }
- }
-
- *ProcessorNumber = Index;
- return EFI_SUCCESS;
-}
-
-
-
-EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
- CpuMpServicesGetNumberOfProcessors,
- CpuMpServicesGetProcessorInfo,
- CpuMpServicesStartupAllAps,
- CpuMpServicesStartupThisAP,
- CpuMpServicesSwitchBSP,
- CpuMpServicesEnableDisableAP,
- CpuMpServicesWhoAmI
-};
-
-
-
-/*++
- If timeout occurs in StartupAllAps(), a timer is set, which invokes this
- procedure periodically to check whether all APs have finished.
-
-
---*/
-VOID
-EFIAPI
-CpuCheckAllAPsStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN ProcessorNumber;
- UINTN NextNumber;
- PROCESSOR_DATA_BLOCK *ProcessorData;
- PROCESSOR_DATA_BLOCK *NextData;
- EFI_STATUS Status;
- PROCESSOR_STATE ProcessorState;
- UINTN Cpu;
- BOOLEAN Found;
-
- if (gMPSystem.TimeoutActive) {
- gMPSystem.Timeout -= CalculateAndStallInterval (gMPSystem.Timeout);
- }
-
- for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) {
- ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- continue;
- }
-
- // This is an Interrupt Service routine.
- // This can grab a lock that is held in a non-interrupt
- // context. Meaning deadlock. Which is a bad thing.
- // So, try lock it. If we can get it, cool, do our thing.
- // otherwise, just dump out & try again on the next iteration.
- Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
- return;
- }
- ProcessorState = ProcessorData->State;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- switch (ProcessorState) {
- case CPU_STATE_FINISHED:
- if (gMPSystem.SingleThread) {
- Status = GetNextBlockedNumber (&NextNumber);
- if (!EFI_ERROR (Status)) {
- NextData = &gMPSystem.ProcessorData[NextNumber];
-
- gThread->MutexLock (NextData->StateLock);
- NextData->State = CPU_STATE_READY;
- gThread->MutexUnlock (NextData->StateLock);
-
- SetApProcedure (NextData, gMPSystem.Procedure, gMPSystem.ProcedureArgument);
- }
- }
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_IDLE;
- gThread->MutexUnlock (ProcessorData->StateLock);
- gMPSystem.FinishCount++;
- break;
-
- default:
- break;
- }
- }
-
- if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {
- //
- // Timeout
- //
- if (gMPSystem.FailedList != NULL) {
- for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) {
- ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
- // Skip Disabled processors
- continue;
- }
-
- // Mark the
- Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
- return;
- }
- ProcessorState = ProcessorData->State;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- if (ProcessorState != CPU_STATE_IDLE) {
- // If we are retrying make sure we don't double count
- for (Cpu = 0, Found = FALSE; Cpu < gMPSystem.NumberOfProcessors; Cpu++) {
- if (gMPSystem.FailedList[Cpu] == END_OF_CPU_LIST) {
- break;
- }
- if (gMPSystem.FailedList[ProcessorNumber] == Cpu) {
- Found = TRUE;
- break;
- }
- }
- if (!Found) {
- gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Cpu;
- }
- }
- }
- }
- // Force terminal exit
- gMPSystem.FinishCount = gMPSystem.StartCount;
- }
-
- if (gMPSystem.FinishCount != gMPSystem.StartCount) {
- return;
- }
-
- gBS->SetTimer (
- gMPSystem.CheckAllAPsEvent,
- TimerCancel,
- 0
- );
-
- if (gMPSystem.FailedListIndex == 0) {
- if (gMPSystem.FailedList != NULL) {
- FreePool (gMPSystem.FailedList);
- gMPSystem.FailedList = NULL;
- }
- }
-
- Status = gBS->SignalEvent (gMPSystem.WaitEvent);
-
- return ;
-}
-
-VOID
-EFIAPI
-CpuCheckThisAPStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- PROCESSOR_DATA_BLOCK *ProcessorData;
- PROCESSOR_STATE ProcessorState;
-
- ProcessorData = (PROCESSOR_DATA_BLOCK *) Context;
-
- //
- // This is an Interrupt Service routine.
- // that can grab a lock that is held in a non-interrupt
- // context. Meaning deadlock. Which is a badddd thing.
- // So, try lock it. If we can get it, cool, do our thing.
- // otherwise, just dump out & try again on the next iteration.
- //
- Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
- return;
- }
- ProcessorState = ProcessorData->State;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- if (ProcessorState == CPU_STATE_FINISHED) {
- Status = gBS->SetTimer (ProcessorData->CheckThisAPEvent, TimerCancel, 0);
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->SignalEvent (gMPSystem.WaitEvent);
- ASSERT_EFI_ERROR (Status);
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_IDLE;
- gThread->MutexUnlock (ProcessorData->StateLock);
- }
-
- return ;
-}
-
-
-/*++
- This function is called by all processors (both BSP and AP) once and collects MP related data
-
- MPSystemData - Pointer to the data structure containing MP related data
- BSP - TRUE if the CPU is BSP
-
- EFI_SUCCESS - Data for the processor collected and filled in
-
---*/
-EFI_STATUS
-FillInProcessorInformation (
- IN BOOLEAN BSP,
- IN UINTN ProcessorNumber
- )
-{
- gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId = gThread->Self ();
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag = PROCESSOR_ENABLED_BIT | PROCESSOR_HEALTH_STATUS_BIT;
- if (BSP) {
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_AS_BSP_BIT;
- }
-
- gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32) ProcessorNumber;
- gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Core = 0;
- gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Thread = 0;
- gMPSystem.ProcessorData[ProcessorNumber].State = BSP ? CPU_STATE_BUSY : CPU_STATE_IDLE;
-
- gMPSystem.ProcessorData[ProcessorNumber].Procedure = NULL;
- gMPSystem.ProcessorData[ProcessorNumber].Parameter = NULL;
- gMPSystem.ProcessorData[ProcessorNumber].StateLock = gThread->MutexInit ();
- gMPSystem.ProcessorData[ProcessorNumber].ProcedureLock = gThread->MutexInit ();
-
- return EFI_SUCCESS;
-}
-
-VOID *
-EFIAPI
-CpuDriverApIdolLoop (
- VOID *Context
- )
-{
- EFI_AP_PROCEDURE Procedure;
- VOID *Parameter;
- UINTN ProcessorNumber;
- PROCESSOR_DATA_BLOCK *ProcessorData;
-
- ProcessorNumber = (UINTN)Context;
- ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
-
- ProcessorData->Info.ProcessorId = gThread->Self ();
-
- while (TRUE) {
- //
- // Make a local copy on the stack to be extra safe
- //
- gThread->MutexLock (ProcessorData->ProcedureLock);
- Procedure = ProcessorData->Procedure;
- Parameter = ProcessorData->Parameter;
- gThread->MutexUnlock (ProcessorData->ProcedureLock);
-
- if (Procedure != NULL) {
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_BUSY;
- gThread->MutexUnlock (ProcessorData->StateLock);
-
- Procedure (Parameter);
-
- gThread->MutexLock (ProcessorData->ProcedureLock);
- ProcessorData->Procedure = NULL;
- gThread->MutexUnlock (ProcessorData->ProcedureLock);
-
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_FINISHED;
- gThread->MutexUnlock (ProcessorData->StateLock);
- }
-
- // Poll 5 times a seconds, 200ms
- // Don't want to burn too many system resources doing nothing.
- gEmuThunk->Sleep (200 * 1000);
- }
-
- return 0;
-}
-
-
-EFI_STATUS
-InitializeMpSystemData (
- IN UINTN NumberOfProcessors
- )
-{
- EFI_STATUS Status;
- UINTN Index;
-
-
- //
- // Clear the data structure area first.
- //
- ZeroMem (&gMPSystem, sizeof (MP_SYSTEM_DATA));
-
- //
- // First BSP fills and inits all known values, including it's own records.
- //
- gMPSystem.NumberOfProcessors = NumberOfProcessors;
- gMPSystem.NumberOfEnabledProcessors = NumberOfProcessors;
-
- gMPSystem.ProcessorData = AllocateZeroPool (gMPSystem.NumberOfProcessors * sizeof (PROCESSOR_DATA_BLOCK));
- ASSERT (gMPSystem.ProcessorData != NULL);
-
- FillInProcessorInformation (TRUE, 0);
-
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- CpuCheckAllAPsStatus,
- NULL,
- &gMPSystem.CheckAllAPsEvent
- );
- ASSERT_EFI_ERROR (Status);
-
-
- for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
- if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
- continue;
- }
-
- FillInProcessorInformation (FALSE, Index);
-
- Status = gThread->CreateThread (
- (VOID *)&gMPSystem.ProcessorData[Index].Info.ProcessorId,
- NULL,
- CpuDriverApIdolLoop,
- (VOID *)Index
- );
-
-
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- CpuCheckThisAPStatus,
- (VOID *) &gMPSystem.ProcessorData[Index],
- &gMPSystem.ProcessorData[Index].CheckThisAPEvent
- );
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-/**
- Invoke a notification event
-
- @param Event Event whose notification function is being invoked.
- @param Context The pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-CpuReadToBootFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- gReadToBoot = TRUE;
-}
-
-
-
-EFI_STATUS
-CpuMpServicesInit (
- OUT UINTN *MaxCpus
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
-
- *MaxCpus = 1; // BSP
- IoThunk = GetIoThunkInstance (&gEmuThreadThunkProtocolGuid, 0);
- if (IoThunk != NULL) {
- Status = IoThunk->Open (IoThunk);
- if (!EFI_ERROR (Status)) {
- if (IoThunk->ConfigString != NULL) {
- *MaxCpus += StrDecimalToUintn (IoThunk->ConfigString);
- gThread = IoThunk->Interface;
- }
- }
- }
-
- if (*MaxCpus == 1) {
- // We are not MP so nothing to do
- return EFI_SUCCESS;
- }
-
- gPollInterval = (UINTN) PcdGet64 (PcdEmuMpServicesPollingInterval);
-
- Status = InitializeMpSystemData (*MaxCpus);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EfiCreateEventReadyToBootEx (TPL_CALLBACK, CpuReadToBootFunction, NULL, &gReadToBootEvent);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Now install the MP services protocol.
- //
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
- NULL
- );
- return Status;
-}
-
-
diff --git a/EmulatorPkg/EmuBlockIoDxe/ComponentName.c b/EmulatorPkg/EmuBlockIoDxe/ComponentName.c
deleted file mode 100644
index 7ecce35300..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/ComponentName.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/**@file
-
-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 "EmuBlockIo.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
-EmuBlockIoComponentNameGetDriverName (
- 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
-EmuBlockIoComponentNameGetControllerName (
- 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 gEmuBlockIoComponentName = {
- EmuBlockIoComponentNameGetDriverName,
- EmuBlockIoComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBlockIoComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBlockIoComponentNameGetControllerName,
- "en"
-};
-
-
-EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
- { "eng;en", L"Emu Block I/O 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
-EmuBlockIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mEmuBlockIoDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gEmuBlockIoComponentName)
- );
-}
-
-/**
- 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
-EmuBlockIoComponentNameGetControllerName (
- 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_BLOCK_IO_PROTOCOL *BlockIo;
- EMU_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,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- &gEmuIoThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlockIo,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gEmuBlockIoComponentName)
- );
-}
diff --git a/EmulatorPkg/EmuBlockIoDxe/DriverConfiguration.c b/EmulatorPkg/EmuBlockIoDxe/DriverConfiguration.c
deleted file mode 100644
index 03f94b0288..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/DriverConfiguration.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/**@file
-
-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:
-
- DriverConfiguration.c
-
-Abstract:
-
-**/
-
-#include "EmuBlockIo.h"
-
-//
-// EFI Driver Configuration Functions
-//
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverConfigurationSetOptions (
- 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
-EmuBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverConfigurationForceDefaults (
- 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 gEmuBlockIoDriverConfiguration = {
- EmuBlockIoDriverConfigurationSetOptions,
- EmuBlockIoDriverConfigurationOptionsValid,
- EmuBlockIoDriverConfigurationForceDefaults,
- "eng"
-};
-
-/*++
-
- 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
-EFIAPI
-EmuBlockIoDriverConfigurationSetOptions (
- 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 Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
-
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {
- 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,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&BlockIo,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- gEmuBlockIoDriverBinding.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;
-}
-
-/*++
-
- 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
-EFIAPI
-EmuBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-{
- 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,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&BlockIo,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-/*++
-
- 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
-EFIAPI
-EmuBlockIoDriverConfigurationForceDefaults (
- 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_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,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&BlockIo,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- gEmuBlockIoDriverBinding.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/EmulatorPkg/EmuBlockIoDxe/DriverDiagnostics.c b/EmulatorPkg/EmuBlockIoDxe/DriverDiagnostics.c
deleted file mode 100644
index 77a26e79d2..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/DriverDiagnostics.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/**@file
-
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM 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 "EmuBlockIo.h"
-
-//
-// EFI Driver Diagnostics Functions
-//
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverDiagnosticsRunDiagnostics (
- 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 gEmuBlockIoDriverDiagnostics = {
- EmuBlockIoDriverDiagnosticsRunDiagnostics,
- "eng"
-};
-
-//
-// EFI Driver Diagnostics 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gEmuBlockIoDriverDiagnostics2 = {
- (EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) EmuBlockIoDriverDiagnosticsRunDiagnostics,
- "en"
-};
-
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverDiagnosticsRunDiagnostics (
- 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 or a Null-terminated ASCII string array indicating
- the language. 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 *SupportedLanguages;
- BOOLEAN Iso639Language;
- BOOLEAN Found;
- UINTN Index;
-
- if (Language == NULL ||
- ErrorType == NULL ||
- Buffer == NULL ||
- ControllerHandle == NULL ||
- BufferSize == NULL) {
-
- return EFI_INVALID_PARAMETER;
- }
-
- SupportedLanguages = This->SupportedLanguages;
- Iso639Language = (BOOLEAN)(This == &gEmuBlockIoDriverDiagnostics);
- //
- // Make sure Language is in the set of Supported Languages
- //
- Found = FALSE;
- while (*SupportedLanguages != 0) {
- if (Iso639Language) {
- if (CompareMem (Language, SupportedLanguages, 3) == 0) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += 3;
- } else {
- for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
- if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += Index;
- for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
- }
- }
- //
- // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
- //
- if (!Found) {
- return EFI_UNSUPPORTED;
- }
-
- *ErrorType = NULL;
- *BufferSize = 0;
- if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
- *ErrorType = &gEfiBlockIoProtocolGuid;
- *BufferSize = 0x60;
- Buffer = AllocatePool ((UINTN) (*BufferSize));
- CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&BlockIo,
- gEmuBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- gEmuBlockIoDriverBinding.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/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c b/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c
deleted file mode 100644
index e77de2c7bc..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c
+++ /dev/null
@@ -1,747 +0,0 @@
-/**@file
-
-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.
-bbe
-**/
-
-#include "EmuBlockIo.h"
-
-
-/**
- Reset the block device hardware.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] ExtendedVerification Indicates that the driver may perform a more
- exhausive verfication operation of the device
- during 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
-EmuBlockIo2Reset (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = Private->Io->Reset (Private->Io, ExtendedVerification);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Read BufferSize bytes from Lba into Buffer.
-
- This function reads the requested number of blocks from the device. All the
- blocks are read, or an error is returned.
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and
- non-blocking I/O is being used, the Event associated with this request will
- not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId Id of the media, changes every time the media is
- replaced.
- @param[in] Lba The starting Logical Block Address to read from.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[out] Buffer A pointer to the destination buffer for the data. The
- caller is responsible for either having implicit or
- explicit ownership of the buffer.
-
- @retval EFI_SUCCESS The read request was queued if Token->Event is
- not NULL.The data was read correctly from the
- device if the Token->Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while performing
- the read.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIo2ReadBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = Private->Io->ReadBlocks (Private->Io, MediaId, LBA, Token, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Write BufferSize bytes from Lba into Buffer.
-
- This function writes the requested number of blocks to the device. All blocks
- are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,
- EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is
- being used, the Event associated with this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId The media ID that the write request is for.
- @param[in] Lba The starting logical block address to be written. The
- caller is responsible for writing to only legitimate
- locations.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[in] Buffer A pointer to the source buffer for the data.
-
- @retval EFI_SUCCESS The write request was queued if Event is not NULL.
- The data was written correctly to the device if
- the Event is NULL.
- @retval EFI_WRITE_PROTECTED The device can not be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
- @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIo2WriteBlocksEx (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = Private->Io->WriteBlocks (Private->Io, MediaId, LBA, Token, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-
-/**
- Flush the Block Device.
-
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED
- is returned and non-blocking I/O is being used, the Event associated with
- this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in,out] Token A pointer to the token associated with the transaction
-
- @retval EFI_SUCCESS The flush request was queued if Event is not NULL.
- All outstanding data was written correctly to the
- device if the Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while writting back
- the data.
- @retval EFI_WRITE_PROTECTED The device cannot be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIo2Flush (
- IN EFI_BLOCK_IO2_PROTOCOL *This,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = Private->Io->FlushBlocks (Private->Io, Token);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-
-/**
- Reset the Block Device.
-
- @param This Indicates a pointer to the calling context.
- @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
-EmuBlockIoReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = Private->Io->Reset (Private->Io, ExtendedVerification);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Read BufferSize bytes from Lba into Buffer.
-
- @param This Indicates a pointer to the calling context.
- @param MediaId Id of the media, changes every time the media is replaced.
- @param Lba The starting Logical Block Address to read from
- @param BufferSize Size of Buffer, must be a multiple of device block size.
- @param Buffer A pointer to the destination buffer for the data. The caller is
- responsible for either having implicit or explicit ownership of the buffer.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
- @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
- EFI_BLOCK_IO2_TOKEN Token;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Token.Event = NULL;
- Status = Private->Io->ReadBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Write BufferSize bytes from Lba into Buffer.
-
- @param This Indicates a pointer to the calling context.
- @param MediaId The media ID that the write request is for.
- @param Lba The starting logical block address to be written. The caller is
- responsible for writing to only legitimate locations.
- @param BufferSize Size of Buffer, must be a multiple of device block size.
- @param Buffer A pointer to the source buffer for the data.
-
- @retval EFI_SUCCESS The data was written correctly to the device.
- @retval EFI_WRITE_PROTECTED The device can not be written to.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
- EFI_BLOCK_IO2_TOKEN Token;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Token.Event = NULL;
- Status = Private->Io->WriteBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Flush the Block Device.
-
- @param This Indicates a pointer to the calling context.
-
- @retval EFI_SUCCESS All outstanding data was written to the device
- @retval EFI_DEVICE_ERROR The device reported an error while writting back the data
- @retval EFI_NO_MEDIA There is no media in the device.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
- EFI_BLOCK_IO2_TOKEN Token;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Token.Event = NULL;
- Status = Private->Io->FlushBlocks (Private->Io, &Token);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-
-/**
- Tests to see if this driver supports a given controller. If a child device is provided,
- it further tests to see if this driver supports creating a handle for the specified child device.
-
- This function checks to see if the driver specified by This supports the device specified by
- ControllerHandle. Drivers will typically use the device path attached to
- ControllerHandle and/or the services from the bus I/O abstraction attached to
- ControllerHandle to determine if the driver supports ControllerHandle. This function
- may be called many times during platform initialization. In order to reduce boot times, the tests
- performed by this function must be very small, and take as little time as possible to execute. This
- function must not change the state of any hardware devices, and this function must be aware that the
- device specified by ControllerHandle may already be managed by the same driver or a
- different driver. This function must match its calls to AllocatePages() with FreePages(),
- AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
- Because ControllerHandle may have been previously started by the same driver, if a protocol is
- already in the opened state, then it must not be closed with CloseProtocol(). This is required
- to guarantee the state of ControllerHandle is not modified by this function.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to test. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For bus drivers, if this parameter is not NULL, then
- the bus driver must determine if the bus controller specified
- by ControllerHandle and the child controller specified
- by RemainingDevicePath are both supported by this
- bus driver.
-
- @retval EFI_SUCCESS The device specified by ControllerHandle and
- RemainingDevicePath is supported by the driver specified by This.
- @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
- RemainingDevicePath is already being managed by the driver
- specified by This.
- @retval 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.
- Currently not implemented.
- @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
- RemainingDevicePath is not supported by the driver specified by This.
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- Handle,
- 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 (EmuIoThunk->Protocol, &gEmuBlockIoProtocolGuid)) {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
-}
-
-
-/**
- Starts a device controller or a bus controller.
-
- The Start() function is designed to be invoked from the EFI boot service ConnectController().
- As a result, much of the error checking on the parameters to Start() has been moved into this
- common boot service. It is legal to call Start() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE.
- 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
- EFI_DEVICE_PATH_PROTOCOL.
- 3. Prior to calling Start(), the Supported() function for the driver specified by This must
- have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to start. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For a bus driver, if this parameter is NULL, then handles
- for all the children of Controller are created by this driver.
- If this parameter is not NULL and the first Device Path Node is
- not the End of Device Path Node, then only the handle for the
- child device specified by the first Device Path Node of
- RemainingDevicePath is created by this driver.
- If the first Device Path Node of RemainingDevicePath is
- the End of Device Path Node, no child handle is created by this
- driver.
-
- @retval EFI_SUCCESS The device was started.
- @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval Others The driver failded to start the device.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EMU_BLOCK_IO_PRIVATE *Private = NULL;
-
- //
- // Grab the protocols we need
- //
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- (void *)&EmuIoThunk,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (!CompareGuid (EmuIoThunk->Protocol, &gEmuBlockIoProtocolGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Status = EmuIoThunk->Open (EmuIoThunk);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Private = AllocatePool (sizeof (EMU_BLOCK_IO_PRIVATE));
- if (Private == NULL) {
- goto Done;
- }
-
- Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
- Private->IoThunk = EmuIoThunk;
- Private->Io = EmuIoThunk->Interface;
- Private->EfiHandle = Handle;
-
- Private->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2;
- Private->BlockIo.Media = &Private->Media;
- Private->BlockIo.Reset = EmuBlockIoReset;
- Private->BlockIo.ReadBlocks = EmuBlockIoReadBlocks;
- Private->BlockIo.WriteBlocks = EmuBlockIoWriteBlocks;
- Private->BlockIo.FlushBlocks = EmuBlockIoFlushBlocks;
-
- Private->BlockIo2.Media = &Private->Media;
- Private->BlockIo2.Reset = EmuBlockIo2Reset;
- Private->BlockIo2.ReadBlocksEx = EmuBlockIo2ReadBlocksEx;
- Private->BlockIo2.WriteBlocksEx = EmuBlockIo2WriteBlocksEx;
- Private->BlockIo2.FlushBlocksEx = EmuBlockIo2Flush;
-
- Private->ControllerNameTable = NULL;
-
- Status = Private->Io->CreateMapping (Private->Io, &Private->Media);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AddUnicodeString2 (
- "eng",
- gEmuBlockIoComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- TRUE
- );
-
- AddUnicodeString2 (
- "en",
- gEmuBlockIoComponentName2.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- FALSE
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiBlockIoProtocolGuid, &Private->BlockIo,
- &gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
- if (Private != NULL) {
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
-
- gBS->FreePool (Private);
-
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- }
-
- return Status;
-}
-
-
-/**
- Stops a device controller or a bus controller.
-
- The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
- As a result, much of the error checking on the parameters to Stop() has been moved
- into this common boot service. It is legal to call Stop() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
- same driver's Start() function.
- 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
- EFI_HANDLE. In addition, all of these handles must have been created in this driver's
- Start() function, and the Start() function must have called OpenProtocol() on
- ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle A handle to the device being stopped. The handle must
- support a bus specific I/O protocol for the driver
- to use to stop the device.
- @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
- @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
- if NumberOfChildren is 0.
-
- @retval EFI_SUCCESS The device was stopped.
- @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuBlockIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_STATUS Status;
- EMU_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 = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
- Status = Private->IoThunk->Close (Private->IoThunk);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->EfiHandle,
- &gEfiBlockIoProtocolGuid, &Private->BlockIo,
- &gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->CloseProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
- }
-
- return Status;
-}
-
-
-
-
-
-EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
- EmuBlockIoDriverBindingSupported,
- EmuBlockIoDriverBindingStart,
- EmuBlockIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-
-
-/**
- The user Entry Point for module EmuBlockIo . 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
-InitializeEmuBlockIo (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols2 (
- ImageHandle,
- SystemTable,
- &gEmuBlockIoDriverBinding,
- ImageHandle,
- &gEmuBlockIoComponentName,
- &gEmuBlockIoComponentName2,
- NULL,
- NULL,
- &gEmuBlockIoDriverDiagnostics,
- &gEmuBlockIoDriverDiagnostics2
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
-
-
-
diff --git a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.h b/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.h
deleted file mode 100644
index 4b2e676953..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.h
+++ /dev/null
@@ -1,84 +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:
-
- EmuBlockIo.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 _EMU_BLOCK_IO_H_
-#define _EMU_BLOCK_IO_H_
-
-#include <PiDxe.h>
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/BlockIo.h>
-#include <Protocol/BlockIo2.h>
-#include <Protocol/EmuBlockIo.h>
-
-#include <Guid/EmuPhysicalDisk.h>
-#include <Guid/EmuVirtualDisk.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>
-
-
-//
-// Language supported for driverconfiguration protocol
-//
-
-#define EMU_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'b', 'k')
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
- EMU_BLOCK_IO_PROTOCOL *Io;
-
- EFI_HANDLE EfiHandle;
- EFI_BLOCK_IO_PROTOCOL BlockIo;
- EFI_BLOCK_IO2_PROTOCOL BlockIo2;
- EFI_BLOCK_IO_MEDIA Media;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} EMU_BLOCK_IO_PRIVATE;
-
-#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
-
-#define EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo2, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
-
-
-//
-// Block I/O Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuBlockIoComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentName2;
-extern EFI_DRIVER_CONFIGURATION_PROTOCOL gEmuBlockIoDriverConfiguration;
-extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gEmuBlockIoDriverDiagnostics;
-extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gEmuBlockIoDriverDiagnostics2;
-
-#endif
diff --git a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf b/EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
deleted file mode 100644
index 436afd975c..0000000000
--- a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.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 = EmuBlockIo
- FILE_GUID = C6760651-A38D-5F4F-AEAF-F6661549DF75
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuBlockIo
-
-#
-# 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
- EmuBlockIo.c
- EmuBlockIo.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEmuPhysicalDisksGuid # SOMETIMES_CONSUMED
- gEmuVirtualDisksGuid # ALWAYS_CONSUMED
-
-
-[Protocols]
- gEfiBlockIoProtocolGuid # PROTOCOL BY_START
- gEfiBlockIo2ProtocolGuid # PROTOCOL BY_START
- gEmuIoThunkProtocolGuid # PROTOCOL TO_START
- gEmuBlockIoProtocolGuid # PROTOCOL BY_START
diff --git a/EmulatorPkg/EmuBusDriverDxe/ComponentName.c b/EmulatorPkg/EmuBusDriverDxe/ComponentName.c
deleted file mode 100644
index 34275a32bc..0000000000
--- a/EmulatorPkg/EmuBusDriverDxe/ComponentName.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/** @file
-
-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
-
-**/
-
-#include "EmuBusDriverDxe.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-EmuBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverComponentNameGetControllerName (
- 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 gEmuBusDriverComponentName = {
- EmuBusDriverComponentNameGetDriverName,
- EmuBusDriverComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBusDriverComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBusDriverComponentNameGetControllerName,
- "en"
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuBusDriverNameTable[] = {
- { "eng", L"Emu Bus 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
-EmuBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mEmuBusDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gEmuBusDriverComponentName)
- );
-}
-
-/**
- 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
-EmuBusDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIo;
- EMU_IO_DEVICE *Private;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gEmuBusDriverBinding.DriverBindingHandle,
- &gEmuThunkProtocolGuid
- );
- 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,
- &gEmuThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID**)&EmuIo,
- gEmuBusDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = EMU_IO_DEVICE_FROM_THIS (EmuIo);
-
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gEmuBusDriverComponentName)
- );
-}
diff --git a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c b/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c
deleted file mode 100644
index 401141be69..0000000000
--- a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/** @file
- Emu Bus driver
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#include "EmuBusDriverDxe.h"
-
-
-
-//
-// DriverBinding protocol global
-//
-EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding = {
- EmuBusDriverBindingSupported,
- EmuBusDriverBindingStart,
- EmuBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EMU_THUNK_PROTOCOL *EmuThunk;
-
- //
- // 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(EMU_VENDOR_DEVICE_PATH_NODE)) {
- return EFI_UNSUPPORTED;
- }
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuThunkProtocolGuid,
- (VOID **)&EmuThunk ,
- 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,
- &gEmuThunkProtocolGuid,
- 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;
- }
-
-
- //
- // Close protocol, don't use device path protocol in the Support() function
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_STATUS InstallStatus;
- EMU_THUNK_PROTOCOL *EmuThunk;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EMU_IO_DEVICE *EmuDevice;
- EMU_BUS_DEVICE *EmuBusDevice;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- UINT16 ComponentName[512];
- EMU_VENDOR_DEVICE_PATH_NODE *Node;
- BOOLEAN CreateDevice;
-
- InstallStatus = EFI_UNSUPPORTED;
- 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,
- &gEmuThunkProtocolGuid,
- (VOID **)&EmuThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- EmuBusDevice = AllocatePool (sizeof (EMU_BUS_DEVICE));
- if (EmuBusDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- EmuBusDevice->Signature = EMU_BUS_DEVICE_SIGNATURE;
- EmuBusDevice->ControllerNameTable = NULL;
-
- AddUnicodeString2 (
- "eng",
- gEmuBusDriverComponentName.SupportedLanguages,
- &EmuBusDevice->ControllerNameTable,
- L"Emulator Bus Controller",
- TRUE
- );
- AddUnicodeString2 (
- "en",
- gEmuBusDriverComponentName2.SupportedLanguages,
- &EmuBusDevice->ControllerNameTable,
- L"Emulator Bus Controller",
- FALSE
- );
-
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiCallerIdGuid, EmuBusDevice,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (EmuBusDevice->ControllerNameTable);
- gBS->FreePool (EmuBusDevice);
- return Status;
- }
- }
-
-
- for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
- Status = EmuThunk->GetNextProtocol (TRUE, &EmuIoThunk);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- 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 = (EMU_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 (EMU_VENDOR_DEVICE_PATH_NODE)
- ) {
- if (CompareGuid (&Node->VendorDevicePath.Guid, EmuIoThunk->Protocol) && Node->Instance == EmuIoThunk->Instance) {
- CreateDevice = TRUE;
- }
- }
- }
- }
-
- if (CreateDevice) {
- //
- // Allocate instance structure, and fill in parent information.
- //
- EmuDevice = AllocatePool (sizeof (EMU_IO_DEVICE));
- if (EmuDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- EmuDevice->Handle = NULL;
- EmuDevice->ControllerHandle = ControllerHandle;
- EmuDevice->ParentDevicePath = ParentDevicePath;
- CopyMem (&EmuDevice->EmuIoThunk, EmuIoThunk, sizeof (EMU_IO_THUNK_PROTOCOL));
-
- EmuDevice->ControllerNameTable = NULL;
-
- StrnCpy (ComponentName, EmuIoThunk->ConfigString, sizeof (ComponentName)/sizeof (CHAR16));
-
- EmuDevice->DevicePath = EmuBusCreateDevicePath (
- ParentDevicePath,
- EmuIoThunk->Protocol,
- EmuIoThunk->Instance
- );
- if (EmuDevice->DevicePath == NULL) {
- gBS->FreePool (EmuDevice);
- return EFI_OUT_OF_RESOURCES;
- }
-
- AddUnicodeString (
- "eng",
- gEmuBusDriverComponentName.SupportedLanguages,
- &EmuDevice->ControllerNameTable,
- ComponentName
- );
-
- EmuDevice->Signature = EMU_IO_DEVICE_SIGNATURE;
-
- InstallStatus = gBS->InstallMultipleProtocolInterfaces (
- &EmuDevice->Handle,
- &gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
- &gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
- NULL
- );
- if (EFI_ERROR (InstallStatus)) {
- FreeUnicodeStringTable (EmuDevice->ControllerNameTable);
- gBS->FreePool (EmuDevice);
- } else {
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuThunkProtocolGuid,
- (VOID **)&EmuThunk ,
- This->DriverBindingHandle,
- EmuDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (!EFI_ERROR (Status)) {
- InstallStatus = EFI_SUCCESS;
- }
- }
- }
- }
-
- return InstallStatus;
-}
-
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EMU_BUS_DEVICE *EmuBusDevice;
- EMU_IO_DEVICE *EmuDevice;
- EMU_THUNK_PROTOCOL *EmuThunk;
-
- //
- // 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,
- &gEfiCallerIdGuid,
- (VOID **)&EmuBusDevice,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gEfiCallerIdGuid, EmuBusDevice,
- NULL
- );
-
- FreeUnicodeStringTable (EmuBusDevice->ControllerNameTable);
-
- gBS->FreePool (EmuBusDevice);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuThunkProtocolGuid,
- 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],
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- EmuDevice = EMU_IO_DEVICE_FROM_THIS (EmuIoThunk);
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEmuThunkProtocolGuid,
- This->DriverBindingHandle,
- EmuDevice->Handle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- EmuDevice->Handle,
- &gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
- &gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEmuThunkProtocolGuid,
- (VOID **) &EmuThunk ,
- This->DriverBindingHandle,
- EmuDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- //
- // Close the child handle
- //
- FreeUnicodeStringTable (EmuDevice->ControllerNameTable);
- FreePool (EmuDevice);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-
-/*++
-
-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
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EmuBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- )
-{
- EMU_VENDOR_DEVICE_PATH_NODE DevicePath;
-
- DevicePath.VendorDevicePath.Header.Type = HARDWARE_DEVICE_PATH;
- DevicePath.VendorDevicePath.Header.SubType = HW_VENDOR_DP;
- SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (EMU_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
- );
-}
-
-
-
-/**
- The user Entry Point for module EmuBusDriver. 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
-InitializeEmuBusDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gEmuBusDriverBinding,
- ImageHandle,
- &gEmuBusDriverComponentName,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
-
-
-
-
diff --git a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.h b/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.h
deleted file mode 100644
index 082a33ee1b..0000000000
--- a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EMU_BUS_DRIVER_H__
-#define __EMU_BUS_DRIVER_H__
-
-#include <PiDxe.h>
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/EmuThunk.h>
-#include <Protocol/EmuIoThunk.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 gEmuBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2;
-
-
-//
-// Unix Bus Controller Structure
-//
-#define EMU_BUS_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'B', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} EMU_BUS_DEVICE;
-
-//
-// Unix Child Device Controller Structure
-//
-#define EMU_IO_DEVICE_SIGNATURE SIGNATURE_32 ('L', 'X', 'V', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE Handle;
- EMU_IO_THUNK_PROTOCOL EmuIoThunk;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // Private data about the parent
- //
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} EMU_IO_DEVICE;
-
-#define EMU_IO_DEVICE_FROM_THIS(a) \
- CR(a, EMU_IO_DEVICE, EmuIoThunk, EMU_IO_DEVICE_SIGNATURE)
-
-
-
-//
-// Driver Binding Protocol function prototypes
-//
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ParentHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-
-EFI_STATUS
-EFIAPI
-EmuBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// Unix Bus Driver private worker functions
-//
-EFI_DEVICE_PATH_PROTOCOL *
-EmuBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- );
-
-
-#endif
diff --git a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf b/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
deleted file mode 100644
index 861bc9fa47..0000000000
--- a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-## @file
-# Emu Bus driver
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuBusDriver
- FILE_GUID = 9842073D-95D9-9F49-BD3F-2E29525125DF
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuBusDriver
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gEmuBusDriverBinding
-# COMPONENT_NAME = gEmuBusDriverComponentName
-#
-
-[Sources]
- ComponentName.c
- EmuBusDriverDxe.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- DevicePathLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- PcdLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Protocols]
- gEfiDevicePathProtocolGuid # PROTOCOL TO_START
- gEmuThunkProtocolGuid # PROTOCOL TO_START
- gEmuIoThunkProtocolGuid # PROTOCOL BY_START
-
-
-
diff --git a/EmulatorPkg/EmuGopDxe/ComponentName.c b/EmulatorPkg/EmuGopDxe/ComponentName.c
deleted file mode 100644
index 058e4557ef..0000000000
--- a/EmulatorPkg/EmuGopDxe/ComponentName.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/** @file
-
-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 "Gop.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-EmuGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-EmuGopComponentNameGetControllerName (
- 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 gEmuGopComponentName = {
- EmuGopComponentNameGetDriverName,
- EmuGopComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuGopComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuGopComponentNameGetControllerName,
- "en"
-};
-
-
-EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
- { "eng", L"Emulator 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
-EmuGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mEmuGopDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gEmuGopComponentName)
- );
-}
-
-
-/**
- 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
-EmuGopComponentNameGetControllerName (
- 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,
- gEmuGopDriverBinding.DriverBindingHandle,
- &gEmuIoThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **)&GraphicsOutput,
- gEmuGopDriverBinding.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 == &gEmuGopComponentName)
- );
-}
diff --git a/EmulatorPkg/EmuGopDxe/EmuGopDxe.inf b/EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
deleted file mode 100644
index 97ebc60f51..0000000000
--- a/EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
+++ /dev/null
@@ -1,69 +0,0 @@
-## @file
-# GOP driver
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuGopDxe
- FILE_GUID = BCC87E0D-86D6-4D4D-8040-2D983D368BD1
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuGop
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-# DRIVER_BINDING = gEmuGopDriverBinding
-# COMPONENT_NAME = gEmuGopComponentName
-#
-
-[Sources]
- ComponentName.c
- GopScreen.c
- GopDriver.c
- GopInput.c
- Gop.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
- KeyMapLib
-
-
-[Guids]
- gEfiEventExitBootServicesGuid # SOMETIMES_CONSUMED Create Event: EVENT_GROUP_GUID
-
-
-[Protocols]
- gEfiGraphicsOutputProtocolGuid
- gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
- gEfiSimpleTextInputExProtocolGuid # PROTOCOL BY_START
- gEfiSimplePointerProtocolGuid # PROTOCOL BY_START
- gEmuIoThunkProtocolGuid # PROTOCOL TO_START
- gEmuGraphicsWindowProtocolGuid # PROTOCOL TO_START
diff --git a/EmulatorPkg/EmuGopDxe/Gop.h b/EmulatorPkg/EmuGopDxe/Gop.h
deleted file mode 100644
index 6f7b082618..0000000000
--- a/EmulatorPkg/EmuGopDxe/Gop.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2008, 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.
-
-**/
-
-#ifndef __UGA_H_
-#define __UGA_H_
-
-#include <PiDxe.h>
-
-#include <Protocol/GraphicsOutput.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/SimplePointer.h>
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/EmuGraphicsWindow.h>
-
-#include <Guid/EventGroup.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 <Library/KeyMapLib.h>
-
-
-#define MAX_Q 256
-
-typedef struct {
- UINTN Front;
- UINTN Rear;
- UINTN Count;
- EFI_INPUT_KEY Q[MAX_Q];
-} GOP_QUEUE_FIXED;
-
-#define EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n')
-typedef struct _EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
- UINTN Signature;
- EFI_HANDLE NotifyHandle;
- EFI_KEY_DATA KeyData;
- EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
- EFI_EVENT Event;
- LIST_ENTRY NotifyEntry;
-} EMU_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 gEmuGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
-
-#define EMU_UGA_CLASS_NAME L"EmuGopWindow"
-
-#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;
-
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EMU_GRAPHICS_WINDOW_PROTOCOL *EmuGraphicsWindow;
-
- 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 gEmuGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2;
-
-//
-// Gop Hardware abstraction internal worker functions
-//
-EFI_STATUS
-EmuGopSupported (
- IN EMU_IO_THUNK_PROTOCOL *EmuIoThunk
- );
-
-EFI_STATUS
-EmuGopConstructor (
- IN GOP_PRIVATE_DATA *Private
- );
-
-EFI_STATUS
-EmuGopDestructor (
- IN GOP_PRIVATE_DATA *Private
- );
-
-
-EFI_STATUS
-GopPrivateAddQ (
- IN GOP_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- );
-
-EFI_STATUS
-EmuGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- );
-
-EFI_STATUS
-EmuGopInitializeSimplePointerForWindow (
- IN GOP_PRIVATE_DATA *Private
- );
-
-EFI_STATUS
-EmuGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- );
-
-VOID
-EFIAPI
-ShutdownGopEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-GopPrivateMakeCallbackFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-VOID
-EFIAPI
-GopPrivateBreakCallbackFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-#endif
diff --git a/EmulatorPkg/EmuGopDxe/GopDriver.c b/EmulatorPkg/EmuGopDxe/GopDriver.c
deleted file mode 100644
index b7cec38938..0000000000
--- a/EmulatorPkg/EmuGopDxe/GopDriver.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/*++ @file
-
-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.
-
-
-**/
-
-#include "Gop.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.
-
-**/
-{
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode;
-
- if (ListHead == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- while (!IsListEmpty (ListHead)) {
- NotifyNode = CR (
- ListHead->ForwardLink,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- RemoveEntryList (ListHead->ForwardLink);
- gBS->FreePool (NotifyNode);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Tests to see if this driver supports a given controller. If a child device is provided,
- it further tests to see if this driver supports creating a handle for the specified child device.
-
- This function checks to see if the driver specified by This supports the device specified by
- ControllerHandle. Drivers will typically use the device path attached to
- ControllerHandle and/or the services from the bus I/O abstraction attached to
- ControllerHandle to determine if the driver supports ControllerHandle. This function
- may be called many times during platform initialization. In order to reduce boot times, the tests
- performed by this function must be very small, and take as little time as possible to execute. This
- function must not change the state of any hardware devices, and this function must be aware that the
- device specified by ControllerHandle may already be managed by the same driver or a
- different driver. This function must match its calls to AllocatePages() with FreePages(),
- AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
- Because ControllerHandle may have been previously started by the same driver, if a protocol is
- already in the opened state, then it must not be closed with CloseProtocol(). This is required
- to guarantee the state of ControllerHandle is not modified by this function.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to test. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For bus drivers, if this parameter is not NULL, then
- the bus driver must determine if the bus controller specified
- by ControllerHandle and the child controller specified
- by RemainingDevicePath are both supported by this
- bus driver.
-
- @retval EFI_SUCCESS The device specified by ControllerHandle and
- RemainingDevicePath is supported by the driver specified by This.
- @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
- RemainingDevicePath is already being managed by the driver
- specified by This.
- @retval 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.
- Currently not implemented.
- @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
- RemainingDevicePath is not supported by the driver specified by This.
-**/
-EFI_STATUS
-EFIAPI
-EmuGopDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EmuGopSupported (EmuIoThunk);
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-
-/**
- Starts a device controller or a bus controller.
-
- The Start() function is designed to be invoked from the EFI boot service ConnectController().
- As a result, much of the error checking on the parameters to Start() has been moved into this
- common boot service. It is legal to call Start() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE.
- 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
- EFI_DEVICE_PATH_PROTOCOL.
- 3. Prior to calling Start(), the Supported() function for the driver specified by This must
- have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to start. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For a bus driver, if this parameter is NULL, then handles
- for all the children of Controller are created by this driver.
- If this parameter is not NULL and the first Device Path Node is
- not the End of Device Path Node, then only the handle for the
- child device specified by the first Device Path Node of
- RemainingDevicePath is created by this driver.
- If the first Device Path Node of RemainingDevicePath is
- the End of Device Path Node, no child handle is created by this
- driver.
-
- @retval EFI_SUCCESS The device was started.
- @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval Others The driver failded to start the device.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuGopDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- 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->EmuIoThunk = EmuIoThunk;
- Private->WindowName = EmuIoThunk->ConfigString;
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gEmuGopComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString
- );
- AddUnicodeString2 (
- "en",
- gEmuGopComponentName2.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- FALSE
- );
-
- Status = EmuGopConstructor (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,
- &gEmuIoThunkProtocolGuid,
- 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;
-}
-
-
-
-/**
- Stops a device controller or a bus controller.
-
- The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
- As a result, much of the error checking on the parameters to Stop() has been moved
- into this common boot service. It is legal to call Stop() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
- same driver's Start() function.
- 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
- EFI_HANDLE. In addition, all of these handles must have been created in this driver's
- Start() function, and the Start() function must have called OpenProtocol() on
- ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle A handle to the device being stopped. The handle must
- support a bus specific I/O protocol for the driver
- to use to stop the device.
- @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
- @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
- if NumberOfChildren is 0.
-
- @retval EFI_SUCCESS The device was stopped.
- @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuGopDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- 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 = EmuGopDestructor (Private);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEmuIoThunkProtocolGuid,
- 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;
-}
-
-
-///
-/// This protocol provides the services required to determine if a driver supports a given controller.
-/// If a controller is supported, then it also provides routines to start and stop the controller.
-///
-EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = {
- EmuGopDriverBindingSupported,
- EmuGopDriverBindingStart,
- EmuGopDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-
-/**
- The user Entry Point for module EmuGop. 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
-InitializeEmuGop (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gEmuGopDriverBinding,
- ImageHandle,
- &gEmuGopComponentName,
- &gEmuGopComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
-
diff --git a/EmulatorPkg/EmuGopDxe/GopInput.c b/EmulatorPkg/EmuGopDxe/GopInput.c
deleted file mode 100644
index a1f636aaa2..0000000000
--- a/EmulatorPkg/EmuGopDxe/GopInput.c
+++ /dev/null
@@ -1,900 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 0 2011,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 "Gop.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
-GopPrivateMakeCallbackFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- )
-{
- LIST_ENTRY *Link;
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
- GOP_PRIVATE_DATA *Private = (GOP_PRIVATE_DATA *)Context;
-
- KeyMapMake (KeyData);
-
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
- CurrentNotify = CR (
- Link,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- EMU_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);
- }
- }
-}
-
-
-VOID
-EFIAPI
-GopPrivateBreakCallbackFunction (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- )
-{
- KeyMapBreak (KeyData);
-}
-
-
-
-//
-// 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
-EmuGopSimpleTextInReset (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &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
-EmuGopSimpleTextInReadKeyStroke (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData);
- if (!EFI_ERROR (Status)) {
- if ((KeyData.Key.ScanCode == 0) && (KeyData.Key.UnicodeChar == 0)) {
- // Modifier key was pressed
- Status = EFI_NOT_READY;
- } else {
- 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
-EmuGopSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (GOP_PRIVATE_DATA *) Context;
- if (Private->EmuGraphicsWindow == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->CheckKey (Private->EmuGraphicsWindow);
- 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
-EmuGopSimpleTextInExResetEx (
- 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.
-
-**/
-{
- 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
-EmuGopSimpleTextInExReadKeyStrokeEx (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->GetKey(Private->EmuGraphicsWindow, 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
-EmuGopSimpleTextInExSetState (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->KeySetState (Private->EmuGraphicsWindow, 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
-EmuGopRegisterKeyCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *ExNotify = (EMU_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
-EmuGopSimpleTextInExRegisterKeyNotify (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN EFI_KEY_DATA *KeyData,
- IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
- OUT EFI_HANDLE *NotifyHandle
- )
-{
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
- LIST_ENTRY *Link;
- EMU_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,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {
- if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {
- *NotifyHandle = CurrentNotify->NotifyHandle;
- return EFI_SUCCESS;
- }
- }
- }
-
- //
- // Allocate resource to save the notification function
- //
- NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY));
- if (NewNotify == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewNotify->Signature = EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE;
- NewNotify->KeyNotificationFn = KeyNotificationFunction;
- NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify;
- CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData));
- InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry);
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- EmuGopRegisterKeyCallback,
- NewNotify,
- &NewNotify->Event
- );
- ASSERT_EFI_ERROR (Status);
-
-
- *NotifyHandle = NewNotify->NotifyHandle;
-
- 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
-EmuGopSimpleTextInExUnregisterKeyNotify (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
- IN EFI_HANDLE 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;
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify;
-
- if (NotificationHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (((EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) NotificationHandle)->Signature != EMU_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,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY,
- NotifyEntry,
- EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
- );
- if (CurrentNotify->NotifyHandle == 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
-EmuGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- EFI_STATUS Status;
-
- //
- // Initialize Simple Text In protoocol
- //
- Private->SimpleTextIn.Reset = EmuGopSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = EmuGopSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- EmuGopSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
- ASSERT_EFI_ERROR (Status);
-
-
- //
- // Initialize Simple Text In Ex
- //
-
- Private->SimpleTextInEx.Reset = EmuGopSimpleTextInExResetEx;
- Private->SimpleTextInEx.ReadKeyStrokeEx = EmuGopSimpleTextInExReadKeyStrokeEx;
- Private->SimpleTextInEx.SetState = EmuGopSimpleTextInExSetState;
- Private->SimpleTextInEx.RegisterKeyNotify = EmuGopSimpleTextInExRegisterKeyNotify;
- Private->SimpleTextInEx.UnregisterKeyNotify = EmuGopSimpleTextInExUnregisterKeyNotify;
-
- Private->SimpleTextInEx.Reset (&Private->SimpleTextInEx, FALSE);
-
- InitializeListHead (&Private->NotifyList);
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- EmuGopSimpleTextInWaitForKey,
- 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
-EmuGopSimplePointerReset (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, &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
-EmuGopSimplePointerGetState (
- 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->EmuGraphicsWindow == NULL) {
- return EFI_NOT_READY;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, 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
-EmuGopSimplePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (GOP_PRIVATE_DATA *) Context;
- if (Private->EmuGraphicsWindow == NULL) {
- return;
- }
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = Private->EmuGraphicsWindow->CheckPointer (Private->EmuGraphicsWindow);
- 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
-EmuGopInitializeSimplePointerForWindow (
- 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 = EmuGopSimplePointerReset;
- Private->SimplePointer.GetState = EmuGopSimplePointerGetState;
- Private->SimplePointer.Mode = &Private->PointerMode;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- EmuGopSimplePointerWaitForInput,
- Private,
- &Private->SimplePointer.WaitForInput
- );
-
- return Status;
-}
diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c
deleted file mode 100644
index aa21fa68de..0000000000
--- a/EmulatorPkg/EmuGopDxe/GopScreen.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EmuGopScreen.c
-
-Abstract:
-
- This file produces the graphics abstration of UGA. It is called by
- EmuGopDriver.c file which deals with the EFI 1.1 driver model.
- This file just does graphics.
-
-**/
-
-#include "Gop.h"
-
-
-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 }
- };
-
-
-/**
- Returns information for an available graphics mode that the graphics device
- and the set of active video output devices supports.
-
- @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.
- @param ModeNumber The mode number to return information on.
- @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
- @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
-
- @retval EFI_SUCCESS Mode information returned.
- @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
- @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
- @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
- @retval EFI_INVALID_PARAMETER One of the input args was NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuGopQuerytMode (
- 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;
-}
-
-
-
-/**
- Set the video device into the specified mode and clears the visible portions of
- the output display to black.
-
- @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.
- @param ModeNumber Abstraction that defines the current video mode.
-
- @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
- @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuGopSetMode (
- 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 = EmuGopStartWindow (
- Private,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- ModeData->ColorDepth,
- ModeData->RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareNeedsStarting = FALSE;
- }
-
-
- Status = Private->EmuGraphicsWindow->Size(
- Private->EmuGraphicsWindow,
- 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;
-}
-
-
-
-/**
- Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
-
- @param This Protocol instance pointer.
- @param BltBuffer Buffer containing data to blit into video buffer. This
- buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- @param BltOperation Operation to perform on BlitBuffer and video memory
- @param SourceX X coordinate of source for the BltBuffer.
- @param SourceY Y coordinate of source for the BltBuffer.
- @param DestinationX X coordinate of destination for the BltBuffer.
- @param DestinationY Y coordinate of destination for the BltBuffer.
- @param Width Width of rectangle in BltBuffer in pixels.
- @param Height Hight of rectangle in BltBuffer in pixels.
- @param Delta OPTIONAL
-
- @retval EFI_SUCCESS The Blt operation completed.
- @retval EFI_INVALID_PARAMETER BltOperation is not valid.
- @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuGopBlt (
- 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;
- EMU_GRAPHICS_WINDOWS__BLT_ARGS GopBltArgs;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if ((UINT32)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 EMU_GRAPHICS_WINDOWS__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->EmuGraphicsWindow->Blt (
- Private->EmuGraphicsWindow,
- (EFI_UGA_PIXEL *)BltBuffer,
- (EFI_UGA_BLT_OPERATION)BltOperation,
- &GopBltArgs
- );
-
- gBS->RestoreTPL (OriginalTPL);
-
- return Status;
-}
-
-
-//
-// Construction and Destruction functions
-//
-
-EFI_STATUS
-EmuGopSupported (
- IN EMU_IO_THUNK_PROTOCOL *EmuIoThunk
- )
-{
- //
- // 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 (EmuIoThunk->Protocol, &gEmuGraphicsWindowProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EmuGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-{
- EFI_STATUS Status;
-
- //
- // Register to be notified on exit boot services so we can destroy the window.
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_CALLBACK,
- ShutdownGopEvent,
- Private,
- &mGopScreenExitBootServicesEvent
- );
-
- Status = Private->EmuIoThunk->Open (Private->EmuIoThunk);
- if (!EFI_ERROR (Status)) {
- Private->EmuGraphicsWindow = Private->EmuIoThunk->Interface;
-
- // Register callback to support RegisterKeyNotify()
- Status = Private->EmuGraphicsWindow->RegisterKeyNotify (
- Private->EmuGraphicsWindow,
- GopPrivateMakeCallbackFunction,
- GopPrivateBreakCallbackFunction,
- Private
- );
- ASSERT_EFI_ERROR (Status);
- }
- return Status;
-}
-
-EFI_STATUS
-EmuGopConstructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- Private->ModeData = mGopModeData;
-
- Private->GraphicsOutput.QueryMode = EmuGopQuerytMode;
- Private->GraphicsOutput.SetMode = EmuGopSetMode;
- Private->GraphicsOutput.Blt = EmuGopBlt;
-
- //
- // 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->EmuGraphicsWindow = NULL;
-
- EmuGopInitializeSimpleTextInForWindow (Private);
-
- EmuGopInitializeSimplePointerForWindow (Private);
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EmuGopDestructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- if (!Private->HardwareNeedsStarting) {
- Private->EmuIoThunk->Close (Private->EmuIoThunk);
- Private->EmuGraphicsWindow = 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
-ShutdownGopEvent (
- 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 EmuGopDestructor().
-
-Arguments:
-
- Event - not used
- Context - pointer to the Private structure.
-
-Returns:
-
- None.
-
-**/
-{
- EmuGopDestructor (Context);
-}
-
diff --git a/EmulatorPkg/EmuSimpleFileSystemDxe/ComponentName.c b/EmulatorPkg/EmuSimpleFileSystemDxe/ComponentName.c
deleted file mode 100644
index 987658898b..0000000000
--- a/EmulatorPkg/EmuSimpleFileSystemDxe/ComponentName.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/** @file
-
-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 "EmuSimpleFileSystem.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemComponentNameGetControllerName (
- 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 gEmuSimpleFileSystemComponentName = {
- EmuSimpleFileSystemComponentNameGetDriverName,
- EmuSimpleFileSystemComponentNameGetControllerName,
- "eng"
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuSimpleFileSystemComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuSimpleFileSystemComponentNameGetControllerName,
- "en"
-};
-
-EFI_UNICODE_STRING_TABLE mEmuSimpleFileSystemDriverNameTable[] = {
- {
- "eng;en",
- L"Emu Simple File System 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
-EmuSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mEmuSimpleFileSystemDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gEmuSimpleFileSystemComponentName)
- );
-}
-
-
-/**
- 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
-EmuSimpleFileSystemComponentNameGetControllerName (
- 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_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EMU_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,
- gEmuSimpleFileSystemDriverBinding.DriverBindingHandle,
- &gEmuIoThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID**)&SimpleFileSystem,
- gEmuSimpleFileSystemDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gEmuSimpleFileSystemComponentName)
- );
-}
diff --git a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c b/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c
deleted file mode 100644
index 4709f7a46f..0000000000
--- a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c
+++ /dev/null
@@ -1,917 +0,0 @@
-/*++ @file
- 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.
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "EmuSimpleFileSystem.h"
-
-
-
-
-/**
- Opens a new file relative to the source file's location.
-
- @param This The protocol instance pointer.
- @param NewHandle Returns File Handle for FileName.
- @param FileName Null terminated string. "\", ".", and ".." are supported.
- @param OpenMode Open mode for file.
- @param Attributes Only used for EFI_FILE_MODE_CREATE.
-
- @retval EFI_SUCCESS The device was opened.
- @retval EFI_NOT_FOUND The specified file could not be found on the device.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_MEDIA_CHANGED The media has changed.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_ACCESS_DENIED The service denied access to the file.
- @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
- //
- // 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 = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- return PrivateFile->Io->Open (PrivateFile->Io, NewHandle, FileName, OpenMode, Attributes);
-}
-
-
-
-/**
- Close the file handle
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The file was closed.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemClose (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Status = PrivateFile->Io->Close (PrivateFile->Io);
- if (!EFI_ERROR (Status)) {
- gBS->FreePool (PrivateFile);
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-/**
- Close and delete the file handle.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The file was closed and deleted.
- @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemDelete (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->Delete (PrivateFile->Io);
- if (!EFI_ERROR (Status)) {
- gBS->FreePool (PrivateFile);
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-/**
- Read data from the file.
-
- @param This Protocol instance pointer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer in which data is read.
-
- @retval EFI_SUCCESS Data was read.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemRead (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- 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 = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->Read (PrivateFile->Io, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Write data to a file.
-
- @param This Protocol instance pointer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer in which data to write.
-
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to Open directory are not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemWrite (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || BufferSize == NULL || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->Write (PrivateFile->Io, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Get a file's current position
-
- @param This Protocol instance pointer.
- @param Position Byte position from the start of the file.
-
- @retval EFI_SUCCESS Position was updated.
- @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemGetPosition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || Position == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->GetPosition (PrivateFile->Io, Position);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-
-/**
- Set file's current position
-
- @param This Protocol instance pointer.
- @param Position Byte position from the start of the file.
-
- @retval EFI_SUCCESS Position was updated.
- @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open..
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemSetPosition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->SetPosition (PrivateFile->Io, Position);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Get information about a file.
-
- @param This Protocol instance pointer.
- @param InformationType Type of information to return in Buffer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer to return data.
-
- @retval EFI_SUCCESS Data was returned.
- @retval EFI_UNSUPPORTED InformationType is not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in BufferSize.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || InformationType == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->GetInfo (PrivateFile->Io, InformationType, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Set information about a file
-
- @param File Protocol instance pointer.
- @param InformationType Type of information in Buffer.
- @param BufferSize Size of buffer.
- @param Buffer The data to write.
-
- @retval EFI_SUCCESS Data was set.
- @retval EFI_UNSUPPORTED InformationType is not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemSetInfo (
- IN EFI_FILE_PROTOCOL*This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- //
- // Check for invalid parameters.
- //
- if (This == NULL || InformationType == NULL || BufferSize == 0 || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->SetInfo (PrivateFile->Io, InformationType, BufferSize, Buffer);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-/**
- Flush data back for the file handle.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Data was flushed.
- @retval EFI_UNSUPPORTED Writes to Open directory are not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemFlush (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = PrivateFile->Io->Flush (PrivateFile->Io);
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-
-
-/**
- Open the root directory on a volume.
-
- @param This Protocol instance pointer.
- @param Root Returns an Open file handle for the root directory
-
- @retval EFI_SUCCESS The device was opened.
- @retval EFI_UNSUPPORTED This volume does not support the file system.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_ACCESS_DENIED The service denied access to the file.
- @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- )
-{
- EFI_STATUS Status;
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- Status = EFI_UNSUPPORTED;
-
- if (This == NULL || Root == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);
-
- PrivateFile = AllocatePool (sizeof (EMU_EFI_FILE_PRIVATE));
- if (PrivateFile == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- PrivateFile->Signature = EMU_EFI_FILE_PRIVATE_SIGNATURE;
- PrivateFile->IoThunk = Private->IoThunk;
- PrivateFile->SimpleFileSystem = This;
- PrivateFile->EfiFile.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- PrivateFile->EfiFile.Open = EmuSimpleFileSystemOpen;
- PrivateFile->EfiFile.Close = EmuSimpleFileSystemClose;
- PrivateFile->EfiFile.Delete = EmuSimpleFileSystemDelete;
- PrivateFile->EfiFile.Read = EmuSimpleFileSystemRead;
- PrivateFile->EfiFile.Write = EmuSimpleFileSystemWrite;
- PrivateFile->EfiFile.GetPosition = EmuSimpleFileSystemGetPosition;
- PrivateFile->EfiFile.SetPosition = EmuSimpleFileSystemSetPosition;
- PrivateFile->EfiFile.GetInfo = EmuSimpleFileSystemGetInfo;
- PrivateFile->EfiFile.SetInfo = EmuSimpleFileSystemSetInfo;
- PrivateFile->EfiFile.Flush = EmuSimpleFileSystemFlush;
-
- *Root = &PrivateFile->EfiFile;
-
- Status = Private->Io->OpenVolume (Private->Io, &PrivateFile->Io);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- AddUnicodeString2 (
- "eng",
- gEmuSimpleFileSystemComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- Private->IoThunk->ConfigString,
- TRUE
- );
-
- AddUnicodeString2 (
- "en",
- gEmuSimpleFileSystemComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- Private->IoThunk->ConfigString,
- FALSE
- );
-
-
-Done:
- if (EFI_ERROR (Status)) {
- if (PrivateFile) {
- gBS->FreePool (PrivateFile);
- }
-
- *Root = NULL;
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-/**
- Tests to see if this driver supports a given controller. If a child device is provided,
- it further tests to see if this driver supports creating a handle for the specified child device.
-
- This function checks to see if the driver specified by This supports the device specified by
- ControllerHandle. Drivers will typically use the device path attached to
- ControllerHandle and/or the services from the bus I/O abstraction attached to
- ControllerHandle to determine if the driver supports ControllerHandle. This function
- may be called many times during platform initialization. In order to reduce boot times, the tests
- performed by this function must be very small, and take as little time as possible to execute. This
- function must not change the state of any hardware devices, and this function must be aware that the
- device specified by ControllerHandle may already be managed by the same driver or a
- different driver. This function must match its calls to AllocatePages() with FreePages(),
- AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
- Because ControllerHandle may have been previously started by the same driver, if a protocol is
- already in the opened state, then it must not be closed with CloseProtocol(). This is required
- to guarantee the state of ControllerHandle is not modified by this function.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to test. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For bus drivers, if this parameter is not NULL, then
- the bus driver must determine if the bus controller specified
- by ControllerHandle and the child controller specified
- by RemainingDevicePath are both supported by this
- bus driver.
-
- @retval EFI_SUCCESS The device specified by ControllerHandle and
- RemainingDevicePath is supported by the driver specified by This.
- @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
- RemainingDevicePath is already being managed by the driver
- specified by This.
- @retval 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.
- Currently not implemented.
- @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
- RemainingDevicePath is not supported by the driver specified by This.
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- 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 (EmuIoThunk->Protocol, &gEfiSimpleFileSystemProtocolGuid)) {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-
-
-/**
- Starts a device controller or a bus controller.
-
- The Start() function is designed to be invoked from the EFI boot service ConnectController().
- As a result, much of the error checking on the parameters to Start() has been moved into this
- common boot service. It is legal to call Start() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE.
- 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
- EFI_DEVICE_PATH_PROTOCOL.
- 3. Prior to calling Start(), the Supported() function for the driver specified by This must
- have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle The handle of the controller to start. This handle
- must support a protocol interface that supplies
- an I/O abstraction to the driver.
- @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
- parameter is ignored by device drivers, and is optional for bus
- drivers. For a bus driver, if this parameter is NULL, then handles
- for all the children of Controller are created by this driver.
- If this parameter is not NULL and the first Device Path Node is
- not the End of Device Path Node, then only the handle for the
- child device specified by the first Device Path Node of
- RemainingDevicePath is created by this driver.
- If the first Device Path Node of RemainingDevicePath is
- the End of Device Path Node, no child handle is created by this
- driver.
-
- @retval EFI_SUCCESS The device was started.
- @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval Others The driver failded to start the device.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- Private = NULL;
-
- //
- // Open the IO Abstraction(s) needed
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Validate GUID
- //
- if (!CompareGuid (EmuIoThunk->Protocol, &gEfiSimpleFileSystemProtocolGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Private = AllocateZeroPool (sizeof (EMU_SIMPLE_FILE_SYSTEM_PRIVATE));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Status = EmuIoThunk->Open (EmuIoThunk);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Private->Signature = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
- Private->IoThunk = EmuIoThunk;
- Private->Io = EmuIoThunk->Interface;
-
- Private->SimpleFileSystem.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- Private->SimpleFileSystem.OpenVolume = EmuSimpleFileSystemOpenVolume;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString2 (
- "eng",
- gEmuSimpleFileSystemComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- TRUE
- );
-
- AddUnicodeString2 (
- "en",
- gEmuSimpleFileSystemComponentName2.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- FALSE
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
- if (Private != NULL) {
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
-
- gBS->FreePool (Private);
-
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return Status;
-}
-
-
-/**
- Stops a device controller or a bus controller.
-
- The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
- As a result, much of the error checking on the parameters to Stop() has been moved
- into this common boot service. It is legal to call Stop() from other locations,
- but the following calling restrictions must be followed, or the system behavior will not be deterministic.
- 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
- same driver's Start() function.
- 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
- EFI_HANDLE. In addition, all of these handles must have been created in this driver's
- Start() function, and the Start() function must have called OpenProtocol() on
- ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
-
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle A handle to the device being stopped. The handle must
- support a bus specific I/O protocol for the driver
- to use to stop the device.
- @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
- @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
- if NumberOfChildren is 0.
-
- @retval EFI_SUCCESS The device was stopped.
- @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSimpleFileSystemDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EMU_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 = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
- Status = Private->IoThunk->Close (Private->IoThunk);
-
- //
- // Uninstall the Simple File System Protocol from ControllerHandle
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
- }
-
- return Status;
-}
-
-
-EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
- EmuSimpleFileSystemDriverBindingSupported,
- EmuSimpleFileSystemDriverBindingStart,
- EmuSimpleFileSystemDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-
-
-/**
- The user Entry Point for module EmuSimpleFileSystem. 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
-InitializeEmuSimpleFileSystem(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gEmuSimpleFileSystemDriverBinding,
- ImageHandle,
- &gEmuSimpleFileSystemComponentName,
- &gEmuSimpleFileSystemComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.h b/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.h
deleted file mode 100644
index 06369ca3e8..0000000000
--- a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*++ @file
- 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.
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#ifndef _EMU_SIMPLE_FILE_SYSTEM_H_
-#define _EMU_SIMPLE_FILE_SYSTEM_H_
-
-#include "PiDxe.h"
-
-#include <Guid/FileSystemInfo.h>
-#include <Guid/FileInfo.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
-
-#include <Protocol/EmuIoThunk.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>
-
-
-extern EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuSimpleFileSystemComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2;
-
-#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Io;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} EMU_SIMPLE_FILE_SYSTEM_PRIVATE;
-
-#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE, \
- SimpleFileSystem, \
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
- )
-
-#define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('e', 'm', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EFI_FILE_PROTOCOL EfiFile;
- EFI_FILE_PROTOCOL *Io;
-} EMU_EFI_FILE_PRIVATE;
-
-#define EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- EMU_EFI_FILE_PRIVATE, \
- EfiFile, \
- EMU_EFI_FILE_PRIVATE_SIGNATURE \
- )
-
-
-
-#endif
diff --git a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf b/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
deleted file mode 100644
index 6663d6f3b0..0000000000
--- a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Simple filesystem driver
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuSimpleFileSystem
- FILE_GUID = 35B72237-3926-CF4A-A7F3-1449F9E0E4BD
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuSimpleFileSystem
-
-
-[Sources]
- ComponentName.c
- EmuSimpleFileSystem.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- BaseLib
- DebugLib
-
-
-[Guids]
- gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
- gEfiFileInfoGuid # SOMETIMES_CONSUMED
- gEfiFileSystemInfoGuid # SOMETIMES_CONSUMED
-
-
-[Protocols]
- gEfiSimpleFileSystemProtocolGuid # PROTOCOL BY_START
- gEmuIoThunkProtocolGuid # PROTOCOL TO_START
-
diff --git a/EmulatorPkg/EmuSnpDxe/ComponentName.c b/EmulatorPkg/EmuSnpDxe/ComponentName.c
deleted file mode 100644
index a7c5124cff..0000000000
--- a/EmulatorPkg/EmuSnpDxe/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 "EmuSnpDxe.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
-EmuSnpDriverComponentNameGetDriverName (
- 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
-EmuSnpDriverComponentNameGetControllerName (
- 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 gEmuSnpDriverComponentName = {
- EmuSnpDriverComponentNameGetDriverName,
- EmuSnpDriverComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuSnpDriverComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuSnpDriverComponentNameGetControllerName,
- "en"
-};
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuSnpDriverNameTable[] = {
- {
- "eng;en",
- L"Emu 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
-EmuSnpDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mEmuSnpDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gEmuSnpDriverComponentName)
- );
-}
-
-/**
- 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
-EmuSnpDriverComponentNameGetControllerName (
- 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/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
deleted file mode 100644
index 09d16fd8b6..0000000000
--- a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
+++ /dev/null
@@ -1,986 +0,0 @@
-/** @file
-
- 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.
-
-Module Name:
-
- EmuSnp.c
-
-Abstract:
-
--**/
-
-#include "EmuSnpDxe.h"
-
-
-
-EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
- EFI_SIMPLE_NETWORK_PROTOCOL_REVISION,
- EmuSnpStart,
- EmuSnpStop,
- EmuSnpInitialize,
- EmuSnpReset,
- EmuSnpShutdown,
- EmuSnpReceiveFilters,
- EmuSnpStationAddress,
- EmuSnpStatistics,
- EmuSnpMcastIptoMac,
- EmuSnpNvdata,
- EmuSnpGetStatus,
- EmuSnpTransmit,
- EmuSnpReceive,
- NULL, // WaitForPacket
- NULL // Mode
- };
-
-EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
- 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
-};
-
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSnpStart(
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Start (Private->Io);
- 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
-EmuSnpStop (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Stop (Private->Io);
- 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
-EmuSnpInitialize (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Initialize (Private->Io, ExtraRxBufferSize, ExtraTxBufferSize);
- 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
-EmuSnpReset (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Reset (Private->Io, ExtendedVerification);
- return Status;
-}
-
-/**
- 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
-EmuSnpShutdown (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Shutdown (Private->Io);
- return Status;
-}
-
-/**
- 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
-EmuSnpReceiveFilters (
- 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
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->ReceiveFilters (
- Private->Io,
- EnableBits,
- DisableBits,
- ResetMcastFilter,
- McastFilterCount,
- McastFilter
- );
- return Status;
-}
-
-/**
- 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
-EmuSnpStationAddress (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS *NewMacAddr OPTIONAL
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->StationAddress (Private->Io, Reset, NewMacAddr);
- return Status;
-}
-
-/**
- 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
-EmuSnpStatistics (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN OUT UINTN *StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Statistics (Private->Io, Reset, StatisticsSize, StatisticsTable);
- return Status;
-}
-
-/**
- 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
-EmuSnpMcastIptoMac (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN BOOLEAN Ipv6,
- IN EFI_IP_ADDRESS *Ip,
- OUT EFI_MAC_ADDRESS *Mac
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->MCastIpToMac (Private->Io, Ipv6, Ip, Mac);
- return Status;
-}
-
-
-/**
- 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
-EmuSnpNvdata (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- IN BOOLEAN ReadOrWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->NvData (Private->Io, ReadOrWrite, Offset, BufferSize, Buffer);
- return Status;
-}
-
-
-/**
- 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
-EmuSnpGetStatus (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
- OUT UINT32 *InterruptStatus,
- OUT VOID **TxBuffer
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->GetStatus (Private->Io, InterruptStatus, TxBuffer);
- return Status;
-}
-
-
-/**
- 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
-EmuSnpTransmit (
- 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
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Transmit (
- Private->Io,
- HeaderSize,
- BufferSize,
- Buffer,
- SrcAddr,
- DestAddr,
- Protocol
- );
- return Status;
-}
-
-/**
- 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
-EmuSnpReceive (
- 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
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
-
- Status = Private->Io->Receive (
- Private->Io,
- HeaderSize,
- BuffSize,
- Buffer,
- SourceAddr,
- DestinationAddr,
- Protocol
- );
- 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
-EmuSnpDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- MAC_ADDR_DEVICE_PATH *Node;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- if (RemainingDevicePath != NULL) {
- if (!IsDevicePathEnd (RemainingDevicePath)) {
- Node = (MAC_ADDR_DEVICE_PATH *)RemainingDevicePath;
- if (Node->Header.Type != MESSAGING_DEVICE_PATH ||
- Node->Header.SubType != MSG_MAC_ADDR_DP) {
- // If the remaining device path does not match we don't support the request
- return EFI_UNSUPPORTED;
- }
- }
- }
-
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- 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;
- }
-
- //
- // Make sure GUID is for a SNP handle.
- //
- Status = EFI_UNSUPPORTED;
- if (CompareGuid (EmuIoThunk->Protocol, &gEmuSnpProtocolGuid)) {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close protocol, don't use device path protocol in the Support() function
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- 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
-EmuSnpDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
- EMU_SNP_PRIVATE_DATA *Private;
- MAC_ADDR_DEVICE_PATH Node;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- Private = NULL;
-
- //
- // 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) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (!CompareGuid (EmuIoThunk->Protocol, &gEmuSnpProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EmuIoThunk->Open (EmuIoThunk);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Allocate the private data.
- //
- Private = AllocateZeroPool (sizeof (EMU_SNP_PRIVATE_DATA));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- CopyMem (&Private->Snp, &gEmuSnpTemplate, sizeof (EFI_SIMPLE_NETWORK_PROTOCOL));
- CopyMem (&Private->Mode, &gEmuSnpModeTemplate, sizeof (EFI_SIMPLE_NETWORK_MODE));
-
- Private->Signature = EMU_SNP_PRIVATE_DATA_SIGNATURE;
- Private->IoThunk = EmuIoThunk;
- Private->Io = EmuIoThunk->Interface;
- Private->EfiHandle = ControllerHandle;
- Private->DeviceHandle = NULL;
- Private->Snp.Mode = &Private->Mode;
- Private->ControllerNameTable = NULL;
-
-
- Status = Private->Io->CreateMapping (Private->Io, &Private->Mode);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Build the device path by appending the MAC node to the ParentDevicePath
- // from the EmuIo 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 EmuIo handle.
- //
- Private->DevicePath = AppendDevicePathNode (ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&Node);
- if ( Private->DevicePath == NULL ) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- AddUnicodeString2 (
- "eng",
- gEmuSnpDriverComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- TRUE
- );
-
- AddUnicodeString2 (
- "en",
- gEmuSnpDriverComponentName2.SupportedLanguages,
- &Private->ControllerNameTable,
- EmuIoThunk->ConfigString,
- FALSE
- );
-
- //
- // Create Child Handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Private->DeviceHandle,
- &gEfiSimpleNetworkProtocolGuid, &Private->Snp,
- &gEfiDevicePathProtocolGuid, Private->DevicePath,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- (VOID **)&EmuIoThunk,
- This->DriverBindingHandle,
- Private->DeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
-Done:
- if (EFI_ERROR (Status)) {
- 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
-EmuSnpDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE_DATA *Private = NULL;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
-
- //
- // 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 (
- ControllerHandle,
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- ASSERT (NumberOfChildren == 1);
-
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol(
- ChildHandleBuffer[0],
- &gEfiSimpleNetworkProtocolGuid,
- ( VOID ** ) &Snp,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (Snp);
- Status = Private->IoThunk->Close (Private->IoThunk);
-
- Status = gBS->CloseProtocol(
- ChildHandleBuffer[0],
- &gEmuIoThunkProtocolGuid,
- This->DriverBindingHandle,
- Private->DeviceHandle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces(
- ChildHandleBuffer[0],
- &gEfiSimpleNetworkProtocolGuid, &Private->Snp,
- &gEfiDevicePathProtocolGuid, Private->DevicePath,
- NULL
- );
-
- FreePool (Private->DevicePath);
- FreeUnicodeStringTable (Private->ControllerNameTable);
- FreePool (Private);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
- EmuSnpDriverBindingSupported,
- EmuSnpDriverBindingStart,
- EmuSnpDriverBindingStop,
- 0xA,
- NULL,
- NULL
-};
-
-
-
-/**
- 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
-EFIAPI
-InitializeEmuSnpDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install the Driver Protocols
- //
- Status = EfiLibInstallDriverBindingComponentName2(
- ImageHandle,
- SystemTable,
- &gEmuSnpDriverBinding,
- ImageHandle,
- &gEmuSnpDriverComponentName,
- &gEmuSnpDriverComponentName2
- );
-
- return Status;
-}
diff --git a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.h b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.h
deleted file mode 100644
index e2b3c303bf..0000000000
--- a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.h
+++ /dev/null
@@ -1,488 +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:
-
- EmuSnp.h
-
-Abstract:
-
--**/
-
-#ifndef _EMU_SNP_H_
-#define _EMU_SNP_H_
-
-#include <Uefi.h>
-
-#include <Protocol/SimpleNetwork.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/EmuSnp.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 EMU_SNP_PRIVATE_DATA_SIGNATURE SIGNATURE_32( 'U', 'S', 'N', 'P' )
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
- EMU_SNP_PROTOCOL *Io;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- EFI_HANDLE EfiHandle;
- EFI_HANDLE DeviceHandle;
-
- EFI_SIMPLE_NETWORK_PROTOCOL Snp;
- EFI_SIMPLE_NETWORK_MODE Mode;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} EMU_SNP_PRIVATE_DATA;
-
-#define EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
- CR( a, EMU_SNP_PRIVATE_DATA, Snp, EMU_SNP_PRIVATE_DATA_SIGNATURE )
-
-extern EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEmuSnpDriverComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponentName2;
-
-/**
- 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
-EmuSnpDriverBindingSupported (
- 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
-EmuSnpDriverBindingStart (
- 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
-EmuSnpDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Always succeeds.
-
-**/
-EFI_STATUS
-EFIAPI
-EmuSnpStart(
- 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
-EmuSnpStop(
- 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
-EmuSnpInitialize(
- 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
-EmuSnpReset(
- 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
-EmuSnpShutdown(
- 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
-EmuSnpReceiveFilters(
- 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
-EmuSnpStationAddress(
- 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
-EmuSnpStatistics(
- 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
-EmuSnpMcastIptoMac(
- 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
-EmuSnpNvdata(
- 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
-EmuSnpGetStatus(
- 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
-EmuSnpTransmit(
- 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
-EmuSnpReceive(
- 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
-EmuSnpWaitForPacketNotify(
- IN EFI_EVENT Event,
- IN VOID* Private
- );
-
-#endif // _EMU_SNP_H_
diff --git a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
deleted file mode 100644
index 5360e2463c..0000000000
--- a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-#/** @file
-# Component name for module EmuSnpDxe
-#
-# 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 = EmuSnpDxe
- FILE_GUID = 22597239-6107-DF44-AD3F-5F053E92222E
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- EDK_RELEASE_VERSION = 0x00020000
- EFI_SPECIFICATION_VERSION = 0x00020000
-
- ENTRY_POINT = InitializeEmuSnpDriver
-# UNLOAD_IMAGE = EmuSnpUnload
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources.common]
- ComponentName.c
- EmuSnpDxe.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DevicePathLib
- UefiLib
- UefiBootServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiDriverEntryPoint
- NetLib
-
-[Protocols]
- gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEmuSnpProtocolGuid
- gEmuIoThunkProtocolGuid
-
-
diff --git a/EmulatorPkg/EmuThunkDxe/EmuThunk.c b/EmulatorPkg/EmuThunkDxe/EmuThunk.c
deleted file mode 100644
index 3a421bfdf3..0000000000
--- a/EmulatorPkg/EmuThunkDxe/EmuThunk.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-#include <PiDxe.h>
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/EmuThunk.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-
-//
-// EmuThunk Device Path Protocol Instance
-//
-EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
- }
- },
- EMU_THUNK_PROTOCOL_GUID
- },
- 0
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
- }
-};
-
-
-EFI_STATUS
-EFIAPI
-InitializeEmuThunk (
- 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().
-
-**/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEmuThunkProtocolGuid, gEmuThunk,
- &gEfiDevicePathProtocolGuid, &mEmuThunkDevicePath,
- NULL
- );
-
- return Status;
-}
diff --git a/EmulatorPkg/EmuThunkDxe/EmuThunk.inf b/EmulatorPkg/EmuThunkDxe/EmuThunk.inf
deleted file mode 100644
index 4e798eef8d..0000000000
--- a/EmulatorPkg/EmuThunkDxe/EmuThunk.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# A DXE driver to produce EMU_THUNK_PROTOCOL
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuThunk
- FILE_GUID = 2F62A818-4A72-CD40-90B9-FF00DAABEE7B
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuThunk
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- EmuThunk.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- EmuThunkLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- DevicePathLib
-
-
-
-[Protocols]
- gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEmuThunkProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
deleted file mode 100644
index 25f79c92c9..0000000000
--- a/EmulatorPkg/EmulatorPkg.dec
+++ /dev/null
@@ -1,106 +0,0 @@
-## @file
-#
-# This is the Emu Emulation Environment Platform
-#
-# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials are licensed and made available
-# under the terms and conditions of the BSD License which accompanies this distribution.
-# The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
-# OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- DEC_VERSION = 0x00010005
- PACKAGE_NAME = EmulatorPkg
- PACKAGE_GUID = 36E48BD7-7D92-5A47-A2CD-513F072E3300
- PACKAGE_VERSION = 0.1
-
-
-[Includes]
- Include
-
-
-[LibraryClasses]
- ThunkPpiList|Include/Library/ThunkPpiList.h
- ThunkProtocolList|Include/Library/ThunkProtocolList.h
- EmuThunkLib|Include/Library/EmuThunkLib.h
- KeyMap|Include/Library/KeyMapLib.h
- PpiListLib|Include/Library/PpiListLib.h
- SmbiosLib|Include/Library/SmbiosLib.h
-
-[Protocols]
- gEmuThunkProtocolGuid = { 0x5CF32E0B, 0x8EDF, 0x2E44, { 0x9C, 0xDA, 0x93, 0x20, 0x5E, 0x99, 0xEC, 0x1C } }
- gEmuIoThunkProtocolGuid = { 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } }
- gEmuGraphicsWindowProtocolGuid = { 0x30FD316A, 0x6728, 0x2E41, { 0xA6, 0x90, 0x0D, 0x13, 0x33, 0xD8, 0xCA, 0xC1 } }
- gEmuThreadThunkProtocolGuid = { 0x3B1E4B7C, 0x09D8, 0x944F, { 0xA4, 0x08, 0x13, 0x09, 0xEB, 0x8B, 0x44, 0x27 } }
- gEmuBlockIoProtocolGuid = { 0x6888A4AE, 0xAFCE, 0xE84B, { 0x91, 0x02, 0xF7, 0xB9, 0xDA, 0xE6, 0xA0, 0x30 } }
- gEmuSnpProtocolGuid = { 0xFD5FBE54, 0x8C35, 0xB345, { 0x8A, 0x0F, 0x7A, 0xC8, 0xA5, 0xFD, 0x05, 0x21 } }
-
-[Ppis]
- gEmuThunkPpiGuid = { 0xE113F896, 0x75CF, 0xF640, { 0x81, 0x7F, 0xC8, 0x5A, 0x79, 0xE8, 0xAE, 0x67 } }
-
-[Guids]
- gEmulatorPkgTokenSpaceGuid = { 0x4F792E68, 0xE8C8, 0x794E, { 0xB1, 0xD8, 0x37, 0x03, 0xF3, 0xF2, 0xD5, 0xA5 } }
- gEmuSystemConfigGuid = { 0xF8626165, 0x6CEB, 0x924A, { 0xBA, 0xFC, 0xF1, 0x3A, 0xB9, 0xD6, 0x57, 0x28 } }
- gEmuVirtualDisksGuid = { 0xf2ba331a, 0x8985, 0x11db, { 0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
- gEmuPhysicalDisksGuid = { 0xf2bdcc96, 0x8985, 0x11db, { 0x87, 0x19, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
-
-[PcdsFeatureFlag]
- ## If TRUE, if symbols only load on breakpoints and gdb entry
- gEmulatorPkgTokenSpaceGuid.PcdEmulatorLazyLoadSymbols|TRUE|BOOLEAN|0x00020000
-
-[PcdsFixedAtBuild]
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase|0x0|UINT64|0x00001014
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase|0x0|UINT64|0x00001015
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase|0x0|UINT64|0x00001016
- gEmulatorPkgTokenSpaceGuid.PcdEmuFdBaseAddress|0x0|UINT64|0x00001017
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase|0x0|UINT64|0x0000100e
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize|0x0|UINT32|0x0000100f
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase|0x0|UINT64|0x00001010
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize|0x0|UINT32|0x00001011
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize|0x0|UINT32|0x00001012
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize|0|UINT32|0x00001013
-
- ## Number of Application Processors (APs) in the system 0 means Uniprocessor mode
- gEmulatorPkgTokenSpaceGuid.PcdEmuApCount|L"0"|VOID*|0x00001019
-
- ## Magic page to implement PEI Services Table Pointer Lib
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage|0x1003000000|UINT64|0x0000101b
-
- ## Size of the packet filter
- gEmulatorPkgTokenSpaceGuid.PcdNetworkPacketFilterSize|524288|UINT32|0x0000101c
-
-
-
-[PcdsFixedAtBuild, PcdsPatchableInModule]
- gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode|1|UINT32|0x00001006
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume|L"..\\Fv\\Fv_Recovery.fd"|VOID*|0x00001009
- gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize|L"64!64"|VOID*|0x0000100c
-
- #
- # filename[:[R|F][O|W]][:BlockSize]
- # filename can be a device node, like /dev/disk1
- # R - Removable Media F - Fixed Media
- # O - Write protected W - Writable
- # Default is Fixed Media, Writable
- # For a file the default BlockSize is 512, and can be overridden via BlockSize,
- # for example 2048 for an ISO CD image. The block size for a device comes from
- # the device and is not configurable.
- # Device Size comes from file or device.
- # On Mac OS X you can use Disk Utility to create .dmg files and mount them like disks
- gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk|L"disk.dmg:FW"|VOID*|0x00001001
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"|VOID*|0x00001018
- gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L".!../../../../../EdkShellBinPkg/bin/ia32/Apps"|VOID*|0x00001004
- gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"|VOID*|0x00001002
- gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"|VOID*|0x0000100d
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuCpuModel|L"Intel(R) Processor Model"|VOID*|0x00001007
- gEmulatorPkgTokenSpaceGuid.PcdEmuCpuSpeed|L"3000"|VOID*|0x00001008
- gEmulatorPkgTokenSpaceGuid.PcdEmuMpServicesPollingInterval|0x100|UINT64|0x0000101a
-
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
deleted file mode 100644
index 27a78d5570..0000000000
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ /dev/null
@@ -1,412 +0,0 @@
-## @file
-# UEFI/PI 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 - 2015, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2010 - 2011, 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]
- PLATFORM_NAME = EmulatorPkg
- PLATFORM_GUID = 05FD064D-1073-E844-936C-A0E16317107D
- PLATFORM_VERSION = 0.3
- DSC_SPECIFICATION = 0x00010005
-!if $(BUILD_32)
- OUTPUT_DIRECTORY = Build/Emulator32
-!else
- OUTPUT_DIRECTORY = Build/Emulator
-!endif
-
- SUPPORTED_ARCHITECTURES = X64|IA32
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = DEFAULT
- FLASH_DEFINITION = EmulatorPkg/EmulatorPkg.fdf
-
-[SkuIds]
- 0|DEFAULT
-
-[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
- 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
-
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- SmbiosLib|EmulatorPkg/Library/SmbiosLib/SmbiosLib.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
- CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.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|EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
- KeyMapLib|EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
-
- #
- # Misc
- #
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
- PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
- DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
- PeiServicesTablePointerLib|EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf
- DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
- LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
- CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
- TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
- AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
- VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
-
-[LibraryClasses.common.SEC]
- PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PeCoffGetEntryPointLib|EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
- PeCoffExtraActionLib|EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
- SerialPortLib|EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
- PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- TimerLib|EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
-
-[LibraryClasses.common.USER_DEFINED, LibraryClasses.common.BASE]
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
- ThunkPpiList|EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf
- ThunkProtocolList|EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
- PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.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|EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
- PeCoffExtraActionLib|EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
- SerialPortLib|EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
- TimerLib|EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
-
-[LibraryClasses.common.PEI_CORE]
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-[LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
-
-[LibraryClasses.common.DXE_CORE]
- HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
- MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- PeCoffExtraActionLib|EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
- ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- TimerLib|EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf
- EmuThunkLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.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
- EmuThunkLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
- PeCoffExtraActionLib|EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
- ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
- TimerLib|EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
-
-[LibraryClasses.common.UEFI_DRIVER]
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-
-[PcdsFeatureFlag]
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
- gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE
-
-[PcdsFixedAtBuild]
- gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040
- gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize|0x002a0000
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize|0x10000
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume|L"../FV/FV_RECOVERY.fd"
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize|L"64!64"
-
-!if $(BUILD_NEW_SHELL)
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
-!else
-!if $(USE_NEW_SHELL)
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
-!endif
-!endif
-
-#define BOOT_WITH_FULL_CONFIGURATION 0x00
-#define BOOT_WITH_MINIMAL_CONFIGURATION 0x01
-#define BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02
-#define BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
-#define BOOT_WITH_DEFAULT_SETTINGS 0x04
-#define BOOT_ON_S4_RESUME 0x05
-#define BOOT_ON_S5_RESUME 0x06
-#define BOOT_ON_S2_RESUME 0x10
-#define BOOT_ON_S3_RESUME 0x11
-#define BOOT_ON_FLASH_UPDATE 0x12
-#define BOOT_IN_RECOVERY_MODE 0x20
- gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode|0
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuApCount|L"1"
-
- # For a CD-ROM/DVD use L"diag.dmg:RO:2048"
- gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk|L"disk.dmg:FW"
- gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
- gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L".!../../../../EdkShellBinPkg/Bin"
- gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"
- gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuCpuModel|L"Intel(R) Processor Model"
- gEmulatorPkgTokenSpaceGuid.PcdEmuCpuSpeed|L"3000"
-
- # 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
- gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
-
-[PcdsDynamicDefault.common.DEFAULT]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
-
-[PcdsDynamicHii.common.DEFAULT]
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Setup"|gEmuSystemConfigGuid|0x0|80
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Setup"|gEmuSystemConfigGuid|0x4|25
-
-
-[Components]
-!ifdef $(UNIX_SEC_BUILD)
- ##
- # Emulator, OS POSIX application
- ##
- EmulatorPkg/Unix/Host/Host.inf
-!endif
-
-!ifndef $(SKIP_MAIN_BUILD)
- #
- # Generic SEC
- #
- EmulatorPkg/Sec/Sec.inf
-
- ##
- # PEI Phase modules
- ##
- MdeModulePkg/Core/Pei/PeiMain.inf
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
- MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
- MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
-
- IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
- EmulatorPkg/BootModePei/BootModePei.inf
- MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
- EmulatorPkg/AutoScanPei/AutoScanPei.inf
- EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
- EmulatorPkg/FlashMapPei/FlashMapPei.inf
- EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
- ##
- # DXE Phase modules
- ##
- MdeModulePkg/Core/Dxe/DxeMain.inf {
- <LibraryClasses>
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- SerialPortLib|EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
- DxeEmuLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
- 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
- }
-
- MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
- MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf {
- <LibraryClasses>
- DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- SerialPortLib|EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
- }
-
- MdeModulePkg/Universal/Metronome/Metronome.inf
- EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
- EmulatorPkg/ResetRuntimeDxe/Reset.inf
- MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
- EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
- MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
- MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
- MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
- EmulatorPkg/EmuThunkDxe/EmuThunk.inf
- EmulatorPkg/CpuRuntimeDxe/Cpu.inf
- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
- EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
- EmulatorPkg/TimerDxe/Timer.inf
-
-
- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.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/SerialDxe/SerialDxe.inf {
- <LibraryClasses>
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- SerialPortLib|EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
- }
-
- MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
- IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- #{
- # <LibraryClasses>
- # NULL|EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.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
-
- EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
- EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
- EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
- EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
- EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
-
- MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
- #
- # Network stack drivers
- #
- MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
- MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.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/DisplayEngineDxe/DisplayEngineDxe.inf
- MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
- MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
- MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- }
-
-!if $(BUILD_FAT)
- FatPkg/EnhancedFatDxe/Fat.inf
-!endif
-
-!if $(BUILD_NEW_SHELL)
- ShellPkg/Application/Shell/Shell.inf {
- <LibraryClasses>
- ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
- NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
- NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
- HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
-# MemoryAllocationLib|EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf
-# SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
-# SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
-
- <PcdsFixedAtBuild>
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
- gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
- }
-!endif
-
-!endif
-
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
deleted file mode 100644
index 985a78ee2f..0000000000
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ /dev/null
@@ -1,321 +0,0 @@
-## @file
-# This is Emulator FDF file with UEFI HII features enabled
-#
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2009 - 2011, 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.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|gEmulatorPkgTokenSpaceGuid.PcdEmuFdBaseAddress #The base address of the FLASH Device.
-Size = 0x005a0000|gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize #The size in bytes of the FLASH Device
-ErasePolarity = 1
-BlockSize = 0x10000
-NumBlocks = 0x5a
-
-0x00000000|0x00580000
-gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase|gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize
-FV = FvRecovery
-
-0x00580000|0x0000c000
-gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase|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
-gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase|gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
-
-0x0058e000|0x00002000
-gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
-#NV_FTW_WORKING
-DATA = {
- # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEdkiiWorkingBlockSignatureGuid =
- # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95 }}
- 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49,
- 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95,
- # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
- 0xE2, 0x33, 0xF2, 0x03, 0xFE, 0xFF, 0xFF, 0xFF,
- # WriteQueueSize: UINT64
- 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-}
-
-0x00590000|0x00010000
-#NV_FTW_SPARE
-gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-
-[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
-
-#
-# PEI Phase modules
-#
-
-#
-# PEI Apriori file example, more PEIM module added later.
-#
-APRIORI PEI {
- INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
- INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
- INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- }
-APRIORI DXE {
- INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- INF MdeModulePkg/Universal/Metronome/Metronome.inf
- }
-INF EmulatorPkg/Sec/Sec.inf
-INF MdeModulePkg/Core/Pei/PeiMain.inf
-INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
-INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
-INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
-INF EmulatorPkg/BootModePei/BootModePei.inf
-INF EmulatorPkg/AutoScanPei/AutoScanPei.inf
-INF EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
-INF EmulatorPkg/FlashMapPei/FlashMapPei.inf
-INF EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
-INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
-INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
-INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
-
-#
-# DXE Phase modules
-#
-INF MdeModulePkg/Core/Dxe/DxeMain.inf
-INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
-INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
-INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
-INF MdeModulePkg/Universal/Metronome/Metronome.inf
-INF EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
-INF EmulatorPkg/ResetRuntimeDxe/Reset.inf
-INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-INF EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
-INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
-INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
-INF EmulatorPkg/EmuThunkDxe/EmuThunk.inf
-INF EmulatorPkg/CpuRuntimeDxe/Cpu.inf
-INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-INF EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
-INF EmulatorPkg/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/SerialDxe/SerialDxe.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 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-
-INF EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
-INF EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
-INF EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
-INF EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
-INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
-
-INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
-INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
-INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
-INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
-INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
-INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
-
-#
-# Network stack drivers
-#
-!if $(NETWORK_SUPPORT)
-INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.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/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 $(BUILD_FAT)
-INF FatPkg/EnhancedFatDxe/Fat.inf
-!else
-INF RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
-!endif
-
-!if $(BUILD_NEW_SHELL)
-INF ShellPkg/Application/Shell/Shell.inf
-!else
-!if $(USE_NEW_SHELL)
-INF RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf
-!else
-INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-!endif
-!endif
-
-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
-
-
-[Rule.Common.SEC]
- FILE SEC = $(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.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/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.c b/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.c
deleted file mode 100644
index 91d1197b4f..0000000000
--- a/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "PiPei.h"
-#include <Ppi/EmuThunk.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
-PeimInitializeFirmwareVolumePei (
- 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;
- EMU_THUNK_PPI *Thunk;
- 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 = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&Thunk // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Index = 0;
- do {
- //
- // Get information about all the FD's in the system
- //
- Status = Thunk->FirmwareDevices (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 (PcdEmuFlashNvStorageEventLogSize)
- )
- );
-
- //
- // 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 (PcdEmuFlashNvStorageEventLogSize);
-
- BuildFvHob (FdFixUp + PcdGet64 (PcdEmuFlashNvStorageVariableBase), 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/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf b/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
deleted file mode 100644
index 38483918e5..0000000000
--- a/EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
+++ /dev/null
@@ -1,60 +0,0 @@
-## @file
-# Component description file for EmuFwh module
-#
-# This PEIM will produce the HOB to describe Firmware Volume, Firmware Devices
-# on the Emu emulator.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FirmwareVolumePei
- FILE_GUID = 6DB075DE-449E-2644-96D0-CC5A1B4C3B2A
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = PeimInitializeFirmwareVolumePei
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- FirmwareVolumePei.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-[Depex]
- gEmuThunkPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
-
diff --git a/EmulatorPkg/FlashMapPei/FlashMapPei.c b/EmulatorPkg/FlashMapPei/FlashMapPei.c
deleted file mode 100644
index 5d8bff8a79..0000000000
--- a/EmulatorPkg/FlashMapPei/FlashMapPei.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++ @file
- PEIM to build GUIDed HOBs for platform specific flash map
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include "PiPei.h"
-
-#include <Guid/SystemNvDataGuid.h>
-#include <Ppi/EmuThunk.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
-
-**/
-{
- EFI_STATUS Status;
- EMU_THUNK_PPI *Thunk;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- EFI_PHYSICAL_ADDRESS FdBase;
- EFI_PHYSICAL_ADDRESS FdFixUp;
- UINT64 FdSize;
-
- DEBUG ((EFI_D_ERROR, "EmulatorPkg Flash Map PEIM Loaded\n"));
-
- //
- // Get the Fwh Information PPI
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&Thunk // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Assume that FD0 contains the Flash map.
- //
- Status = Thunk->FirmwareDevices (0, &FdBase, &FdSize, &FdFixUp);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStorageVariableBase) + FdFixUp);
- PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvStorageFtwWorkingBase) + FdFixUp);
- PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStorageFtwSpareBase) + FdFixUp);
-
- return EFI_SUCCESS;
-}
diff --git a/EmulatorPkg/FlashMapPei/FlashMapPei.inf b/EmulatorPkg/FlashMapPei/FlashMapPei.inf
deleted file mode 100644
index 1028e5f579..0000000000
--- a/EmulatorPkg/FlashMapPei/FlashMapPei.inf
+++ /dev/null
@@ -1,68 +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>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FlashMapPei
- FILE_GUID = C9FAF091-57F8-A64C-A07A-445B124F0D93
- 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]
- FlashMapPei.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- PcdLib
- BaseMemoryLib
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase
-
-[Depex]
- gEmuThunkPpiGuid
-
diff --git a/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c b/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c
deleted file mode 100644
index 44df1172b1..0000000000
--- a/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c
+++ /dev/null
@@ -1,1356 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#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/EmulatorPkg/FvbServicesRuntimeDxe/FvbInfo.c b/EmulatorPkg/FvbServicesRuntimeDxe/FvbInfo.c
deleted file mode 100644
index 5668b5472c..0000000000
--- a/EmulatorPkg/FvbServicesRuntimeDxe/FvbInfo.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*++ @file
- Defines data structure that is the volume header found.These data is intent
- to decouple FVB driver with FV header.
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#include <PiDxe.h>
-
-#include <Guid/EventGroup.h>
-#include <Guid/FirmwareFileSystem2.h>
-#include <Guid/SystemNvDataGuid.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>
-
-
-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 (PcdEmuFlashFvRecoverySize),
- {
- {
- 0,
- }, // ZeroVector[16]
- EFI_FIRMWARE_FILE_SYSTEM2_GUID,
- FixedPcdGet32 (PcdEmuFlashFvRecoverySize),
- 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 (PcdEmuFlashFvRecoverySize)/FixedPcdGet32 (PcdEmuFirmwareBlockSize),
- FixedPcdGet32 (PcdEmuFirmwareBlockSize),
- }
- }
- },
- {
- {
- 0,
- 0
- }
- }
- },
- //
- // Systen NvStorage FVB
- //
- {
- FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + \
- FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize),
- {
- {
- 0,
- }, // ZeroVector[16]
- EFI_SYSTEM_NV_DATA_FV_GUID,
- FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + \
- FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize),
- 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 (PcdEmuFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdEmuFirmwareBlockSize),
- FixedPcdGet32 (PcdEmuFirmwareBlockSize),
- }
- }
- },
- {
- {
- 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/EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf b/EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
deleted file mode 100644
index 00140b3cb9..0000000000
--- a/EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
+++ /dev/null
@@ -1,80 +0,0 @@
-## @file
-# Component description file for Emu Fimware Volume Block DXE driver module.
-#
-# This DXE runtime driver implements and produces the Fimware Volue Block Protocol on
-# Emu emulator.
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FwBlockService
- FILE_GUID = A01E498C-96E8-2A4C-95F4-85248F989753
- 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
- EmulatorPkg/EmulatorPkg.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]
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
-
-[Depex]
- TRUE
-
diff --git a/EmulatorPkg/FvbServicesRuntimeDxe/FwBlockService.h b/EmulatorPkg/FvbServicesRuntimeDxe/FwBlockService.h
deleted file mode 100644
index 62dfcd54a1..0000000000
--- a/EmulatorPkg/FvbServicesRuntimeDxe/FwBlockService.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*++ @file
- Firmware volume block driver for Intel Firmware Hub (FWH) device
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#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/EmulatorPkg/Include/Guid/EmuPhysicalDisk.h b/EmulatorPkg/Include/Guid/EmuPhysicalDisk.h
deleted file mode 100644
index 8461ee7142..0000000000
--- a/EmulatorPkg/Include/Guid/EmuPhysicalDisk.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- Setup Variable data structure for Emu 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 __EMU_PHYSICAL_DISK_H__
-#define __EMU_PHYSICAL_DISK_H__
-
-#define EFI_EMU_PHYSICAL_DISK_GUID \
- { 0xf2ba331a, 0x8985, 0x11db, { 0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
-
-extern EFI_GUID gEmuPhysicalDisksGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Guid/EmuSystemConfig.h b/EmulatorPkg/Include/Guid/EmuSystemConfig.h
deleted file mode 100644
index 0f297d9660..0000000000
--- a/EmulatorPkg/Include/Guid/EmuSystemConfig.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- Setup Variable data structure for Emu 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 __EMU_SYSTEM_CONFIG_H__
-#define __EMU_SYSTEM_CONFIG_H__
-
-#define EFI_EMU_SYSTEM_CONFIG_GUID \
- { 0x9C4FB516, 0x3A1E, 0xD847, { 0xA1, 0xA1, 0x70, 0x58, 0xB6, 0x98, 0x67, 0x32 } }
-
-
-#pragma pack(1)
-typedef struct {
- //
- // Console output mode
- //
- UINT32 ConOutColumn;
- UINT32 ConOutRow;
-} EMU_SYSTEM_CONFIGURATION;
-#pragma pack()
-
-
-extern EFI_GUID gEmuSystemConfigGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Guid/EmuVirtualDisk.h b/EmulatorPkg/Include/Guid/EmuVirtualDisk.h
deleted file mode 100644
index c6d2bea89c..0000000000
--- a/EmulatorPkg/Include/Guid/EmuVirtualDisk.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- Setup Variable data structure for Emu 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 __EMU_VIRTUAL_DISK_H__
-#define __EMU_VIRTUAL_DISK_H__
-
-#define EFI_EMU_VIRTUAL_DISK_GUID \
- { 0xf2ba331a, 0x8985, 0x11db, { 0xa4, 0x06, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }
-
-extern EFI_GUID gEmuVirtualDisksGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Library/EmuMagicPageLib.h b/EmulatorPkg/Include/Library/EmuMagicPageLib.h
deleted file mode 100644
index e0c339a3b8..0000000000
--- a/EmulatorPkg/Include/Library/EmuMagicPageLib.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++ @file
-The PCD, gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage, points to a magic page
-of memory that is like SRAM on an embedded system. This file defines what goes
-where in the magic page.
-
-Copyright (c) 2011, 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 __EMU_MAGIC_PAGE_LIB_H__
-#define __EMU_MAGIC_PAGE_LIB_H__
-
-#include <PiPei.h>
-#include <Library/PcdLib.h>
-#include <Protocol/EmuThunk.h>
-
-typedef struct {
- // Used by PEI Core and PEIMs to store the PEI Services pointer.
- // Privilege issues prevent using the PI mechanism in the emulator.
- CONST EFI_PEI_SERVICES **PeiServicesTablePointer;
-
- // Used by SecPeiServicesLib
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
-
- // Needed by PEI PEI PeCoffLoaderExtraActionLib
- EMU_THUNK_PROTOCOL *Thunk;
-} EMU_MAGIC_PAGE_LAYOUT;
-
-#define EMU_MAGIC_PAGE() ((EMU_MAGIC_PAGE_LAYOUT *)((UINTN)PcdGet64 (PcdPeiServicesTablePage)))
-
-#endif
diff --git a/EmulatorPkg/Include/Library/EmuThunkLib.h b/EmulatorPkg/Include/Library/EmuThunkLib.h
deleted file mode 100644
index 98b22e16ee..0000000000
--- a/EmulatorPkg/Include/Library/EmuThunkLib.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++ @file
-
-Copyright (c) 2011, 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 __EMU_THUNK_LIB_H__
-#define __EMU_THUNK_LIB_H__
-
-#include <Protocol/EmuThunk.h>
-
-
-extern EMU_THUNK_PROTOCOL *gEmuThunk;
-
-
-/**
- Serach the EMU IO Thunk database for a matching EMU IO Thunk
- Protocol instance.
-
- @param Protocol Protocol to search for.
- @param Instance Instance of protocol to search for.
-
- @retval NULL Protocol and Instance not found.
- @retval other EMU IO Thunk protocol that matched.
-
-**/
-EMU_IO_THUNK_PROTOCOL *
-EFIAPI
-GetIoThunkInstance (
- IN EFI_GUID *Protocol,
- IN UINTN Instance
- );
-
-
-#endif
diff --git a/EmulatorPkg/Include/Library/KeyMapLib.h b/EmulatorPkg/Include/Library/KeyMapLib.h
deleted file mode 100644
index 45dbfa4f18..0000000000
--- a/EmulatorPkg/Include/Library/KeyMapLib.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*++ @file
-
-Copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Protocol/SimpleTextInEx.h>
-
-
-/**
- KeyMapMake gets called on key presses.
-
- @param KeyData Key that was pressed.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-KeyMapMake (
- IN EFI_KEY_DATA *KeyData
- );
-
-/**
- KeyMapBreak gets called on key releases.
-
- @param KeyData Key that was pressed.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-KeyMapBreak (
- IN EFI_KEY_DATA *KeyData
- );
diff --git a/EmulatorPkg/Include/Library/PpiListLib.h b/EmulatorPkg/Include/Library/PpiListLib.h
deleted file mode 100644
index c1271b23c8..0000000000
--- a/EmulatorPkg/Include/Library/PpiListLib.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*++ @file
-
-Copyright (c) 2011, 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 __PPI_LIST_LIB_H__
-#define __PPI_LIST_LIB_H__
-
-
-extern CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList;
-
-
-#endif
diff --git a/EmulatorPkg/Include/Library/SmbiosLib.h b/EmulatorPkg/Include/Library/SmbiosLib.h
deleted file mode 100644
index 8ee14e07dd..0000000000
--- a/EmulatorPkg/Include/Library/SmbiosLib.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/** @file
- Provides library functions for common SMBIOS operations. Only available to DXE
- and UEFI module types.
-
-
-Copyright (c) 2012, Apple Inc. All rights reserved.
-Portitions 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 that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _SMBIOS_LIB_H__
-#define _SMBIOS_LIB_H__
-
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-
-
-///
-/// Cache copy of the SMBIOS Protocol pointer
-///
-extern EFI_SMBIOS_PROTOCOL *gSmbios;
-
-
-///
-/// Template for SMBIOS table initialization.
-/// The SMBIOS_TABLE_STRING types in the formated area must match the
-/// StringArray sequene.
-///
-typedef struct {
- //
- // formatted area of a given SMBIOS record
- //
- SMBIOS_STRUCTURE *Entry;
- //
- // NULL terminated array of ASCII strings to be added to the SMBIOS record.
- //
- CHAR8 **StringArray;
-} SMBIOS_TEMPLATE_ENTRY;
-
-
-/**
- Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
- entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
-
- @param Template Array of SMBIOS_TEMPLATE_ENTRY entries.
-
- @retval EFI_SUCCESS New SMBIOS tables were created.
- @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibInitializeFromTemplate (
- IN SMBIOS_TEMPLATE_ENTRY *Template
- );
-
-
-
-/**
- Create SMBIOS record.
-
- Converts a fixed SMBIOS structure and an array of pointers to strings into
- an SMBIOS record where the strings are cat'ed on the end of the fixed record
- and terminated via a double NULL and add to SMBIOS table.
-
- SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
- { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
- 1 // StringCount
- };
- CHAR8 *gSmbiosType12Strings[] = {
- "Not Found",
- NULL
- };
-
- ...
- AddSmbiosEntryFromTemplate (
- (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,
- gSmbiosType12Strings
- );
-
- @param SmbiosEntry Fixed SMBIOS structure
- @param StringArray Array of strings to convert to an SMBIOS string pack.
- NULL is OK.
-
- @retval EFI_SUCCESS New SmbiosEntry was added to SMBIOS table.
- @retval EFI_OUT_OF_RESOURCES SmbiosEntry was not added.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibCreateEntry (
- IN SMBIOS_STRUCTURE *SmbiosEntry,
- IN CHAR8 **StringArray
- );
-
-
-/**
- Update the string associated with an existing SMBIOS record.
-
- This function allows the update of specific SMBIOS strings. The number of valid strings for any
- SMBIOS record is defined by how many strings were present when Add() was called.
-
- @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
- @param[in] StringNumber The non-zero string number of the string to update.
- @param[in] String Update the StringNumber string with String.
-
- @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
- @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
- @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateString (
- IN EFI_SMBIOS_HANDLE SmbiosHandle,
- IN SMBIOS_TABLE_STRING StringNumber,
- IN CHAR8 *String
- );
-
-/**
- Update the string associated with an existing SMBIOS record.
-
- This function allows the update of specific SMBIOS strings. The number of valid strings for any
- SMBIOS record is defined by how many strings were present when Add() was called.
-
- @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
- @param[in] StringNumber The non-zero string number of the string to update.
- @param[in] String Update the StringNumber string with String.
-
- @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
- @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
- @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateUnicodeString (
- IN EFI_SMBIOS_HANDLE SmbiosHandle,
- IN SMBIOS_TABLE_STRING StringNumber,
- IN CHAR16 *String
- );
-
-/**
- Allow caller to read a specific SMBIOS string
-
- @param[in] Header SMBIOS record that contains the string.
- @param[in[ StringNumber Instance of SMBIOS string 1 - N.
-
- @retval NULL Instance of Type SMBIOS string was not found.
- @retval Other Pointer to matching SMBIOS string.
-**/
-CHAR8 *
-EFIAPI
-SmbiosLibReadString (
- IN SMBIOS_STRUCTURE *Header,
- IN EFI_SMBIOS_STRING StringNumber
- );
-
-
-/**
- Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
-
- @param[in] Type Type of the next SMBIOS record to return.
- @param[in[ Instance Instance of SMBIOS record 0 - N-1.
- @param[out] SmbiosHandle Returns SMBIOS handle for the matching record.
-
- @retval NULL Instance of Type SMBIOS record was not found.
- @retval Other Pointer to matching SMBIOS record.
-**/
-SMBIOS_STRUCTURE *
-EFIAPI
-SmbiosLibGetRecord (
- IN EFI_SMBIOS_TYPE Type,
- IN UINTN Instance,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle
- );
-
-/**
- Remove an SMBIOS record.
-
- This function removes an SMBIOS record using the handle specified by SmbiosHandle.
-
- @param[in] SmbiosHandle The handle of the SMBIOS record to remove.
-
- @retval EFI_SUCCESS SMBIOS record was removed.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not specify a valid SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibRemove (
- OUT EFI_SMBIOS_HANDLE SmbiosHandle
- );
-
-
-
-
-#endif
diff --git a/EmulatorPkg/Include/Library/ThunkPpiList.h b/EmulatorPkg/Include/Library/ThunkPpiList.h
deleted file mode 100644
index cd5af7ac3f..0000000000
--- a/EmulatorPkg/Include/Library/ThunkPpiList.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
- All 3rd parties to register the PPIs passed into PEI Core
-
- Copyright (c) 2008 - 2011, 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>
-
-
-EFI_PEI_PPI_DESCRIPTOR *
-GetThunkPpiList (
- VOID
- );
-
-
-EFI_STATUS
-EFIAPI
-AddThunkPpi (
- IN UINTN Flags,
- IN EFI_GUID *Guid,
- IN VOID *Ppi
- );
-
-
diff --git a/EmulatorPkg/Include/Library/ThunkProtocolList.h b/EmulatorPkg/Include/Library/ThunkProtocolList.h
deleted file mode 100644
index 918970ddb0..0000000000
--- a/EmulatorPkg/Include/Library/ThunkProtocolList.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2008 - 2011, 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 <Uefi.h>
-#include <Protocol/EmuIoThunk.h>
-
-
-EFI_STATUS
-EFIAPI
-AddThunkProtocol (
- IN EMU_IO_THUNK_PROTOCOL *ThunkIo,
- IN CHAR16 *ConfigString,
- IN BOOLEAN EmuBusDriver
- );
-
-EFI_STATUS
-EFIAPI
-GetNextThunkProtocol (
- IN BOOLEAN EmuBusDriver,
- OUT EMU_IO_THUNK_PROTOCOL **Instance
- );
-
-
diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h b/EmulatorPkg/Include/Ppi/EmuThunk.h
deleted file mode 100644
index 7788d7b569..0000000000
--- a/EmulatorPkg/Include/Ppi/EmuThunk.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2008 - 2011, 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 __EMU_THUNK_PPI_H__
-#define __EMU_THUNK_PPI_H__
-
-#define EMU_THUNK_PPI_GUID \
- { 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }
-
-
-
-/*++
-
-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.
-
-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
-EFI_STATUS
-(EFIAPI *EMU_PEI_AUTOSCAN) (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- );
-
-
-/*++
-
-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
-EFI_STATUS
-(EFIAPI *EMU_PEI_FD_INFORMATION) (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- );
-
-
-/*++
-
-Routine Description:
- Export of EMU_THUNK_PROTOCOL from the SEC.
-
-Returns:
- EFI_SUCCESS - Data returned
-
-**/
-typedef
-VOID *
-(EFIAPI *EMU_PEI_THUNK_INTERFACE) (
- VOID
- );
-
-
-
-/*++
-
-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
-EFI_STATUS
-(EFIAPI *EMU_PEI_LOAD_FILE) (
- VOID *Pe32Data,
- EFI_PHYSICAL_ADDRESS *ImageAddress,
- UINT64 *ImageSize,
- EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-
-typedef struct {
- EMU_PEI_AUTOSCAN MemoryAutoScan;
- EMU_PEI_FD_INFORMATION FirmwareDevices;
- EMU_PEI_THUNK_INTERFACE Thunk;
-} EMU_THUNK_PPI;
-
-extern EFI_GUID gEmuThunkPpiGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Protocol/EmuBlockIo.h b/EmulatorPkg/Include/Protocol/EmuBlockIo.h
deleted file mode 100644
index 8e5463c74e..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuBlockIo.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/** @file
- Emu Block IO2 protocol as defined in the UEFI 2.3.1 specification.
-
- The Block IO2 protocol defines an extension to the Block IO protocol which
- enables the ability to read and write data at a block level in a non-blocking
- manner.
-
- 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.
-
-**/
-
-#ifndef __EMU_BLOCK_IO_H__
-#define __EMU_BLOCK_IO_H__
-
-#include <Protocol/BlockIo.h>
-#include <Protocol/BlockIo2.h>
-
-#define EMU_BLOCK_IO_PROTOCOL_GUID \
-{ 0x6888A4AE, 0xAFCE, 0xE84B, { 0x91, 0x02, 0xF7, 0xB9, 0xDA, 0xE6, 0xA0, 0x30 } }
-
-typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;
-
-
-
-/**
- Reset the block device hardware.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] ExtendedVerification Indicates that the driver may perform a more
- exhausive verfication operation of the device
- during reset.
-
- @retval EFI_SUCCESS The device was reset.
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could
- not be reset.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_BLOCK_RESET) (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-/**
- Read BufferSize bytes from Lba into Buffer.
-
- This function reads the requested number of blocks from the device. All the
- blocks are read, or an error is returned.
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and
- non-blocking I/O is being used, the Event associated with this request will
- not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId Id of the media, changes every time the media is
- replaced.
- @param[in] Lba The starting Logical Block Address to read from.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[out] Buffer A pointer to the destination buffer for the data. The
- caller is responsible for either having implicit or
- explicit ownership of the buffer.
-
- @retval EFI_SUCCESS The read request was queued if Token->Event is
- not NULL.The data was read correctly from the
- device if the Token->Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while performing
- the read.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_BLOCK_READ) (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- );
-
-/**
- Write BufferSize bytes from Lba into Buffer.
-
- This function writes the requested number of blocks to the device. All blocks
- are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,
- EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is
- being used, the Event associated with this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId The media ID that the write request is for.
- @param[in] Lba The starting logical block address to be written. The
- caller is responsible for writing to only legitimate
- locations.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[in] Buffer A pointer to the source buffer for the data.
-
- @retval EFI_SUCCESS The write request was queued if Event is not NULL.
- The data was written correctly to the device if
- the Event is NULL.
- @retval EFI_WRITE_PROTECTED The device can not be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
- @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_BLOCK_WRITE) (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-/**
- Flush the Block Device.
-
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED
- is returned and non-blocking I/O is being used, the Event associated with
- this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in,out] Token A pointer to the token associated with the transaction
-
- @retval EFI_SUCCESS The flush request was queued if Event is not NULL.
- All outstanding data was written correctly to the
- device if the Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while writting back
- the data.
- @retval EFI_WRITE_PROTECTED The device cannot be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_BLOCK_FLUSH) (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token
- );
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_BLOCK_CREATE_MAPPING) (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN EFI_BLOCK_IO_MEDIA *Media
- );
-
-
-///
-/// The Block I/O2 protocol defines an extension to the Block I/O protocol which
-/// enables the ability to read and write data at a block level in a non-blocking
-// manner.
-///
-struct _EMU_BLOCK_IO_PROTOCOL {
- EMU_BLOCK_RESET Reset;
- EMU_BLOCK_READ ReadBlocks;
- EMU_BLOCK_WRITE WriteBlocks;
- EMU_BLOCK_FLUSH FlushBlocks;
- EMU_BLOCK_CREATE_MAPPING CreateMapping;
-};
-
-extern EFI_GUID gEmuBlockIoProtocolGuid;
-
-#endif
-
diff --git a/EmulatorPkg/Include/Protocol/EmuFileSystem.h b/EmulatorPkg/Include/Protocol/EmuFileSystem.h
deleted file mode 100644
index 6d8717479b..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuFileSystem.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/** @file
- SimpleFileSystem protocol as defined in the UEFI 2.0 specification.
-
- The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32)
- file system specified in UEFI 2.0. It can also be used to abstract a file
- system other than FAT.
-
- UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _EMU_UGA_IO_H_
-#define _EMU_UGA_IO_H_
-
-#include <Protocol/SimplePointer.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UgaDraw.h>
-
-#define EMU_GRAPHICS_WINDOW_PROTOCOL_GUID \
- { 0x30FD316A, 0x6728, 0x2E41, { 0xA6, 0x90, 0x0D, 0x13, 0x33, 0xD8, 0xCA, 0xC1 } }
-
-typedef struct _EMU_GRAPHICS_WINDOW_PROTOCOL EMU_GRAPHICS_WINDOW_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CLOSE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_SIZE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga,
- UINT32 Width,
- UINT32 Height
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CHECK_KEY)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_GET_KEY)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga,
- EFI_KEY_DATA *key
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- );
-
-
-typedef
-VOID
-(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK) (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
- IN VOID *Context
- );
-
-
-typedef struct {
- UINTN SourceX;
- UINTN SourceY;
- UINTN DestinationX;
- UINTN DestinationY;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
-} EMU_GRAPHICS_WINDOWS__BLT_ARGS;
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_BLT)(
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
- );
-
-typedef
-BOOLEAN
-(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CHECK_POINTER)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- EFI_SIMPLE_POINTER_STATE *state
- );
-
-struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
- EMU_GRAPHICS_WINDOWS_SIZE Size;
- EMU_GRAPHICS_WINDOWS_CHECK_KEY CheckKey;
- EMU_GRAPHICS_WINDOWS_KEY_SET_STATE KeySetState;
- EMU_GRAPHICS_WINDOWS_GET_KEY GetKey;
- EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY RegisterKeyNotify;
- EMU_GRAPHICS_WINDOWS_BLT Blt;
- EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED IsKeyPressed;
- EMU_GRAPHICS_WINDOWS_CHECK_POINTER CheckPointer;
- EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
-};
-
-
-extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Protocol/EmuGraphicsWindow.h b/EmulatorPkg/Include/Protocol/EmuGraphicsWindow.h
deleted file mode 100644
index 844159a766..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuGraphicsWindow.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006, Tristan Gingold. All rights reserved.<BR>
-Portitions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the
-BSD License which accompanies this distribution. The full text of the
-license may be found at http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _EMU_UGA_IO_H_
-#define _EMU_UGA_IO_H_
-
-#include <Protocol/SimplePointer.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UgaDraw.h>
-
-#define EMU_GRAPHICS_WINDOW_PROTOCOL_GUID \
- { 0x30FD316A, 0x6728, 0x2E41, { 0xA6, 0x90, 0x0D, 0x13, 0x33, 0xD8, 0xCA, 0xC1 } }
-
-typedef struct _EMU_GRAPHICS_WINDOW_PROTOCOL EMU_GRAPHICS_WINDOW_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CLOSE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_SIZE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga,
- UINT32 Width,
- UINT32 Height
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CHECK_KEY)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_GET_KEY)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *Uga,
- EFI_KEY_DATA *key
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- );
-
-
-typedef
-VOID
-(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK) (
- IN VOID *Context,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
- IN VOID *Context
- );
-
-
-typedef struct {
- UINTN SourceX;
- UINTN SourceY;
- UINTN DestinationX;
- UINTN DestinationY;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
-} EMU_GRAPHICS_WINDOWS__BLT_ARGS;
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_BLT)(
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
- );
-
-typedef
-BOOLEAN
-(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED) (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_KEY_DATA *KeyData
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_CHECK_POINTER)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE)(
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- EFI_SIMPLE_POINTER_STATE *state
- );
-
-struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
- EMU_GRAPHICS_WINDOWS_SIZE Size;
- EMU_GRAPHICS_WINDOWS_CHECK_KEY CheckKey;
- EMU_GRAPHICS_WINDOWS_KEY_SET_STATE KeySetState;
- EMU_GRAPHICS_WINDOWS_GET_KEY GetKey;
- EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY RegisterKeyNotify;
- EMU_GRAPHICS_WINDOWS_BLT Blt;
- EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED IsKeyPressed;
- EMU_GRAPHICS_WINDOWS_CHECK_POINTER CheckPointer;
- EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
-};
-
-
-extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Protocol/EmuIoThunk.h b/EmulatorPkg/Include/Protocol/EmuIoThunk.h
deleted file mode 100644
index 471c13b882..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuIoThunk.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2010 - 2011, 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 __EMU_IO_THUNK__
-#define __EMU_IO_THUNK__
-
-
-#define EMU_IO_THUNK_PROTOCO_GUID \
- { 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } }
-
-
-typedef struct _EMU_IO_THUNK_PROTOCOL EMU_IO_THUNK_PROTOCOL;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_OPEN) (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_CLOSE) (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-struct _EMU_IO_THUNK_PROTOCOL {
- EFI_GUID *Protocol;
- VOID *Interface; /// Only be valid after Open() is called
- CHAR16 *ConfigString;
- UINT16 Instance;
- EMU_IO_THUNK_PROTOCOL_CLOSE_OPEN Open;
- EMU_IO_THUNK_PROTOCOL_CLOSE_CLOSE Close;
- VOID *Private; /// Used by implementation
-};
-
-extern EFI_GUID gEmuIoThunkProtocolGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Protocol/EmuSnp.h b/EmulatorPkg/Include/Protocol/EmuSnp.h
deleted file mode 100644
index a022c9ecb7..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuSnp.h
+++ /dev/null
@@ -1,459 +0,0 @@
-/** @file
- The EMU_SNP_PROTOCOL provides services to initialize a network interface,
- transmit packets, receive packets, and close a network interface.
-
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EMU_SNP_H__
-#define __EMU_SNP_H__
-
-#include <Protocol/SimpleNetwork.h>
-
-#define EMU_SNP_PROTOCOL_GUID \
- { 0xFD5FBE54, 0x8C35, 0xB345, { 0x8A, 0x0F, 0x7A, 0xC8, 0xA5, 0xFD, 0x05, 0x21 } }
-
-typedef struct _EMU_SNP_PROTOCOL EMU_SNP_PROTOCOL;
-
-
-/**
- Register storage for SNP Mode.
-
- @param This Protocol instance pointer.
- @param Mode SimpleNetworkProtocol Mode structure passed into driver.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_CREATE_MAPPING)(
- IN EMU_SNP_PROTOCOL *This,
- IN EFI_SIMPLE_NETWORK_MODE *Mode
- );
-
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_ALREADY_STARTED The network interface is already in the started state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_START)(
- IN EMU_SNP_PROTOCOL *This
- );
-
-/**
- Changes the state of a network interface from "started" to "stopped".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The network interface was stopped.
- @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_STOP)(
- IN EMU_SNP_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 The 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 The network interface was initialized.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
- receive buffers.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_INITIALIZE)(
- IN EMU_SNP_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 The protocol instance pointer.
- @param ExtendedVerification Indicates that the driver may perform a more
- exhaustive verification operation of the device
- during reset.
-
- @retval EFI_SUCCESS The network interface was reset.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_RESET)(
- IN EMU_SNP_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 The network interface was shutdown.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_SHUTDOWN)(
- IN EMU_SNP_PROTOCOL *This
- );
-
-/**
- Manages the multicast receive filters of a network interface.
-
- @param This The protocol instance pointer.
- @param Enable A bit mask of receive filters to enable on the network interface.
- @param Disable 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 McastFilterCnt Number of multicast HW MAC addresses in the new
- MCastFilter list. This value must be less than or equal to
- the MCastFilterCnt field of EMU_SNP_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_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_RECEIVE_FILTERS)(
- IN EMU_SNP_PROTOCOL *This,
- IN UINT32 Enable,
- IN UINT32 Disable,
- IN BOOLEAN ResetMCastFilter,
- IN UINTN MCastFilterCnt OPTIONAL,
- IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
- );
-
-/**
- Modifies or resets the current station address, if supported.
-
- @param This The protocol instance pointer.
- @param Reset Flag used to reset the station address to the network interfaces
- permanent address.
- @param New The new station address to be used for the network interface.
-
- @retval EFI_SUCCESS The network interfaces station address was updated.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_STATION_ADDRESS)(
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS *New 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_STATISTICS)(
- IN EMU_SNP_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 The 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_MCAST_IP_TO_MAC)(
- IN EMU_SNP_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 The protocol instance pointer.
- @param ReadWrite 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_SUCCESS The NVRAM access was performed.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_NVDATA)(
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ReadWrite,
- 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 The 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 TxBuf 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 The status of the network interface was retrieved.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_GET_STATUS)(
- IN EMU_SNP_PROTOCOL *This,
- OUT UINT32 *InterruptStatus OPTIONAL,
- OUT VOID **TxBuf OPTIONAL
- );
-
-/**
- Places a packet in the transmit queue of a network interface.
-
- @param This The 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_NOT_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_TRANSMIT)(
- IN EMU_SNP_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 The 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 BufferSize 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 SrcAddr The source HW MAC address. If this parameter is NULL, the
- HW MAC source address will not be extracted from the media
- header.
- @param DestAddr 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_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_SNP_RECEIVE)(
- IN EMU_SNP_PROTOCOL *This,
- OUT UINTN *HeaderSize OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer,
- OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
- OUT UINT16 *Protocol OPTIONAL
- );
-
-#define EMU_SNP_PROTOCOL_REVISION 0x00010000
-
-//
-// Revision defined in EFI1.1
-//
-#define EMU_SNP_INTERFACE_REVISION EMU_SNP_PROTOCOL_REVISION
-
-///
-/// The EMU_SNP_PROTOCOL protocol abstracts OS network sercices
-/// from the EFI driver that produces EFI Simple Network Protocol.
-///
-struct _EMU_SNP_PROTOCOL {
- EMU_SNP_CREATE_MAPPING CreateMapping;
- EMU_SNP_START Start;
- EMU_SNP_STOP Stop;
- EMU_SNP_INITIALIZE Initialize;
- EMU_SNP_RESET Reset;
- EMU_SNP_SHUTDOWN Shutdown;
- EMU_SNP_RECEIVE_FILTERS ReceiveFilters;
- EMU_SNP_STATION_ADDRESS StationAddress;
- EMU_SNP_STATISTICS Statistics;
- EMU_SNP_MCAST_IP_TO_MAC MCastIpToMac;
- EMU_SNP_NVDATA NvData;
- EMU_SNP_GET_STATUS GetStatus;
- EMU_SNP_TRANSMIT Transmit;
- EMU_SNP_RECEIVE Receive;
-};
-
-extern EFI_GUID gEmuSnpProtocolGuid;
-
-#endif
diff --git a/EmulatorPkg/Include/Protocol/EmuThread.h b/EmulatorPkg/Include/Protocol/EmuThread.h
deleted file mode 100644
index e518bb1368..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuThread.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2010 - 2011, 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.
-
-**/
-
-#ifndef __EMU_THREAD_THUNK__
-#define __EMU_THREAD_THUNK__
-
-
-typedef struct _EMU_THREAD_THUNK_PROTOCOL EMU_THREAD_THUNK_PROTOCOL;
-
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_MUTEX_LOCK) (
- IN VOID *Mutex
- );
-
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK) (
- IN VOID *Mutex
- );
-
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK) (
- IN VOID *Mutex
- );
-
-
-typedef
-VOID *
-(EFIAPI *THREAD_THUNK_MUTEX_INIT) (
- IN VOID
- );
-
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_MUTEX_DISTROY) (
- IN VOID *Mutex
- );
-
-
-
-typedef
-VOID *
-(EFIAPI *THREAD_THUNK_THREAD_ENTRY) (
- IN VOID *Context
- );
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_CREATE_THREAD) (
- IN VOID *Thread,
- IN VOID *Attribute,
- IN THREAD_THUNK_THREAD_ENTRY Start,
- IN VOID *Context
- );
-
-typedef
-VOID
-(EFIAPI *THREAD_THUNK_EXIT_THREAD) (
- IN VOID *ValuePtr
- );
-
-
-typedef
-UINTN
-(EFIAPI *THREAD_THUNK_SELF) (
- VOID
- );
-
-
-struct _EMU_THREAD_THUNK_PROTOCOL {
- THREAD_THUNK_MUTEX_LOCK MutexLock;
- THREAD_THUNK_MUTEX_UNLOCK MutexUnlock;
- THREAD_THUNK_MUTEX_TRY_LOCK MutexTryLock;
- THREAD_THUNK_MUTEX_INIT MutexInit;
- THREAD_THUNK_MUTEX_DISTROY MutexDistroy;
- THREAD_THUNK_CREATE_THREAD CreateThread;
- THREAD_THUNK_EXIT_THREAD ExitThread;
- THREAD_THUNK_SELF Self;
-};
-
-extern EFI_GUID gEmuThreadThunkProtocolGuid;
-
-#endif
-
diff --git a/EmulatorPkg/Include/Protocol/EmuThunk.h b/EmulatorPkg/Include/Protocol/EmuThunk.h
deleted file mode 100644
index eccf0f47d9..0000000000
--- a/EmulatorPkg/Include/Protocol/EmuThunk.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2008 - 2011, 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 __EMU_THUNK_PROTOCOL_H__
-#define __EMU_THUNK_PROTOCOL_H__
-
-#define EMU_THUNK_PROTOCOL_GUID \
- { 0x5CF32E0B, 0x8EDF, 0x2E44, { 0x9C, 0xDA, 0x93, 0x20, 0x5E, 0x99, 0xEC, 0x1C } }
-
-// neded for things like EFI_TIME_CAPABILITIES
-#include <Uefi.h>
-
-#include <Library/PeCoffExtraActionLib.h>
-
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/DevicePath.h>
-
-
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Instance;
-} EMU_VENDOR_DEVICE_PATH_NODE;
-
-typedef struct {
- EMU_VENDOR_DEVICE_PATH_NODE Vendor;
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
-} EMU_THUNK_DEVICE_PATH;
-
-
-
-typedef struct _EMU_THUNK_PROTOCOL EMU_THUNK_PROTOCOL;
-
-
-
-typedef
-UINTN
-(EFIAPI *EMU_WRITE_STD_ERROR) (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_CONFIG_STD_IN) (
- VOID
- );
-
-typedef
-UINTN
-(EFIAPI *EMU_WRITE_STD_OUT) (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-typedef
-UINTN
-(EFIAPI *EMU_READ_STD_IN) (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-typedef
-BOOLEAN
-(EFIAPI *EMU_POLL_STD_IN) (
- VOID
- );
-
-
-typedef
-VOID *
-(EFIAPI *EMU_OS_MALLOC) (
- IN UINTN Size
- );
-
-typedef
-VOID *
-(EFIAPI *EMU_OS_VMALLOC) (
- IN UINTN Size
- );
-
-typedef
-BOOLEAN
-(EFIAPI *EMU_OS_FREE) (
- IN VOID *Ptr
- );
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT) (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- );
-
-typedef
-VOID
-(EFIAPI *EMU_PE_COFF_RELOCATE_EXTRA_ACTION) (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-VOID
-(EFIAPI *EMU_PE_COFF_UNLOAD_EXTRA_ACTION) (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-VOID
-(EFIAPI *EMU_ENABLE_INERRUPTS) (
- VOID
- );
-
-typedef
-VOID
-(EFIAPI *EMU_DISABLE_INERRUPTS) (
- VOID
- );
-
-typedef
-UINT64
-(EFIAPI *EMU_QUERY_PERFORMANCE_FREQENCY) (
- VOID
- );
-
-typedef
-UINT64
-(EFIAPI *EMU_QUERY_PERFORMANCE_COUNTER) (
- VOID
- );
-
-typedef
-VOID
-(EFIAPI *EMU_SLEEP) (
- IN UINT64 Milliseconds
- );
-
-typedef
-VOID
-(EFIAPI *EMU_CPU_SLEEP) (
- VOID
- );
-
-typedef
-VOID
-(EFIAPI *EMU_EXIT) (
- IN UINTN Status
- );
-
-typedef
-VOID
-(EFIAPI *EMU_GET_TIME) (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
- );
-
-typedef
-VOID
-(EFIAPI *EMU_SET_TIME) (
- IN EFI_TIME *Time
- );
-
-
-typedef
-VOID
-(EFIAPI EMU_SET_TIMER_CALLBACK) (
- IN UINT64 DeltaMs
- );
-
-typedef
-VOID
-(EFIAPI *EMU_SET_TIMER) (
- IN UINT64 PeriodMs,
- IN EMU_SET_TIMER_CALLBACK CallBack
- );
-
-
-
-/**
- Enumerates the current set of protocol instances that abstract OS services from EFI.
-
- A given protocol can have multiple instances. Usually a protocol is configured via a
- single PCD string. The data associated for each instance is seperated via a ! in the string.
- EMU_IO_THUNK_PROTOCOL_CLOSE.ConfigString will contain the information in the PCD string up to the next !.
- Thus each instance has a unique ConfigString.
-
- @param EmuBusDriver TRUE means only return protocol instances that need to be produced
- by the EmuBusDriver. FALSE means return all possible protocols
- @param Instance On input the protocol to search for, or NULL to start a search
- of all the supported protocol instances.
- @param NextProtocol On output it represents the next value to be passed into Protocol.
- @param Interface A pointer to the EMU_IO_THUNK_PROTOCOL_CLOSE interface.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND The next protocol instance was not found.
- @retval EFI_INVALID_PARAMETER Instance is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EMU_GET_NEXT_PROTOCOL) (
- IN BOOLEAN EmuBusDriver,
- OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
- );
-
-
-struct _EMU_THUNK_PROTOCOL {
- // Used for early debug printing
- EMU_WRITE_STD_ERROR WriteStdErr;
- EMU_CONFIG_STD_IN ConfigStdIn;
- EMU_WRITE_STD_OUT WriteStdOut;
- EMU_READ_STD_IN ReadStdIn;
- EMU_POLL_STD_IN PollStdIn;
-
- //
- // Map OS malloc/free so we can use OS based guard malloc
- //
- EMU_OS_MALLOC Malloc;
- EMU_OS_VMALLOC Valloc;
- EMU_OS_FREE Free;
-
-
- ///
- /// PE/COFF loader hooks to get symbols loaded
- ///
- EMU_PE_COFF_GET_ENTRY_POINT PeCoffGetEntryPoint;
- EMU_PE_COFF_RELOCATE_EXTRA_ACTION PeCoffRelocateImageExtraAction;
- EMU_PE_COFF_UNLOAD_EXTRA_ACTION PeCoffUnloadImageExtraAction;
-
- ///
- /// DXE Architecture Protocol Services
- ///
- EMU_ENABLE_INERRUPTS EnableInterrupt;
- EMU_DISABLE_INERRUPTS DisableInterrupt;
- EMU_QUERY_PERFORMANCE_FREQENCY QueryPerformanceFrequency;
- EMU_QUERY_PERFORMANCE_COUNTER QueryPerformanceCounter;
-
- EMU_SLEEP Sleep;
- EMU_CPU_SLEEP CpuSleep;
- EMU_EXIT Exit;
- EMU_GET_TIME GetTime;
- EMU_SET_TIME SetTime;
- EMU_SET_TIMER SetTimer;
-
- ///
- /// Generic System Services
- ///
- EMU_GET_NEXT_PROTOCOL GetNextProtocol;
-};
-
-extern EFI_GUID gEmuThunkProtocolGuid;
-
-#endif
diff --git a/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.c b/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.c
deleted file mode 100644
index 7478a5ef2a..0000000000
--- a/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/** @file
- Null Platform Hook Library instance.
-
- 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.
-
-**/
-
-#include <Base.h>
-
-#include <Protocol/EmuThunk.h>
-#include <Protocol/EmuGraphicsWindow.h>
-#include <Protocol/EmuBlockIo.h>
-#include <Protocol/SimpleFileSystem.h>
-#include <Protocol/EmuThread.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DevicePathToTextLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-
-
-/**
- Converts a Vendor device path structure to its string representative.
-
- @param Str The string representative of input device.
- @param DevPath The input device path structure.
- @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
- of the display node is used, where applicable. If DisplayOnly
- is FALSE, then the longer text representation of the display node
- is used.
- @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
- representation for a device node can be used, where applicable.
-
- @return EFI_NOT_FOUND if no string representation exists.
- @return EFI_SUCCESS a string representation was created.
-**/
-EFI_STATUS
-EFIAPI
-DevPathToTextVendorLib (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- EMU_VENDOR_DEVICE_PATH_NODE *Vendor;
- CHAR16 *Type;
-
- Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *)DevPath;
- if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThunkProtocolGuid)) {
- CatPrint (Str, L"EmuThunk()");
- return EFI_SUCCESS;
- }
- if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
- CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
- return EFI_SUCCESS;
- }
- if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
- CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
- return EFI_SUCCESS;
- }
- if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
- CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
- return EFI_SUCCESS;
- }
- if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
- CatPrint (Str, L"EmuThread()");
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- Converts a text device path node to Hardware Vendor device path structure.
-
- @param TextDeviceNode The input Text device path node.
-
- @return A pointer to the newly-created Hardware Vendor device path structure.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextEmuThunk (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *Str;
- VENDOR_DEVICE_PATH *Vendor;
-
- Str = GetNextParamStr (&TextDeviceNode);
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH)
- );
- CopyGuid (&Vendor->Guid, &gEmuThunkProtocolGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-/**
- Converts a text device path node to Hardware Vendor device path structure.
-
- @param TextDeviceNode The input Text device path node.
-
- @return A pointer to the newly-created Hardware Vendor device path structure.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextEmuThread (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *Str;
- VENDOR_DEVICE_PATH *Vendor;
-
- Str = GetNextParamStr (&TextDeviceNode);
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEVICE_PATH)
- );
- CopyGuid (&Vendor->Guid, &gEmuThreadThunkProtocolGuid);
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-/**
- Converts a text device path node to Hardware Vendor device path structure.
-
- @param TextDeviceNode The input Text device path node.
-
- @return A pointer to the newly-created Hardware Vendor device path structure.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextEmuFs (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *Str;
- EMU_VENDOR_DEVICE_PATH_NODE *Vendor;
-
- Str = GetNextParamStr (&TextDeviceNode);
- Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- (UINT16) sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
- );
- CopyGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid);
- Vendor->Instance = (UINT32) StrDecimalToUintn (Str);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-/**
- Register the Filter function
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor executed correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-DevicePathToTextLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-
-{
- DevPathToTextSetVendorDevicePathFilter (DevPathToTextVendorLib);
- DevicePathFromTextAddFilter (L"EmuThunk", DevPathFromTextEmuThunk);
- DevicePathFromTextAddFilter (L"EmuThread", DevPathFromTextEmuThread);
- DevicePathFromTextAddFilter (L"EmuFs", DevPathFromTextEmuFs);
- return EFI_SUCCESS;
-} \ No newline at end of file
diff --git a/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.inf b/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
deleted file mode 100644
index f5726785e1..0000000000
--- a/EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# Null DevicePathToText library.
-#
-# Copyright (c) 2010 - 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 = DevicePathTextLib
- FILE_GUID = DCD1F939-1732-CA4D-81B7-C757AEC84DBC
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = NULL|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
- CONSTRUCTOR = DevicePathToTextLibConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- DevicePathTextLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- DevicePathLib
-
-[Protocols]
- gEmuThunkProtocolGuid
- gEmuGraphicsWindowProtocolGuid
- gEfiSimpleFileSystemProtocolGuid
- gEmuBlockIoProtocolGuid
- gEmuThreadThunkProtocolGuid \ No newline at end of file
diff --git a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c b/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
deleted file mode 100644
index f4f3c09ddd..0000000000
--- a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/** @file
- A non-functional instance of the Timer Library.
-
- 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 <PiPei.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <Protocol/Timer.h>
-
-
-
-/**
- Stalls the CPU for at least the given number of microseconds.
-
- Stalls the CPU for the number of microseconds specified by MicroSeconds.
-
- @param MicroSeconds The minimum number of microseconds to delay.
-
- @return The value of MicroSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-MicroSecondDelay (
- IN UINTN MicroSeconds
- )
-{
- return NanoSecondDelay (MicroSeconds * 1000);
-}
-
-
-/**
- Stalls the CPU for at least the given number of nanoseconds.
-
- Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
-
- @param NanoSeconds The minimum number of nanoseconds to delay.
-
- @return The value of NanoSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-NanoSecondDelay (
- IN UINTN NanoSeconds
- )
-{
- gEmuThunk->Sleep (NanoSeconds);
- return NanoSeconds;
-}
-
-
-/**
- Retrieves the current value of a 64-bit free running performance counter.
-
- The counter can either count up by 1 or count down by 1. If the physical
- performance counter counts by a larger increment, then the counter values
- must be translated. The properties of the counter can be retrieved from
- GetPerformanceCounterProperties().
-
- @return The current value of the free running performance counter.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounter (
- VOID
- )
-{
- return gEmuThunk->QueryPerformanceCounter ();
-}
-
-/**
- Retrieves the 64-bit frequency in Hz and the range of performance counter
- values.
-
- If StartValue is not NULL, then the value that the performance counter starts
- with immediately after is it rolls over is returned in StartValue. If
- EndValue is not NULL, then the value that the performance counter end with
- immediately before it rolls over is returned in EndValue. The 64-bit
- frequency of the performance counter in Hz is always returned. If StartValue
- is less than EndValue, then the performance counter counts up. If StartValue
- is greater than EndValue, then the performance counter counts down. For
- example, a 64-bit free running counter that counts up would have a StartValue
- of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
- that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
-
- @param StartValue The value the performance counter starts with when it
- rolls over.
- @param EndValue The value that the performance counter ends with before
- it rolls over.
-
- @return The frequency in Hz.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounterProperties (
- OUT UINT64 *StartValue, OPTIONAL
- OUT UINT64 *EndValue OPTIONAL
- )
-{
-
- if (StartValue != NULL) {
- *StartValue = 0ULL;
- }
- if (EndValue != NULL) {
- *EndValue = (UINT64)-1LL;
- }
-
- return gEmuThunk->QueryPerformanceFrequency ();
-}
-
-
diff --git a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf b/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf
deleted file mode 100644
index 88ce324c19..0000000000
--- a/EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file
-# NULL instance of Timer Library as a template.
-#
-# A non-functional instance of the Timer Library that can be used as a template
-# for the implementation of a functional timer library instance. This library instance can
-# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer
-# services as well as EBC modules that require timer services.
-#
-# Copyright (c) 2007 - 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 = EmuDxeCodeTimerLib
- FILE_GUID = FB184AF4-A2F2-EE4E-8885-E81E5D8B0135
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TimerLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER UEFI_APPLICATION
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- DxeCoreTimerLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- EmuThunkLib
-
diff --git a/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c b/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c
deleted file mode 100644
index 22f8da7b64..0000000000
--- a/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/BaseMemoryLib.h>
-
-EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
-
-
-/**
- The constructor function caches the pointer of EMU Thunk protocol.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-DxeEmuLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEmuThunkProtocolGuid);
- ASSERT (GuidHob != NULL);
-
- gEmuThunk = (EMU_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- ASSERT (gEmuThunk != NULL);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Serach the EMU IO Thunk database for a matching EMU IO Thunk
- Protocol instance.
-
- @param Protocol Protocol to search for.
- @param Instance Instance of protocol to search for.
-
- @retval NULL Protocol and Instance not found.
- @retval other EMU IO Thunk protocol that matched.
-
-**/
-EMU_IO_THUNK_PROTOCOL *
-EFIAPI
-GetIoThunkInstance (
- IN EFI_GUID *Protocol,
- IN UINTN Instance
- )
-{
- EFI_STATUS Status;
- EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
-
- for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
- Status = gEmuThunk->GetNextProtocol (FALSE, &EmuIoThunk);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (EmuIoThunk->Instance == Instance) {
- if (CompareGuid (EmuIoThunk->Protocol, Protocol)) {
- return EmuIoThunk;
- }
- }
- }
-
- return NULL;
-} \ No newline at end of file
diff --git a/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf b/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
deleted file mode 100644
index 21268a439e..0000000000
--- a/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
+++ /dev/null
@@ -1,46 +0,0 @@
-## @file
-# A library to produce the global variable 'gEmuThunk'
-#
-# This library contains a single global variable 'gEmuThunk' along with a constructor to
-# initialize that global.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeEmuLib
- FILE_GUID = 31479AFD-B06F-4E4A-863B-A8F7E7710778
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = EmuThunkLib
-
- CONSTRUCTOR = DxeEmuLibConstructor
-
-
-[Sources]
- DxeEmuLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- HobLib
- DebugLib
- BaseMemoryLib
-
-
-[Protocols]
- gEmuThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
diff --git a/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.c b/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.c
deleted file mode 100644
index 5a8730c5f7..0000000000
--- a/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- Provides services to perform additional actions to relocate and unload
- PE/Coff image for Emu environment specific purpose such as souce level debug.
- This version only works for DXE phase
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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 <PiDxe.h>
-
-#include <Protocol/EmuThunk.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
-//
-EMU_THUNK_PROTOCOL *mThunk = 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
-DxeEmuPeCoffLibExtraActionConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- //
- // Retrieve EmuThunkProtocol from GUID'ed HOB
- //
- GuidHob = GetFirstGuidHob (&gEmuThunkProtocolGuid);
- ASSERT (GuidHob != NULL);
- mThunk = (EMU_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- ASSERT (mThunk != 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 (mThunk != NULL) {
- mThunk->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 (mThunk != NULL) {
- mThunk->PeCoffUnloadImageExtraAction (ImageContext);
- }
-}
diff --git a/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf b/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
deleted file mode 100644
index f79ebc78e2..0000000000
--- a/EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# PeCoff extra action libary for DXE phase that run Emu emulator.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeEmuPeCoffExtraActionLib
- FILE_GUID = 68FCD487-D230-6846-95B1-5E1F2EF942C4
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeCoffExtraActionLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER
-
- CONSTRUCTOR = DxeEmuPeCoffLibExtraActionConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32
-#
-
-[Sources]
- DxeEmuPeCoffExtraActionLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- HobLib
- BaseMemoryLib
-
-[Protocols]
- gEmuThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
diff --git a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.c b/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.c
deleted file mode 100644
index 2bf5961bf0..0000000000
--- a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/** @file
- Serial Port Lib that thunks back to Emulator services to write to StdErr.
- All read functions are stubed out.
-
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
- Portions copyright (c) 2011, 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 <PiDxe.h>
-#include <Library/SerialPortLib.h>
-#include <Library/EmuThunkLib.h>
-
-
-
-
-/**
- Initialize the serial device hardware.
-
- If no initialization is required, then return RETURN_SUCCESS.
- If the serial device was successfully initialized, then return RETURN_SUCCESS.
- If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
-
- @retval RETURN_SUCCESS The serial device was initialized.
- @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- return gEmuThunk->ConfigStdIn ();
-}
-
-/**
- Write data from buffer to serial device.
-
- Writes NumberOfBytes data bytes from Buffer to the serial device.
- The number of bytes actually written to the serial device is returned.
- If the return value is less than NumberOfBytes, then the write operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to be written.
- @param NumberOfBytes The number of bytes to written to the serial device.
-
- @retval 0 NumberOfBytes is 0.
- @retval >0 The number of bytes written to the serial device.
- If this value is less than NumberOfBytes, then the read operation failed.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return gEmuThunk->WriteStdOut (Buffer, NumberOfBytes);
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- Reads NumberOfBytes data bytes from a serial device into the buffer
- specified by Buffer. The number of bytes actually read is returned.
- If the return value is less than NumberOfBytes, then the rest operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to store the data read from the serial device.
- @param NumberOfBytes The number of bytes which will be read.
-
- @retval 0 Read data failed; No data is to be read.
- @retval >0 The actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return gEmuThunk->ReadStdIn (Buffer, NumberOfBytes);
-}
-
-/**
- Polls a serial device to see if there is any data waiting to be read.
-
- Polls a serial device to see if there is any data waiting to be read.
- If there is data waiting to be read from the serial device, then TRUE is returned.
- If there is no data waiting to be read from the serial device, then FALSE is returned.
-
- @retval TRUE Data is waiting to be read from the serial device.
- @retval FALSE There is no data waiting to be read from the serial device.
-
-**/
-BOOLEAN
-EFIAPI
-SerialPortPoll (
- VOID
- )
-{
- return gEmuThunk->PollStdIn ();
-}
-
-/**
- Sets the control bits on a serial device.
-
- @param Control Sets the bits of Control that are settable.
-
- @retval RETURN_SUCCESS The new control bits were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-/**
- Retrieve the status of the control bits on a serial device.
-
- @param Control A pointer to return the current control signals from the serial device.
-
- @retval RETURN_SUCCESS The control bits were read from the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- *Control = 0;
- if (!SerialPortPoll ()) {
- *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
- }
- return RETURN_SUCCESS;
-}
-
-/**
- Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
- data bits, and stop bits on a serial device.
-
- @param BaudRate The requested baud rate. A BaudRate value of 0 will use the
- device's default interface speed.
- On output, the value actually set.
- @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
- serial interface. A ReceiveFifoDepth value of 0 will use
- the device's default FIFO depth.
- On output, the value actually set.
- @param Timeout The requested time out for a single character in microseconds.
- This timeout applies to both the transmit and receive side of the
- interface. A Timeout value of 0 will use the device's default time
- out value.
- On output, the value actually set.
- @param Parity The type of parity to use on this serial device. A Parity value of
- DefaultParity will use the device's default parity value.
- On output, the value actually set.
- @param DataBits The number of data bits to use on the serial device. A DataBits
- vaule of 0 will use the device's default data bit setting.
- On output, the value actually set.
- @param StopBits The number of stop bits to use on this serial device. A StopBits
- value of DefaultStopBits will use the device's default number of
- stop bits.
- On output, the value actually set.
-
- @retval RETURN_SUCCESS The new attributes were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
diff --git a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf b/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
deleted file mode 100644
index 119028d465..0000000000
--- a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# Write only instance of Serial Port Library with empty functions.
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeEmuSerialPortLib
- FILE_GUID = DF08A29A-F60B-E649-AA79-A1490E863A5D
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SerialPortLib| DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVE
-
-
-[Sources]
- DxeEmuSerialPortLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
-
-[LibraryClasses]
- EmuThunkLib
-
-
-
-
-
diff --git a/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.c b/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.c
deleted file mode 100644
index 00d9f19369..0000000000
--- a/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/** @file
- Serial Port Lib that thunks back to Emulator services to write to StdErr.
- All read functions are stubed out.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Portions copyright (c) 2011, 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 <PiDxe.h>
-#include <Library/SerialPortLib.h>
-#include <Library/EmuThunkLib.h>
-
-
-
-
-/**
- Initialize the serial device hardware.
-
- If no initialization is required, then return RETURN_SUCCESS.
- If the serial device was successfully initialized, then return RETURN_SUCCESS.
- If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
-
- @retval RETURN_SUCCESS The serial device was initialized.
- @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Write data from buffer to serial device.
-
- Writes NumberOfBytes data bytes from Buffer to the serial device.
- The number of bytes actually written to the serial device is returned.
- If the return value is less than NumberOfBytes, then the write operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to be written.
- @param NumberOfBytes The number of bytes to written to the serial device.
-
- @retval 0 NumberOfBytes is 0.
- @retval >0 The number of bytes written to the serial device.
- If this value is less than NumberOfBytes, then the read operation failed.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- if (gEmuThunk == NULL) {
- return NumberOfBytes;
- }
-
- return gEmuThunk->WriteStdErr (Buffer, NumberOfBytes);
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- Reads NumberOfBytes data bytes from a serial device into the buffer
- specified by Buffer. The number of bytes actually read is returned.
- If the return value is less than NumberOfBytes, then the rest operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to store the data read from the serial device.
- @param NumberOfBytes The number of bytes which will be read.
-
- @retval 0 Read data failed; No data is to be read.
- @retval >0 The actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return 0;
-}
-
-/**
- Polls a serial device to see if there is any data waiting to be read.
-
- Polls a serial device to see if there is any data waiting to be read.
- If there is data waiting to be read from the serial device, then TRUE is returned.
- If there is no data waiting to be read from the serial device, then FALSE is returned.
-
- @retval TRUE Data is waiting to be read from the serial device.
- @retval FALSE There is no data waiting to be read from the serial device.
-
-**/
-BOOLEAN
-EFIAPI
-SerialPortPoll (
- VOID
- )
-{
- return FALSE;
-}
-
-
diff --git a/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf b/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
deleted file mode 100644
index c1514d0b5f..0000000000
--- a/EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-## @file
-# Write only instance of Serial Port Library with empty functions.
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeEmuStdErrSerialPortLib
- FILE_GUID = 4EED5138-C512-9E4F-AB13-149B87D40453
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SerialPortLib| DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVE
-
-
-[Sources]
- DxeEmuStdErrSerialPortLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- EmuThunkLib
-
-
-
-
-
diff --git a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c b/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c
deleted file mode 100644
index 032fec4b84..0000000000
--- a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/** @file
- A non-functional instance of the Timer Library.
-
- 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 <PiPei.h>
-#include <Library/BaseLib.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <Protocol/Timer.h>
-
-
-STATIC UINT64 gTimerPeriod = 0;
-STATIC EFI_TIMER_ARCH_PROTOCOL *gTimerAp = NULL;
-STATIC EFI_EVENT gTimerEvent = NULL;
-STATIC VOID *gRegistration = NULL;
-
-VOID
-EFIAPI
-RegisterTimerArchProtocol (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **)&gTimerAp);
- if (!EFI_ERROR (Status)) {
- Status = gTimerAp->GetTimerPeriod (gTimerAp, &gTimerPeriod);
- ASSERT_EFI_ERROR (Status);
-
- // Convert to Nanoseconds.
- gTimerPeriod = MultU64x32 (gTimerPeriod, 100);
-
- if (gTimerEvent == NULL) {
- Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, (VOID **)&gTimerEvent);
- ASSERT_EFI_ERROR (Status);
- }
- }
-}
-
-
-
-/**
- Stalls the CPU for at least the given number of microseconds.
-
- Stalls the CPU for the number of microseconds specified by MicroSeconds.
-
- @param MicroSeconds The minimum number of microseconds to delay.
-
- @return The value of MicroSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-MicroSecondDelay (
- IN UINTN MicroSeconds
- )
-{
- return NanoSecondDelay (MicroSeconds * 1000);
-}
-
-
-/**
- Stalls the CPU for at least the given number of nanoseconds.
-
- Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
-
- @param NanoSeconds The minimum number of nanoseconds to delay.
-
- @return The value of NanoSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-NanoSecondDelay (
- IN UINTN NanoSeconds
- )
-{
- EFI_STATUS Status;
- UINT64 HundredNanoseconds;
- UINTN Index;
-
- if ((gTimerPeriod != 0) &&
- ((UINT64)NanoSeconds > gTimerPeriod) &&
- (EfiGetCurrentTpl () == TPL_APPLICATION)) {
- //
- // This stall is long, so use gBS->WaitForEvent () to yield CPU to DXE Core
- //
-
- HundredNanoseconds = DivU64x32 (NanoSeconds, 100);
- Status = gBS->SetTimer (gTimerEvent, TimerRelative, HundredNanoseconds);
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->WaitForEvent (sizeof (gTimerEvent)/sizeof (EFI_EVENT), &gTimerEvent, &Index);
- ASSERT_EFI_ERROR (Status);
-
- } else {
- gEmuThunk->Sleep (NanoSeconds);
- }
- return NanoSeconds;
-}
-
-
-/**
- Retrieves the current value of a 64-bit free running performance counter.
-
- The counter can either count up by 1 or count down by 1. If the physical
- performance counter counts by a larger increment, then the counter values
- must be translated. The properties of the counter can be retrieved from
- GetPerformanceCounterProperties().
-
- @return The current value of the free running performance counter.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounter (
- VOID
- )
-{
- return gEmuThunk->QueryPerformanceCounter ();
-}
-
-/**
- Retrieves the 64-bit frequency in Hz and the range of performance counter
- values.
-
- If StartValue is not NULL, then the value that the performance counter starts
- with immediately after is it rolls over is returned in StartValue. If
- EndValue is not NULL, then the value that the performance counter end with
- immediately before it rolls over is returned in EndValue. The 64-bit
- frequency of the performance counter in Hz is always returned. If StartValue
- is less than EndValue, then the performance counter counts up. If StartValue
- is greater than EndValue, then the performance counter counts down. For
- example, a 64-bit free running counter that counts up would have a StartValue
- of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
- that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
-
- @param StartValue The value the performance counter starts with when it
- rolls over.
- @param EndValue The value that the performance counter ends with before
- it rolls over.
-
- @return The frequency in Hz.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounterProperties (
- OUT UINT64 *StartValue, OPTIONAL
- OUT UINT64 *EndValue OPTIONAL
- )
-{
-
- if (StartValue != NULL) {
- *StartValue = 0ULL;
- }
- if (EndValue != NULL) {
- *EndValue = (UINT64)-1LL;
- }
-
- return gEmuThunk->QueryPerformanceFrequency ();
-}
-
-
-/**
- Register for the Timer AP protocol.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-DxeTimerLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiTimerArchProtocolGuid,
- TPL_CALLBACK,
- RegisterTimerArchProtocol,
- NULL,
- &gRegistration
- );
-
- return EFI_SUCCESS;
-}
-
diff --git a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf b/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
deleted file mode 100644
index 19f133e952..0000000000
--- a/EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
+++ /dev/null
@@ -1,51 +0,0 @@
-## @file
-# NULL instance of Timer Library as a template.
-#
-# A non-functional instance of the Timer Library that can be used as a template
-# for the implementation of a functional timer library instance. This library instance can
-# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer
-# services as well as EBC modules that require timer services.
-#
-# Copyright (c) 2007 - 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 = EmuDxeTimerLib
- FILE_GUID = 74B62391-AD0D-1B4D-8784-151404F9D538
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TimerLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER UEFI_APPLICATION
-
- CONSTRUCTOR = DxeTimerLibConstructor
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- DxeTimerLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- EmuThunkLib
- UefiLib
- UefiBootServicesTableLib
-
-[Protocols]
- gEfiTimerArchProtocolGuid
diff --git a/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c b/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
deleted file mode 100644
index 46d2a7ee03..0000000000
--- a/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "BdsPlatform.h"
-
-EMU_SYSTEM_CONFIGURATION mSystemConfigData;
-
-VOID
-SetupVariableInit (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN Size;
-
- Size = sizeof (mSystemConfigData);
- Status = gRT->GetVariable (
- L"Setup",
- &gEmuSystemConfigGuid,
- NULL,
- &Size,
- (VOID *) &mSystemConfigData
- );
-
- if (EFI_ERROR (Status)) {
- //
- // SetupVariable is corrupt
- //
- mSystemConfigData.ConOutRow = PcdGet32 (PcdConOutColumn);
- mSystemConfigData.ConOutColumn = PcdGet32 (PcdConOutRow);
-
- Status = gRT->SetVariable (
- L"Setup",
- &gEmuSystemConfigGuid,
- 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/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h b/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h
deleted file mode 100644
index a099fecda0..0000000000
--- a/EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _BDS_PLATFORM_H
-#define _BDS_PLATFORM_H
-
-#include <PiDxe.h>
-
-#include <Guid/EmuSystemConfig.h>
-#include <Protocol/EmuThunk.h>
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/EmuGraphicsWindow.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>
-
-
-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 {
- EMU_VENDOR_DEVICE_PATH_NODE EmuBus;
- EMU_VENDOR_DEVICE_PATH_NODE EmuGraphicsWindow;
- EFI_DEVICE_PATH_PROTOCOL End;
-} EMU_PLATFORM_UGA_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/EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf b/EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
deleted file mode 100644
index 526a159b96..0000000000
--- a/EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
+++ /dev/null
@@ -1,66 +0,0 @@
-## @file
-# Platfrom BDS driver
-#
-# Do platform action customized by IBV/OEM.
-# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuBdsLib
- FILE_GUID = 59569181-CBF8-2E44-9C3E-C2AB2F5608E1
- 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
- EmulatorPkg/EmulatorPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- BaseLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- PcdLib
- GenericBdsLib
- DevicePathLib
-
-
-[Guids]
- gEmuSystemConfigGuid
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
-
-[Depex]
- gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/EmulatorPkg/Library/EmuBdsLib/PlatformData.c b/EmulatorPkg/Library/EmuBdsLib/PlatformData.c
deleted file mode 100644
index 3eb959b894..0000000000
--- a/EmulatorPkg/Library/EmuBdsLib/PlatformData.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "BdsPlatform.h"
-
-
-
-EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
- }
- },
- EMU_THUNK_PROTOCOL_GUID
- },
- 0
- },
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
- },
- },
- EMU_GRAPHICS_WINDOW_PROTOCOL_GUID,
- },
- 0
- },
- gEndEntire
-};
-
-//
-// Predefined platform default console device path
-//
-BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
- {
- (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/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf b/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf
deleted file mode 100644
index 3b008ccb56..0000000000
--- a/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf
+++ /dev/null
@@ -1,42 +0,0 @@
-## @file
-# Instance of Memory Allocation Library using EFI Boot Services.
-#
-# Memory Allocation Library that uses EFI Boot Services to allocate
-# and free memory. Calls OS malloc to enable OS based debug tools
-#
-# 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 = GuardUefiMemoryAllocationLib
- FILE_GUID = DB290230-3EFA-064F-A317-E146925684FE
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = MemoryAllocationLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER DXE_CORE
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- MemoryAllocationLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- BaseMemoryLib
- UefiBootServicesTableLib
- EmuThunkLib
diff --git a/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/MemoryAllocationLib.c b/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/MemoryAllocationLib.c
deleted file mode 100644
index d6e20d6f74..0000000000
--- a/EmulatorPkg/Library/GuardUefiMemoryAllocationLib/MemoryAllocationLib.c
+++ /dev/null
@@ -1,819 +0,0 @@
-/** @file
- Support routines for memory allocation routines based
- on boot services for Dxe phase drivers using OS malloc.
-
- OS malloc is used so OS based malloc debugging tools can be used.
- If a single driver links against this lib protocols from other
- drivers, or EFI boot services can return a buffer that needs to
- freed using the EFI scheme. This is why the gEmuThunk->Free ()
- can detect if the memory rang is for EFI so the right free can be
- called.
-
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
- Portions copyright (c) 2011, Apple Inc. All rights reserved.
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include <Uefi.h>
-
-
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/EmuThunkLib.h>
-
-/**
- Allocates one or more 4KB pages of a certain memory type.
-
- Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
- buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
- If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param MemoryType The type of memory to allocate.
- @param Pages The number of 4 KB pages to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalAllocatePages (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS Memory;
-
- if (Pages == 0) {
- return NULL;
- }
-
- return gEmuThunk->Valloc (Pages * EFI_PAGE_SIZE);
-}
-
-/**
- Allocates one or more 4KB pages of type EfiBootServicesData.
-
- Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
- allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
- is returned. If there is not enough memory remaining to satisfy the request, then NULL is
- returned.
-
- @param Pages The number of 4 KB pages to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocatePages (
- IN UINTN Pages
- )
-{
- return InternalAllocatePages (EfiBootServicesData, Pages);
-}
-
-/**
- Allocates one or more 4KB pages of type EfiRuntimeServicesData.
-
- Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
- allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
- is returned. If there is not enough memory remaining to satisfy the request, then NULL is
- returned.
-
- @param Pages The number of 4 KB pages to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateRuntimePages (
- IN UINTN Pages
- )
-{
- return InternalAllocatePages (EfiRuntimeServicesData, Pages);
-}
-
-/**
- Allocates one or more 4KB pages of type EfiReservedMemoryType.
-
- Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
- allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
- is returned. If there is not enough memory remaining to satisfy the request, then NULL is
- returned.
-
- @param Pages The number of 4 KB pages to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateReservedPages (
- IN UINTN Pages
- )
-{
- return InternalAllocatePages (EfiReservedMemoryType, Pages);
-}
-
-/**
- Frees one or more 4KB pages that were previously allocated with one of the page allocation
- functions in the Memory Allocation Library.
-
- Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
- must have been allocated on a previous call to the page allocation services of the Memory
- Allocation Library. If it is not possible to free allocated pages, then this function will
- perform no actions.
-
- If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
- then ASSERT().
- If Pages is zero, then ASSERT().
-
- @param Buffer The pointer to the buffer of pages to free.
- @param Pages The number of 4 KB pages to free.
-
-**/
-VOID
-EFIAPI
-FreePages (
- IN VOID *Buffer,
- IN UINTN Pages
- )
-{
- EFI_STATUS Status;
-
- ASSERT (Pages != 0);
- if (!gEmuThunk->Free (Buffer)) {
- // The Free thunk will not free memory allocated in emulated EFI memory.
- // The assmuption is this was allocated directly by EFI. We need this as some
- // times protocols or EFI BootServices can return dynamically allocated buffers.
- Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
- Allocates one or more 4KB pages of a certain memory type at a specified alignment.
-
- Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment
- specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.
- If there is not enough memory at the specified alignment remaining to satisfy the request, then
- NULL is returned.
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().
-
- @param MemoryType The type of memory to allocate.
- @param Pages The number of 4 KB pages to allocate.
- @param Alignment The requested alignment of the allocation. Must be a power of two.
- If Alignment is zero, then byte alignment is used.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalAllocateAlignedPages (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN UINTN Alignment
- )
-{
- EFI_STATUS Status;
- VOID *Memory;
- UINTN AlignedMemory;
- UINTN AlignmentMask;
- UINTN UnalignedPages;
- UINTN RealPages;
-
- //
- // Alignment must be a power of two or zero.
- //
- ASSERT ((Alignment & (Alignment - 1)) == 0);
-
- if (Pages == 0) {
- return NULL;
- }
- if (Alignment > EFI_PAGE_SIZE) {
- //
- // Caculate the total number of pages since alignment is larger than page size.
- //
- AlignmentMask = Alignment - 1;
- RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
- //
- // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
- //
- ASSERT (RealPages > Pages);
-
- Memory = gEmuThunk->Valloc (Pages * EFI_PAGE_SIZE);
- if (Memory != NULL) {
- return NULL;
- }
- AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
- UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
- if (UnalignedPages > 0) {
- //
- // Free first unaligned page(s).
- //
- FreePages (Memory, UnalignedPages);
- }
- Memory = (VOID *) (AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
- UnalignedPages = RealPages - Pages - UnalignedPages;
- if (UnalignedPages > 0) {
- //
- // Free last unaligned page(s).
- //
- FreePages (Memory, UnalignedPages);
- }
- } else {
- //
- // Do not over-allocate pages in this case.
- //
- Memory = gEmuThunk->Valloc (Pages * EFI_PAGE_SIZE);
- if (Memory != NULL) {
- return NULL;
- }
- AlignedMemory = (UINTN) Memory;
- }
- return (VOID *) AlignedMemory;
-}
-
-/**
- Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
-
- Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
- alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
- returned. If there is not enough memory at the specified alignment remaining to satisfy the
- request, then NULL is returned.
-
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().
-
- @param Pages The number of 4 KB pages to allocate.
- @param Alignment The requested alignment of the allocation. Must be a power of two.
- If Alignment is zero, then byte alignment is used.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateAlignedPages (
- IN UINTN Pages,
- IN UINTN Alignment
- )
-{
- return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
-}
-
-/**
- Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
-
- Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
- alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
- returned. If there is not enough memory at the specified alignment remaining to satisfy the
- request, then NULL is returned.
-
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().
-
- @param Pages The number of 4 KB pages to allocate.
- @param Alignment The requested alignment of the allocation. Must be a power of two.
- If Alignment is zero, then byte alignment is used.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateAlignedRuntimePages (
- IN UINTN Pages,
- IN UINTN Alignment
- )
-{
- return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
-}
-
-/**
- Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
-
- Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
- alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
- returned. If there is not enough memory at the specified alignment remaining to satisfy the
- request, then NULL is returned.
-
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().
-
- @param Pages The number of 4 KB pages to allocate.
- @param Alignment The requested alignment of the allocation. Must be a power of two.
- If Alignment is zero, then byte alignment is used.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateAlignedReservedPages (
- IN UINTN Pages,
- IN UINTN Alignment
- )
-{
- return InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
-}
-
-/**
- Frees one or more 4KB pages that were previously allocated with one of the aligned page
- allocation functions in the Memory Allocation Library.
-
- Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
- must have been allocated on a previous call to the aligned page allocation services of the Memory
- Allocation Library. If it is not possible to free allocated pages, then this function will
- perform no actions.
-
- If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
- Library, then ASSERT().
- If Pages is zero, then ASSERT().
-
- @param Buffer The pointer to the buffer of pages to free.
- @param Pages The number of 4 KB pages to free.
-
-**/
-VOID
-EFIAPI
-FreeAlignedPages (
- IN VOID *Buffer,
- IN UINTN Pages
- )
-{
- FreePages (Buffer, Pages);
-}
-
-/**
- Allocates a buffer of a certain pool type.
-
- Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
- pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
- returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param MemoryType The type of memory to allocate.
- @param AllocationSize The number of bytes to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalAllocatePool (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN AllocationSize
- )
-{
- return gEmuThunk->Malloc (AllocationSize);
-}
-
-/**
- Allocates a buffer of type EfiBootServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
- pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
- returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocatePool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocatePool (EfiBootServicesData, AllocationSize);
-}
-
-/**
- Allocates a buffer of type EfiRuntimeServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
- a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
- returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateRuntimePool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
-}
-
-/**
- Allocates a buffer of type EfiReservedMemoryType.
-
- Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
- a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
- returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateReservedPool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
-}
-
-/**
- Allocates and zeros a buffer of a certain pool type.
-
- Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
- with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
- buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
- then NULL is returned.
-
- @param PoolType The type of memory to allocate.
- @param AllocationSize The number of bytes to allocate and zero.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalAllocateZeroPool (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN AllocationSize
- )
-{
- VOID *Memory;
-
- Memory = InternalAllocatePool (PoolType, AllocationSize);
- if (Memory != NULL) {
- Memory = ZeroMem (Memory, AllocationSize);
- }
- return Memory;
-}
-
-/**
- Allocates and zeros a buffer of type EfiBootServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
- buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
- valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
- request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate and zero.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateZeroPool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
-}
-
-/**
- Allocates and zeros a buffer of type EfiRuntimeServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
- buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
- valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
- request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate and zero.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateRuntimeZeroPool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
-}
-
-/**
- Allocates and zeros a buffer of type EfiReservedMemoryType.
-
- Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
- buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
- valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
- request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate and zero.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateReservedZeroPool (
- IN UINTN AllocationSize
- )
-{
- return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
-}
-
-/**
- Copies a buffer to an allocated buffer of a certain pool type.
-
- Allocates the number bytes specified by AllocationSize of a certain pool type, copies
- AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
- allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
- is not enough memory remaining to satisfy the request, then NULL is returned.
- If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- @param PoolType The type of pool to allocate.
- @param AllocationSize The number of bytes to allocate and zero.
- @param Buffer The buffer to copy to the allocated buffer.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalAllocateCopyPool (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN AllocationSize,
- IN CONST VOID *Buffer
- )
-{
- VOID *Memory;
-
- ASSERT (Buffer != NULL);
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
-
- Memory = InternalAllocatePool (PoolType, AllocationSize);
- if (Memory != NULL) {
- Memory = CopyMem (Memory, Buffer, AllocationSize);
- }
- return Memory;
-}
-
-/**
- Copies a buffer to an allocated buffer of type EfiBootServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
- AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
- allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
- is not enough memory remaining to satisfy the request, then NULL is returned.
-
- If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- @param AllocationSize The number of bytes to allocate and zero.
- @param Buffer The buffer to copy to the allocated buffer.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateCopyPool (
- IN UINTN AllocationSize,
- IN CONST VOID *Buffer
- )
-{
- return InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
-}
-
-/**
- Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
- AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
- allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
- is not enough memory remaining to satisfy the request, then NULL is returned.
-
- If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- @param AllocationSize The number of bytes to allocate and zero.
- @param Buffer The buffer to copy to the allocated buffer.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateRuntimeCopyPool (
- IN UINTN AllocationSize,
- IN CONST VOID *Buffer
- )
-{
- return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
-}
-
-/**
- Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
-
- Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
- AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
- allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
- is not enough memory remaining to satisfy the request, then NULL is returned.
-
- If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- @param AllocationSize The number of bytes to allocate and zero.
- @param Buffer The buffer to copy to the allocated buffer.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateReservedCopyPool (
- IN UINTN AllocationSize,
- IN CONST VOID *Buffer
- )
-{
- return InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
-}
-
-/**
- Reallocates a buffer of a specified memory type.
-
- Allocates and zeros the number bytes specified by NewSize from memory of the type
- specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
- NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
- OldBuffer is freed. A pointer to the newly allocated buffer is returned.
- If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
- enough memory remaining to satisfy the request, then NULL is returned.
-
- If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
- is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
-
- @param PoolType The type of pool to allocate.
- @param OldSize The size, in bytes, of OldBuffer.
- @param NewSize The size, in bytes, of the buffer to reallocate.
- @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
- parameter that may be NULL.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-InternalReallocatePool (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN OldSize,
- IN UINTN NewSize,
- IN VOID *OldBuffer OPTIONAL
- )
-{
- VOID *NewBuffer;
-
- NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
- if (NewBuffer != NULL && OldBuffer != NULL) {
- CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
- FreePool (OldBuffer);
- }
- return NewBuffer;
-}
-
-/**
- Reallocates a buffer of type EfiBootServicesData.
-
- Allocates and zeros the number bytes specified by NewSize from memory of type
- EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
- NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
- OldBuffer is freed. A pointer to the newly allocated buffer is returned.
- If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
- enough memory remaining to satisfy the request, then NULL is returned.
-
- If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
- is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
-
- @param OldSize The size, in bytes, of OldBuffer.
- @param NewSize The size, in bytes, of the buffer to reallocate.
- @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
- parameter that may be NULL.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-ReallocatePool (
- IN UINTN OldSize,
- IN UINTN NewSize,
- IN VOID *OldBuffer OPTIONAL
- )
-{
- return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
-}
-
-/**
- Reallocates a buffer of type EfiRuntimeServicesData.
-
- Allocates and zeros the number bytes specified by NewSize from memory of type
- EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
- NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
- OldBuffer is freed. A pointer to the newly allocated buffer is returned.
- If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
- enough memory remaining to satisfy the request, then NULL is returned.
-
- If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
- is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
-
- @param OldSize The size, in bytes, of OldBuffer.
- @param NewSize The size, in bytes, of the buffer to reallocate.
- @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
- parameter that may be NULL.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-ReallocateRuntimePool (
- IN UINTN OldSize,
- IN UINTN NewSize,
- IN VOID *OldBuffer OPTIONAL
- )
-{
- return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
-}
-
-/**
- Reallocates a buffer of type EfiReservedMemoryType.
-
- Allocates and zeros the number bytes specified by NewSize from memory of type
- EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
- NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
- OldBuffer is freed. A pointer to the newly allocated buffer is returned.
- If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
- enough memory remaining to satisfy the request, then NULL is returned.
-
- If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
- is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
-
- @param OldSize The size, in bytes, of OldBuffer.
- @param NewSize The size, in bytes, of the buffer to reallocate.
- @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
- parameter that may be NULL.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-ReallocateReservedPool (
- IN UINTN OldSize,
- IN UINTN NewSize,
- IN VOID *OldBuffer OPTIONAL
- )
-{
- return InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
-}
-
-/**
- Frees a buffer that was previously allocated with one of the pool allocation functions in the
- Memory Allocation Library.
-
- Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
- pool allocation services of the Memory Allocation Library. If it is not possible to free pool
- resources, then this function will perform no actions.
-
- If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
- then ASSERT().
-
- @param Buffer The pointer to the buffer to free.
-
-**/
-VOID
-EFIAPI
-FreePool (
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
-
- if (!gEmuThunk->Free (Buffer)) {
- // The Free thunk will not free memory allocated in emulated EFI memory.
- // The assmuption is this was allocated directly by EFI. We need this as some
- // times protocols or EFI BootServices can return dynamically allocated buffers.
- Status = gBS->FreePool (Buffer);
- ASSERT_EFI_ERROR (Status);
- }
-}
-
diff --git a/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.c b/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.c
deleted file mode 100644
index e555026601..0000000000
--- a/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*++ @file
-
-Copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Uefi.h>
-#include <Protocol/SimpleTextInEx.h>
-
-
-/**
- KeyMapMake gets called on key presses.
-
- @param KeyData Key that was pressed.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-KeyMapMake (
- IN EFI_KEY_DATA *KeyData
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- KeyMapBreak gets called on key releases.
-
- @param KeyData Key that was pressed.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-KeyMapBreak (
- IN EFI_KEY_DATA *KeyData
- )
-{
- return EFI_SUCCESS;
-} \ No newline at end of file
diff --git a/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf b/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
deleted file mode 100644
index 0b03e416ac..0000000000
--- a/EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-## @file
-# A library to produce the global variable 'gEmuThunk'
-#
-# This library contains a single global variable 'gEmuThunk' along with a constructor to
-# initialize that global.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = KeyMapLibNull
- FILE_GUID = 6B7067C7-A843-A34C-9530-48446963B740
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = KeyMapLib
-
-[Sources]
- KeyMapLibNull.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- HobLib
- DebugLib
-
-
diff --git a/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiCoreServicesTablePointerLib.inf b/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiCoreServicesTablePointerLib.inf
deleted file mode 100644
index f50f8a46de..0000000000
--- a/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiCoreServicesTablePointerLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# Instance of PEI Services Table Pointer Library using global variable for the table pointer.
-#
-# PEI Services Table Pointer Library implementation that retrieves a pointer to the
-# PEI Services Table from a global variable. Not available to modules that execute from
-# read-only memory.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmulatorPkgPeiCoreServicesTablePointerLib
- FILE_GUID = E9A22529-44FA-3E4A-A66B-1E918E7AB26A
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeiServicesTablePointerLib|PEI_CORE
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- PeiServicesTablePointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- DebugLib
-
diff --git a/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiServicesTablePointer.c b/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiServicesTablePointer.c
deleted file mode 100644
index 06f995b0d3..0000000000
--- a/EmulatorPkg/Library/PeiCoreServicesTablePointerLib/PeiServicesTablePointer.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/** @file
- PEI Services Table Pointer Library.
-
- This library is used for PEIM which does executed from flash device directly but
- executed in memory.
-
- Copyright (c) 2006 - 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 <PiPei.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/DebugLib.h>
-
-CONST EFI_PEI_SERVICES **gPeiServices;
-
-/**
- Caches a pointer PEI Services Table.
-
- Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
- in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
- Pre-EFI Initialization Core Interface Specification.
-
- If PeiServicesTablePointer is NULL, then ASSERT().
-
- @param PeiServicesTablePointer The address of PeiServices pointer.
-**/
-VOID
-EFIAPI
-SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
- )
-{
- ASSERT (PeiServicesTablePointer != NULL);
- gPeiServices = PeiServicesTablePointer;
-}
-
-/**
- Retrieves the cached value of the PEI Services Table pointer.
-
- Returns the cached value of the PEI Services Table pointer in a CPU specific manner
- as specified in the CPU binding section of the Platform Initialization Pre-EFI
- Initialization Core Interface Specification.
-
- If the cached PEI Services Table pointer is NULL, then ASSERT().
-
- @return The pointer to PeiServices.
-
-**/
-CONST EFI_PEI_SERVICES **
-EFIAPI
-GetPeiServicesTablePointer (
- VOID
- )
-{
- ASSERT (gPeiServices != NULL);
- return gPeiServices;
-}
-
-
-/**
- The constructor function caches the pointer to PEI services.
-
- The constructor function caches the pointer to PEI services.
- It will always return EFI_SUCCESS.
-
- @param FileHandle The handle of FFS header the loaded driver.
- @param PeiServices The pointer to the PEI services.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesTablePointerLibConstructor (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- gPeiServices = PeiServices;
- return EFI_SUCCESS;
-}
-
-/**
- Perform CPU specific actions required to migrate the PEI Services Table
- pointer from temporary RAM to permanent RAM.
-
- For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
- a dedicated CPU register. This means that there is no memory storage
- associated with storing the PEI Services Table pointer, so no additional
- migration actions are required for Itanium or ARM CPUs.
-
-**/
-VOID
-EFIAPI
-MigratePeiServicesTablePointer (
- VOID
- )
-{
- //
- // PEI Services Table pointer is cached in the global variable. No additional
- // migration actions are required.
- //
- return;
-}
-
diff --git a/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.c b/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.c
deleted file mode 100644
index b30ec8f0fc..0000000000
--- a/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/** @file
- Provides services to perform additional actions to relocate and unload
- PE/Coff image for Emu environment specific purpose such as souce level debug.
- This version only works for PEI phase
-
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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 <Ppi/EmuThunk.h>
-#include <Protocol/EmuThunk.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/PeCoffExtraActionLib.h>
-#include <Library/EmuMagicPageLib.h>
-
-//
-// Cache of UnixThunk protocol
-//
-EMU_THUNK_PROTOCOL *mThunk = 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
-EmuPeCoffGetThunkStucture (
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
-
-
- //
- // Locate Unix ThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- EMU_MAGIC_PAGE()->Thunk = (EMU_THUNK_PROTOCOL *) ThunkPpi->Thunk ();
-
- 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 (EMU_MAGIC_PAGE()->Thunk == NULL) {
- EmuPeCoffGetThunkStucture ();
- }
- EMU_MAGIC_PAGE()->Thunk->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 (EMU_MAGIC_PAGE()->Thunk == NULL) {
- EmuPeCoffGetThunkStucture ();
- }
- EMU_MAGIC_PAGE()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
-}
diff --git a/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf b/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
deleted file mode 100644
index 9a757f7294..0000000000
--- a/EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
+++ /dev/null
@@ -1,49 +0,0 @@
-## @file
-# PeCoff extra action libary for Pei phase that run Emu emulator.
-#
-# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiEmuPeCoffExtraActionLib
- FILE_GUID = 79C4E72A-730B-F040-8129-95877B3A97A8
- 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]
- PeiEmuPeCoffExtraActionLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- PeiServicesLib
- DebugLib
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
diff --git a/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.c b/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.c
deleted file mode 100644
index 46560f8117..0000000000
--- a/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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/PeCoffGetEntryPointLib.h>
-#include <Library/PeiServicesLib.h>
-#include <IndustryStandard/PeImage.h>
-#include <Library/DebugLib.h>
-
-#include <Ppi/EmuThunk.h>
-#include <Protocol/EmuThunk.h>
-
-
-
-/**
- Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
- into system memory with the PE/COFF Loader Library functions.
-
- Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry
- point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then
- return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS.
- If Pe32Data is NULL, then ASSERT().
- If EntryPoint is NULL, then ASSERT().
-
- @param Pe32Data The pointer to the PE/COFF image that is loaded in system memory.
- @param EntryPoint The pointer to entry point to the PE/COFF image to return.
-
- @retval RETURN_SUCCESS EntryPoint was returned.
- @retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image.
-
-**/
-RETURN_STATUS
-EFIAPI
-PeCoffLoaderGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
- EMU_THUNK_PROTOCOL *Thunk;
-
- //
- // Locate EmuThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
-
- return Thunk->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 Emu 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 (UINT32) SizeOfHeaders;
-}
-
diff --git a/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf b/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
deleted file mode 100644
index bf35a35f1e..0000000000
--- a/EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
+++ /dev/null
@@ -1,49 +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>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiEmuPeCoffGetEntryPointLib
- FILE_GUID = 1CBED347-7DE6-BC48-AC68-3758598124D2
- 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]
- PeiEmuPeCoffGetEntryPointLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- PeiServicesLib
- DebugLib
-
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
diff --git a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.c b/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.c
deleted file mode 100644
index b3a20a9811..0000000000
--- a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/** @file
- Serial Port Lib that thunks back to Emulator services to write to StdErr.
- All read functions are stubed out. There is no constructor so this lib can
- be linked with PEI Core.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Portions copyright (c) 2011, 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/SerialPortLib.h>
-#include <Library/PeiServicesLib.h>
-
-#include <Ppi/EmuThunk.h>
-#include <Protocol/EmuThunk.h>
-
-
-
-/**
- Initialize the serial device hardware.
-
- If no initialization is required, then return RETURN_SUCCESS.
- If the serial device was successfully initialized, then return RETURN_SUCCESS.
- If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
-
- @retval RETURN_SUCCESS The serial device was initialized.
- @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-/**
- Write data from buffer to serial device.
-
- Writes NumberOfBytes data bytes from Buffer to the serial device.
- The number of bytes actually written to the serial device is returned.
- If the return value is less than NumberOfBytes, then the write operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to be written.
- @param NumberOfBytes The number of bytes to written to the serial device.
-
- @retval 0 NumberOfBytes is 0.
- @retval >0 The number of bytes written to the serial device.
- If this value is less than NumberOfBytes, then the read operation failed.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
- EMU_THUNK_PROTOCOL *Thunk;
-
- //
- // Locate EmuThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- if (!EFI_ERROR (Status)) {
- Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
- return Thunk->WriteStdErr (Buffer, NumberOfBytes);
- }
-
- return 0;
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- Reads NumberOfBytes data bytes from a serial device into the buffer
- specified by Buffer. The number of bytes actually read is returned.
- If the return value is less than NumberOfBytes, then the rest operation failed.
- If Buffer is NULL, then ASSERT().
- If NumberOfBytes is zero, then return 0.
-
- @param Buffer The pointer to the data buffer to store the data read from the serial device.
- @param NumberOfBytes The number of bytes which will be read.
-
- @retval 0 Read data failed; No data is to be read.
- @retval >0 The actual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return 0;
-}
-
-/**
- Polls a serial device to see if there is any data waiting to be read.
-
- Polls a serial device to see if there is any data waiting to be read.
- If there is data waiting to be read from the serial device, then TRUE is returned.
- If there is no data waiting to be read from the serial device, then FALSE is returned.
-
- @retval TRUE Data is waiting to be read from the serial device.
- @retval FALSE There is no data waiting to be read from the serial device.
-
-**/
-BOOLEAN
-EFIAPI
-SerialPortPoll (
- VOID
- )
-{
- return FALSE;
-}
-
diff --git a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf b/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
deleted file mode 100644
index d431acdb07..0000000000
--- a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
+++ /dev/null
@@ -1,46 +0,0 @@
-## @file
-# Write only instance of Serial Port Library with empty functions.
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiEmuSerialPortLibNull
- FILE_GUID = E4541241-8897-411a-91F8-7D7E45837146
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SerialPortLib| PEI_CORE PEIM SEC
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PeiEmuSerialPortLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
-
-[LibraryClasses]
- PeiServicesLib
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-
-
-
diff --git a/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
deleted file mode 100644
index 5aaf296389..0000000000
--- a/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
- PEI Services Table Pointer Library.
-
- This library is used for PEIM which does executed from flash device directly but
- executed in memory.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Portiions copyrigth (c) 2011, Apple Inc. All rights reserved.
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiPei.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/DebugLib.h>
-
-#include <Ppi/MemoryDiscovered.h>
-
-
-CONST EFI_PEI_SERVICES **gPeiServices = NULL;
-
-/**
- Caches a pointer PEI Services Table.
-
- Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
- in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
- Pre-EFI Initialization Core Interface Specification.
-
- If PeiServicesTablePointer is NULL, then ASSERT().
-
- @param PeiServicesTablePointer The address of PeiServices pointer.
-**/
-VOID
-EFIAPI
-SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
- )
-{
- ASSERT (PeiServicesTablePointer != NULL);
- ASSERT (*PeiServicesTablePointer != NULL);
- gPeiServices = PeiServicesTablePointer;
-}
-
-/**
- Retrieves the cached value of the PEI Services Table pointer.
-
- Returns the cached value of the PEI Services Table pointer in a CPU specific manner
- as specified in the CPU binding section of the Platform Initialization Pre-EFI
- Initialization Core Interface Specification.
-
- If the cached PEI Services Table pointer is NULL, then ASSERT().
-
- @return The pointer to PeiServices.
-
-**/
-CONST EFI_PEI_SERVICES **
-EFIAPI
-GetPeiServicesTablePointer (
- VOID
- )
-{
- ASSERT (gPeiServices != NULL);
- ASSERT (*gPeiServices != NULL);
- return gPeiServices;
-}
-
-
-
-/**
- Notification service to be called when gEmuThunkPpiGuid is installed.
-
- @param PeiServices Indirect reference to the PEI Services Table.
- @param NotifyDescriptor Address of the notification descriptor data structure. Type
- EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
- @param Ppi Address of the PPI that was installed.
-
- @retval EFI_STATUS This function will install a PPI to PPI database. The status
- code will be the code for (*PeiServices)->InstallPpi.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesTablePointerNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
- )
-{
- gPeiServices = (CONST EFI_PEI_SERVICES **)PeiServices;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnThunkList = {
- (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiMemoryDiscoveredPpiGuid,
- PeiServicesTablePointerNotifyCallback
-};
-
-
-/**
- Constructor register notification on when PPI updates. If PPI is
- alreay installed registering the notify will cause the handle to
- run.
-
- @param FileHandle The handle of FFS header the loaded driver.
- @param PeiServices The pointer to the PEI services.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesTablePointerLibConstructor (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- gPeiServices = (CONST EFI_PEI_SERVICES **)PeiServices;
-
- // register to be told when PeiServices pointer is updated
- Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnThunkList);
- ASSERT_EFI_ERROR (Status);
- return Status;
-}
-
-/**
- Perform CPU specific actions required to migrate the PEI Services Table
- pointer from temporary RAM to permanent RAM.
-
- For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
- a dedicated CPU register. This means that there is no memory storage
- associated with storing the PEI Services Table pointer, so no additional
- migration actions are required for Itanium or ARM CPUs.
-
-**/
-VOID
-EFIAPI
-MigratePeiServicesTablePointer (
- VOID
- )
-{
- //
- // PEI Services Table pointer is cached in the global variable. No additional
- // migration actions are required.
- //
- return;
-}
-
diff --git a/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf b/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
deleted file mode 100644
index a4844bab09..0000000000
--- a/EmulatorPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+++ /dev/null
@@ -1,46 +0,0 @@
-## @file
-# Instance of PEI Services Table Pointer Library using global variable for the table pointer.
-#
-# PEI Services Table Pointer Library implementation that retrieves a pointer to the
-# PEI Services Table from a global variable. Not available to modules that execute from
-# read-only memory.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmulatorPkgPeiServicesTablePointerLib
- FILE_GUID = 5FD8B4ED-D66F-C144-9953-AC557C649925
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM
-
- CONSTRUCTOR = PeiServicesTablePointerLibConstructor
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- PeiServicesTablePointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- DebugLib
-
-[Ppis]
- gEfiPeiMemoryDiscoveredPpiGuid
-
diff --git a/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointer.c b/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointer.c
deleted file mode 100644
index fa04ed3e04..0000000000
--- a/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointer.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- PEI Services Table Pointer Library.
-
- Store PEI Services Table pointer via gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage.
- This emulates a platform SRAM. The PI mechaism does not work in the emulator due to
- lack of privledge.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Portiions copyrigth (c) 2011, Apple Inc. All rights reserved.
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiPei.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/EmuMagicPageLib.h>
-
-
-/**
- Caches a pointer PEI Services Table.
-
- Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
- in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
- Pre-EFI Initialization Core Interface Specification.
-
- If PeiServicesTablePointer is NULL, then ASSERT().
-
- @param PeiServicesTablePointer The address of PeiServices pointer.
-**/
-VOID
-EFIAPI
-SetPeiServicesTablePointer (
- IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
- )
-{
- ASSERT (PeiServicesTablePointer != NULL);
- ASSERT (*PeiServicesTablePointer != NULL);
- EMU_MAGIC_PAGE()->PeiServicesTablePointer = PeiServicesTablePointer;
-}
-
-/**
- Retrieves the cached value of the PEI Services Table pointer.
-
- Returns the cached value of the PEI Services Table pointer in a CPU specific manner
- as specified in the CPU binding section of the Platform Initialization Pre-EFI
- Initialization Core Interface Specification.
-
- If the cached PEI Services Table pointer is NULL, then ASSERT().
-
- @return The pointer to PeiServices.
-
-**/
-CONST EFI_PEI_SERVICES **
-EFIAPI
-GetPeiServicesTablePointer (
- VOID
- )
-{
- CONST EFI_PEI_SERVICES **PeiServicesTablePointer;
-
- PeiServicesTablePointer = EMU_MAGIC_PAGE()->PeiServicesTablePointer;
- ASSERT (PeiServicesTablePointer != NULL);
- ASSERT (*PeiServicesTablePointer != NULL);
- return PeiServicesTablePointer;
-}
-
-/**
- Perform CPU specific actions required to migrate the PEI Services Table
- pointer from temporary RAM to permanent RAM.
-
- For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
- immediately preceding the Interrupt Descriptor Table (IDT) in memory.
- For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
- a dedicated CPU register. This means that there is no memory storage
- associated with storing the PEI Services Table pointer, so no additional
- migration actions are required for Itanium or ARM CPUs.
-
-**/
-VOID
-EFIAPI
-MigratePeiServicesTablePointer (
- VOID
- )
-{
- //
- // PEI Services Table pointer is cached in SRAM. No additional
- // migration actions are required.
- //
- return;
-}
-
-
diff --git a/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf b/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf
deleted file mode 100644
index 5c42914b45..0000000000
--- a/EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file
-# PEI Services Table Pointer Library.
-#
-# Store PEI Services Table pointer via gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage.
-# This emulates a platform SRAM. The PI mechaism does not work in the emulator due to
-# lack of privledge.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmulatorPkgPeiServicesTablePointerLib
- FILE_GUID = 7488FC06-370A-1C41-B05C-7395559A535A
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- PeiServicesTablePointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
diff --git a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c b/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c
deleted file mode 100644
index 4a212efbef..0000000000
--- a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/** @file
- A non-functional instance of the Timer Library.
-
- 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 <PiPei.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-
-#include <Ppi/EmuThunk.h>
-#include <Protocol/EmuThunk.h>
-
-/**
- Stalls the CPU for at least the given number of microseconds.
-
- Stalls the CPU for the number of microseconds specified by MicroSeconds.
-
- @param MicroSeconds The minimum number of microseconds to delay.
-
- @return The value of MicroSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-MicroSecondDelay (
- IN UINTN MicroSeconds
- )
-{
- return NanoSecondDelay (MicroSeconds * 1000);
-}
-
-/**
- Stalls the CPU for at least the given number of nanoseconds.
-
- Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
-
- @param NanoSeconds The minimum number of nanoseconds to delay.
-
- @return The value of NanoSeconds inputted.
-
-**/
-UINTN
-EFIAPI
-NanoSecondDelay (
- IN UINTN NanoSeconds
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
- EMU_THUNK_PROTOCOL *Thunk;
-
- //
- // Locate EmuThunkPpi for
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- if (!EFI_ERROR (Status)) {
- Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
- Thunk->Sleep (NanoSeconds * 100);
- return NanoSeconds;
- }
-
- return 0;
-}
-
-/**
- Retrieves the current value of a 64-bit free running performance counter.
-
- The counter can either count up by 1 or count down by 1. If the physical
- performance counter counts by a larger increment, then the counter values
- must be translated. The properties of the counter can be retrieved from
- GetPerformanceCounterProperties().
-
- @return The current value of the free running performance counter.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounter (
- VOID
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
- EMU_THUNK_PROTOCOL *Thunk;
-
- //
- // Locate EmuThunkPpi for
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- if (!EFI_ERROR (Status)) {
- Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
- return Thunk->QueryPerformanceCounter ();
- }
-
- return 0;
-}
-
-/**
- Retrieves the 64-bit frequency in Hz and the range of performance counter
- values.
-
- If StartValue is not NULL, then the value that the performance counter starts
- with immediately after is it rolls over is returned in StartValue. If
- EndValue is not NULL, then the value that the performance counter end with
- immediately before it rolls over is returned in EndValue. The 64-bit
- frequency of the performance counter in Hz is always returned. If StartValue
- is less than EndValue, then the performance counter counts up. If StartValue
- is greater than EndValue, then the performance counter counts down. For
- example, a 64-bit free running counter that counts up would have a StartValue
- of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
- that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
-
- @param StartValue The value the performance counter starts with when it
- rolls over.
- @param EndValue The value that the performance counter ends with before
- it rolls over.
-
- @return The frequency in Hz.
-
-**/
-UINT64
-EFIAPI
-GetPerformanceCounterProperties (
- OUT UINT64 *StartValue, OPTIONAL
- OUT UINT64 *EndValue OPTIONAL
- )
-{
- EMU_THUNK_PPI *ThunkPpi;
- EFI_STATUS Status;
- EMU_THUNK_PROTOCOL *Thunk;
-
- //
- // Locate EmuThunkPpi for
- //
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &ThunkPpi
- );
- if (!EFI_ERROR (Status)) {
- if (StartValue != NULL) {
- *StartValue = 0ULL;
- }
- if (EndValue != NULL) {
- *EndValue = (UINT64)-1LL;
- }
-
- Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
- return Thunk->QueryPerformanceFrequency ();
- }
-
- return 0;
-}
diff --git a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf b/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
deleted file mode 100644
index e473b52376..0000000000
--- a/EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
+++ /dev/null
@@ -1,47 +0,0 @@
-## @file
-# NULL instance of Timer Library as a template.
-#
-# A non-functional instance of the Timer Library that can be used as a template
-# for the implementation of a functional timer library instance. This library instance can
-# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer
-# services as well as EBC modules that require timer services.
-#
-# Copyright (c) 2007 - 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 = EmuPeiTimerLib
- FILE_GUID = 6ABE5FDC-AE4B-474E-8E52-9546C96AE536
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TimerLib|PEIM PEI_CORE SEC
-
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PeiTimerLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- PeiServicesLib
-
-[Ppis]
- gEmuThunkPpiGuid \ No newline at end of file
diff --git a/EmulatorPkg/Library/SecPeiServicesLib/FwVol.c b/EmulatorPkg/Library/SecPeiServicesLib/FwVol.c
deleted file mode 100644
index 7fa4ddb594..0000000000
--- a/EmulatorPkg/Library/SecPeiServicesLib/FwVol.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*++ @file
- A simple FV stack so the SEC can extract the SEC Core from an
- FV.
-
-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 <PiPei.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_PEI_FV_HANDLE FvHandle,
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle
- )
-/*++
-
-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;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_FFS_FILE_HEADER **FileHeader;
-
- //
- // Convert the handle of FV to FV header for memory-mapped firmware volume
- //
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvHandle;
- FileHeader = (EFI_FFS_FILE_HEADER **)FileHandle;
-
- 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;
-}
-
diff --git a/EmulatorPkg/Library/SecPeiServicesLib/PeiServicesLib.c b/EmulatorPkg/Library/SecPeiServicesLib/PeiServicesLib.c
deleted file mode 100644
index f9ae3e64ed..0000000000
--- a/EmulatorPkg/Library/SecPeiServicesLib/PeiServicesLib.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/** @file
- Implementation for PEI Services Library.
-
- 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 <PiPei.h>
-#include <Library/EmuMagicPageLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-
-
-
-EFI_STATUS
-SecFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_PEI_FV_HANDLE VolumeHandle,
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle
- );
-
-EFI_STATUS
-SecFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_PEI_FILE_HANDLE FileHandle,
- OUT VOID **SectionData
- );
-
-
-/**
- This service enables a given PEIM to register an interface into the PEI Foundation.
-
- @param PpiList A pointer to the list of interfaces that the caller shall install.
-
- @retval EFI_SUCCESS The interface was successfully installed.
- @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
- @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
- EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
- @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesInstallPpi (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
-
- @param OldPpi The pointer to the old PEI PPI Descriptors.
- @param NewPpi The pointer to the new PEI PPI Descriptors.
-
- @retval EFI_SUCCESS The interface was successfully installed.
- @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
- @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
- EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
- @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
- @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
- installed.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesReInstallPpi (
- IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
- IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to discover a given instance of an interface.
-
- So this is, well a hack, so we can reuse the same libraries as the PEI Core
- for XIP modules....
-
- @param Guid A pointer to the GUID whose corresponding interface needs to be
- found.
- @param Instance The N-th instance of the interface that is required.
- @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
- @param Ppi A pointer to the instance of the interface.
-
- @retval EFI_SUCCESS The interface was successfully returned.
- @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesLocatePpi (
- IN CONST EFI_GUID *Guid,
- IN UINTN Instance,
- IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
- IN OUT VOID **Ppi
- )
-{
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
-
- if (Instance != 0) {
- return EFI_NOT_FOUND;
- }
-
- for (PpiList = EMU_MAGIC_PAGE()->PpiList; ; PpiList++) {
- if (CompareGuid (PpiList->Guid, Guid)) {
- if (PpiDescriptor != NULL) {
- *PpiDescriptor = PpiList;
- }
- if (Ppi != NULL) {
- *Ppi = PpiList->Ppi;
- }
- return EFI_SUCCESS;
- }
-
- if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) == EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
- break;
- }
- }
-
-
- return EFI_NOT_FOUND;
-}
-
-/**
- This service enables PEIMs to register a given service to be invoked when another service is
- installed or reinstalled.
-
- @param NotifyList A pointer to the list of notification interfaces
- that the caller shall install.
-
- @retval EFI_SUCCESS The interface was successfully installed.
- @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
- @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do
- not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES
- bit set in the Flags field.
- @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesNotifyPpi (
- IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to ascertain the present value of the boot mode.
-
- @param BootMode A pointer to contain the value of the boot mode.
-
- @retval EFI_SUCCESS The boot mode was returned successfully.
- @retval EFI_INVALID_PARAMETER BootMode is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesGetBootMode (
- OUT EFI_BOOT_MODE *BootMode
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to update the boot mode variable.
-
- @param BootMode The value of the boot mode to set.
-
- @retval EFI_SUCCESS The value was successfully updated
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesSetBootMode (
- IN EFI_BOOT_MODE BootMode
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables a PEIM to ascertain the address of the list of HOBs in memory.
-
- @param HobList A pointer to the list of HOBs that the PEI Foundation
- will initialize.
-
- @retval EFI_SUCCESS The list was successfully returned.
- @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesGetHobList (
- OUT VOID **HobList
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to create various types of HOBs.
-
- @param Type The type of HOB to be installed.
- @param Length The length of the HOB to be added.
- @param Hob The address of a pointer that will contain the
- HOB header.
-
- @retval EFI_SUCCESS The HOB was successfully created.
- @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesCreateHob (
- IN UINT16 Type,
- IN UINT16 Length,
- OUT VOID **Hob
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to discover additional firmware volumes.
-
- @param Instance This instance of the firmware volume to find. The
- value 0 is the Boot Firmware Volume (BFV).
- @param VolumeHandle Handle of the firmware volume header of the volume
- to return.
-
- @retval EFI_SUCCESS The volume was found.
- @retval EFI_NOT_FOUND The volume was not found.
- @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsFindNextVolume (
- IN UINTN Instance,
- IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to discover additional firmware files.
-
- @param SearchType A filter to find files only of this type.
- @param VolumeHandle The pointer to the firmware volume header of the
- volume to search. This parameter must point to a
- valid FFS volume.
- @param FileHandle Handle of the current file from which to begin searching.
-
- @retval EFI_SUCCESS The file was found.
- @retval EFI_NOT_FOUND The file was not found.
- @retval EFI_NOT_FOUND The header checksum was not zero.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_PEI_FV_HANDLE VolumeHandle,
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle
- )
-{
- return SecFfsFindNextFile (SearchType, VolumeHandle, FileHandle);
-}
-
-/**
- This service enables PEIMs to discover sections of a given type within a valid FFS file.
-
- @param SectionType The value of the section type to find.
- @param FileHandle A pointer to the file header that contains the set
- of sections to be searched.
- @param SectionData A pointer to the discovered section, if successful.
-
- @retval EFI_SUCCESS The section was found.
- @retval EFI_NOT_FOUND The section was not found.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_PEI_FILE_HANDLE FileHandle,
- OUT VOID **SectionData
- )
-{
- return SecFfsFindSectionData (SectionType, FileHandle, SectionData);
-}
-
-/**
- This service enables PEIMs to register the permanent memory configuration
- that has been initialized with the PEI Foundation.
-
- @param MemoryBegin The value of a region of installed memory.
- @param MemoryLength The corresponding length of a region of installed memory.
-
- @retval EFI_SUCCESS The region was successfully installed in a HOB.
- @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
- @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesInstallPeiMemory (
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service enables PEIMs to allocate memory after the permanent memory has been
- installed by a PEIM.
-
- @param MemoryType Type of memory to allocate.
- @param Pages The number of pages to allocate.
- @param Memory Pointer of memory allocated.
-
- @retval EFI_SUCCESS The memory range was successfully allocated.
- @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
- @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
- @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesAllocatePages (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Memory
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service allocates memory from the Hand-Off Block (HOB) heap.
-
- @param Size The number of bytes to allocate from the pool.
- @param Buffer If the call succeeds, a pointer to a pointer to
- the allocate buffer; otherwise, undefined.
-
- @retval EFI_SUCCESS The allocation was successful
- @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesAllocatePool (
- IN UINTN Size,
- OUT VOID **Buffer
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- Resets the entire platform.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesResetSystem (
- VOID
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service is a wrapper for the PEI Service RegisterForShadow(), except the
- pointer to the PEI Services Table has been removed. See the Platform
- Initialization Pre-EFI Initialization Core Interface Specification for details.
-
- @param FileHandle PEIM's file handle. Must be the currently
- executing PEIM.
-
- @retval EFI_SUCCESS The PEIM was successfully registered for
- shadowing.
-
- @retval EFI_ALREADY_STARTED The PEIM was previously
- registered for shadowing.
-
- @retval EFI_NOT_FOUND The FileHandle does not refer to a
- valid file handle.
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesRegisterForShadow (
- IN EFI_PEI_FILE_HANDLE FileHandle
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services
- Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
- Specification for details.
-
- @param FileHandle The handle of the file.
-
- @param FileInfo Upon exit, points to the file's
- information.
-
- @retval EFI_SUCCESS File information returned.
-
- @retval EFI_INVALID_PARAMETER If FileHandle does not
- represent a valid file.
-
- @retval EFI_INVALID_PARAMETER FileInfo is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsGetFileInfo (
- IN CONST EFI_PEI_FILE_HANDLE FileHandle,
- OUT EFI_FV_FILE_INFO *FileInfo
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-
-/**
- This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services
- Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
- Specification for details.
-
- @param FileName A pointer to the name of the file to
- find within the firmware volume.
-
- @param VolumeHandle The firmware volume to search FileHandle
- Upon exit, points to the found file's
- handle or NULL if it could not be found.
- @param FileHandle The pointer to found file handle
-
- @retval EFI_SUCCESS File was found.
-
- @retval EFI_NOT_FOUND File was not found.
-
- @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or
- FileName was NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsFindFileByName (
- IN CONST EFI_GUID *FileName,
- IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
- OUT EFI_PEI_FILE_HANDLE *FileHandle
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-
-/**
- This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
- Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
- Specification for details.
-
- @param VolumeHandle Handle of the volume.
-
- @param VolumeInfo Upon exit, points to the volume's
- information.
-
- @retval EFI_SUCCESS File information returned.
-
- @retval EFI_INVALID_PARAMETER If FileHandle does not
- represent a valid file.
-
- @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-PeiServicesFfsGetVolumeInfo (
- IN EFI_PEI_FV_HANDLE VolumeHandle,
- OUT EFI_FV_INFO *VolumeInfo
- )
-{
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.
-
- This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using
- the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.
- If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().
- If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().
-
-
- @param FvFormat Unique identifier of the format of the memory-mapped
- firmware volume. This parameter is optional and
- may be NULL. If NULL is specified, the
- EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
- @param FvInfo Points to a buffer which allows the
- EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
- The format of this buffer is specific to the FvFormat.
- For memory-mapped firmware volumes, this typically
- points to the first byte of the firmware volume.
- @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped
- firmware volumes, this is typically the size of
- the firmware volume.
- @param ParentFvName If the new firmware volume originated from a file
- in a different firmware volume, then this parameter
- specifies the GUID name of the originating firmware
- volume. Otherwise, this parameter must be NULL.
- @param ParentFileName If the new firmware volume originated from a file
- in a different firmware volume, then this parameter
- specifies the GUID file name of the originating
- firmware file. Otherwise, this parameter must be NULL.
-**/
-VOID
-EFIAPI
-PeiServicesInstallFvInfoPpi (
- IN CONST EFI_GUID *FvFormat, OPTIONAL
- IN CONST VOID *FvInfo,
- IN UINT32 FvInfoSize,
- IN CONST EFI_GUID *ParentFvName, OPTIONAL
- IN CONST EFI_GUID *ParentFileName OPTIONAL
- )
-{
- ASSERT (FALSE);
- return;
-}
-
diff --git a/EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf b/EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
deleted file mode 100644
index 5454387eeb..0000000000
--- a/EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
+++ /dev/null
@@ -1,49 +0,0 @@
-## @file
-# PEI Services Library implementation.
-#
-# 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 = SecPeiServicesLib
- FILE_GUID = E3E4A441-8465-0F41-8AF4-F67EBE984099
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PeiServicesLib|SEC PEIM PEI_CORE
- PI_SPECIFICATION_VERSION = 0x0001000A
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- PeiServicesLib.c
- FwVol.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- BaseMemoryLib
- PpiListLib
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
-
-
-
-
-
diff --git a/EmulatorPkg/Library/SecPpiListLib/PpiListLib.c b/EmulatorPkg/Library/SecPpiListLib/PpiListLib.c
deleted file mode 100644
index f9c0c3d677..0000000000
--- a/EmulatorPkg/Library/SecPpiListLib/PpiListLib.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*++ @file
-
-Copyright (c) 2011, 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>
-
-CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList = NULL;
-
diff --git a/EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf b/EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
deleted file mode 100644
index 6b1dac8efd..0000000000
--- a/EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-## @file
-# Place thunk PPI in HOB.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SecPpiListLib
- FILE_GUID = F950E820-0457-8143-86AD-30E4A45FD4BF
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PpiListLib|SEC BASE USER_DEFINED
-
-[Sources]
- PpiListLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
deleted file mode 100644
index 3382d7d2a6..0000000000
--- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/** @file
- Provides library functions for common SMBIOS operations. Only available to DXE
- and UEFI module types.
-
-
-Copyright (c) 2012, Apple Inc. All rights reserved.
-Portitions 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 that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/SmbiosLib.h>
-
-
-EFI_SMBIOS_PROTOCOL *gSmbios = NULL;
-
-
-/**
- Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
- entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
-
- @param Template Array of SMBIOS_TEMPLATE_ENTRY entries.
-
- @retval EFI_SUCCESS New SMBIOS tables were created.
- @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibInitializeFromTemplate (
- IN SMBIOS_TEMPLATE_ENTRY *Template
- )
-{
- EFI_STATUS Status;
- UINTN Index;
-
- if (Template == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_SUCCESS;
-
- for (Index = 0; Template[Index].Entry != NULL; Index++) {
- Status = SmbiosLibCreateEntry (Template[Index].Entry, Template[Index].StringArray);
- }
-
- return Status;
-}
-
-
-
-/**
- Create SMBIOS record.
-
- Converts a fixed SMBIOS structure and an array of pointers to strings into
- an SMBIOS record where the strings are cat'ed on the end of the fixed record
- and terminated via a double NULL and add to SMBIOS table.
-
- SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
- { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
- 1 // StringCount
- };
- CHAR8 *gSmbiosType12Strings[] = {
- "Not Found",
- NULL
- };
-
- ...
- CreateSmbiosEntry (
- (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,
- gSmbiosType12Strings
- );
-
- @param SmbiosEntry Fixed SMBIOS structure
- @param StringArray Array of strings to convert to an SMBIOS string pack.
- NULL is OK.
-
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibCreateEntry (
- IN SMBIOS_STRUCTURE *SmbiosEntry,
- IN CHAR8 **StringArray
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_SMBIOS_TABLE_HEADER *Record;
- UINTN Index;
- UINTN StringSize;
- UINTN Size;
- CHAR8 *Str;
-
- // Calculate the size of the fixed record and optional string pack
- Size = SmbiosEntry->Length;
- if (StringArray == NULL) {
- Size += 2; // Min string section is double null
- } else if (StringArray[0] == NULL) {
- Size += 2; // Min string section is double null
- } else {
- for (Index = 0; StringArray[Index] != NULL; Index++) {
- StringSize = AsciiStrSize (StringArray[Index]);
- Size += StringSize;
- }
- // Don't forget the terminating double null
- Size += 1;
- }
-
- // Copy over Template
- Record = (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size);
- if (Record == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (Record, SmbiosEntry, SmbiosEntry->Length);
-
- if (StringArray != NULL) {
- // Append string pack
- Str = ((CHAR8 *)Record) + Record->Length;
- for (Index = 0; StringArray[Index] != NULL; Index++) {
- StringSize = AsciiStrSize (StringArray[Index]);
- CopyMem (Str, StringArray[Index], StringSize);
- Str += StringSize;
- }
- *Str = 0;
- }
-
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = gSmbios->Add (
- gSmbios,
- gImageHandle,
- &SmbiosHandle,
- Record
- );
-
- FreePool (Record);
- return Status;
-}
-
-
-
-/**
- Update the string associated with an existing SMBIOS record.
-
- This function allows the update of specific SMBIOS strings. The number of valid strings for any
- SMBIOS record is defined by how many strings were present when Add() was called.
-
- @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
- @param[in] StringNumber The non-zero string number of the string to update.
- @param[in] String Update the StringNumber string with String.
-
- @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
- @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
- @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateString (
- IN EFI_SMBIOS_HANDLE SmbiosHandle,
- IN SMBIOS_TABLE_STRING StringNumber,
- IN CHAR8 *String
- )
-{
- UINTN StringIndex;
-
- if (String == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*String == '\0') {
- // A string with no data is not legal in SMBIOS
- return EFI_INVALID_PARAMETER;
- }
-
- StringIndex = StringNumber;
- return gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, String);
-}
-
-
-/**
- Update the string associated with an existing SMBIOS record.
-
- This function allows the update of specific SMBIOS strings. The number of valid strings for any
- SMBIOS record is defined by how many strings were present when Add() was called.
-
- @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
- @param[in] StringNumber The non-zero string number of the string to update.
- @param[in] String Update the StringNumber string with String.
-
- @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
- @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
- @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibUpdateUnicodeString (
- IN EFI_SMBIOS_HANDLE SmbiosHandle,
- IN SMBIOS_TABLE_STRING StringNumber,
- IN CHAR16 *String
- )
-{
- EFI_STATUS Status;
- UINTN StringIndex;
- CHAR8 *Ascii;
-
- if (String == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*String == '\0') {
- // A string with no data is not legal in SMBIOS
- return EFI_INVALID_PARAMETER;
- }
-
- Ascii = AllocateZeroPool (StrSize (String));
- if (Ascii == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- UnicodeStrToAsciiStr (String, Ascii);
-
- StringIndex = StringNumber;
- Status = gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, Ascii);
-
- FreePool (Ascii);
- return Status;
-}
-
-
-/**
- Allow caller to read a specific SMBIOS string
-
- @param[in] Header SMBIOS record that contains the string.
- @param[in[ StringNumber Instance of SMBIOS string 1 - N.
-
- @retval NULL Instance of Type SMBIOS string was not found.
- @retval Other Pointer to matching SMBIOS string.
-**/
-CHAR8 *
-EFIAPI
-SmbiosLibReadString (
- IN SMBIOS_STRUCTURE *Header,
- IN EFI_SMBIOS_STRING StringNumber
- )
-{
- CHAR8 *Data;
- UINTN Match;
-
- Data = (CHAR8 *)Header + Header->Length;
- for (Match = 1;!(*Data == 0 && *(Data+1) == 0); ) {
- if (StringNumber == Match) {
- return Data;
- }
- Data++;
- if (*(Data - 1) == '\0') {
- Match++;
- }
- }
-
- return NULL;
-}
-
-
-/**
- Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
-
- @param[in] Type Type of the next SMBIOS record to return.
- @param[in[ Instance Instance of SMBIOS record 0 - N-1.
- @param[out] SmbiosHandle Returns SMBIOS handle for the matching record.
-
- @retval NULL Instance of Type SMBIOS record was not found.
- @retval Other Pointer to matching SMBIOS record.
-**/
-SMBIOS_STRUCTURE *
-EFIAPI
-SmbiosLibGetRecord (
- IN EFI_SMBIOS_TYPE Type,
- IN UINTN Instance,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_TABLE_HEADER *Record;
- UINTN Match;
-
- Match = 0;
- *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- do {
- Status = gSmbios->GetNext (gSmbios, SmbiosHandle, &Type, &Record, NULL);
- if (!EFI_ERROR (Status)) {
- if (Match == Instance) {
- return (SMBIOS_STRUCTURE *)Record;
- }
- Match++;
- }
- } while (!EFI_ERROR (Status));
-
- return NULL;
-}
-
-
-/**
- Remove an SMBIOS record.
-
- This function removes an SMBIOS record using the handle specified by SmbiosHandle.
-
- @param[in] SmbiosHandle The handle of the SMBIOS record to remove.
-
- @retval EFI_SUCCESS SMBIOS record was removed.
- @retval EFI_INVALID_PARAMETER SmbiosHandle does not specify a valid SMBIOS record.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibRemove (
- OUT EFI_SMBIOS_HANDLE SmbiosHandle
- )
-{
- return gSmbios->Remove (gSmbios, SmbiosHandle);
-}
-
-
-
-/**
-
- @param ImageHandle ImageHandle of the loaded driver.
- @param SystemTable Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS Register successfully.
- @retval EFI_OUT_OF_RESOURCES No enough memory to register this handler.
-**/
-EFI_STATUS
-EFIAPI
-SmbiosLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&gSmbios);
-}
-
diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
deleted file mode 100644
index adcd7ef08e..0000000000
--- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
+++ /dev/null
@@ -1,47 +0,0 @@
-## @file
-# SMBIOS Library
-#
-# Copyright (c) 2012, Apple Inc. All rights reserved.
-# Portions 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 = SmbiosLib
- FILE_GUID = 881863A2-09FD-3E44-8D62-7AE038D03747
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PcdLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVER
-
- CONSTRUCTOR = SmbiosLibConstructor
-
-
-[Sources]
- SmbiosLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- DebugLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- UefiLib
-
-[Protocols]
- gEfiSmbiosProtocolGuid
-
-[Depex]
- gEfiSmbiosProtocolGuid \ No newline at end of file
diff --git a/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.c b/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.c
deleted file mode 100644
index ba64608f4d..0000000000
--- a/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2008 - 2011, 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.
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-
-UINTN gThunkPpiListSize = 0;
-EFI_PEI_PPI_DESCRIPTOR *gThunkPpiList = NULL;
-
-
-
-EFI_PEI_PPI_DESCRIPTOR *
-GetThunkPpiList (
- VOID
- )
-{
- UINTN Index;
-
- if (gThunkPpiList == NULL) {
- return NULL;
- }
-
- Index = (gThunkPpiListSize/sizeof (EFI_PEI_PPI_DESCRIPTOR)) - 1;
- gThunkPpiList[Index].Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
-
- return gThunkPpiList;
-}
-
-
-EFI_STATUS
-EFIAPI
-AddThunkPpi (
- IN UINTN Flags,
- IN EFI_GUID *Guid,
- IN VOID *Ppi
- )
-{
- UINTN Index;
-
- gThunkPpiList = ReallocatePool (
- gThunkPpiListSize,
- gThunkPpiListSize + sizeof (EFI_PEI_PPI_DESCRIPTOR),
- gThunkPpiList
- );
- if (gThunkPpiList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Index = (gThunkPpiListSize/sizeof (EFI_PEI_PPI_DESCRIPTOR));
- gThunkPpiList[Index].Flags = Flags;
- gThunkPpiList[Index].Guid = Guid;
- gThunkPpiList[Index].Ppi = Ppi;
- gThunkPpiListSize += sizeof (EFI_PEI_PPI_DESCRIPTOR);
-
- return EFI_SUCCESS;
-}
-
-
-
-
-
diff --git a/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf b/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf
deleted file mode 100644
index f4a7be77a3..0000000000
--- a/EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf
+++ /dev/null
@@ -1,38 +0,0 @@
-## @file
-# Place thunk PPI in HOB.
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ThunkPpiList
- FILE_GUID = 465FDE84-E8B0-B04B-A843-A03F68F617A9
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = MemoryAllocationLib|SEC BASE USER_DEFINED
-
-[Sources]
- ThunkPpiList.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
-
-[BuildOptions]
- XCODE:*_*_*_DLINK_PATH == gcc
-
diff --git a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c b/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c
deleted file mode 100644
index b2daa2bef5..0000000000
--- a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/** @file
- Emulator Thunk to abstract OS services from pure EFI code
-
- Copyright (c) 2008 - 2011, 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.
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Protocol/EmuIoThunk.h>
-
-
-#define EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('E','m','u','T')
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL Data;
- BOOLEAN EmuBusDriver;
- LIST_ENTRY Link;
-} EMU_IO_THUNK_PROTOCOL_DATA;
-
-LIST_ENTRY mThunkList = INITIALIZE_LIST_HEAD_VARIABLE (mThunkList);
-
-
-EFI_STATUS
-EFIAPI
-AddThunkProtocol (
- IN EMU_IO_THUNK_PROTOCOL *ThunkIo,
- IN CHAR16 *ConfigString,
- IN BOOLEAN EmuBusDriver
- )
-{
- CHAR16 *StartString;
- CHAR16 *SubString;
- UINTN Instance;
- EMU_IO_THUNK_PROTOCOL_DATA *Private;
-
- if (ThunkIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Instance = 0;
- StartString = AllocatePool (StrSize (ConfigString));
- StrCpy (StartString, ConfigString);
- 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++;
- }
-
- Private = AllocatePool (sizeof (EMU_IO_THUNK_PROTOCOL_DATA));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- Private->Signature = EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE;
- Private->EmuBusDriver = EmuBusDriver;
-
- CopyMem (&Private->Data, ThunkIo, sizeof (EMU_IO_THUNK_PROTOCOL));
- Private->Data.Instance = Instance++;
- Private->Data.ConfigString = StartString;
-
- InsertTailList (&mThunkList, &Private->Link);
-
- //
- // Parse Next sub string. This will point to '\0' if we are at the end.
- //
- StartString = SubString;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-GetNextThunkProtocol (
- IN BOOLEAN EmuBusDriver,
- OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
- )
-{
- LIST_ENTRY *Link;
- EMU_IO_THUNK_PROTOCOL_DATA *Private;
-
- if (mThunkList.ForwardLink == &mThunkList) {
- // Skip parsing an empty list
- return EFI_NOT_FOUND;
- }
-
- for (Link = mThunkList.ForwardLink; Link != &mThunkList; Link = Link->ForwardLink) {
- Private = CR (Link, EMU_IO_THUNK_PROTOCOL_DATA, Link, EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE);
- if (EmuBusDriver & !Private->EmuBusDriver) {
- continue;
- } else if (*Instance == NULL) {
- // Find 1st match in list
- *Instance = &Private->Data;
- return EFI_SUCCESS;
- } else if (*Instance == &Private->Data) {
- // Matched previous call so look for valid next entry
- Link = Link->ForwardLink;
- if (Link == &mThunkList) {
- return EFI_NOT_FOUND;
- }
- Private = CR (Link, EMU_IO_THUNK_PROTOCOL_DATA, Link, EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE);
- *Instance = &Private->Data;
- return EFI_SUCCESS;
- }
- }
-
-
- return EFI_NOT_FOUND;
-}
-
diff --git a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf b/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf
deleted file mode 100644
index 5a22c2f41f..0000000000
--- a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf
+++ /dev/null
@@ -1,36 +0,0 @@
-## @file
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ThunkProtocolList
- FILE_GUID = 7833616E-AE0D-594F-870C-80E68682D587
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = MemoryAllocationLib|BASE SEC USER_DEFINED
-
-[Sources]
- ThunkProtocolList.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
-
-
-
diff --git a/EmulatorPkg/License.txt b/EmulatorPkg/License.txt
deleted file mode 100644
index be68999be6..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni
deleted file mode 100644
index 669654ece4..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
deleted file mode 100644
index d077092740..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c
deleted file mode 100644
index 562f716fd4..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni
deleted file mode 100644
index dda02d2970..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendor.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
deleted file mode 100644
index 48f08ffa91..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c
deleted file mode 100644
index 39cb889f62..0000000000
--- a/EmulatorPkg/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, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE 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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
deleted file mode 100644
index 1c184c856d..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c
deleted file mode 100644
index 8e58e61031..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni
deleted file mode 100644
index 177ff38925..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
deleted file mode 100644
index 8dfc848ff2..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c
deleted file mode 100644
index 0df651e693..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscDevicePath.h b/EmulatorPkg/MiscSubClassPlatformDxe/MiscDevicePath.h
deleted file mode 100644
index 0cd0e68c70..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
deleted file mode 100644
index e56208ae4a..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
deleted file mode 100644
index 988e0c6029..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/** @file
- This driver parses the mSmbiosMiscDataTable structure and reports
- any generated data.
-
- 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"
-/*++
- 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;
- }
-
- CurrentLang = GetEfiGlobalVariable (L"PlatformLang");
- 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/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemString.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemString.uni
deleted file mode 100644
index 782a83bf89..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemString.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringData.c
deleted file mode 100644
index 19c7416a44..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
deleted file mode 100644
index a879283a9c..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni
deleted file mode 100644
index 87c5a8112b..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignator.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
deleted file mode 100644
index 0b2a22087e..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
deleted file mode 100644
index 3242fe342e..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
deleted file mode 100644
index ca9ee8caca..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
deleted file mode 100644
index d7678d3758..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h
deleted file mode 100644
index c7749f3f17..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h
+++ /dev/null
@@ -1,132 +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 <Guid/DataHubRecords.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-#include <Protocol/EmuIoThunk.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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
deleted file mode 100644
index cda0d276ee..0000000000
--- a/EmulatorPkg/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
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DevicePathLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiDriverEntryPoint
- UefiLib
- HiiLib
- DebugLib
- BaseLib
- PcdLib
-
-[Protocols]
- gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
- gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize
-
-
-[Depex]
- gEfiSmbiosProtocolGuid
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni
deleted file mode 100644
index 7a4e8a2cbc..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
deleted file mode 100644
index d0be1cdca0..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
deleted file mode 100644
index 65fec01158..0000000000
--- a/EmulatorPkg/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 *MemString;
-
- 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
- //
- MemString = (CHAR16 *)PcdGetPtr (PcdEmuMemorySize);
- for (TotalMemorySize = 0; *MemString != '\0';) {
- TotalMemorySize += StrDecimalToUint64 (MemString);
- while (*MemString != '\0') {
- if (*MemString == '!') {
- MemString++;
- break;
- }
- MemString++;
- }
- }
-
- //
- // 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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni
deleted file mode 100644
index 709c53a660..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageString.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
deleted file mode 100644
index 347767884e..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
deleted file mode 100644
index 96a3577828..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni
deleted file mode 100644
index 3ff890b83d..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
deleted file mode 100644
index 5564ad1471..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
deleted file mode 100644
index 317922ffe1..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni
deleted file mode 100644
index abf2da762c..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionString.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
deleted file mode 100644
index b64181e0fb..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c
deleted file mode 100644
index 734e90dff6..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni
deleted file mode 100644
index 45e9ce3c00..0000000000
--- a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignation.uni
+++ /dev/null
Binary files differ
diff --git a/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
deleted file mode 100644
index 3406fdbe08..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c b/EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c
deleted file mode 100644
index 3c64a11e69..0000000000
--- a/EmulatorPkg/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/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c
deleted file mode 100644
index 2c75f85f47..0000000000
--- a/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/** @file
- Static SMBIOS Table for platform
-
-
- Copyright (c) 2012, 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 <PiDxe.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/SmbiosLib.h>
-#include <Library/HobLib.h>
-
-extern SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[];
-
-
-
-SMBIOS_TABLE_TYPE19 gSmbiosType19Template = {
- { EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
- 0xffffffff, // StartingAddress;
- 0xffffffff, // EndingAddress;
- 0, // MemoryArrayHandle;
- 1, // PartitionWidth;
- 0, // ExtendedStartingAddress;
- 0, // ExtendedEndingAddress;
-};
-
-VOID
-CreatePlatformSmbiosMemoryRecords (
- VOID
- )
-{
- EFI_PEI_HOB_POINTERS HobPtr;
- SMBIOS_STRUCTURE_POINTER Smbios16;
- SMBIOS_STRUCTURE_POINTER Smbios17;
- EFI_SMBIOS_HANDLE PhyscialMemoryArrayHandle;
- EFI_SMBIOS_HANDLE SmbiosHandle;
-
- Smbios16.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, 0, &PhyscialMemoryArrayHandle);
- if (Smbios16.Hdr == NULL) {
- // Only make a Type19 entry if a Type16 entry exists.
- return;
- }
-
- Smbios17.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_MEMORY_DEVICE, 0, &SmbiosHandle);
- if (Smbios17.Hdr == NULL) {
- // if type17 exits update with type16 Smbios handle
- Smbios17.Type17->MemoryArrayHandle = PhyscialMemoryArrayHandle;
- }
-
- // Generate Type16 records
- gSmbiosType19Template.MemoryArrayHandle = PhyscialMemoryArrayHandle;
- HobPtr.Raw = GetHobList ();
- while ((HobPtr.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, HobPtr.Raw)) != NULL) {
- if (HobPtr.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
- gSmbiosType19Template.ExtendedStartingAddress = HobPtr.ResourceDescriptor->PhysicalStart;
- gSmbiosType19Template.ExtendedEndingAddress =
- HobPtr.ResourceDescriptor->PhysicalStart +
- HobPtr.ResourceDescriptor->ResourceLength - 1;
-
- SmbiosLibCreateEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
- }
- HobPtr.Raw = GET_NEXT_HOB (HobPtr);
- }
-}
-
-
-/**
- Main entry for this driver.
-
- @param ImageHandle Image handle this driver.
- @param SystemTable Pointer to SystemTable.
-
- @retval EFI_SUCESS This function always complete successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatfomrSmbiosDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_STRUCTURE_POINTER Smbios;
-
- // Phase 0 - Patch table to make SMBIOS 2.7 structures smaller to conform
- // to an early version of the specification.
-
- // Phase 1 - Initialize SMBIOS tables from template
- Status = SmbiosLibInitializeFromTemplate (gSmbiosTemplate);
- ASSERT_EFI_ERROR (Status);
-
- // Phase 2 - Patch SMBIOS table entries
-
- Smbios.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_BIOS_INFORMATION, 0, &SmbiosHandle);
- if (Smbios.Type0 != NULL) {
- // 64K * (n+1) bytes
- Smbios.Type0->BiosSize = (UINT8)DivU64x32 (FixedPcdGet64 (PcdEmuFirmwareFdSize), 64*1024) - 1;
-
- SmbiosLibUpdateUnicodeString (
- SmbiosHandle,
- Smbios.Type0->BiosVersion,
- (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString)
- );
- SmbiosLibUpdateUnicodeString (
- SmbiosHandle,
- Smbios.Type0->BiosReleaseDate,
- (CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString)
- );
- }
-
- // Phase 3 - Create tables from scratch
-
- // Create Type 13 record from EFI Variables
- // Do we need this record for EFI as the info is availible from EFI varaibles
- // Also language types don't always match between EFI and SMBIOS
- // CreateSmbiosLanguageInformation (1, gSmbiosLangToEfiLang);
-
- CreatePlatformSmbiosMemoryRecords ();
-
- return EFI_SUCCESS;
-} \ No newline at end of file
diff --git a/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
deleted file mode 100644
index 737310f470..0000000000
--- a/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Platform SMBIOS driver that fills in SMBIOS table entries.
-#
-# Copyright (c) 2012, Apple Inc. All rights reserved.
-# Portions 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 = PlatformSmbiosDxe
- FILE_GUID = 67FA951E-4FA2-9F4E-A658-4DBD954AC22E
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = PlatfomrSmbiosDriverEntryPoint
-
-
-[Sources]
- SmbiosTable.c
- PlatformSmbiosDxe.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- BaseLib
- BaseMemoryLib
- DebugLib
- PcdLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- UefiLib
- HobLib
- SmbiosLib
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
- gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize
-
-[Depex]
- TRUE \ No newline at end of file
diff --git a/EmulatorPkg/PlatformSmbiosDxe/SmbiosTable.c b/EmulatorPkg/PlatformSmbiosDxe/SmbiosTable.c
deleted file mode 100644
index c79e57b304..0000000000
--- a/EmulatorPkg/PlatformSmbiosDxe/SmbiosTable.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/** @file
- Static SMBIOS Table for platform
-
- Note SMBIOS 2.7.1 Required structures:
- BIOS Information (Type 0)
- System Information (Type 1)
- System Enclosure (Type 3)
- Processor Information (Type 4) - CPU Driver
- Cache Information (Type 7) - For cache that is external to processor
- System Slots (Type 9) - If system has slots
- Physical Memory Array (Type 16)
- Memory Device (Type 17) - For each socketed system-memory Device
- Memory Array Mapped Address (Type 19) - One per contiguous block per Physical Memroy Array
- System Boot Information (Type 32)
-
- Copyright (c) 2012, 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 <PiDxe.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/Smbios.h>
-#include <Library/SmbiosLib.h>
-
-
-SMBIOS_TABLE_TYPE0 gSmbiosType0Template = {
- { EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
- 1, // Vendor String
- 2, // BiosVersion String
- 0xE000, // BiosSegment
- 3, // BiosReleaseDate String
- 0x7F, // BiosSize
- { // BiosCharacteristics
- 0, // Reserved :2; ///< Bits 0-1.
- 0, // Unknown :1;
- 0, // BiosCharacteristicsNotSupported :1;
- 0, // IsaIsSupported :1;
- 0, // McaIsSupported :1;
- 0, // EisaIsSupported :1;
- 1, // PciIsSupported :1;
- 0, // PcmciaIsSupported :1;
- 0, // PlugAndPlayIsSupported :1;
- 0, // ApmIsSupported :1;
- 1, // BiosIsUpgradable :1;
- 1, // BiosShadowingAllowed :1;
- 0, // VlVesaIsSupported :1;
- 0, // EscdSupportIsAvailable :1;
- 0, // BootFromCdIsSupported :1;
- 1, // 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 // ReservedForVendor :32; ///< Bits 32-63. Bits 32-47 reserved for BIOS vendor
- ///< and bits 48-63 reserved for System Vendor.
- },
- { // BIOSCharacteristicsExtensionBytes[]
- 0x81, // AcpiIsSupported :1;
- // UsbLegacyIsSupported :1;
- // AgpIsSupported :1;
- // I2OBootIsSupported :1;
- // Ls120BootIsSupported :1;
- // AtapiZipDriveBootIsSupported :1;
- // Boot1394IsSupported :1;
- // SmartBatteryIsSupported :1;
- // BIOSCharacteristicsExtensionBytes[1]
- 0x0a, // BiosBootSpecIsSupported :1;
- // FunctionKeyNetworkBootIsSupported :1;
- // TargetContentDistributionEnabled :1;
- // UefiSpecificationSupported :1;
- // VirtualMachineSupported :1;
- // ExtensionByte2Reserved :3;
- },
- 0x00, // SystemBiosMajorRelease
- 0x01, // SystemBiosMinorRelease
- 0xFF, // EmbeddedControllerFirmwareMajorRelease
- 0xFF, // EmbeddedControllerFirmwareMinorRelease
-};
-CHAR8 *gSmbiosType0Strings[] = {
- "http://www.tianocore.org/edk2/", // Vendor String
- __TIME__, // BiosVersion String
- __DATE__, // BiosReleaseDate String
- NULL
-};
-
-SMBIOS_TABLE_TYPE1 gSmbiosType1Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, sizeof (SMBIOS_TABLE_TYPE1), 0 },
- 1, // Manufacturer String
- 2, // ProductName String
- 3, // Version String
- 4, // SerialNumber String
- { 0x25EF0280, 0xEC82, 0x42B0, { 0x8F, 0xB6, 0x10, 0xAD, 0xCC, 0xC6, 0x7C, 0x02 } },
- SystemWakeupTypePowerSwitch,
- 5, // SKUNumber String
- 6, // Family String
-};
-CHAR8 *gSmbiosType1Strings[] = {
- "http://www.tianocore.org/edk2/",
- "EmulatorPkg",
- "1.0",
- "System Serial#",
- "System SKU#",
- "edk2",
- NULL
-};
-
-SMBIOS_TABLE_TYPE2 gSmbiosType2Template = {
- { EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, sizeof (SMBIOS_TABLE_TYPE2), 0 },
- 1, // Manufacturer String
- 2, // ProductName String
- 3, // Version String
- 4, // SerialNumber String
- 5, // AssetTag String
- { // FeatureFlag
- 1, // Motherboard :1;
- 0, // RequiresDaughterCard :1;
- 0, // Removable :1;
- 0, // Replaceable :1;
- 0, // HotSwappable :1;
- 0, // Reserved :3;
- },
- 6, // LocationInChassis String
- 0, // ChassisHandle;
- BaseBoardTypeMotherBoard, // BoardType;
- 0, // NumberOfContainedObjectHandles;
- { 0 } // ContainedObjectHandles[1];
-};
-CHAR8 *gSmbiosType2Strings[] = {
- "http://www.tianocore.org/edk2/",
- "EmulatorPkg",
- "1.0",
- "Base Board Serial#",
- "Base Board Asset Tag#",
- "Part Component",
- NULL
-};
-
-SMBIOS_TABLE_TYPE3 gSmbiosType3Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, sizeof (SMBIOS_TABLE_TYPE3), 0 },
- 1, // Manufacturer String
- MiscChassisTypeLapTop, // Type;
- 2, // Version String
- 3, // SerialNumber String
- 4, // AssetTag String
- ChassisStateSafe, // BootupState;
- ChassisStateSafe, // PowerSupplyState;
- ChassisStateSafe, // ThermalState;
- ChassisSecurityStatusNone,// SecurityStatus;
- { 0, 0, 0, 0 }, // OemDefined[4];
- 0, // Height;
- 0, // NumberofPowerCords;
- 0, // ContainedElementCount;
- 0, // ContainedElementRecordLength;
- { { 0 } }, // ContainedElements[1];
-};
-CHAR8 *gSmbiosType3Strings[] = {
- "http://www.tianocore.org/edk2/",
- "EmulatorPkg",
- "Chassis Board Serial#",
- "Chassis Board Asset Tag#",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template1 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeNone, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeOther, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings1[] = {
- "Mini DisplayPort",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template2 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeNone, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeFireWire, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings2[] = {
- "FireWire 800",
- NULL
-};
-
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template3 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeRJ45, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeNetworkPort, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings3[] = {
- "Ethernet",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template4 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeUsb, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeUsb, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings4[] = {
- "USB0",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template5 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeUsb, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeUsb, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings5[] = {
- "USB1",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template6 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeUsb, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeUsb, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings6[] = {
- "USB2",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template7 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeUsb, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeUsb, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings7[] = {
- "USB3",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template8 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeHeadPhoneMiniJack, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeAudioPort, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings8[] = {
- "Audio Line In",
- NULL
-};
-
-SMBIOS_TABLE_TYPE8 gSmbiosType8Template9 = {
- { EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
- 0, // InternalReferenceDesignator String
- PortConnectorTypeNone, // InternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- 1, // ExternalReferenceDesignator String
- PortConnectorTypeHeadPhoneMiniJack, // ExternalConnectorType; ///< The enumeration value from MISC_PORT_CONNECTOR_TYPE.
- PortTypeAudioPort, // PortType; ///< The enumeration value from MISC_PORT_TYPE.
-};
-CHAR8 *gSmbiosType8Strings9[] = {
- "Audio Line Out",
- NULL
-};
-
-SMBIOS_TABLE_TYPE9 gSmbiosType9Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_SLOTS, sizeof (SMBIOS_TABLE_TYPE9), 0 },
- 1, // SlotDesignation String
- SlotTypeOther, // SlotType; ///< The enumeration value from MISC_SLOT_TYPE.
- SlotDataBusWidthOther, // SlotDataBusWidth; ///< The enumeration value from MISC_SLOT_DATA_BUS_WIDTH.
- SlotUsageAvailable, // CurrentUsage; ///< The enumeration value from MISC_SLOT_USAGE.
- SlotLengthOther, // SlotLength; ///< The enumeration value from MISC_SLOT_LENGTH.
- 0, // SlotID;
- { // SlotCharacteristics1;
- 1, // CharacteristicsUnknown :1;
- 0, // Provides50Volts :1;
- 0, // Provides33Volts :1;
- 0, // SharedSlot :1;
- 0, // PcCard16Supported :1;
- 0, // CardBusSupported :1;
- 0, // ZoomVideoSupported :1;
- 0, // ModemRingResumeSupported:1;
- },
- { // SlotCharacteristics2;
- 0, // PmeSignalSupported :1;
- 0, // HotPlugDevicesSupported :1;
- 0, // SmbusSignalSupported :1;
- 0, // Reserved :5; ///< Set to 0.
- },
- 0, // SegmentGroupNum;
- 0, // BusNum;
- 0, // DevFuncNum;
-};
-CHAR8 *gSmbiosType9Strings[] = {
- "SD Card",
- NULL
-};
-
-SMBIOS_TABLE_TYPE11 gSmbiosType11Template = {
- { EFI_SMBIOS_TYPE_OEM_STRINGS, sizeof (SMBIOS_TABLE_TYPE11), 0 },
- 1 // StringCount
-};
-CHAR8 *gSmbiosType11Strings[] = {
- "https://svn.code.sf.net/p/edk2/code/trunk/edk2/EmulatorPkg/",
- NULL
-};
-
-
-SMBIOS_TABLE_TYPE12 gSmbiosType12Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
- 1 // StringCount
-};
-CHAR8 *gSmbiosType12Strings[] = {
- "https://svn.code.sf.net/p/edk2/code/trunk/edk2/EmulatorPkg/EmulatorPkg.dsc",
- NULL
-};
-
-SMBIOS_TABLE_TYPE16 gSmbiosType16Template = {
- { EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, sizeof (SMBIOS_TABLE_TYPE16), 0 },
- MemoryArrayLocationSystemBoard, // Location; ///< The enumeration value from MEMORY_ARRAY_LOCATION.
- MemoryArrayUseSystemMemory, // Use; ///< The enumeration value from MEMORY_ARRAY_USE.
- MemoryErrorCorrectionUnknown, // MemoryErrorCorrection; ///< The enumeration value from MEMORY_ERROR_CORRECTION.
- 0x80000000, // MaximumCapacity;
- 0xFFFE, // MemoryErrorInformationHandle;
- 1, // NumberOfMemoryDevices;
- 0x3fffffffffffffffULL, // ExtendedMaximumCapacity;
-};
-
-SMBIOS_TABLE_TYPE17 gSmbiosType17Template = {
- { EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17), 0 },
- 0, // MemoryArrayHandle;
- 0xFFFE, // MemoryErrorInformationHandle;
- 0xFFFF, // TotalWidth;
- 0xFFFF, // DataWidth;
- 0xFFFF, // Size;
- MemoryFormFactorUnknown, // FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
- 0xff, // DeviceSet;
- 1, // DeviceLocator String
- 2, // BankLocator String
- MemoryTypeDram, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
- { // TypeDetail;
- 0, // Reserved :1;
- 0, // Other :1;
- 1, // Unknown :1;
- 0, // FastPaged :1;
- 0, // StaticColumn :1;
- 0, // PseudoStatic :1;
- 0, // Rambus :1;
- 0, // Synchronous :1;
- 0, // Cmos :1;
- 0, // Edo :1;
- 0, // WindowDram :1;
- 0, // CacheDram :1;
- 0, // Nonvolatile :1;
- 0, // Registered :1;
- 0, // Unbuffered :1;
- 0, // Reserved1 :1;
- },
- 0, // Speed;
- 3, // Manufacturer String
- 0, // SerialNumber String
- 0, // AssetTag String
- 0, // PartNumber String
- 0, // Attributes;
- 0, // ExtendedSize;
- 0, // ConfiguredMemoryClockSpeed;
-};
-CHAR8 *gSmbiosType17Strings[] = {
- "OS Virtual Memory",
- "malloc",
- "OSV",
- NULL
-};
-
-SMBIOS_TABLE_TYPE23 gSmbiosType23Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, sizeof (SMBIOS_TABLE_TYPE23), 0 },
- 0, // Capabilities;
- 0, // ResetCount;
- 0, // ResetLimit;
- 0, // TimerInterval;
- 0 // Timeout;
-};
-
-SMBIOS_TABLE_TYPE32 gSmbiosType32Template = {
- { EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, sizeof (SMBIOS_TABLE_TYPE32), 0 },
- { 0, 0, 0, 0, 0, 0 }, // Reserved[6];
- BootInformationStatusNoError // BootStatus
-};
-
-
-
-SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[] = {
- { (SMBIOS_STRUCTURE *)&gSmbiosType0Template, gSmbiosType0Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType1Template, gSmbiosType1Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType2Template, gSmbiosType2Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType3Template, gSmbiosType3Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template1, gSmbiosType8Strings1 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template2, gSmbiosType8Strings2 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template3, gSmbiosType8Strings3 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template4, gSmbiosType8Strings4 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template5, gSmbiosType8Strings5 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template6, gSmbiosType8Strings6 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template7, gSmbiosType8Strings7 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template8, gSmbiosType8Strings8 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType8Template9, gSmbiosType8Strings9 },
- { (SMBIOS_STRUCTURE *)&gSmbiosType9Template, gSmbiosType9Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType11Template, gSmbiosType11Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType12Template, gSmbiosType12Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType16Template, NULL },
- { (SMBIOS_STRUCTURE *)&gSmbiosType17Template, gSmbiosType17Strings },
- { (SMBIOS_STRUCTURE *)&gSmbiosType23Template, NULL },
- { (SMBIOS_STRUCTURE *)&gSmbiosType32Template, NULL },
- { NULL, NULL }
-};
diff --git a/EmulatorPkg/README b/EmulatorPkg/README
deleted file mode 100644
index fdb26de503..0000000000
--- a/EmulatorPkg/README
+++ /dev/null
@@ -1,35 +0,0 @@
-
-=== EmulatorPkg Overview ===
-
-EmulatorPkg provides an environment where a UEFI environment can be
-emulated under an environment where a full UEFI compatible
-environment is not possible. (For example, running under an OS
-where an OS process hosts the UEFI emulation environment.)
-
-https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
-
-=== Status ===
-
-* Builds and runs under a posix-like environment with X windows
- - Linux
- - OS X
-
-=== Future Plans ===
-
-* Win32 and Win64 support
-
-=== Build Scripts ===
-
-On systems with the bash shell you can use EmulatorPkg/build.sh to simplify
-building and running EmulatorPkg.
-
-For example, to build + run:
-$ EmulatorPkg/build.sh
-$ EmulatorPkg/build.sh run
-
-The build architecture will match your host machine's architecture.
-
-On X64 host machines, you can build + run IA32 mode as well:
-$ EmulatorPkg/build.sh -a IA32
-$ EmulatorPkg/build.sh -a IA32 run
-
diff --git a/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
deleted file mode 100644
index b7b6c015fd..0000000000
--- a/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*++
- Emu RTC Architectural Protocol Driver as defined in PI
-
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-#include <PiDxe.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/EmuThunkLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/RealTimeClock.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
-EmuGetTime (
- 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.
-
-**/
-{
-
- //
- // Check parameter for null pointer
- //
- if (Time == NULL) {
- return EFI_INVALID_PARAMETER;
-
- }
-
- gEmuThunk->GetTime (Time, Capabilities);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuSetTime (
- 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.
-
-**/
-{
- 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
-EmuGetWakeupTime (
- 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
-EmuSetWakeupTime (
- 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 = EmuGetTime;
- SystemTable->RuntimeServices->SetTime = EmuSetTime;
- SystemTable->RuntimeServices->GetWakeupTime = EmuGetWakeupTime;
- SystemTable->RuntimeServices->SetWakeupTime = EmuSetWakeupTime;
-
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiRealTimeClockArchProtocolGuid,
- NULL,
- NULL
- );
- return Status;
-}
-
-EFI_STATUS
-RtcTimeFieldsValid (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Arguments:
-
- Returns:
-**/
-{
- 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
- )
-{
-
- 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
- )
-{
- 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/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf b/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
deleted file mode 100644
index 35712ac253..0000000000
--- a/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file
-# Emu Real time clock Architectural Protocol Driver as defined in PI
-#
-# This real time clock module simulates virtual device by time WinAPI.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[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
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- EmuThunkLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiRealTimeClockArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/EmulatorPkg/ResetRuntimeDxe/Reset.c b/EmulatorPkg/ResetRuntimeDxe/Reset.c
deleted file mode 100644
index 369bc86296..0000000000
--- a/EmulatorPkg/ResetRuntimeDxe/Reset.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*++ @file
- Reset Architectural Protocol as defined in UEFI/PI under Emulation
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.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 <Library/EmuThunkLib.h>
-
-#include <Protocol/Reset.h>
-
-
-VOID
-EFIAPI
-EmuResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- )
-{
- 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
- //
- gEmuThunk->Exit (0);
-
- //
- // Should never go here
- //
- ASSERT (FALSE);
-
- return;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-InitializeEmuReset (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
-**/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- SystemTable->RuntimeServices->ResetSystem = EmuResetSystem;
-
- Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiResetArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
diff --git a/EmulatorPkg/ResetRuntimeDxe/Reset.inf b/EmulatorPkg/ResetRuntimeDxe/Reset.inf
deleted file mode 100644
index f23dc46bce..0000000000
--- a/EmulatorPkg/ResetRuntimeDxe/Reset.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file
-# Emu Emulation Reset Architectural Protocol Driver as defined in PI
-#
-# This Reset module simulates system reset by process exit on Emulator.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuReset
- FILE_GUID = 50A18017-37AD-8743-BCF2-DF1A8FF12FAB
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeEmuReset
-
-#
-# 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
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- EmuThunkLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiResetArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- TRUE
-
diff --git a/EmulatorPkg/Sec/Ia32/SwitchRam.S b/EmulatorPkg/Sec/Ia32/SwitchRam.S
deleted file mode 100644
index 39304daef1..0000000000
--- a/EmulatorPkg/Sec/Ia32/SwitchRam.S
+++ /dev/null
@@ -1,95 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http:#opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM 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.
-#
-#------------------------------------------------------------------------------
-
- .text
-
-
-//------------------------------------------------------------------------------
-// VOID
-// EFIAPI
-// SecSwitchStack (
-// UINT32 TemporaryMemoryBase,
-// UINT32 PermenentMemoryBase
-// )//
-//------------------------------------------------------------------------------
-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/EmulatorPkg/Sec/Ia32/SwitchRam.asm b/EmulatorPkg/Sec/Ia32/SwitchRam.asm
deleted file mode 100644
index a2e1f3e910..0000000000
--- a/EmulatorPkg/Sec/Ia32/SwitchRam.asm
+++ /dev/null
@@ -1,94 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2007 - 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:
-;
-; Stack.asm
-;
-; Abstract:
-;
-; Switch the stack from temporary memory to permenent memory.
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; SecSwitchStack (
-; UINT32 TemporaryMemoryBase,
-; UINT32 PermenentMemoryBase
-; );
-;------------------------------------------------------------------------------
-SecSwitchStack PROC
- ;
- ; 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!
- ;
-
- mov ebx, [esp + 20] ; Save the first parameter
- mov ecx, [esp + 24] ; Save the second parameter
-
- ;
- ; Save this function's return address into permenent memory at first.
- ; Then, Fixup the esp point to permenent memory
- ;
- mov eax, esp
- sub eax, ebx
- add eax, ecx
- mov edx, dword ptr [esp] ; copy pushed register's value to permenent memory
- mov dword ptr [eax], edx
- mov edx, dword ptr [esp + 4]
- mov dword ptr [eax + 4], edx
- mov edx, dword ptr [esp + 8]
- mov dword ptr [eax + 8], edx
- mov edx, dword ptr [esp + 12]
- mov dword ptr [eax + 12], edx
- mov edx, dword ptr [esp + 16] ; Update this function's return address into permenent memory
- mov dword ptr [eax + 16], edx
- mov esp, eax ; From now, esp is pointed to permenent memory
-
- ;
- ; Fixup the ebp point to permenent memory
- ;
- mov eax, ebp
- sub eax, ebx
- add eax, ecx
- mov ebp, eax ; From now, ebp is pointed to permenent memory
-
- ;
- ; Fixup callee's ebp point for PeiDispatch
- ;
- mov eax, dword ptr [ebp]
- sub eax, ebx
- add eax, ecx
- mov dword ptr [ebp], eax ; From now, Temporary's PPI caller's stack is in permenent memory
-
- pop edx
- pop ecx
- pop ebx
- pop eax
- ret
-SecSwitchStack ENDP
-
- END
diff --git a/EmulatorPkg/Sec/Ia32/TempRam.c b/EmulatorPkg/Sec/Ia32/TempRam.c
deleted file mode 100644
index 525fb95d48..0000000000
--- a/EmulatorPkg/Sec/Ia32/TempRam.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*++ @file
- Temp RAM PPI
-
-Copyright (c) 2011, 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/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-
-#include <Ppi/TemporaryRamSupport.h>
-
-VOID
-EFIAPI
-SecSwitchStack (
- UINT32 TemporaryMemoryBase,
- UINT32 PermenentMemoryBase
- );
-
-
-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/EmulatorPkg/Sec/Sec.c b/EmulatorPkg/Sec/Sec.c
deleted file mode 100644
index 8a015682dd..0000000000
--- a/EmulatorPkg/Sec/Sec.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++ @file
- Stub SEC that is called from the OS appliation that is the root of the emulator.
-
- The OS application will call the SEC with the PEI Entry Point API.
-
-Copyright (c) 2011, 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 "Sec.h"
-
-
-
-EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {
- SecTemporaryRamSupport
-};
-
-
-EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gEfiTemporaryRamSupportPpiGuid,
- &mSecTemporaryRamSupportPpi
- }
-};
-
-
-
-/**
- The entry point of PE/COFF Image for the PEI Core, that has been hijacked by this
- SEC that sits on top of an OS application. So the entry and exit of this module
- has the same API.
-
- This function is the entry point for the PEI Foundation, which allows the SEC phase
- to pass information about the stack, temporary RAM and the Boot Firmware Volume.
- In addition, it also allows the SEC phase to pass services and data forward for use
- during the PEI phase in the form of one or more PPIs.
- There is no limit to the number of additional PPIs that can be passed from SEC into
- the PEI Foundation. As part of its initialization phase, the PEI Foundation will add
- these SEC-hosted PPIs to its PPI database such that both the PEI Foundation and any
- modules can leverage the associated service calls and/or code in these early PPIs.
- This function is required to call ProcessModuleEntryPointList() with the Context
- parameter set to NULL. ProcessModuleEntryPoint() is never expected to return.
- The PEI Core is responsible for calling ProcessLibraryConstructorList() as soon as
- the PEI Services Table and the file handle for the PEI Core itself have been established.
- If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system.
-
- @param SecCoreData Points to a data structure containing information about the PEI
- core's operating environment, such as the size and location of
- temporary RAM, the stack location and the BFV location.
-
- @param PpiList Points to a list of one or more PPI descriptors to be installed
- initially by the PEI core. An empty PPI list consists of a single
- descriptor with the end-tag EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.
- As part of its initialization phase, the PEI Foundation will add
- these SEC-hosted PPIs to its PPI database such that both the PEI
- Foundation and any modules can leverage the associated service calls
- and/or code in these early PPIs.
-
-**/
-VOID
-EFIAPI
-_ModuleEntryPoint (
- IN EFI_SEC_PEI_HAND_OFF *SecCoreData,
- IN EFI_PEI_PPI_DESCRIPTOR *PpiList
- )
-{
- EFI_STATUS Status;
- EFI_PEI_FV_HANDLE VolumeHandle;
- EFI_PEI_FILE_HANDLE FileHandle;
- VOID *PeCoffImage;
- EFI_PEI_CORE_ENTRY_POINT EntryPoint;
- EFI_PEI_PPI_DESCRIPTOR *Ppi;
- EFI_PEI_PPI_DESCRIPTOR *SecPpiList;
- UINTN SecReseveredMemorySize;
- UINTN Index;
-
- EMU_MAGIC_PAGE()->PpiList = PpiList;
- ProcessLibraryConstructorList ();
-
- DEBUG ((EFI_D_ERROR, "SEC Has Started\n"));
-
- //
- // Add Our PPIs to the list
- //
- SecReseveredMemorySize = sizeof (gPrivateDispatchTable);
- for (Ppi = PpiList, Index = 1; ; Ppi++, Index++) {
- SecReseveredMemorySize += sizeof (EFI_PEI_PPI_DESCRIPTOR);
-
- if ((Ppi->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) == EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
- // Since we are appending, need to clear out privious list terminator.
- Ppi->Flags &= ~EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
- break;
- }
- }
-
- // Keep everything on a good alignment
- SecReseveredMemorySize = ALIGN_VALUE (SecReseveredMemorySize, CPU_STACK_ALIGNMENT);
-
-#if 0
- // Tell the PEI Core to not use our buffer in temp RAM
- SecPpiList = (EFI_PEI_PPI_DESCRIPTOR *)SecCoreData->PeiTemporaryRamBase;
- SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + SecReseveredMemorySize);
- SecCoreData->PeiTemporaryRamSize -= SecReseveredMemorySize;
-#else
- {
- //
- // When I subtrack from SecCoreData->PeiTemporaryRamBase PEI Core crashes? Either there is a bug
- // or I don't understand temp RAM correctly?
- //
- EFI_PEI_PPI_DESCRIPTOR PpiArray[10];
-
- SecPpiList = &PpiArray[0];
- ASSERT (sizeof (PpiArray) >= SecReseveredMemorySize);
- }
-#endif
- // Copy existing list, and append our entries.
- CopyMem (SecPpiList, PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR) * Index);
- CopyMem (&SecPpiList[Index], gPrivateDispatchTable, sizeof (gPrivateDispatchTable));
-
- // Find PEI Core and transfer control
- VolumeHandle = (EFI_PEI_FV_HANDLE)(UINTN)SecCoreData->BootFirmwareVolumeBase;
- FileHandle = NULL;
- Status = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_PEI_CORE, VolumeHandle, &FileHandle);
- ASSERT_EFI_ERROR (Status);
-
- Status = PeiServicesFfsFindSectionData (EFI_SECTION_PE32, FileHandle, &PeCoffImage);
- ASSERT_EFI_ERROR (Status);
-
- Status = PeCoffLoaderGetEntryPoint (PeCoffImage, (VOID **)&EntryPoint);
- ASSERT_EFI_ERROR (Status);
-
- // Transfer control to PEI Core
- EntryPoint (SecCoreData, SecPpiList);
-
- // PEI Core never returns
- ASSERT (FALSE);
- return;
-}
-
-
-
diff --git a/EmulatorPkg/Sec/Sec.h b/EmulatorPkg/Sec/Sec.h
deleted file mode 100644
index 4782578efa..0000000000
--- a/EmulatorPkg/Sec/Sec.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*++ @file
- Stub SEC that is called from the OS appliation that is the root of the emulator.
-
- The OS application will call the SEC with the PEI Entry Point API.
-
-Copyright (c) 2011, 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_H___
-#define __SEC_H___
-
-
-#include <PiPei.h>
-#include <Library/EmuMagicPageLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/BaseMemoryLib.h>
-
-#include <Ppi/TemporaryRamSupport.h>
-
-
-//
-// I think this shold be defined in a MdePkg include file?
-//
-VOID
-EFIAPI
-ProcessLibraryConstructorList (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-SecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-
-
-#endif
-
diff --git a/EmulatorPkg/Sec/Sec.inf b/EmulatorPkg/Sec/Sec.inf
deleted file mode 100644
index d253fd724e..0000000000
--- a/EmulatorPkg/Sec/Sec.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# Entry Point of Emu Emulator
-#
-# Main executable file of Unix Emulator that loads PEI core after initialization finished.
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 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]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuSec
- FILE_GUID = BCAF98C9-22B0-3B4F-9CBD-C8A6B4DBCEE9
- MODULE_TYPE = SEC
- VERSION_STRING = 1.0
-
-
-[Sources]
- Sec.c
-
-[Sources.X64]
- X64/SwitchRam.asm
- X64/SwitchRam.S
-
-[Sources.IA32]
- Ia32/TempRam.c
- Ia32/SwitchRam.asm
- Ia32/SwitchRam.S
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- PeCoffGetEntryPointLib
- PeiServicesLib
- PpiListLib
- BaseMemoryLib
-
-[Ppis]
- gEfiTemporaryRamSupportPpiGuid
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
diff --git a/EmulatorPkg/Sec/X64/SwitchRam.S b/EmulatorPkg/Sec/X64/SwitchRam.S
deleted file mode 100644
index 9ed1f911e7..0000000000
--- a/EmulatorPkg/Sec/X64/SwitchRam.S
+++ /dev/null
@@ -1,72 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-# Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-
-
-// EFI_STATUS
-// EFIAPI
-// SecTemporaryRamSupport (
-// IN CONST EFI_PEI_SERVICES **PeiServices, // %rcx
-// IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, // %rdx
-// IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8
-// IN UINTN CopySize // %r9
-// )
-//
-ASM_GLOBAL ASM_PFX(SecTemporaryRamSupport)
-ASM_PFX(SecTemporaryRamSupport):
- // Adjust callers %rbp to account for stack move
- subq %rdx, %rbp // Calc offset of %rbp in Temp Memory
- addq %r8, %rbp // add in permanent base to offset
-
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- pushq %rdx // Save TemporaryMemoryBase
- pushq %r8 // Save PermanentMemoryBase
- pushq %r9 // Save CopySize
-
- //
- // Copy all of temp RAM to permanent memory, including stack
- //
- // CopyMem (PermanentMemoryBase, TemporaryMemoryBase, CopySize);
- // %rcx, %rdx, %r8
- movq %r8, %rcx // Shift arguments
- movq %r9, %r8
- subq $0x28, %rsp // Allocate register spill area & 16-byte align stack
- call ASM_PFX(CopyMem)
- // Temp mem stack now copied to permanent location. %esp still in temp memory
- addq $0x28, %rsp
-
- popq %r9 // CopySize (old stack)
- popq %r8 // PermanentMemoryBase (old stack)
- popq %rdx // TemporaryMemoryBase (old stack)
-
- movq %rsp, %rcx // Move to new stack
- subq %rdx, %rcx // Calc offset of stack in Temp Memory
- addq %r8, %rcx // Calc PermanentMemoryBase address
- movq %rcx, %rsp // Update stack
- // Stack now points to permanent memory
-
- // ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);
- movq %rdx, %rcx
- movq %r9, %rdx
- subq $0x28, %rsp // Allocate register spill area & 16-byte align stack
- call ASM_PFX(ZeroMem)
- addq $0x28, %rsp
-
- // This data comes off the NEW stack
- popq %rbp
- ret
-
-
diff --git a/EmulatorPkg/Sec/X64/SwitchRam.asm b/EmulatorPkg/Sec/X64/SwitchRam.asm
deleted file mode 100644
index d1a7b943fd..0000000000
--- a/EmulatorPkg/Sec/X64/SwitchRam.asm
+++ /dev/null
@@ -1,76 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-; Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-;------------------------------------------------------------------------------
-
-EXTERN CopyMem:PROC
-EXTERN ZeroMem:PROC
-
- .code
-
-;------------------------------------------------------------------------------
-; EFI_STATUS
-; EFIAPI
-; SecTemporaryRamSupport (
-; IN CONST EFI_PEI_SERVICES **PeiServices, // %rcx
-; IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, // %rdx
-; IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8
-; IN UINTN CopySize // %r9
-; )
-;------------------------------------------------------------------------------
-SecTemporaryRamSupport PROC
- ; Adjust callers %rbp to account for stack move
- sub rbp, rdx ; Calc offset of %rbp in Temp Memory
- add rbp, r8 ; add in permanent base to offset
-
- push rbp ; stack frame is for the debugger
- mov rbp, rsp
-
- push rdx ; Save TemporaryMemoryBase
- push r8 ; Save PermanentMemoryBase
- push r9 ; Save CopySize
-
- ;
- ; Copy all of temp RAM to permanent memory, including stack
- ;
- ; CopyMem (PermanentMemoryBase, TemporaryMemoryBase, CopySize);
- ; %rcx, %rdx, %r8
- mov rcx, r8 ; Shift arguments
- mov r8, r9
- sub rsp, 028h ; Allocate register spill area & 16-byte align stack
- call CopyMem
- ; Temp mem stack now copied to permanent location. %esp still in temp memory
- add rsp, 028h
-
- pop r9 ; CopySize (old stack)
- pop r8 ; PermanentMemoryBase (old stack)
- pop rdx ; TemporaryMemoryBase (old stack)
-
- mov rcx, rsp ; Move to new stack
- sub rcx, rdx ; Calc offset of stack in Temp Memory
- add rcx, r8 ; Calc PermanentMemoryBase address
- mov rsp, rcx ; Update stack
- ; Stack now points to permanent memory
-
- ; ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);
- mov rcx, rdx
- mov rdx, r9
- sub rsp, 028h ; Allocate register spill area & 16-byte align stack
- call ZeroMem
- add rsp, 028h
-
- ; This data comes off the NEW stack
- pop rbp
- ret
-SecTemporaryRamSupport ENDP
-
- END
diff --git a/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c b/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c
deleted file mode 100644
index 33188d5e95..0000000000
--- a/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*++ @file
- UEFI/PI PEIM to abstract construction of firmware volume in a Unix environment.
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiPei.h>
-
-#include <Library/DebugLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-
-#include <Ppi/EmuThunk.h>
-#include <Protocol/EmuThunk.h>
-
-
-
-EFI_STATUS
-EFIAPI
-PeiInitialzeThunkPpiToProtocolPei (
- 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
-
-**/
-{
- EFI_STATUS Status;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- EMU_THUNK_PPI *Thunk;
- VOID *Ptr;
-
- DEBUG ((EFI_D_ERROR, "Emu Thunk PEIM Loaded\n"));
-
- Status = PeiServicesLocatePpi (
- &gEmuThunkPpiGuid, // GUID
- 0, // INSTANCE
- &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
- (VOID **)&Thunk // PPI
- );
- ASSERT_EFI_ERROR (Status);
-
- Ptr = Thunk->Thunk ();
-
- BuildGuidDataHob (
- &gEmuThunkProtocolGuid, // Guid
- &Ptr, // Buffer
- sizeof (VOID *) // Sizeof Buffer
- );
- return Status;
-}
diff --git a/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf b/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
deleted file mode 100644
index d0fcc952ed..0000000000
--- a/EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Stuff driver
-#
-# Tiano PEIM to abstract construction of firmware volume in a Emu environment.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ThunkPpiToProtocolPei
- FILE_GUID = C32A66D5-D8B7-2640-B768-082C8F083C37
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeiInitialzeThunkPpiToProtocolPei
-
-
-[Sources]
- ThunkPpiToProtocolPei.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- PeiServicesTablePointerLib
- PeiServicesLib
- HobLib
- PeimEntryPoint
- DebugLib
-
-
-[Protocols]
- gEmuThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-
-[Ppis]
- gEmuThunkPpiGuid # PPI ALWAYS_CONSUMED
-
-
-[Depex]
- gEmuThunkPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
-
diff --git a/EmulatorPkg/TimerDxe/Timer.c b/EmulatorPkg/TimerDxe/Timer.c
deleted file mode 100644
index 5230a9625e..0000000000
--- a/EmulatorPkg/TimerDxe/Timer.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*++ @file
- Emu Emulation Timer Architectural Protocol Driver as defined in DXE CIS
-
- This Timer module uses an Emu 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) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#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 <Library/EmuThunkLib.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 = {
- EmuTimerDriverRegisterHandler,
- EmuTimerDriverSetTimerPeriod,
- EmuTimerDriverGetTimerPeriod,
- EmuTimerDriverGenerateSoftInterrupt
-};
-
-//
-// 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)
-{
- 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 (MultU64x32 (DeltaMs, 10000));
- }
- }
-
- gBS->RestoreTPL (OriginalTPL);
-
-}
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverRegisterHandler (
- 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. */
- gEmuThunk->SetTimer (0, TimerCallback);
- } else if (mTimerNotifyFunction == NULL) {
- /* Enable Timer. */
- gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
- }
- mTimerNotifyFunction = NotifyFunction;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverSetTimerPeriod (
- 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);
-
- gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverGetTimerPeriod (
- 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 = MultU64x32 (mTimerPeriodMs, 10000);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverGenerateSoftInterrupt (
- 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
-EmuTimerDriverInitialize (
- 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);
-
- //
- // Start the timer thread at the default timer period
- //
- Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);
- if (EFI_ERROR (Status)) {
- return 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;
- }
-
-
- return EFI_SUCCESS;
-}
diff --git a/EmulatorPkg/TimerDxe/Timer.h b/EmulatorPkg/TimerDxe/Timer.h
deleted file mode 100644
index ca5b43b025..0000000000
--- a/EmulatorPkg/TimerDxe/Timer.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*++ @file
- Emu Emulation Architectural Protocol Driver as defined in UEFI/PI.
- This Timer module uses an UNIX Thread to simulate the timer-tick driven
- timer service.
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#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
-EmuTimerDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverRegisterHandler (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN EFI_TIMER_NOTIFY NotifyFunction
- );
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverSetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- );
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
- );
-
-EFI_STATUS
-EFIAPI
-EmuTimerDriverGenerateSoftInterrupt (
- IN EFI_TIMER_ARCH_PROTOCOL *This
- );
-
-#endif
diff --git a/EmulatorPkg/TimerDxe/Timer.inf b/EmulatorPkg/TimerDxe/Timer.inf
deleted file mode 100644
index 713f8eac0b..0000000000
--- a/EmulatorPkg/TimerDxe/Timer.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# Emu Emulation Timer Architectural Protocol Driver as defined in DXE CIS
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EmuTimer
- FILE_GUID = 87E1BB14-4D5C-7C4E-A90E-E1415687D062
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = EmuTimerDriverInitialize
-
-#
-# 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
- EmulatorPkg/EmulatorPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- EmuThunkLib
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- BaseLib
-
-
-[Protocols]
- gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiTimerArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-
-[Depex]
- gEfiCpuArchProtocolGuid
-
diff --git a/EmulatorPkg/Unix/.gdbinit b/EmulatorPkg/Unix/.gdbinit
deleted file mode 100644
index 173818c0e7..0000000000
--- a/EmulatorPkg/Unix/.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/EmulatorPkg/Unix/GdbRun b/EmulatorPkg/Unix/GdbRun
deleted file mode 100644
index b2d6dccccb..0000000000
--- a/EmulatorPkg/Unix/GdbRun
+++ /dev/null
@@ -1,79 +0,0 @@
-## @file
-# GDB startup script
-#
-# 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.
-#
-##
-
-#
-# Gdb will set $_exitcode when the program exits. Pre-init it to an unlikely
-# return value.
-#
-set $_exitcode = 42
-
-#
-# Gdb will call hook-stop on each break. Check to see if $_exitcode was
-# changed from the value we pre-initialized it to. If so, the program
-# had exited, so gdb should now quit.
-#
-define hook-stop
- if $_exitcode != 42
- quit
- else
- source Host.gdb
- end
-end
-
-#
-# We keep track of the number of symbol files we have loaded via gdb
-# scripts in the $SymbolFilesAdded variable
-#
-set $SymbolFileChangesCount = 0
-
-#
-# This macro adds a symbols file for gdb
-#
-# @param $arg0 - Symbol file changes number
-# @param $arg1 - Symbol file name
-# @param $arg2 - Image address
-#
-define AddFirmwareSymbolFile
- if $SymbolFileChangesCount < $arg0
- add-symbol-file $arg1 $arg2
- set $SymbolFileChangesCount = $arg0
- end
-end
-
-#
-# This macro removes a symbols file for gdb
-#
-# @param $arg0 - Symbol file changes number
-# @param $arg1 - Symbol file name
-#
-define RemoveFirmwareSymbolFile
- if $SymbolFileChangesCount < $arg0
- #
- # Currently there is not a method to remove a single symbol file
- #
- set $SymbolFileChangesCount = $arg0
- end
-end
-
-if gInXcode == 1
- # in Xcode the program is already runing. Issuing a run command
- # will cause a fatal debugger error. The break point sciprt that
- # is used to source this script sets gInCode to 1.
-else
- #
- # Start the program running
- #
- run
-end
diff --git a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c b/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c
deleted file mode 100644
index 4ba27c2a6a..0000000000
--- a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c
+++ /dev/null
@@ -1,1111 +0,0 @@
-/**@file
- Berkeley Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
- emulator to get on real networks.
-
- Tested on Mac OS X.
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include "Host.h"
-
-#ifdef __APPLE__
-
-
-#include <Library/NetLib.h>
-
-
-#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
-typedef struct {
- UINTN Signature;
-
- EMU_IO_THUNK_PROTOCOL *Thunk;
- EMU_SNP_PROTOCOL EmuSnp;
- EFI_SIMPLE_NETWORK_MODE *Mode;
-
- int BpfFd;
- char *InterfaceName;
- EFI_MAC_ADDRESS MacAddress;
- u_int ReadBufferSize;
- VOID *ReadBuffer;
-
- //
- // Two walking pointers to manage the multiple packets that can be returned
- // in a single read.
- //
- VOID *CurrentReadPointer;
- VOID *EndReadPointer;
-
- UINT32 ReceivedPackets;
- UINT32 DroppedPackets;
-
-} EMU_SNP_PRIVATE;
-
-#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
-
-
-//
-// 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;
-} ETHERNET_HEADER;
-
-/**
- Register storage for SNP Mode.
-
- @param This Protocol instance pointer.
- @param Mode SimpleNetworkProtocol Mode structure passed into driver.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
-
-**/
-EFI_STATUS
-EmuSnpCreateMapping (
- IN EMU_SNP_PROTOCOL *This,
- IN EFI_SIMPLE_NETWORK_MODE *Mode
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Mode = Mode;
-
- //
- // Set the broadcast address.
- //
- SetMem (&Mode->BroadcastAddress, sizeof (EFI_MAC_ADDRESS), 0xFF);
-
- CopyMem (&Mode->CurrentAddress, &Private->MacAddress, sizeof (EFI_MAC_ADDRESS));
- CopyMem (&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.
- //
- Mode->CurrentAddress.Addr[NET_ETHER_ADDR_LEN - 1]++;
-
- return EFI_SUCCESS;
-}
-
-
-static struct bpf_insn mFilterInstructionTemplate[] = {
- // Load 4 bytes from the destination MAC address.
- BPF_STMT (BPF_LD + BPF_W + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, 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( ETHERNET_HEADER, 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 (ETHERNET_HEADER, 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( ETHERNET_HEADER, 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)
-};
-
-
-EFI_STATUS
-OpenBpfFileDescriptor (
- IN EMU_SNP_PRIVATE *Private,
- OUT int *Fd
- )
-{
- char BfpDeviceName[256];
- int Index;
-
- //
- // 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++ ) {
- snprintf (BfpDeviceName, sizeof (BfpDeviceName), "/dev/bpf%d", Index);
-
- *Fd = open (BfpDeviceName, O_RDWR, 0);
- if ( *Fd >= 0 ) {
- return EFI_SUCCESS;
- }
-
- if (errno == EACCES) {
- printf (
- "SNP: Permissions on '%s' are incorrect. Fix with 'sudo chmod 666 %s'.\n",
- BfpDeviceName,
- BfpDeviceName
- );
- }
-
- if (errno != EBUSY) {
- break;
- }
- }
-
- return EFI_OUT_OF_RESOURCES;
-}
-
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_ALREADY_STARTED The network interface is already in the started state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStart (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_SNP_PRIVATE *Private;
- struct ifreq BoundIf;
- struct bpf_program BpfProgram;
- struct bpf_insn *FilterProgram;
- u_int Value;
- u_int ReadBufferSize;
- UINT16 Temp16;
- UINT32 Temp32;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- switch (Private->Mode->State) {
- case EfiSimpleNetworkStopped:
- break;
-
- case EfiSimpleNetworkStarted:
- case EfiSimpleNetworkInitialized:
- return EFI_ALREADY_STARTED;
- break;
-
- default:
- return EFI_DEVICE_ERROR;
- break;
- }
-
- Status = EFI_SUCCESS;
- if (Private->BpfFd == 0) {
- Status = OpenBpfFileDescriptor (Private, &Private->BpfFd);
- if (EFI_ERROR (Status)) {
- goto DeviceErrorExit;
- }
-
- //
- // Get the read buffer size.
- //
- if (ioctl (Private->BpfFd, BIOCGBLEN, &ReadBufferSize) < 0) {
- goto DeviceErrorExit;
- }
-
- //
- // Default value from BIOCGBLEN is usually too small, so use a much larger size, if necessary.
- //
- if (ReadBufferSize < FixedPcdGet32 (PcdNetworkPacketFilterSize)) {
- ReadBufferSize = FixedPcdGet32 (PcdNetworkPacketFilterSize);
- if (ioctl (Private->BpfFd, BIOCSBLEN, &ReadBufferSize) < 0) {
- goto DeviceErrorExit;
- }
- }
-
- //
- // Associate our interface with this BPF file descriptor.
- //
- AsciiStrCpy (BoundIf.ifr_name, Private->InterfaceName);
- if (ioctl (Private->BpfFd, BIOCSETIF, &BoundIf) < 0) {
- goto DeviceErrorExit;
- }
-
- //
- // Enable immediate mode.
- //
- Value = 1;
- if (ioctl (Private->BpfFd, BIOCIMMEDIATE, &Value) < 0) {
- goto DeviceErrorExit;
- }
-
- //
- // Enable non-blocking I/O.
- //
- if (fcntl (Private->BpfFd, F_GETFL, 0) == -1) {
- goto DeviceErrorExit;
- }
-
- Value |= O_NONBLOCK;
-
- if (fcntl (Private->BpfFd, F_SETFL, Value) == -1) {
- goto DeviceErrorExit;
- }
-
- //
- // Disable "header complete" flag. This means the supplied source MAC address is
- // what goes on the wire.
- //
- Value = 1;
- if (ioctl (Private->BpfFd, BIOCSHDRCMPLT, &Value) < 0) {
- goto DeviceErrorExit;
- }
-
- //
- // Allocate read buffer.
- //
- Private->ReadBufferSize = ReadBufferSize;
- Private->ReadBuffer = malloc (Private->ReadBufferSize);
- if (Private->ReadBuffer == NULL) {
- goto ErrorExit;
- }
-
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer;
-
- //
- // Install our packet filter: successful reads should only produce broadcast or unicast
- // packets directed to our fake MAC address.
- //
- FilterProgram = malloc (sizeof (mFilterInstructionTemplate)) ;
- if ( FilterProgram == NULL ) {
- goto ErrorExit;
- }
-
- CopyMem (FilterProgram, &mFilterInstructionTemplate, sizeof (mFilterInstructionTemplate));
-
- //
- // 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 (mFilterInstructionTemplate) / sizeof (struct bpf_insn);
- BpfProgram.bf_insns = FilterProgram;
-
- if (ioctl (Private->BpfFd, BIOCSETF, &BpfProgram) < 0) {
- goto DeviceErrorExit;
- }
-
- free (FilterProgram);
-
- //
- // Enable promiscuous mode.
- //
- if (ioctl (Private->BpfFd, BIOCPROMISC, 0) < 0) {
- goto DeviceErrorExit;
- }
-
-
- Private->Mode->State = EfiSimpleNetworkStarted;
- }
-
- return Status;
-
-DeviceErrorExit:
- Status = EFI_DEVICE_ERROR;
-ErrorExit:
- if (Private->ReadBuffer != NULL) {
- free (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 The network interface was stopped.
- @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStop (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- switch ( Private->Mode->State ) {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
- break;
-
- default:
- return EFI_DEVICE_ERROR;
- break;
- }
-
- if (Private->BpfFd != 0) {
- close (Private->BpfFd);
- Private->BpfFd = 0;
- }
-
- if (Private->ReadBuffer != NULL) {
- free (Private->ReadBuffer );
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer = NULL;
- }
-
- Private->Mode->State = EfiSimpleNetworkStopped;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- 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 The 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 The network interface was initialized.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
- receive buffers.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpInitialize (
- IN EMU_SNP_PROTOCOL *This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- switch ( Private->Mode->State ) {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
- break;
-
- default:
- return EFI_DEVICE_ERROR;
- break;
- }
-
- Private->Mode->MCastFilterCount = 0;
- Private->Mode->ReceiveFilterSetting = 0;
- ZeroMem (Private->Mode->MCastFilter, sizeof (Private->Mode->MCastFilter));
-
- Private->Mode->State = EfiSimpleNetworkInitialized;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
-
- @param This The protocol instance pointer.
- @param ExtendedVerification Indicates that the driver may perform a more
- exhaustive verification operation of the device
- during reset.
-
- @retval EFI_SUCCESS The network interface was reset.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReset (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- switch ( Private->Mode->State ) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
- break;
-
- default:
- return EFI_DEVICE_ERROR;
- break;
- }
-
- return EFI_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 The network interface was shutdown.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpShutdown (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- switch ( Private->Mode->State ) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
- break;
-
- default:
- return EFI_DEVICE_ERROR;
- break;
- }
-
- Private->Mode->State = EfiSimpleNetworkStarted;
-
- Private->Mode->ReceiveFilterSetting = 0;
- Private->Mode->MCastFilterCount = 0;
- ZeroMem (Private->Mode->MCastFilter, sizeof (Private->Mode->MCastFilter));
-
- if (Private->BpfFd != 0) {
- close (Private->BpfFd);
- Private->BpfFd = 0;
- }
-
- if (Private->ReadBuffer != NULL) {
- free (Private->ReadBuffer);
- Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Manages the multicast receive filters of a network interface.
-
- @param This The protocol instance pointer.
- @param Enable A bit mask of receive filters to enable on the network interface.
- @param Disable 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 McastFilterCnt Number of multicast HW MAC addresses in the new
- MCastFilter list. This value must be less than or equal to
- the MCastFilterCnt field of EMU_SNP_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_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReceiveFilters (
- IN EMU_SNP_PROTOCOL *This,
- IN UINT32 Enable,
- IN UINT32 Disable,
- IN BOOLEAN ResetMCastFilter,
- IN UINTN MCastFilterCnt OPTIONAL,
- IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- // For now, just succeed...
- return EFI_SUCCESS;
-}
-
-
-/**
- Modifies or resets the current station address, if supported.
-
- @param This The protocol instance pointer.
- @param Reset Flag used to reset the station address to the network interfaces
- permanent address.
- @param New The new station address to be used for the network interface.
-
- @retval EFI_SUCCESS The network interfaces station address was updated.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStationAddress (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS *New OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStatistics (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN OUT UINTN *StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Converts a multicast IP address to a multicast HW MAC address.
-
- @param This The 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpMCastIpToMac (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Performs read and write operations on the NVRAM device attached to a
- network interface.
-
- @param This The protocol instance pointer.
- @param ReadWrite 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_SUCCESS The NVRAM access was performed.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpNvData (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ReadWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID *Buffer
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Reads the current interrupt status and recycled transmit buffer status from
- a network interface.
-
- @param This The 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 TxBuf 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 The status of the network interface was retrieved.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpGetStatus (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINT32 *InterruptStatus OPTIONAL,
- OUT VOID **TxBuf OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- if (TxBuf != NULL) {
- *((UINT8 **)TxBuf) = (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 The 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_NOT_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpTransmit (
- IN EMU_SNP_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
- )
-{
- EMU_SNP_PRIVATE *Private;
- ETHERNET_HEADER *EnetHeader;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->Mode->State < EfiSimpleNetworkStarted) {
- return EFI_NOT_STARTED;
- }
-
- if ( HeaderSize != 0 ) {
- if ((DestAddr == NULL) || (Protocol == NULL) || (HeaderSize != Private->Mode->MediaHeaderSize)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (SrcAddr == NULL) {
- SrcAddr = &Private->Mode->CurrentAddress;
- }
-
- EnetHeader = (ETHERNET_HEADER *) Buffer;
-
- CopyMem (EnetHeader->DstAddr, DestAddr, NET_ETHER_ADDR_LEN);
- CopyMem (EnetHeader->SrcAddr, SrcAddr, NET_ETHER_ADDR_LEN);
-
- EnetHeader->Type = HTONS(*Protocol);
- }
-
- if (write (Private->BpfFd, Buffer, BufferSize) < 0) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Receives a packet from a network interface.
-
- @param This The 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 BufferSize 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 SrcAddr The source HW MAC address. If this parameter is NULL, the
- HW MAC source address will not be extracted from the media
- header.
- @param DestAddr 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_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReceive (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINTN *HeaderSize OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer,
- OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
- OUT UINT16 *Protocol OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
- struct bpf_hdr *BpfHeader;
- struct bpf_stat BpfStats;
- ETHERNET_HEADER *EnetHeader;
- ssize_t Result;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->Mode->State < EfiSimpleNetworkStarted) {
- return EFI_NOT_STARTED;
- }
-
- ZeroMem (&BpfStats, sizeof( BpfStats));
-
- if (ioctl (Private->BpfFd, BIOCGSTATS, &BpfStats) == 0) {
- Private->ReceivedPackets += BpfStats.bs_recv;
- if (BpfStats.bs_drop > Private->DroppedPackets) {
- printf (
- "SNP: STATS: RCVD = %d DROPPED = %d. Probably need to increase BPF PcdNetworkPacketFilterSize?\n",
- BpfStats.bs_recv,
- BpfStats.bs_drop - Private->DroppedPackets
- );
- Private->DroppedPackets = BpfStats.bs_drop;
- }
- }
-
- //
- // Do we have any remaining packets from the previous read?
- //
- if (Private->CurrentReadPointer >= Private->EndReadPointer) {
- Result = read (Private->BpfFd, Private->ReadBuffer, Private->ReadBufferSize);
- if (Result < 0) {
- // EAGAIN means that there's no I/O outstanding against this file descriptor.
- return (errno == EAGAIN) ? EFI_NOT_READY : 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 > *BufferSize) {
- *BufferSize = BpfHeader->bh_caplen;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- CopyMem (Buffer, EnetHeader, BpfHeader->bh_caplen);
- *BufferSize = BpfHeader->bh_caplen;
-
- if (HeaderSize != NULL) {
- *HeaderSize = sizeof (ETHERNET_HEADER);
- }
-
- if (DestAddr != NULL) {
- ZeroMem (DestAddr, sizeof (EFI_MAC_ADDRESS));
- CopyMem (DestAddr, EnetHeader->DstAddr, NET_ETHER_ADDR_LEN);
- }
-
- if (SrcAddr != NULL) {
- ZeroMem (SrcAddr, sizeof (EFI_MAC_ADDRESS));
- CopyMem (SrcAddr, EnetHeader->SrcAddr, NET_ETHER_ADDR_LEN);
- }
-
- if (Protocol != NULL) {
- *Protocol = NTOHS (EnetHeader->Type);
- }
-
- Private->CurrentReadPointer += BPF_WORDALIGN (BpfHeader->bh_hdrlen + BpfHeader->bh_caplen);
- return EFI_SUCCESS;
-}
-
-
-EMU_SNP_PROTOCOL gEmuSnpProtocol = {
- GasketSnpCreateMapping,
- GasketSnpStart,
- GasketSnpStop,
- GasketSnpInitialize,
- GasketSnpReset,
- GasketSnpShutdown,
- GasketSnpReceiveFilters,
- GasketSnpStationAddress,
- GasketSnpStatistics,
- GasketSnpMCastIpToMac,
- GasketSnpNvData,
- GasketSnpGetStatus,
- GasketSnpTransmit,
- GasketSnpReceive
-};
-
-EFI_STATUS
-GetInterfaceMacAddr (
- EMU_SNP_PRIVATE *Private
- )
-{
- EFI_STATUS Status;
- struct ifaddrs *IfAddrs;
- struct ifaddrs *If;
- struct sockaddr_dl *IfSdl;
-
- if (getifaddrs (&IfAddrs) != 0) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Convert the interface name to ASCII so we can find it.
- //
- Private->InterfaceName = malloc (StrSize (Private->Thunk->ConfigString));
- if (Private->InterfaceName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Exit;
- }
-
- UnicodeStrToAsciiStr (Private->Thunk->ConfigString, Private->InterfaceName);
-
- Status = EFI_NOT_FOUND;
- 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:
- freeifaddrs (IfAddrs);
- return Status;
-}
-
-
-EFI_STATUS
-EmuSnpThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- if (This->Private != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = malloc (sizeof (EMU_SNP_PRIVATE));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
-
- Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
- Private->Thunk = This;
- CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
- GetInterfaceMacAddr (Private);
-
- This->Interface = &Private->EmuSnp;
- This->Private = Private;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EmuSnpThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = This->Private;
- free (Private);
-
- return EFI_SUCCESS;
-}
-
-
-
-EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
- &gEmuSnpProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketSnpThunkOpen,
- GasketSnpThunkClose,
- NULL
-};
-
-#endif
diff --git a/EmulatorPkg/Unix/Host/BlockIo.c b/EmulatorPkg/Unix/Host/BlockIo.c
deleted file mode 100644
index fa05fbc107..0000000000
--- a/EmulatorPkg/Unix/Host/BlockIo.c
+++ /dev/null
@@ -1,708 +0,0 @@
-/**@file
-
-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.
-
-**/
-
-#include "Host.h"
-
-#define EMU_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'b', 'k')
-typedef struct {
- UINTN Signature;
-
- EMU_IO_THUNK_PROTOCOL *Thunk;
-
- char *Filename;
- UINTN ReadMode;
- UINTN Mode;
-
- int fd;
-
- BOOLEAN RemovableMedia;
- BOOLEAN WriteProtected;
-
- UINT64 NumberOfBlocks;
- UINT32 BlockSize;
-
- EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
- EFI_BLOCK_IO_MEDIA *Media;
-
-} EMU_BLOCK_IO_PRIVATE;
-
-#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EMU_BLOCK_IO_PRIVATE, EmuBlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
-
-
-
-EFI_STATUS
-EmuBlockIoReset (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-
-/*++
-
-This function extends the capability of SetFilePointer to accept 64 bit parameters
-
-**/
-EFI_STATUS
-SetFilePointer64 (
- IN EMU_BLOCK_IO_PRIVATE *Private,
- IN INT64 DistanceToMove,
- OUT UINT64 *NewFilePointer,
- IN INT32 MoveMethod
- )
-{
- EFI_STATUS Status;
- off_t res;
- off_t offset = DistanceToMove;
-
- Status = EFI_SUCCESS;
- res = lseek (Private->fd, offset, (int)MoveMethod);
- if (res == -1) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- if (NewFilePointer != NULL) {
- *NewFilePointer = res;
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-EmuBlockIoOpenDevice (
- IN EMU_BLOCK_IO_PRIVATE *Private
- )
-{
- EFI_STATUS Status;
- UINT64 FileSize;
- struct statfs buf;
-
-
- //
- // If the device is already opened, close it
- //
- if (Private->fd >= 0) {
- EmuBlockIoReset (&Private->EmuBlockIo, FALSE);
- }
-
- //
- // Open the device
- //
- Private->fd = open (Private->Filename, Private->Mode, 0644);
- if (Private->fd < 0) {
- printf ("EmuOpenBlock: Could not open %s: %s\n", Private->Filename, strerror(errno));
- Private->Media->MediaPresent = FALSE;
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (!Private->Media->MediaPresent) {
- //
- // BugBug: try to emulate if a CD appears - notify drivers to check it out
- //
- Private->Media->MediaPresent = TRUE;
- }
-
- //
- // get the size of the file
- //
- Status = SetFilePointer64 (Private, 0, &FileSize, SEEK_END);
- if (EFI_ERROR (Status)) {
- printf ("EmuOpenBlock: Could not get filesize of %s\n", Private->Filename);
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (FileSize == 0) {
- // lseek fails on a real device. ioctl calls are OS specific
-#if __APPLE__
- {
- UINT32 BlockSize;
-
- if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {
- Private->Media->BlockSize = BlockSize;
- }
- if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) {
- if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) {
- // A DVD is ~ 4.37 GB so make up a number
- Private->Media->LastBlock = (0x100000000ULL/0x800) - 1;
- } else {
- Private->Media->LastBlock = Private->NumberOfBlocks - 1;
- }
- }
- ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
- }
-#else
- {
- size_t BlockSize;
- UINT64 DiskSize;
-
- if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
- Private->Media->BlockSize = BlockSize;
- }
- if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) {
- Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize);
- Private->Media->LastBlock = Private->NumberOfBlocks - 1;
- }
- }
-#endif
-
- } else {
- Private->Media->BlockSize = Private->BlockSize;
- Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
- Private->Media->LastBlock = Private->NumberOfBlocks - 1;
-
- if (fstatfs (Private->fd, &buf) == 0) {
-#if __APPLE__
- Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;
-#else
- Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;
-#endif
- }
- }
-
- DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N\n", Private->Filename));
- Status = EFI_SUCCESS;
-
-Done:
- if (EFI_ERROR (Status)) {
- if (Private->fd >= 0) {
- EmuBlockIoReset (&Private->EmuBlockIo, FALSE);
- }
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-EmuBlockIoCreateMapping (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN EFI_BLOCK_IO_MEDIA *Media
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Media = Media;
-
- Media->MediaId = 0;
- Media->RemovableMedia = Private->RemovableMedia;
- Media->MediaPresent = TRUE;
- Media->LogicalPartition = FALSE;
- Media->ReadOnly = Private->WriteProtected;
- Media->WriteCaching = FALSE;
- Media->IoAlign = 1;
- Media->LastBlock = 0; // Filled in by OpenDevice
-
- // EFI_BLOCK_IO_PROTOCOL_REVISION2
- Media->LowestAlignedLba = 0;
- Media->LogicalBlocksPerPhysicalBlock = 0;
-
-
- // EFI_BLOCK_IO_PROTOCOL_REVISION3
- Media->OptimalTransferLengthGranularity = 0;
-
- Status = EmuBlockIoOpenDevice (Private);
-
-
- return Status;
-}
-
-
-EFI_STATUS
-EmuBlockIoError (
- IN EMU_BLOCK_IO_PRIVATE *Private
- )
-{
- EFI_STATUS Status;
- BOOLEAN ReinstallBlockIoFlag;
-
-
- switch (errno) {
-
- case EAGAIN:
- Status = EFI_NO_MEDIA;
- Private->Media->ReadOnly = FALSE;
- Private->Media->MediaPresent = FALSE;
- ReinstallBlockIoFlag = FALSE;
- break;
-
- case EACCES:
- Private->Media->ReadOnly = FALSE;
- Private->Media->MediaPresent = TRUE;
- Private->Media->MediaId += 1;
- ReinstallBlockIoFlag = TRUE;
- Status = EFI_MEDIA_CHANGED;
- break;
-
- case EROFS:
- Private->Media->ReadOnly = TRUE;
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_WRITE_PROTECTED;
- break;
-
- default:
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_DEVICE_ERROR;
- break;
- }
- return Status;
-}
-
-
-EFI_STATUS
-EmuBlockIoReadWriteCommon (
- IN EMU_BLOCK_IO_PRIVATE *Private,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer,
- IN CHAR8 *CallerName
- )
-{
- EFI_STATUS Status;
- UINTN BlockSize;
- UINT64 LastBlock;
- INT64 DistanceToMove;
- UINT64 DistanceMoved;
-
- if (Private->fd < 0) {
- Status = EmuBlockIoOpenDevice (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->Media->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->Media->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 EmuBlockIoError (Private);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Read BufferSize bytes from Lba into Buffer.
-
- This function reads the requested number of blocks from the device. All the
- blocks are read, or an error is returned.
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and
- non-blocking I/O is being used, the Event associated with this request will
- not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId Id of the media, changes every time the media is
- replaced.
- @param[in] Lba The starting Logical Block Address to read from.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[out] Buffer A pointer to the destination buffer for the data. The
- caller is responsible for either having implicit or
- explicit ownership of the buffer.
-
- @retval EFI_SUCCESS The read request was queued if Token->Event is
- not NULL.The data was read correctly from the
- device if the Token->Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while performing
- the read.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-**/
-EFI_STATUS
-EmuBlockIoReadBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_BLOCK_IO_PRIVATE *Private;
- ssize_t len;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixReadBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- len = read (Private->fd, Buffer, BufferSize);
- if (len != BufferSize) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed.\n"));
- Status = EmuBlockIoError (Private);
- goto Done;
- }
-
- //
- // If we read then media is present.
- //
- Private->Media->MediaPresent = TRUE;
- Status = EFI_SUCCESS;
-
-Done:
- if (Token != NULL) {
- if (Token->Event != NULL) {
- // Caller is responcible for signaling EFI Event
- Token->TransactionStatus = Status;
- return EFI_SUCCESS;
- }
- }
- return Status;
-}
-
-
-/**
- Write BufferSize bytes from Lba into Buffer.
-
- This function writes the requested number of blocks to the device. All blocks
- are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,
- EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is
- being used, the Event associated with this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] MediaId The media ID that the write request is for.
- @param[in] Lba The starting logical block address to be written. The
- caller is responsible for writing to only legitimate
- locations.
- @param[in, out] Token A pointer to the token associated with the transaction.
- @param[in] BufferSize Size of Buffer, must be a multiple of device block size.
- @param[in] Buffer A pointer to the source buffer for the data.
-
- @retval EFI_SUCCESS The write request was queued if Event is not NULL.
- The data was written correctly to the device if
- the Event is NULL.
- @retval EFI_WRITE_PROTECTED The device can not be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
- @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
- @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
- or the buffer is not on proper alignment.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EmuBlockIoWriteBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- EMU_BLOCK_IO_PRIVATE *Private;
- ssize_t len;
- EFI_STATUS Status;
-
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixWriteBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- len = write (Private->fd, Buffer, BufferSize);
- if (len != BufferSize) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed.\n"));
- Status = EmuBlockIoError (Private);
- goto Done;
- }
-
- //
- // If the write succeeded, we are not write protected and media is present.
- //
- Private->Media->MediaPresent = TRUE;
- Private->Media->ReadOnly = FALSE;
- Status = EFI_SUCCESS;
-
-Done:
- if (Token != NULL) {
- if (Token->Event != NULL) {
- // Caller is responcible for signaling EFI Event
- Token->TransactionStatus = Status;
- return EFI_SUCCESS;
- }
- }
-
- return Status;
-}
-
-
-/**
- Flush the Block Device.
-
- If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED
- is returned and non-blocking I/O is being used, the Event associated with
- this request will not be signaled.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in,out] Token A pointer to the token associated with the transaction
-
- @retval EFI_SUCCESS The flush request was queued if Event is not NULL.
- All outstanding data was written correctly to the
- device if the Event is NULL.
- @retval EFI_DEVICE_ERROR The device reported an error while writting back
- the data.
- @retval EFI_WRITE_PROTECTED The device cannot be written to.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EmuBlockIoFlushBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token
- )
-{
- EMU_BLOCK_IO_PRIVATE *Private;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->fd >= 0) {
- fsync (Private->fd);
-#if __APPLE__
- fcntl (Private->fd, F_FULLFSYNC);
-#endif
- }
-
-
- if (Token != NULL) {
- if (Token->Event != NULL) {
- // Caller is responcible for signaling EFI Event
- Token->TransactionStatus = EFI_SUCCESS;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Reset the block device hardware.
-
- @param[in] This Indicates a pointer to the calling context.
- @param[in] ExtendedVerification Indicates that the driver may perform a more
- exhausive verfication operation of the device
- during 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
-EmuBlockIoReset (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EMU_BLOCK_IO_PRIVATE *Private;
-
- Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->fd >= 0) {
- close (Private->fd);
- Private->fd = -1;
- }
-
- return EFI_SUCCESS;
-}
-
-
-char *
-StdDupUnicodeToAscii (
- IN CHAR16 *Str
- )
-{
- UINTN Size;
- char *Ascii;
- char *Ptr;
-
- Size = StrLen (Str) + 1;
- Ascii = malloc (Size);
- if (Ascii == NULL) {
- return NULL;
- }
-
- for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {
- *Ptr = *Str;
- }
- *Ptr = 0;
-
- return Ascii;
-}
-
-
-EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol = {
- GasketEmuBlockIoReset,
- GasketEmuBlockIoReadBlocks,
- GasketEmuBlockIoWriteBlocks,
- GasketEmuBlockIoFlushBlocks,
- GasketEmuBlockIoCreateMapping
-};
-
-EFI_STATUS
-EmuBlockIoThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_BLOCK_IO_PRIVATE *Private;
- char *Str;
-
- if (This->Private != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = malloc (sizeof (EMU_BLOCK_IO_PRIVATE));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
-
- Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
- Private->Thunk = This;
- CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
- Private->fd = -1;
- Private->BlockSize = 512;
-
- Private->Filename = StdDupUnicodeToAscii (This->ConfigString);
- if (Private->Filename == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Str = strstr (Private->Filename, ":");
- if (Str == NULL) {
- Private->RemovableMedia = FALSE;
- Private->WriteProtected = FALSE;
- } else {
- for (*Str++ = '\0'; *Str != 0; Str++) {
- if (*Str == 'R' || *Str == 'F') {
- Private->RemovableMedia = (BOOLEAN) (*Str == 'R');
- }
- if (*Str == 'O' || *Str == 'W') {
- Private->WriteProtected = (BOOLEAN) (*Str == 'O');
- }
- if (*Str == ':') {
- Private->BlockSize = strtol (++Str, NULL, 0);
- break;
- }
- }
- }
-
- Private->Mode = Private->WriteProtected ? O_RDONLY : O_RDWR;
-
- This->Interface = &Private->EmuBlockIo;
- This->Private = Private;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EmuBlockIoThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_BLOCK_IO_PRIVATE *Private;
-
- if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = This->Private;
-
- if (This->Private != NULL) {
- if (Private->Filename != NULL) {
- free (Private->Filename);
- }
- free (This->Private);
- This->Private = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo = {
- &gEmuBlockIoProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketBlockIoThunkOpen,
- GasketBlockIoThunkClose,
- NULL
-};
-
-
diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c b/EmulatorPkg/Unix/Host/EmuThunk.c
deleted file mode 100644
index a7b12b14e5..0000000000
--- a/EmulatorPkg/Unix/Host/EmuThunk.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*++ @file
- Since the SEC is the only program in our emulation we
- must use a UEFI/PI mechanism to export APIs to other modules.
- This is the role of the EFI_EMU_THUNK_PROTOCOL.
-
- The mUnixThunkTable exists so that a change to EFI_EMU_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.
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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 "Host.h"
-
-#ifdef __APPLE__
-#define DebugAssert _Mangle__DebugAssert
-
-#include <assert.h>
-#include <CoreServices/CoreServices.h>
-#include <mach/mach.h>
-#include <mach/mach_time.h>
-
-#undef DebugAssert
-#endif
-
-int settimer_initialized;
-struct timeval settimer_timeval;
-void (*settimer_callback)(UINT64 delta);
-
-BOOLEAN gEmulatorInterruptEnabled = FALSE;
-
-
-UINTN
-SecWriteStdErr (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- ssize_t Return;
-
- Return = write (STDERR_FILENO, (const void *)Buffer, (size_t)NumberOfBytes);
-
- return (Return == -1) ? 0 : Return;
-}
-
-
-EFI_STATUS
-SecConfigStdIn (
- VOID
- )
-{
- struct termios tty;
-
- //
- // Need to turn off line buffering, ECHO, and make it unbuffered.
- //
- tcgetattr (STDIN_FILENO, &tty);
- tty.c_lflag &= ~(ICANON | ECHO);
- tcsetattr (STDIN_FILENO, TCSANOW, &tty);
-
-// setvbuf (STDIN_FILENO, NULL, _IONBF, 0);
-
- // now ioctl FIONREAD will do what we need
- return EFI_SUCCESS;
-}
-
-UINTN
-SecWriteStdOut (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- ssize_t Return;
-
- Return = write (STDOUT_FILENO, (const void *)Buffer, (size_t)NumberOfBytes);
-
- return (Return == -1) ? 0 : Return;
-}
-
-UINTN
-SecReadStdIn (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- ssize_t Return;
-
- Return = read (STDIN_FILENO, Buffer, (size_t)NumberOfBytes);
-
- return (Return == -1) ? 0 : Return;
-}
-
-BOOLEAN
-SecPollStdIn (
- VOID
- )
-{
- int Result;
- int Bytes;
-
- Result = ioctl (STDIN_FILENO, FIONREAD, &Bytes);
- if (Result == -1) {
- return FALSE;
- }
-
- return (BOOLEAN)(Bytes > 0);
-}
-
-
-VOID *
-SecMalloc (
- IN UINTN Size
- )
-{
- return malloc ((size_t)Size);
-}
-
-VOID *
-SecValloc (
- IN UINTN Size
- )
-{
- return valloc ((size_t)Size);
-}
-
-BOOLEAN
-SecFree (
- IN VOID *Ptr
- )
-{
- if (EfiSystemMemoryRange (Ptr)) {
- // If an address range is in the EFI memory map it was alloced via EFI.
- // So don't free those ranges and let the caller know.
- return FALSE;
- }
-
- free (Ptr);
- return TRUE;
-}
-
-
-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) {
- ReverseGasketUint64 (settimer_callback, delta);
- }
-}
-
-VOID
-SecSetTimer (
- IN UINT64 PeriodMs,
- IN EMU_SET_TIMER_CALLBACK CallBack
- )
-{
- 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
-SecEnableInterrupt (
- 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);
- pthread_sigmask (SIG_UNBLOCK, &sigset, NULL);
-}
-
-
-VOID
-SecDisableInterrupt (
- VOID
- )
-{
- sigset_t sigset;
-
- // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts
- // by enabling/disabling SIGALRM.
- sigemptyset (&sigset);
- sigaddset (&sigset, SIGALRM);
- pthread_sigmask (SIG_BLOCK, &sigset, NULL);
- gEmulatorInterruptEnabled = FALSE;
-}
-
-
-BOOLEAN
-SecInterruptEanbled (void)
-{
- return gEmulatorInterruptEnabled;
-}
-
-
-UINT64
-QueryPerformanceFrequency (
- VOID
- )
-{
- // Hard code to nanoseconds
- return 1000000000ULL;
-}
-
-UINT64
-QueryPerformanceCounter (
- VOID
- )
-{
-#if __APPLE__
- UINT64 Start;
- static mach_timebase_info_data_t sTimebaseInfo;
-
-
- Start = mach_absolute_time ();
-
- // Convert to nanoseconds.
-
- // If this is the first time we've run, get the timebase.
- // We can use denom == 0 to indicate that sTimebaseInfo is
- // uninitialised because it makes no sense to have a zero
- // denominator is a fraction.
-
- if ( sTimebaseInfo.denom == 0 ) {
- (void) mach_timebase_info(&sTimebaseInfo);
- }
-
- // Do the maths. We hope that the multiplication doesn't
- // overflow; the price you pay for working in fixed point.
-
- return (Start * sTimebaseInfo.numer) / sTimebaseInfo.denom;
-#else
- // Need to figure out what to do for Linux?
- return 0;
-#endif
-}
-
-
-
-VOID
-SecSleep (
- IN UINT64 Nanoseconds
- )
-{
- struct timespec rq, rm;
- struct timeval start, end;
- unsigned long MicroSec;
-
- rq.tv_sec = DivU64x32 (Nanoseconds, 1000000000);
- rq.tv_nsec = ModU64x32 (Nanoseconds, 1000000000);
-
- //
- // 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
-SecCpuSleep (
- VOID
- )
-{
- struct timespec rq, rm;
-
- // nanosleep gets interrupted by the timer tic
- rq.tv_sec = 1;
- rq.tv_nsec = 0;
-
- nanosleep (&rq, &rm);
-}
-
-
-VOID
-SecExit (
- UINTN Status
- )
-{
- exit (Status);
-}
-
-
-VOID
-SecGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
- )
-{
- 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 = timezone;
- Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0)
- | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
-
- if (Capabilities != NULL) {
- Capabilities->Resolution = 1;
- Capabilities->Accuracy = 50000000;
- Capabilities->SetsToZero = FALSE;
- }
-}
-
-
-
-VOID
-SecSetTime (
- IN EFI_TIME *Time
- )
-{
- // Don't change the time on the system
- // We could save delta to localtime() and have SecGetTime adjust return values?
- return;
-}
-
-
-EFI_STATUS
-SecGetNextProtocol (
- IN BOOLEAN EmuBusDriver,
- OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
- )
-{
- return GetNextThunkProtocol (EmuBusDriver, Instance);
-}
-
-
-EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
- GasketSecWriteStdErr,
- GasketSecConfigStdIn,
- GasketSecWriteStdOut,
- GasketSecReadStdIn,
- GasketSecPollStdIn,
- GasketSecMalloc,
- GasketSecValloc,
- GasketSecFree,
- GasketSecPeCoffGetEntryPoint,
- GasketSecPeCoffRelocateImageExtraAction,
- GasketSecPeCoffUnloadImageExtraAction,
- GasketSecEnableInterrupt,
- GasketSecDisableInterrupt,
- GasketQueryPerformanceFrequency,
- GasketQueryPerformanceCounter,
- GasketSecSleep,
- GasketSecCpuSleep,
- GasketSecExit,
- GasketSecGetTime,
- GasketSecSetTime,
- GasketSecSetTimer,
- GasketSecGetNextProtocol
-};
-
-
-VOID
-SecInitThunkProtocol (
- VOID
- )
-{
- // timezone and daylight lib globals depend on tzset be called 1st.
- tzset ();
-}
-
diff --git a/EmulatorPkg/Unix/Host/Gasket.h b/EmulatorPkg/Unix/Host/Gasket.h
deleted file mode 100644
index f1cf4c7ef4..0000000000
--- a/EmulatorPkg/Unix/Host/Gasket.h
+++ /dev/null
@@ -1,651 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2011, 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.
-
-**/
-
-#ifndef _GASKET_H_
-#define _GASKET_H_
-
-//
-// EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI)
-//
-
-UINTN
-EFIAPI
-GasketSecWriteStdErr (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecConfigStdIn (
- VOID
- );
-
-UINTN
-EFIAPI
-GasketSecWriteStdOut (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-UINTN
-EFIAPI
-GasketSecReadStdIn (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-BOOLEAN
-EFIAPI
-GasketSecPollStdIn (
- VOID
- );
-
-VOID *
-EFIAPI
-GasketSecMalloc (
- IN UINTN Size
- );
-
-VOID *
-EFIAPI
-GasketSecValloc (
- IN UINTN Size
- );
-
-BOOLEAN
-EFIAPI
-GasketSecFree (
- IN VOID *Ptr
- );
-
-
-RETURN_STATUS
-EFIAPI
-GasketSecPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- );
-
-VOID
-EFIAPI
-GasketSecPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-VOID
-EFIAPI
-GasketSecPeCoffUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-VOID
-EFIAPI
-GasketSecSetTimer (
- IN UINT64 PeriodMs,
- IN EMU_SET_TIMER_CALLBACK CallBack
- );
-
-VOID
-EFIAPI
-GasketSecEnableInterrupt (
- VOID
- );
-
-VOID
-EFIAPI
-GasketSecDisableInterrupt (
- VOID
- );
-
-UINT64
-EFIAPI
-GasketQueryPerformanceFrequency (
- VOID
- );
-
-UINT64
-EFIAPI
-GasketQueryPerformanceCounter (
- VOID
- );
-
-
-VOID
-EFIAPI
-GasketSecSleep (
- IN UINT64 Nanoseconds
- );
-
-VOID
-EFIAPI
-GasketSecCpuSleep (
- VOID
- );
-
-VOID
-EFIAPI
-GasketSecExit (
- UINTN Status
- );
-
-VOID
-EFIAPI
-GasketSecGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
- );
-
-VOID
-EFIAPI
-GasketSecSetTime (
- IN EFI_TIME *Time
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecGetNextProtocol (
- IN BOOLEAN EmuBusDriver,
- OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
- );
-
-
-// PPIs produced by SEC
-
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixPeiAutoScan (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- );
-
-VOID *
-EFIAPI
-GasketSecEmuThunkAddress (
- VOID
- );
-
-
-EFI_STATUS
-EFIAPI
-GasketSecUnixUnixFwhAddress (
- IN OUT UINT64 *FwhSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
- );
-
-
-
-//
-// Reverse (UNIX to EFIAPI) gaskets
-//
-
-typedef
-void
-(EFIAPI *CALL_BACK) (
- UINT64 Delta
- );
-
-UINTN
-ReverseGasketUint64 (
- CALL_BACK CallBack,
- UINT64 a
- );
-
-UINTN
-ReverseGasketUint64Uint64 (
- VOID *CallBack,
- VOID *Context,
- VOID *Key
- );
-
-//
-// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
-//
-
-
-EFI_STATUS
-EFIAPI
-GasketX11Size (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
- UINT32 Width,
- UINT32 Height
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11CheckKey (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11GetKey (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
- EFI_KEY_DATA *key
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11KeySetState (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
- EFI_KEY_TOGGLE_STATE *KeyToggleState
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11RegisterKeyNotify (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
- IN VOID *Context
- );
-
-
-EFI_STATUS
-EFIAPI
-GasketX11Blt (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11CheckPointer (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11GetPointerState (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
- EFI_SIMPLE_POINTER_STATE *state
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11GraphicsWindowOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketX11GraphicsWindowClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-// Pthreads
-
-UINTN
-EFIAPI
-GasketPthreadMutexLock (
- IN VOID *Mutex
- );
-
-
-
-UINTN
-EFIAPI
-GasketPthreadMutexUnLock (
- IN VOID *Mutex
- );
-
-
-UINTN
-EFIAPI
-GasketPthreadMutexTryLock (
- IN VOID *Mutex
- );
-
-
-VOID *
-EFIAPI
-GasketPthreadMutexInit (
- IN VOID
- );
-
-
-UINTN
-EFIAPI
-GasketPthreadMutexDestroy (
- IN VOID *Mutex
- );
-
-
-UINTN
-EFIAPI
-GasketPthreadCreate (
- IN VOID *Thread,
- IN VOID *Attribute,
- IN THREAD_THUNK_THREAD_ENTRY Start,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-GasketPthreadExit (
- IN VOID *ValuePtr
- );
-
-
-UINTN
-EFIAPI
-GasketPthreadSelf (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-GasketPthreadOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketPthreadClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-
-// PosixFileSystem
-
-EFI_STATUS
-EFIAPI
-GasketPosixOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileCLose (
- IN EFI_FILE_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileDelete (
- IN EFI_FILE_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileRead (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileWrite (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileSetPossition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileGetPossition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileFlush (
- IN EFI_FILE_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileSystmeThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketPosixFileSystmeThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketEmuBlockIoReset (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-EFI_STATUS
-EFIAPI
-GasketEmuBlockIoReadBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketEmuBlockIoWriteBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketEmuBlockIoFlushBlocks (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN OUT EFI_BLOCK_IO2_TOKEN *Token
- );
-
-EFI_STATUS
-EFIAPI
-GasketEmuBlockIoCreateMapping (
- IN EMU_BLOCK_IO_PROTOCOL *This,
- IN EFI_BLOCK_IO_MEDIA *Media
- );
-
-EFI_STATUS
-EFIAPI
-GasketBlockIoThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketBlockIoThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpCreateMapping (
- IN EMU_SNP_PROTOCOL *This,
- IN EFI_SIMPLE_NETWORK_MODE *Media
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpStart (
- IN EMU_SNP_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpStop (
- IN EMU_SNP_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpInitialize (
- IN EMU_SNP_PROTOCOL *This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpReset (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpShutdown (
- IN EMU_SNP_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpReceiveFilters (
- IN EMU_SNP_PROTOCOL *This,
- IN UINT32 Enable,
- IN UINT32 Disable,
- IN BOOLEAN ResetMCastFilter,
- IN UINTN MCastFilterCnt OPTIONAL,
- IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpStationAddress (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS *New OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpStatistics (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN OUT UINTN *StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpMCastIpToMac (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpNvData (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ReadWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpGetStatus (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINT32 *InterruptStatus OPTIONAL,
- OUT VOID **TxBuf OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpTransmit (
- IN EMU_SNP_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
- );
-
-EFI_STATUS
-EFIAPI
-GasketSnpReceive (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINTN *HeaderSize OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer,
- OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
- OUT UINT16 *Protocol OPTIONAL
- );
-
-
-#endif
-
-
diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
deleted file mode 100644
index 977fe87fa6..0000000000
--- a/EmulatorPkg/Unix/Host/Host.c
+++ /dev/null
@@ -1,1286 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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 "Host.h"
-
-#ifdef __APPLE__
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
-
-//
-// Globals
-//
-
-EMU_THUNK_PPI mSecEmuThunkPpi = {
- GasketSecUnixPeiAutoScan,
- GasketSecUnixFdAddress,
- GasketSecEmuThunkAddress
-};
-
-char *gGdbWorkingFileName = NULL;
-unsigned int mScriptSymbolChangesCount = 0;
-
-
-//
-// 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;
-EMU_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;
-EMU_SYSTEM_MEMORY *gSystemMemory;
-
-
-
-UINTN mImageContextModHandleArraySize = 0;
-IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
-
-EFI_PEI_PPI_DESCRIPTOR *gPpiList;
-
-
-int gInXcode = 0;
-
-
-/*++
- Breakpoint target for Xcode project. Set in the Xcode XML
-
- Xcode breakpoint will 'source Host.gdb'
- gGdbWorkingFileName is set to Host.gdb
-
-**/
-VOID
-SecGdbConfigBreak (
- VOID
- )
-{
-}
-
-
-
-/*++
-
-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
-
-**/
-int
-main (
- IN int Argc,
- IN char **Argv,
- IN char **Envp
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS InitialStackMemory;
- UINT64 InitialStackMemorySize;
- UINTN Index;
- UINTN Index1;
- UINTN Index2;
- UINTN PeiIndex;
- CHAR8 *FileName;
- BOOLEAN Done;
- EFI_PEI_FILE_HANDLE FileHandle;
- VOID *SecFile;
- CHAR16 *MemorySizeStr;
- CHAR16 *FirmwareVolumesStr;
- UINTN *StackPointer;
- FILE *GdbTempFile;
-
- //
- // Xcode does not support sourcing gdb scripts directly, so the Xcode XML
- // has a break point script to source the GdbRun script.
- //
- SecGdbConfigBreak ();
-
- //
- // If dlopen doesn't work, then we build a gdb script to allow the
- // symbols to be loaded.
- //
- Index = strlen (*Argv);
- gGdbWorkingFileName = AllocatePool (Index + strlen(".gdb") + 1);
- strcpy (gGdbWorkingFileName, *Argv);
- strcat (gGdbWorkingFileName, ".gdb");
-
- //
- // Empty out the gdb symbols script file.
- //
- GdbTempFile = fopen (gGdbWorkingFileName, "w");
- if (GdbTempFile != NULL) {
- fclose (GdbTempFile);
- }
-
- printf ("\nEDK II UNIX Host Emulation Environment from http://www.tianocore.org/edk2/\n");
-
- setbuf (stdout, 0);
- setbuf (stderr, 0);
-
- MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
- FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
-
- //
- // PPIs pased into PEI_CORE
- //
- AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, &mSecEmuThunkPpi);
-
- SecInitThunkProtocol ();
-
- //
- // Emulator Bus Driver Thunks
- //
- AddThunkProtocol (&gX11ThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE);
- AddThunkProtocol (&gPosixFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE);
- AddThunkProtocol (&gBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE);
- AddThunkProtocol (&gSnpThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuNetworkInterface), TRUE);
-
- //
- // Emulator other Thunks
- //
- AddThunkProtocol (&gPthreadThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuApCount), FALSE);
-
- // EmuSecLibConstructor ();
-
- gPpiList = GetThunkPpiList ();
-
- //
- // Allocate space for gSystemMemory Array
- //
- gSystemMemoryCount = CountSeperatorsInString (MemorySizeStr, '!') + 1;
- gSystemMemory = AllocateZeroPool (gSystemMemoryCount * sizeof (EMU_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 = AllocateZeroPool (gFdInfoCount * sizeof (EMU_FD_INFO));
- if (gFdInfo == NULL) {
- printf ("ERROR : Can not allocate memory for fd info. Exiting.\n");
- exit (1);
- }
-
- printf (" BootMode 0x%02x\n", (unsigned int)PcdGet32 (PcdEmuBootMode));
-
- //
- // Open up a 128K file to emulate temp memory for SEC.
- // 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 (" OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\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 *) AllocatePool (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, SecFile = 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';
-
- if (Index == 0) {
- // Map FV Recovery Read Only and other areas Read/Write
- Status = MapFd0 (
- FileName,
- &gFdInfo[0].Address,
- &gFdInfo[0].Size
- );
- } else {
- //
- // Open the FD and remmeber where it got mapped into our processes address space
- // Maps Read Only
- //
- 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 (SecFile == NULL) {
- //
- // Assume the beginning of the FD is an FV and look for the SEC Core.
- // Load the first one we find.
- //
- FileHandle = NULL;
- Status = PeiServicesFfsFindNextFile (
- EFI_FV_FILETYPE_SECURITY_CORE,
- (EFI_PEI_FV_HANDLE)(UINTN)gFdInfo[Index].Address,
- &FileHandle
- );
- if (!EFI_ERROR (Status)) {
- Status = PeiServicesFfsFindSectionData (EFI_SECTION_PE32, FileHandle, &SecFile);
- if (!EFI_ERROR (Status)) {
- PeiIndex = Index;
- printf (" contains SEC Core");
- }
- }
- }
-
- printf ("\n");
- }
-
- if (SecFile == NULL) {
- printf ("ERROR : SEC not found!\n");
- exit (1);
- }
-
- //
- // 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 SEC
- //
- SecLoadFromCore ((UINTN) InitialStackMemory, (UINTN) InitialStackMemorySize, (UINTN) gFdInfo[0].Address, SecFile);
-
- //
- // If we get here, then the SEC Core returned. This is an error as SEC should
- // always hand off to PEI Core and then on to DXE Core.
- //
- printf ("ERROR : SEC returned\n");
- exit (1);
-}
-
-
-EFI_PHYSICAL_ADDRESS *
-MapMemory (
- IN INTN fd,
- IN UINT64 length,
- IN INTN prot,
- IN 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;
-}
-
-
-/*++
-
-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
-
-**/
-EFI_STATUS
-MapFile (
- IN CHAR8 *FileName,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- )
-{
- int fd;
- VOID *res;
- UINTN FileSize;
-
- fd = open (FileName, O_RDWR);
- if (fd < 0) {
- return EFI_NOT_FOUND;
- }
- FileSize = lseek (fd, 0, SEEK_END);
-
-
- res = MapMemory (fd, FileSize, PROT_READ | PROT_EXEC, MAP_PRIVATE);
-
- close (fd);
-
- if (res == NULL) {
- perror ("MapFile() Failed");
- return EFI_DEVICE_ERROR;
- }
-
- *Length = (UINT64) FileSize;
- *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-MapFd0 (
- IN CHAR8 *FileName,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- )
-{
- int fd;
- void *res, *res2, *res3;
- UINTN FileSize;
- UINTN FvSize;
- void *EmuMagicPage;
-
- fd = open (FileName, O_RDWR);
- if (fd < 0) {
- return EFI_NOT_FOUND;
- }
- FileSize = lseek (fd, 0, SEEK_END);
-
- FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize);
-
- // Assume start of FD is Recovery FV, and make it write protected
- res = mmap (
- (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase),
- FvSize,
- PROT_READ | PROT_EXEC,
- MAP_PRIVATE,
- fd,
- 0
- );
- if (res == MAP_FAILED) {
- perror ("MapFd0() Failed res =");
- close (fd);
- return EFI_DEVICE_ERROR;
- } else if (res != (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase)) {
- // We could not load at the build address, so we need to allow writes
- munmap (res, FvSize);
- res = mmap (
- (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase),
- FvSize,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE,
- fd,
- 0
- );
- if (res == MAP_FAILED) {
- perror ("MapFd0() Failed res =");
- close (fd);
- return EFI_DEVICE_ERROR;
- }
- }
-
- // Map the rest of the FD as read/write
- res2 = mmap (
- (void *)(UINTN)(FixedPcdGet64 (PcdEmuFlashFvRecoveryBase) + FvSize),
- FileSize - FvSize,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED,
- fd,
- FvSize
- );
- close (fd);
- if (res2 == MAP_FAILED) {
- perror ("MapFd0() Failed res2 =");
- return EFI_DEVICE_ERROR;
- }
-
- //
- // If enabled use the magic page to communicate between modules
- // This replaces the PI PeiServicesTable pointer mechanism that
- // deos not work in the emulator. It also allows the removal of
- // writable globals from SEC, PEI_CORE (libraries), PEIMs
- //
- EmuMagicPage = (void *)(UINTN)FixedPcdGet64 (PcdPeiServicesTablePage);
- if (EmuMagicPage != NULL) {
- res3 = mmap (
- (void *)EmuMagicPage,
- 4096,
- PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS,
- 0,
- 0
- );
- if (res3 != EmuMagicPage) {
- printf ("MapFd0(): Could not allocate PeiServicesTablePage @ %lx\n", (long unsigned int)EmuMagicPage);
- return EFI_DEVICE_ERROR;
- }
- }
-
- *Length = (UINT64) FileSize;
- *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res;
-
- return EFI_SUCCESS;
-}
-
-
-/*++
-
-Routine Description:
- This is the service to load the SEC Core from the Firmware Volume
-
-Arguments:
- LargestRegion - Memory to use for SEC.
- LargestRegionSize - Size of Memory to use for PEI
- BootFirmwareVolumeBase - Start of the Boot FV
- PeiCorePe32File - SEC PE32
-
-Returns:
- Success means control is transfered and thus we should never return
-
-**/
-VOID
-SecLoadFromCore (
- IN UINTN LargestRegion,
- IN UINTN LargestRegionSize,
- IN UINTN BootFirmwareVolumeBase,
- IN VOID *PeiCorePe32File
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS TopOfMemory;
- VOID *TopOfStack;
- EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;
- EFI_SEC_PEI_HAND_OFF *SecCoreData;
- UINTN PeiStackSize;
-
- //
- // 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 (PcdEmuFirmwareFdSize);
- 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;
-
- //
- // Find the SEC Core Entry Point
- //
- Status = SecPeCoffGetEntryPoint (PeiCorePe32File, (VOID **)&PeiCoreEntryPoint);
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- //
- // Transfer control to the SEC Core
- //
- PeiSwitchStacks (
- (SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
- SecCoreData,
- (VOID *)gPpiList,
- TopOfStack
- );
- //
- // If we get here, then the SEC Core returned. This is an error
- //
- return ;
-}
-
-
-/*++
-
-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
-
-**/
-EFI_STATUS
-SecUnixPeiAutoScan (
- IN UINTN Index,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
- OUT UINT64 *MemorySize
- )
-{
- 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;
-}
-
-
-/*++
-
-Routine Description:
- Check to see if an address range is in the EFI GCD memory map.
-
- This is all of GCD for system memory passed to DXE Core. FV
- mapping and other device mapped into system memory are not
- inlcuded in the check.
-
-Arguments:
- Index - Which memory region to use
- MemoryBase - Return Base address of memory region
- MemorySize - Return size in bytes of the memory region
-
-Returns:
- TRUE - Address is in the EFI GCD memory map
- FALSE - Address is NOT in memory map
-
-**/
-BOOLEAN
-EfiSystemMemoryRange (
- IN VOID *MemoryAddress
- )
-{
- UINTN Index;
- EFI_PHYSICAL_ADDRESS MemoryBase;
-
- MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
- for (Index = 0; Index < gSystemMemoryCount; Index++) {
- if ((MemoryBase >= gSystemMemory[Index].Memory) &&
- (MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)) ) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-/*++
-
-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
-
-**/
-VOID *
-SecEmuThunkAddress (
- VOID
- )
-{
- return &gEmuThunkProtocol;
-}
-
-
-
-RETURN_STATUS
-EFIAPI
-SecPeCoffGetEntryPoint (
- IN VOID *Pe32Data,
- IN OUT VOID **EntryPoint
- )
-{
- 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;
- }
-
- if (ImageContext.ImageAddress != (UINTN)Pe32Data) {
- //
- // Relocate image to match the address where it resides
- //
- ImageContext.ImageAddress = (UINTN)Pe32Data;
- Status = PeCoffLoaderLoadImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- //
- // Or just return image entry point
- //
- ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer (Pe32Data);
- Status = PeCoffLoaderGetEntryPoint (Pe32Data, EntryPoint);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- ImageContext.EntryPoint = (UINTN)*EntryPoint;
- }
-
- // On Unix a dlopen is done that will change the entry point
- SecPeCoffRelocateImageExtraAction (&ImageContext);
- *EntryPoint = (VOID *)(UINTN)ImageContext.EntryPoint;
-
- return Status;
-}
-
-
-
-/*++
-
-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
-
-**/
-EFI_STATUS
-SecUnixFdAddress (
- IN UINTN Index,
- IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
- IN OUT UINT64 *FdSize,
- IN OUT EFI_PHYSICAL_ADDRESS *FixUp
- )
-{
- 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 (PcdEmuFdBaseAddress);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/*++
-
-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
-CountSeperatorsInString (
- IN const CHAR16 *String,
- IN CHAR16 Seperator
- )
-{
- UINTN Count;
-
- for (Count = 0; *String != '\0'; String++) {
- if (*String == Seperator) {
- Count++;
- }
- }
-
- return Count;
-}
-
-
-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;
-}
-
-
-/*++
-
-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.
-
-**/
-EFI_STATUS
-AddHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN VOID *ModHandle
- )
-{
- 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 = ReallocatePool (
- (mImageContextModHandleArraySize - 1) * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE),
- mImageContextModHandleArraySize * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE),
- mImageContextModHandleArray
- );
- 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);
-}
-
-
-/*++
-
-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
-
-**/
-VOID *
-RemoveHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *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;
-}
-
-
-
-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] == 'P' || PdbFileName[Len - 3] == 'p') &&
- (PdbFileName[Len - 2] == 'D' || PdbFileName[Len - 2] == 'd') &&
- (PdbFileName[Len - 1] == 'B' || PdbFileName[Len - 1] == 'b')) {
- 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);
-}
-
-
-/**
- Loads the image using dlopen so symbols will be automatically
- loaded by gdb.
-
- @param ImageContext The PE/COFF image context
-
- @retval TRUE - The image was successfully loaded
- @retval FALSE - The image was successfully loaded
-
-**/
-BOOLEAN
-DlLoadImage (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
-
-#ifdef __APPLE__
-
- return FALSE;
-
-#else
-
- void *Handle = NULL;
- void *Entry = NULL;
-
- if (ImageContext->PdbPointer == NULL) {
- return FALSE;
- }
-
- if (!IsPdbFile (ImageContext->PdbPointer)) {
- return FALSE;
- }
-
- 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 != NULL) {
- Entry = dlsym (Handle, "_ModuleEntryPoint");
- AddHandle (ImageContext, Handle);
- } 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);
- return TRUE;
- } else {
- return FALSE;
- }
-
-#endif
-}
-
-
-VOID
-SecGdbScriptBreak (
- char *FileName,
- int FileNameLength,
- long unsigned int LoadAddress,
- int AddSymbolFlag
- )
-{
- return;
-}
-
-
-/**
- Adds the image to a gdb script so it's symbols can be loaded.
- The AddFirmwareSymbolFile helper macro is used.
-
- @param ImageContext The PE/COFF image context
-
-**/
-VOID
-GdbScriptAddImage (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
-
- PrintLoadAddress (ImageContext);
-
- if (ImageContext->PdbPointer != NULL && !IsPdbFile (ImageContext->PdbPointer)) {
- FILE *GdbTempFile;
- if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) {
- GdbTempFile = fopen (gGdbWorkingFileName, "a");
- if (GdbTempFile != NULL) {
- long unsigned int SymbolsAddr = (long unsigned int)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders);
- mScriptSymbolChangesCount++;
- fprintf (
- GdbTempFile,
- "AddFirmwareSymbolFile 0x%x %s 0x%08lx\n",
- mScriptSymbolChangesCount,
- ImageContext->PdbPointer,
- SymbolsAddr
- );
- fclose (GdbTempFile);
- // This is for the lldb breakpoint only
- SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext->PdbPointer) + 1, (long unsigned int)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders), 1);
- } else {
- ASSERT (FALSE);
- }
- } else {
- 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....
- // Also used for the lldb breakpoint script. The lldb breakpoint script does
- // not use the file, it uses the arguments.
- //
- SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext->PdbPointer) + 1, (long unsigned int)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders), 1);
- } else {
- ASSERT (FALSE);
- }
- }
- }
-}
-
-
-VOID
-EFIAPI
-SecPeCoffRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- if (!DlLoadImage (ImageContext)) {
- GdbScriptAddImage (ImageContext);
- }
-}
-
-
-/**
- Adds the image to a gdb script so it's symbols can be unloaded.
- The RemoveFirmwareSymbolFile helper macro is used.
-
- @param ImageContext The PE/COFF image context
-
-**/
-VOID
-GdbScriptRemoveImage (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- FILE *GdbTempFile;
-
- //
- // Need to skip .PDB files created from VC++
- //
- if (IsPdbFile (ImageContext->PdbPointer)) {
- return;
- }
-
- if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) {
- //
- // Write the file we need for the gdb script
- //
- GdbTempFile = fopen (gGdbWorkingFileName, "a");
- if (GdbTempFile != NULL) {
- mScriptSymbolChangesCount++;
- fprintf (
- GdbTempFile,
- "RemoveFirmwareSymbolFile 0x%x %s\n",
- mScriptSymbolChangesCount,
- ImageContext->PdbPointer
- );
- fclose (GdbTempFile);
- SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext->PdbPointer) + 1, 0, 0);
- } else {
- ASSERT (FALSE);
- }
- } else {
- 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 (ImageContext->PdbPointer, strlen (ImageContext->PdbPointer) + 1, 0, 0);
- } else {
- ASSERT (FALSE);
- }
- }
-}
-
-
-VOID
-EFIAPI
-SecPeCoffUnloadImageExtraAction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- VOID *Handle;
-
- //
- // Check to see if the image symbols were loaded with gdb script, or dlopen
- //
- Handle = RemoveHandle (ImageContext);
- if (Handle != NULL) {
-#ifndef __APPLE__
- dlclose (Handle);
-#endif
- return;
- }
-
- GdbScriptRemoveImage (ImageContext);
-}
-
-
diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
deleted file mode 100644
index aff7c36d79..0000000000
--- a/EmulatorPkg/Unix/Host/Host.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/*++ @file
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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_MAIN_H__
-#define _SEC_MAIN_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 <sys/mman.h>
-#include <dlfcn.h>
-
-#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/statvfs.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>
-#include <sys/disk.h>
-#define _XOPEN_SOURCE
-#ifndef _Bool
- #define _Bool char // for clang debug
-#endif
-#else
-#include <termio.h>
-#include <sys/vfs.h>
-#include <linux/fs.h>
-#endif
-
-#include <utime.h>
-
-#undef NTOHL
-#undef HTONL
-#undef NTOHS
-#undef HTONS
-#undef B0
-
-
-#include <PiPei.h>
-#include <Uefi.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ReportStatusCodeLib.h>
-
-#include <Library/ThunkPpiList.h>
-#include <Library/ThunkProtocolList.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeCoffGetEntryPointLib.h>
-#include <Library/EmuMagicPageLib.h>
-
-#include <Ppi/EmuThunk.h>
-#include <Ppi/StatusCode.h>
-
-#include <Protocol/SimplePointer.h>
-#include <Protocol/SimpleTextIn.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/UgaDraw.h>
-#include <Protocol/SimpleFileSystem.h>
-
-#include <Protocol/EmuThunk.h>
-#include <Protocol/EmuIoThunk.h>
-#include <Protocol/EmuGraphicsWindow.h>
-#include <Protocol/EmuThread.h>
-#include <Protocol/EmuBlockIo.h>
-#include <Protocol/EmuSnp.h>
-
-#include <Guid/FileInfo.h>
-#include <Guid/FileSystemInfo.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
-
-
-#include "Gasket.h"
-
-
-#define STACK_SIZE 0x20000
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Address;
- UINT64 Size;
-} EMU_FD_INFO;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Memory;
- UINT64 Size;
-} EMU_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,
- EFI_PHYSICAL_ADDRESS *ImageAddress,
- UINT64 *ImageSize,
- EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-int
-main (
- IN int Argc,
- IN char **Argv,
- IN char **Envp
- );
-
-VOID
-SecLoadFromCore (
- IN UINTN LargestRegion,
- IN UINTN LargestRegionSize,
- IN UINTN BootFirmwareVolumeBase,
- IN VOID *PeiCoreFile
- );
-
-EFI_STATUS
-SecLoadFile (
- IN VOID *Pe32Data,
- IN EFI_PHYSICAL_ADDRESS *ImageAddress,
- IN UINT64 *ImageSize,
- IN EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-EFI_STATUS
-SecFfsFindPeiCore (
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- OUT VOID **Pe32Data
- );
-
-EFI_STATUS
-SecFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- );
-
-EFI_STATUS
-SecFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- );
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderLoadAsDll (
- IN CHAR8 *PdbFileName,
- IN VOID **ImageEntryPoint,
- OUT VOID **ModHandle
- );
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderFreeLibrary (
- OUT VOID *ModHandle
- );
-
-EFI_STATUS
-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
- );
-
-EFI_STATUS
-EFIAPI
-SecImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- );
-
-CHAR16 *
-AsciiToUnicode (
- IN CHAR8 *Ascii,
- IN UINTN *StrLen OPTIONAL
- );
-
-UINTN
-CountSeperatorsInString (
- IN const CHAR16 *String,
- IN CHAR16 Seperator
- );
-
-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
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
- );
-
-VOID
-SecInitThunkProtocol (
- VOID
- );
-
-
-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
-MapFd0 (
- IN CHAR8 *FileName,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-BOOLEAN
-EfiSystemMemoryRange (
- IN VOID *MemoryAddress
- );
-
-
-VOID SecSleep (UINT64 Nanoseconds);
-VOID SecEnableInterrupt (VOID);
-VOID SecDisableInterrupt (VOID);
-BOOLEAN SecInterruptEanbled (VOID);
-
-
-extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
-extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
-extern EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo;
-extern EMU_IO_THUNK_PROTOCOL gPthreadThunkIo;
-extern EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo;
-extern EMU_IO_THUNK_PROTOCOL gSnpThunkIo;
-
-#endif
diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
deleted file mode 100644
index d0b4927d16..0000000000
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ /dev/null
@@ -1,148 +0,0 @@
-## @file
-# Entry Point of Emu 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 - 2011, 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 = Host
- FILE_GUID = 8863C0AD-7724-C84B-88E5-A33B116D1485
- MODULE_TYPE = USER_DEFINED
- VERSION_STRING = 1.0
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Host.c
- EmuThunk.c
- X11GraphicsWindow.c
- Pthreads.c
- PosixFileSystem.c
- BlockIo.c
- LinuxPacketFilter.c
- BerkeleyPacketFilter.c
- MemoryAllocationLib.c
-
-[Sources.X64]
- X64/Gasket.S # convert between Emu x86_64 ABI and EFI X64 ABI
- X64/SwitchStack.S
-
-[Sources.IA32]
- Ia32/Gasket.S # enforce 16-byte stack alignment for Mac OS X
- Ia32/SwitchStack.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EmulatorPkg/EmulatorPkg.dec
-
-[LibraryClasses]
- DebugLib
- PcdLib
- PrintLib
- BaseMemoryLib
- BaseLib
- PeCoffLib
- ThunkPpiList
- ThunkProtocolList
- PpiListLib
- PeiServicesLib
- PeCoffGetEntryPointLib
-
-[Ppis]
- gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED
- gEmuThunkPpiGuid
-
-[Protocols]
- gEmuIoThunkProtocolGuid
- gEmuIoThunkProtocolGuid
- gEmuGraphicsWindowProtocolGuid
- gEmuThreadThunkProtocolGuid
- gEmuBlockIoProtocolGuid
- gEmuSnpProtocolGuid
- gEfiSimpleFileSystemProtocolGuid
-
-[Guids]
- gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
- gEfiFileInfoGuid # SOMETIMES_CONSUMED
- gEfiFileSystemInfoGuid # SOMETIMES_CONSUMED
-
-[Pcd]
- gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume
- gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFdBaseAddress
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuApCount
- gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk
- gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
- gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem
- gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort
- gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface
- gEmulatorPkgTokenSpaceGuid.PcdNetworkPacketFilterSize
-
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
- gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
-
-[FeaturePcd]
- gEmulatorPkgTokenSpaceGuid.PcdEmulatorLazyLoadSymbols
-
-
-[BuildOptions]
- GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_i386 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/i386-linux-gnu -L/usr/X11R6/lib -lXext -lX11
- GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
- GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
- GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
-
- GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_x86_64 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/x86_64-linux-gnu -L/usr/X11R6/lib -lXext -lX11
- GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
- GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_GCC46_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_GCC47_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_GCC48_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_GCC49_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
- GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
- GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
-
- GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc -ldl
-
-#
-# 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_CC_FLAGS == -arch i386 -O0 -g -include $(DEST_DIR_DEBUG)/AutoGen.h -c -fshort-wchar -fno-strict-aliasing
- XCODE:*_*_IA32_DLINK_FLAGS == -arch i386 -o $(BIN_DIR)/Host -L/usr/X11R6/lib -lXext -lX11 -framework Carbon
- XCODE:*_*_IA32_ASM_FLAGS == -arch i386 -g
-
- XCODE:*_*_X64_DLINK_PATH == gcc
- XCODE:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -L/usr/X11R6/lib -lXext -lX11 -framework Carbon
- XCODE:*_*_X64_ASM_FLAGS == -g
- XCODE:*_*_X64_CC_FLAGS = -I$(WORKSPACE)/EmulatorPkg/Unix/Host/X11IncludeHack
diff --git a/EmulatorPkg/Unix/Host/Ia32/Gasket.S b/EmulatorPkg/Unix/Host/Ia32/Gasket.S
deleted file mode 100644
index aa90ea8095..0000000000
--- a/EmulatorPkg/Unix/Host/Ia32/Gasket.S
+++ /dev/null
@@ -1,1492 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Manage differenced between UNIX ABI and EFI/Windows ABI
-#
-# For IA-32 the only difference is Mac OS X requires a 16-byte aligned stack.
-# For Linux this stack adjustment is a no-op, but we may as well make the
-# the code common.
-#
-# Copyright (c) 2008 - 2011, 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.
-#
-#------------------------------------------------------------------------------
-
-
-
- .text
-
-//
-// EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI)
-//
-
-
-ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr)
-ASM_PFX(GasketSecWriteStdErr):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecWriteStdErr)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecConfigStdIn)
-ASM_PFX(GasketSecConfigStdIn):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecConfigStdIn)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecWriteStdOut)
-ASM_PFX(GasketSecWriteStdOut):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecWriteStdOut)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecReadStdIn)
-ASM_PFX(GasketSecReadStdIn):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecReadStdIn)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecPollStdIn)
-ASM_PFX(GasketSecPollStdIn):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecPollStdIn)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecMalloc)
-ASM_PFX(GasketSecMalloc):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecMalloc)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecValloc)
-ASM_PFX(GasketSecValloc):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecValloc)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecFree)
-ASM_PFX(GasketSecFree):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecFree)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecSetTimer)
-ASM_PFX(GasketSecSetTimer):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 8(%ebp), %eax
- movl 12(%ebp), %edx
- movl %edx, 4(%esp)
- movl %eax, (%esp)
-
- call ASM_PFX(SecSetTimer)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt)
-ASM_PFX(GasketSecEnableInterrupt):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(SecEnableInterrupt)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt)
-ASM_PFX(GasketSecDisableInterrupt):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(SecDisableInterrupt)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency)
-ASM_PFX(GasketQueryPerformanceFrequency):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(QueryPerformanceFrequency)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter)
-ASM_PFX(GasketQueryPerformanceCounter):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(QueryPerformanceCounter)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecSleep)
-ASM_PFX(GasketSecSleep):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl 12(%ebp), %ecx
- movl %ecx, 4(%esp)
- movl %eax, (%esp)
-
- call ASM_PFX(SecSleep)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecCpuSleep)
-ASM_PFX(GasketSecCpuSleep):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(SecCpuSleep)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecExit)
-ASM_PFX(GasketSecExit):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecExit) // 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(GasketSecGetTime)
-ASM_PFX(GasketSecGetTime):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecGetTime)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecSetTime)
-ASM_PFX(GasketSecSetTime):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecSetTime)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol)
-ASM_PFX(GasketSecGetNextProtocol):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecGetNextProtocol)
-
- leave
- ret
-
-// PPIs produced by SEC
-
-ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint)
-ASM_PFX(GasketSecPeCoffGetEntryPoint):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecPeCoffGetEntryPoint)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction)
-ASM_PFX(GasketSecPeCoffRelocateImageExtraAction):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecPeCoffRelocateImageExtraAction)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction)
-ASM_PFX(GasketSecPeCoffUnloadImageExtraAction):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecPeCoffUnloadImageExtraAction)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress)
-ASM_PFX(GasketSecEmuThunkAddress):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(SecEmuThunkAddress)
-
- leave
- ret
-
-//
-// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
-//
-
-ASM_GLOBAL ASM_PFX(GasketX11Size)
-ASM_PFX(GasketX11Size):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11Size)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11CheckKey)
-ASM_PFX(GasketX11CheckKey):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11CheckKey)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketX11GetKey)
-ASM_PFX(GasketX11GetKey):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11GetKey)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11KeySetState)
-ASM_PFX(GasketX11KeySetState):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11KeySetState)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify)
-ASM_PFX(GasketX11RegisterKeyNotify):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11RegisterKeyNotify)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11Blt)
-ASM_PFX(GasketX11Blt):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11Blt)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11CheckPointer)
-ASM_PFX(GasketX11CheckPointer):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11CheckPointer)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GetPointerState)
-ASM_PFX(GasketX11GetPointerState):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11GetPointerState)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen)
-ASM_PFX(GasketX11GraphicsWindowOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11GraphicsWindowOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose)
-ASM_PFX(GasketX11GraphicsWindowClose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(X11GraphicsWindowClose)
-
- leave
- ret
-
-
-// Pthreads
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock)
-ASM_PFX(GasketPthreadMutexLock):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadMutexLock)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock)
-ASM_PFX(GasketPthreadMutexUnLock):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadMutexUnLock)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock)
-ASM_PFX(GasketPthreadMutexTryLock):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadMutexTryLock)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit)
-ASM_PFX(GasketPthreadMutexInit):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(PthreadMutexInit)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy)
-ASM_PFX(GasketPthreadMutexDestroy):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadMutexDestroy)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadCreate)
-ASM_PFX(GasketPthreadCreate):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadCreate)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadExit)
-ASM_PFX(GasketPthreadExit):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadExit)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadSelf)
-ASM_PFX(GasketPthreadSelf):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
-
- call ASM_PFX(PthreadSelf)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadOpen)
-ASM_PFX(GasketPthreadOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadClose)
-ASM_PFX(GasketPthreadClose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PthreadClose)
-
- leave
- ret
-
-
-
-
-//
-// UNIX ABI to EFI ABI call
-//
-// UINTN
-// ReverseGasketUint64 (
-// void *Api,
-// UINTN Arg1
-// );
-ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
-ASM_PFX(ReverseGasketUint64):
- pushl %ebp
- movl %esp, %ebp
- subl $8, %esp
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- calll *8(%ebp)
- addl $8, %esp
- popl %ebp
- ret
-
-
-
-//
-// UNIX ABI to EFI ABI call
-//
-// UINTN
-// ReverseGasketUint64Uint64 (
-// void *Api,
-// UINTN Arg1
-// UINTN Arg2
-// );
-ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
-ASM_PFX(ReverseGasketUint64Uint64):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %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)
- calll *8(%ebp)
- addl $24, %esp
- popl %ebp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
-ASM_PFX(GasketSecUnixPeiAutoScan):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecUnixPeiAutoScan)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
-ASM_PFX(GasketSecUnixFdAddress):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(SecUnixFdAddress)
-
- leave
- ret
-
-
-// EmuIoThunk SimpleFileSystem
-
-ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume)
-ASM_PFX(GasketPosixOpenVolume):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixOpenVolume)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileOpen)
-ASM_PFX(GasketPosixFileOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 28(%ebp), %eax
- movl 32(%ebp), %ecx
- movl %ecx, 24(%esp)
- movl %eax, 20(%esp)
- movl 20(%ebp), %eax
- movl 24(%ebp), %ecx
- movl %ecx, 16(%esp)
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileCLose)
-ASM_PFX(GasketPosixFileCLose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileCLose)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileDelete)
-ASM_PFX(GasketPosixFileDelete):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileDelete)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileRead)
-ASM_PFX(GasketPosixFileRead):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileRead)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileWrite)
-ASM_PFX(GasketPosixFileWrite):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileWrite)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition)
-ASM_PFX(GasketPosixFileSetPossition):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl 16(%ebp), %ecx
- movl %ecx, 8(%esp)
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileSetPossition)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition)
-ASM_PFX(GasketPosixFileGetPossition):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileGetPossition)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo)
-ASM_PFX(GasketPosixFileGetInfo):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileGetInfo)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo)
-ASM_PFX(GasketPosixFileSetInfo):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileSetInfo)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileFlush)
-ASM_PFX(GasketPosixFileFlush):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileFlush)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen)
-ASM_PFX(GasketPosixFileSystmeThunkOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileSystmeThunkOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose)
-ASM_PFX(GasketPosixFileSystmeThunkClose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(PosixFileSystmeThunkClose)
-
- leave
- ret
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset)
-ASM_PFX(GasketEmuBlockIoReset):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoReset)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks)
-ASM_PFX(GasketEmuBlockIoReadBlocks):
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 32(%ebp), %eax
- movl %eax, 24(%esp)
- movl 28(%ebp), %eax
- movl %eax, 20(%esp)
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 16(%ebp), %eax
- movl 20(%ebp), %edx
- movl %edx, 12(%esp)
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoReadBlocks)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks)
-ASM_PFX(GasketEmuBlockIoWriteBlocks):
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 32(%ebp), %eax
- movl %eax, 24(%esp)
- movl 28(%ebp), %eax
- movl %eax, 20(%esp)
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 16(%ebp), %eax
- movl 20(%ebp), %edx
- movl %edx, 12(%esp)
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoWriteBlocks)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks)
-ASM_PFX(GasketEmuBlockIoFlushBlocks): pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
-
- call ASM_PFX(EmuBlockIoFlushBlocks)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping)
-ASM_PFX(GasketEmuBlockIoCreateMapping):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoCreateMapping)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen)
-ASM_PFX(GasketBlockIoThunkOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoThunkOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose)
-ASM_PFX(GasketBlockIoThunkClose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuBlockIoThunkClose)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpCreateMapping)
-ASM_PFX(GasketSnpCreateMapping):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpCreateMapping)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStart)
-ASM_PFX(GasketSnpStart):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpStart)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStop)
-ASM_PFX(GasketSnpStop):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpStop)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpInitialize)
-ASM_PFX(GasketSnpInitialize):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpInitialize)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReset)
-ASM_PFX(GasketSnpReset):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpReset)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpShutdown)
-ASM_PFX(GasketSnpShutdown):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpShutdown)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReceiveFilters)
-ASM_PFX(GasketSnpReceiveFilters):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 28(%ebp), %eax
- movl %eax, 20(%esp)
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpReceiveFilters)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStationAddress)
-ASM_PFX(GasketSnpStationAddress):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStatistics)
-ASM_PFX(GasketSnpStatistics):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpStatistics)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpMCastIpToMac)
-ASM_PFX(GasketSnpMCastIpToMac):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpMCastIpToMac)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpNvData)
-ASM_PFX(GasketSnpNvData):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpNvData)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpGetStatus)
-ASM_PFX(GasketSnpGetStatus):
- pushl %ebp
- movl %esp, %ebp
- subl $40, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpGetStatus)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpTransmit)
-ASM_PFX(GasketSnpTransmit):
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 32(%ebp), %eax
- movl %eax, 24(%esp)
- movl 28(%ebp), %eax
- movl %eax, 20(%esp)
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpTransmit)
-
- leave
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReceive)
-ASM_PFX(GasketSnpReceive):
- pushl %ebp
- movl %esp, %ebp
- subl $56, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 32(%ebp), %eax
- movl %eax, 24(%esp)
- movl 28(%ebp), %eax
- movl %eax, 20(%esp)
- movl 24(%ebp), %eax
- movl %eax, 16(%esp)
- movl 20(%ebp), %eax
- movl %eax, 12(%esp)
- movl 16(%ebp), %eax
- movl %eax, 8(%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpReceive)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpThunkOpen)
-ASM_PFX(GasketSnpThunkOpen):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpThunkOpen)
-
- leave
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpThunkClose)
-ASM_PFX(GasketSnpThunkClose):
- pushl %ebp
- movl %esp, %ebp
- subl $24, %esp // sub extra 16 from the stack for alignment
- and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call
- movl 8(%ebp), %eax
- movl %eax, (%esp)
-
- call ASM_PFX(EmuSnpThunkClose)
-
- leave
- ret
-
-
diff --git a/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c b/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c
deleted file mode 100644
index 118083f4b5..0000000000
--- a/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c
+++ /dev/null
@@ -1,74 +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.
-
-
---*/
-
-#include "Host.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.
-
-**/
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, 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);
- ((VOID**)JumpBuffer.Esp)[1] = Context1;
- ((VOID**)JumpBuffer.Esp)[2] = Context2;
-
- LongJump (&JumpBuffer, (UINTN)-1);
-
-
- //
- // PeiSwitchStacks () will never return
- //
- ASSERT (FALSE);
-}
-
-
-
diff --git a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c b/EmulatorPkg/Unix/Host/LinuxPacketFilter.c
deleted file mode 100644
index 15e4bc9543..0000000000
--- a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/**@file
- Linux Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
- emulator to get on real networks.
-
- Currently only the Berkeley Packet Filter is fully implemented and this file
- is just a template that needs to get filled in.
-
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
-Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include "Host.h"
-
-#ifndef __APPLE__
-
-#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
-typedef struct {
- UINTN Signature;
-
- EMU_IO_THUNK_PROTOCOL *Thunk;
-
-
- EMU_SNP_PROTOCOL EmuSnp;
- EFI_SIMPLE_NETWORK_MODE *Mode;
-
-} EMU_SNP_PRIVATE;
-
-#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
-
-/**
- Register storage for SNP Mode.
-
- @param This Protocol instance pointer.
- @param Mode SimpleNetworkProtocol Mode structure passed into driver.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
-
-**/
-EFI_STATUS
-EmuSnpCreateMapping (
- IN EMU_SNP_PROTOCOL *This,
- IN EFI_SIMPLE_NETWORK_MODE *Mode
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Mode = Mode;
-
- return EFI_SUCCESS;
-}
-
-/**
- Changes the state of a network interface from "stopped" to "started".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The network interface was started.
- @retval EFI_ALREADY_STARTED The network interface is already in the started state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStart (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Changes the state of a network interface from "started" to "stopped".
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The network interface was stopped.
- @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStop (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- 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 The 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 The network interface was initialized.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
- receive buffers.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpInitialize (
- IN EMU_SNP_PROTOCOL *This,
- IN UINTN ExtraRxBufferSize OPTIONAL,
- IN UINTN ExtraTxBufferSize OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
-
- @param This The protocol instance pointer.
- @param ExtendedVerification Indicates that the driver may perform a more
- exhaustive verification operation of the device
- during reset.
-
- @retval EFI_SUCCESS The network interface was reset.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReset (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- 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 The network interface was shutdown.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpShutdown (
- IN EMU_SNP_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Manages the multicast receive filters of a network interface.
-
- @param This The protocol instance pointer.
- @param Enable A bit mask of receive filters to enable on the network interface.
- @param Disable 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 McastFilterCnt Number of multicast HW MAC addresses in the new
- MCastFilter list. This value must be less than or equal to
- the MCastFilterCnt field of EMU_SNP_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_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReceiveFilters (
- IN EMU_SNP_PROTOCOL *This,
- IN UINT32 Enable,
- IN UINT32 Disable,
- IN BOOLEAN ResetMCastFilter,
- IN UINTN MCastFilterCnt OPTIONAL,
- IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Modifies or resets the current station address, if supported.
-
- @param This The protocol instance pointer.
- @param Reset Flag used to reset the station address to the network interfaces
- permanent address.
- @param New The new station address to be used for the network interface.
-
- @retval EFI_SUCCESS The network interfaces station address was updated.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStationAddress (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN EFI_MAC_ADDRESS *New OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpStatistics (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN Reset,
- IN OUT UINTN *StatisticsSize OPTIONAL,
- OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Converts a multicast IP address to a multicast HW MAC address.
-
- @param This The 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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpMCastIpToMac (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Performs read and write operations on the NVRAM device attached to a
- network interface.
-
- @param This The protocol instance pointer.
- @param ReadWrite 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_SUCCESS The NVRAM access was performed.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpNvData (
- IN EMU_SNP_PROTOCOL *This,
- IN BOOLEAN ReadWrite,
- IN UINTN Offset,
- IN UINTN BufferSize,
- IN OUT VOID *Buffer
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Reads the current interrupt status and recycled transmit buffer status from
- a network interface.
-
- @param This The 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 TxBuf 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 The status of the network interface was retrieved.
- @retval EFI_NOT_STARTED The network interface has not been started.
- @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpGetStatus (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINT32 *InterruptStatus OPTIONAL,
- OUT VOID **TxBuf OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Places a packet in the transmit queue of a network interface.
-
- @param This The 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_NOT_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpTransmit (
- IN EMU_SNP_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
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Receives a packet from a network interface.
-
- @param This The 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 BufferSize 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 SrcAddr The source HW MAC address. If this parameter is NULL, the
- HW MAC source address will not be extracted from the media
- header.
- @param DestAddr 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_STARTED The network interface has not been started.
- @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_INVALID_PARAMETER One or more of the parameters has an unsupported value.
- @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
- @retval EFI_UNSUPPORTED This function is not supported by the network interface.
-
-**/
-EFI_STATUS
-EmuSnpReceive (
- IN EMU_SNP_PROTOCOL *This,
- OUT UINTN *HeaderSize OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer,
- OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
- OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
- OUT UINT16 *Protocol OPTIONAL
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
-
- return EFI_UNSUPPORTED;
-}
-
-
-EMU_SNP_PROTOCOL gEmuSnpProtocol = {
- GasketSnpCreateMapping,
- GasketSnpStart,
- GasketSnpStop,
- GasketSnpInitialize,
- GasketSnpReset,
- GasketSnpShutdown,
- GasketSnpReceiveFilters,
- GasketSnpStationAddress,
- GasketSnpStatistics,
- GasketSnpMCastIpToMac,
- GasketSnpNvData,
- GasketSnpGetStatus,
- GasketSnpTransmit,
- GasketSnpReceive
-};
-
-EFI_STATUS
-EmuSnpThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- if (This->Private != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = malloc (sizeof (EMU_SNP_PRIVATE));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
-
- Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
- Private->Thunk = This;
- CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
-
- This->Interface = &Private->EmuSnp;
- This->Private = Private;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EmuSnpThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SNP_PRIVATE *Private;
-
- if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = This->Private;
- free (Private);
-
- return EFI_SUCCESS;
-}
-
-
-
-EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
- &gEmuSnpProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketSnpThunkOpen,
- GasketSnpThunkClose,
- NULL
-};
-
-#endif
diff --git a/EmulatorPkg/Unix/Host/MemoryAllocationLib.c b/EmulatorPkg/Unix/Host/MemoryAllocationLib.c
deleted file mode 100644
index 9db91b83d9..0000000000
--- a/EmulatorPkg/Unix/Host/MemoryAllocationLib.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*++ @file
-
- 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.
-
-**/
-
-#include "Base.h"
-#include "Library/BaseMemoryLib.h"
-#include "Library/MemoryAllocationLib.h"
-
-#include <stdlib.h>
-
-/**
- Allocates a buffer of type EfiBootServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
- pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
- returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocatePool (
- IN UINTN AllocationSize
- )
-{
- return (VOID*) malloc (AllocationSize);
-}
-
-
-/**
- Allocates and zeros a buffer of type EfiBootServicesData.
-
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
- buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
- valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
- request, then NULL is returned.
-
- @param AllocationSize The number of bytes to allocate and zero.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-AllocateZeroPool (
- IN UINTN AllocationSize
- )
-{
- VOID *Buffer;
-
- Buffer = AllocatePool (AllocationSize);
- if (Buffer == NULL) {
- return NULL;
- }
-
- ZeroMem (Buffer, AllocationSize);
-
- return Buffer;
-}
-
-
-/**
- Reallocates a buffer of type EfiBootServicesData.
-
- Allocates and zeros the number bytes specified by NewSize from memory of type
- EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
- NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
- OldBuffer is freed. A pointer to the newly allocated buffer is returned.
- If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
- enough memory remaining to satisfy the request, then NULL is returned.
-
- If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
- is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
-
- @param OldSize The size, in bytes, of OldBuffer.
- @param NewSize The size, in bytes, of the buffer to reallocate.
- @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
- parameter that may be NULL.
-
- @return A pointer to the allocated buffer or NULL if allocation fails.
-
-**/
-VOID *
-EFIAPI
-ReallocatePool (
- IN UINTN OldSize,
- IN UINTN NewSize,
- IN VOID *OldBuffer OPTIONAL
- )
-{
- VOID *NewBuffer;
-
- NewBuffer = AllocatePool (NewSize);
- if (NewBuffer == NULL) {
- return NULL;
- }
-
- if (OldBuffer != NULL) {
- if (OldSize > 0) {
- CopyMem (NewBuffer, OldBuffer, OldSize);
- }
-
- FreePool (OldBuffer);
- }
-
- return NewBuffer;
-}
-
-
-/**
- Frees a buffer that was previously allocated with one of the pool allocation functions in the
- Memory Allocation Library.
-
- Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
- pool allocation services of the Memory Allocation Library. If it is not possible to free pool
- resources, then this function will perform no actions.
-
- If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
- then ASSERT().
-
- @param Buffer Pointer to the buffer to free.
-
-**/
-VOID
-EFIAPI
-FreePool (
- IN VOID *Buffer
- )
-{
- free ((void *) Buffer);
-}
-
diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c b/EmulatorPkg/Unix/Host/PosixFileSystem.c
deleted file mode 100644
index 98e8c894eb..0000000000
--- a/EmulatorPkg/Unix/Host/PosixFileSystem.c
+++ /dev/null
@@ -1,1556 +0,0 @@
-/*++ @file
- POSIX Pthreads to emulate APs and implement threads
-
-Copyright (c) 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-**/
-
-#include "Host.h"
-
-
-#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *Thunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
- CHAR8 *FilePath;
- CHAR16 *VolumeLabel;
- BOOLEAN FileHandlesOpen;
-} EMU_SIMPLE_FILE_SYSTEM_PRIVATE;
-
-#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE, \
- SimpleFileSystem, \
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
- )
-
-
-#define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 'i')
-
-typedef struct {
- UINTN Signature;
- EMU_IO_THUNK_PROTOCOL *Thunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EFI_FILE_PROTOCOL EfiFile;
- int fd;
- DIR *Dir;
- BOOLEAN IsRootDirectory;
- BOOLEAN IsDirectoryPath;
- BOOLEAN IsOpenedByRead;
- char *FileName;
- struct dirent *Dirent;
-} EMU_EFI_FILE_PRIVATE;
-
-#define EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- EMU_EFI_FILE_PRIVATE, \
- EfiFile, \
- EMU_EFI_FILE_PRIVATE_SIGNATURE \
- )
-
-EFI_STATUS
-PosixFileGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-PosixFileSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-
-EFI_FILE_PROTOCOL gPosixFileProtocol = {
- EFI_FILE_REVISION,
- GasketPosixFileOpen,
- GasketPosixFileCLose,
- GasketPosixFileDelete,
- GasketPosixFileRead,
- GasketPosixFileWrite,
- GasketPosixFileGetPossition,
- GasketPosixFileSetPossition,
- GasketPosixFileGetInfo,
- GasketPosixFileSetInfo,
- GasketPosixFileFlush
-};
-
-EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gPosixFileSystemProtocol = {
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION,
- GasketPosixOpenVolume,
-};
-
-
-/**
- Open the root directory on a volume.
-
- @param This Protocol instance pointer.
- @param Root Returns an Open file handle for the root directory
-
- @retval EFI_SUCCESS The device was opened.
- @retval EFI_UNSUPPORTED This volume does not support the file system.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_ACCESS_DENIED The service denied access to the file.
- @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
-
-**/
-EFI_STATUS
-PosixOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **Root
- )
-{
- EFI_STATUS Status;
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
- Private = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);
-
- Status = EFI_OUT_OF_RESOURCES;
- PrivateFile = malloc (sizeof (EMU_EFI_FILE_PRIVATE));
- if (PrivateFile == NULL) {
- goto Done;
- }
-
- PrivateFile->FileName = malloc (AsciiStrSize (Private->FilePath));
- if (PrivateFile->FileName == NULL) {
- goto Done;
- }
- AsciiStrCpy (PrivateFile->FileName, Private->FilePath);
-
- PrivateFile->Signature = EMU_EFI_FILE_PRIVATE_SIGNATURE;
- PrivateFile->Thunk = Private->Thunk;
- PrivateFile->SimpleFileSystem = This;
- PrivateFile->IsRootDirectory = TRUE;
- PrivateFile->IsDirectoryPath = TRUE;
- PrivateFile->IsOpenedByRead = TRUE;
-
- CopyMem (&PrivateFile->EfiFile, &gPosixFileProtocol, sizeof (EFI_FILE_PROTOCOL));
-
- PrivateFile->fd = -1;
- PrivateFile->Dir = NULL;
- PrivateFile->Dirent = NULL;
-
- *Root = &PrivateFile->EfiFile;
-
- PrivateFile->Dir = opendir (PrivateFile->FileName);
- if (PrivateFile->Dir == NULL) {
- Status = EFI_ACCESS_DENIED;
- } else {
- Status = EFI_SUCCESS;
- }
-
-Done:
- if (EFI_ERROR (Status)) {
- if (PrivateFile != NULL) {
- if (PrivateFile->FileName != NULL) {
- free (PrivateFile->FileName);
- }
-
- free (PrivateFile);
- }
-
- *Root = NULL;
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-ErrnoToEfiStatus ()
-{
- switch (errno) {
- case EACCES:
- return EFI_ACCESS_DENIED;
-
- case EDQUOT:
- case ENOSPC:
- return EFI_VOLUME_FULL;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-}
-
-VOID
-CutPrefix (
- IN CHAR8 *Str,
- IN UINTN Count
- )
-{
- CHAR8 *Pointer;
-
- if (AsciiStrLen (Str) < Count) {
- ASSERT (0);
- }
-
- for (Pointer = Str; *(Pointer + Count); Pointer++) {
- *Pointer = *(Pointer + Count);
- }
-
- *Pointer = *(Pointer + Count);
-}
-
-
-VOID
-PosixSystemTimeToEfiTime (
- IN time_t SystemTime,
- OUT EFI_TIME *Time
- )
-{
- struct tm *tm;
-
- tm = 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 = timezone;
- Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0) | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
-}
-
-
-EFI_STATUS
-UnixSimpleFileSystemFileInfo (
- EMU_EFI_FILE_PRIVATE *PrivateFile,
- IN CHAR8 *FileName,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- EFI_FILE_INFO *Info;
- CHAR8 *RealFileName;
- CHAR8 *TempPointer;
- CHAR16 *BufferFileName;
- struct stat 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 (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);
-
- PosixSystemTimeToEfiTime (buf.st_ctime, &Info->CreateTime);
- PosixSystemTimeToEfiTime (buf.st_atime, &Info->LastAccessTime);
- PosixSystemTimeToEfiTime (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;
-}
-
-BOOLEAN
-IsZero (
- IN VOID *Buffer,
- IN UINTN Length
- )
-{
- 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;
-}
-
-
-
-/**
- Opens a new file relative to the source file's location.
-
- @param This The protocol instance pointer.
- @param NewHandle Returns File Handle for FileName.
- @param FileName Null terminated string. "\", ".", and ".." are supported.
- @param OpenMode Open mode for file.
- @param Attributes Only used for EFI_FILE_MODE_CREATE.
-
- @retval EFI_SUCCESS The device was opened.
- @retval EFI_NOT_FOUND The specified file could not be found on the device.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_MEDIA_CHANGED The media has changed.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_ACCESS_DENIED The service denied access to the file.
- @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-PosixFileOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-{
- EFI_FILE_PROTOCOL *Root;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EMU_EFI_FILE_PRIVATE *NewPrivateFile;
- EMU_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;
- struct stat finfo;
- int res;
-
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
- NewPrivateFile = NULL;
- Status = EFI_OUT_OF_RESOURCES;
-
- //
- // BUGBUG: assume an open of root
- // if current location, return current data
- //
- TrailingDash = FALSE;
- if ((StrCmp (FileName, L"\\") == 0) ||
- (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
-OpenRoot:
- Status = PosixOpenVolume (PrivateFile->SimpleFileSystem, &Root);
- NewPrivateFile = EMU_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
- //
- NewPrivateFile = malloc (sizeof (EMU_EFI_FILE_PRIVATE));
- if (NewPrivateFile == NULL) {
- goto Done;
- }
-
- CopyMem (NewPrivateFile, PrivateFile, sizeof (EMU_EFI_FILE_PRIVATE));
-
- NewPrivateFile->FileName = malloc (AsciiStrSize (PrivateFile->FileName) + 1 + StrLen (FileName) + 1);
- if (NewPrivateFile->FileName == NULL) {
- 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;
- free (NewPrivateFile->FileName);
- free (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 {
- res = 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 (mkdir (NewPrivateFile->FileName, 0777) != 0) {
- if (errno != EEXIST) {
- //free (TempFileName);
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- }
- }
-
- NewPrivateFile->Dir = opendir (NewPrivateFile->FileName);
- if (NewPrivateFile->Dir == NULL) {
- if (errno == EACCES) {
- Status = EFI_ACCESS_DENIED;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
- goto Done;
- }
-
- } else {
- //
- // deal with file
- //
- NewPrivateFile->fd = open (
- NewPrivateFile->FileName,
- ((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0) | (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR),
- 0666
- );
- if (NewPrivateFile->fd < 0) {
- if (errno == 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 = PosixFileGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
- if (Status != EFI_BUFFER_TOO_SMALL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Info = malloc (InfoSize);
- if (Info == NULL) {
- goto Done;
- }
-
- Status = PosixFileGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Info->Attribute = Attributes;
- PosixFileSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);
-
- free (Info);
- }
-
-Done: ;
- if (TrailingDash) {
- FileName[StrLen (FileName) + 1] = 0;
- FileName[StrLen (FileName)] = L'\\';
- }
-
- if (EFI_ERROR (Status)) {
- if (NewPrivateFile) {
- if (NewPrivateFile->FileName) {
- free (NewPrivateFile->FileName);
- }
-
- free (NewPrivateFile);
- }
- } else {
- *NewHandle = &NewPrivateFile->EfiFile;
- }
-
- return Status;
-}
-
-
-
-/**
- Close the file handle
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The device was opened.
-
-**/
-EFI_STATUS
-PosixFileCLose (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->fd >= 0) {
- close (PrivateFile->fd);
- }
- if (PrivateFile->Dir != NULL) {
- closedir (PrivateFile->Dir);
- }
-
- PrivateFile->fd = -1;
- PrivateFile->Dir = NULL;
-
- if (PrivateFile->FileName) {
- free (PrivateFile->FileName);
- }
-
- free (PrivateFile);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Close and delete the file handle.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The device was opened.
- @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
-
-**/
-EFI_STATUS
-PosixFileDelete (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- Status = EFI_WARN_DELETE_FAILURE;
-
- if (PrivateFile->IsDirectoryPath) {
- if (PrivateFile->Dir != NULL) {
- closedir (PrivateFile->Dir);
- PrivateFile->Dir = NULL;
- }
-
- if (rmdir (PrivateFile->FileName) == 0) {
- Status = EFI_SUCCESS;
- }
- } else {
- close (PrivateFile->fd);
- PrivateFile->fd = -1;
-
- if (!PrivateFile->IsOpenedByRead) {
- if (!unlink (PrivateFile->FileName)) {
- Status = EFI_SUCCESS;
- }
- }
- }
-
- free (PrivateFile->FileName);
- free (PrivateFile);
-
- return Status;
-}
-
-
-/**
- Read data from the file.
-
- @param This Protocol instance pointer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer in which data is read.
-
- @retval EFI_SUCCESS Data was read.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size.
-
-**/
-EFI_STATUS
-PosixFileRead (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- int Res;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- CHAR8 *FullFileName;
-
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (!PrivateFile->IsDirectoryPath) {
- if (PrivateFile->fd < 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Res = 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 = 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;
-
- FullFileName = malloc (AsciiStrLen(PrivateFile->FileName) + 1 + NameSize);
- if (FullFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- AsciiStrCpy (FullFileName, PrivateFile->FileName);
- AsciiStrCat (FullFileName, "/");
- AsciiStrCat (FullFileName, PrivateFile->Dirent->d_name);
- Status = UnixSimpleFileSystemFileInfo (
- PrivateFile,
- FullFileName,
- BufferSize,
- Buffer
- );
- free (FullFileName);
-
- PrivateFile->Dirent = NULL;
-
-Done:
- return Status;
-}
-
-
-
-/**
- Write data to a file.
-
- @param This Protocol instance pointer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer in which data to write.
-
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to Open directory are not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-PosixFileWrite (
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- int Res;
-
-
- PrivateFile = EMU_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 = write (PrivateFile->fd, Buffer, *BufferSize);
- if (Res == (UINTN)-1) {
- return ErrnoToEfiStatus ();
- }
-
- *BufferSize = Res;
- return EFI_SUCCESS;
-}
-
-
-
-/**
- Set a files current position
-
- @param This Protocol instance pointer.
- @param Position Byte position from the start of the file.
-
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
-
-**/
-EFI_STATUS
-PosixFileSetPossition (
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- off_t Pos;
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- if (Position != 0) {
- return EFI_UNSUPPORTED;
- }
-
- if (PrivateFile->Dir == NULL) {
- return EFI_DEVICE_ERROR;
- }
- rewinddir (PrivateFile->Dir);
- return EFI_SUCCESS;
- } else {
- if (Position == (UINT64) -1) {
- Pos = lseek (PrivateFile->fd, 0, SEEK_END);
- } else {
- Pos = lseek (PrivateFile->fd, Position, SEEK_SET);
- }
- if (Pos == (off_t)-1) {
- return ErrnoToEfiStatus ();
- }
- return EFI_SUCCESS;
- }
-}
-
-
-
-/**
- Get a file's current position
-
- @param This Protocol instance pointer.
- @param Position Byte position from the start of the file.
-
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open..
-
-**/
-EFI_STATUS
-PosixFileGetPossition (
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_UNSUPPORTED;
- } else {
- *Position = (UINT64)lseek (PrivateFile->fd, 0, SEEK_CUR);
- Status = (*Position == (UINT64) -1) ? ErrnoToEfiStatus () : EFI_SUCCESS;
- }
-
- return Status;
-}
-
-
-/**
- Get information about a file.
-
- @param This Protocol instance pointer.
- @param InformationType Type of information to return in Buffer.
- @param BufferSize On input size of buffer, on output amount of data in buffer.
- @param Buffer The buffer to return data.
-
- @retval EFI_SUCCESS Data was returned.
- @retval EFI_UNSUPPORTED InformationType is not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in BufferSize.
-
-**/
-EFI_STATUS
-PosixFileGetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
- int UnixStatus;
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- struct statfs buf;
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
-
- Status = EFI_SUCCESS;
- 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);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- UnixStatus = statfs (PrivateFile->FileName, &buf);
- if (UnixStatus < 0) {
- return EFI_DEVICE_ERROR;
- }
-
- 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);
-
- } else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel);
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
-
- }
-
- return Status;
-}
-
-
-/**
- Set information about a file
-
- @param File Protocol instance pointer.
- @param InformationType Type of information in Buffer.
- @param BufferSize Size of buffer.
- @param Buffer The data to write.
-
- @retval EFI_SUCCESS Data was returned.
- @retval EFI_UNSUPPORTED InformationType is not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
-
-**/
-EFI_STATUS
-PosixFileSetInfo (
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-{
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- EMU_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_INFO *OldFileInfo;
- EFI_FILE_INFO *NewFileInfo;
- EFI_STATUS Status;
- UINTN OldInfoSize;
- mode_t NewAttr;
- struct stat 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;
- int UnixStatus;
- struct utimbuf Utime;
-
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
- errno = 0;
- 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;
-
- free (PrivateRoot->VolumeLabel);
-
- PrivateRoot->VolumeLabel = malloc (StrSize (NewFileSystemInfo->VolumeLabel));
- if (PrivateRoot->VolumeLabel == NULL) {
- 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 <= sizeof (EFI_FILE_INFO) ||
- (NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
- (sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // 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;
- }
-
- OldFileInfo = malloc (OldInfoSize);
- if (OldFileInfo == NULL) {
- goto Done;
- }
-
- Status = UnixSimpleFileSystemFileInfo (PrivateFile, NULL, &OldInfoSize, OldFileInfo);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- OldFileName = malloc (AsciiStrSize (PrivateFile->FileName));
- if (OldFileInfo == NULL) {
- goto Done;
- }
-
- AsciiStrCpy (OldFileName, PrivateFile->FileName);
-
- //
- // Make full pathname from new filename and rootpath.
- //
- if (NewFileInfo->FileName[0] == '\\') {
- NewFileName = malloc (AsciiStrLen (PrivateRoot->FilePath) + 1 + StrLen (NewFileInfo->FileName) + 1);
- if (NewFileName == NULL) {
- goto Done;
- }
-
- AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
- AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
- UnicodeFilePtr = NewFileInfo->FileName + 1;
- *AsciiFilePtr++ ='/';
- } else {
- NewFileName = malloc (AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1);
- if (NewFileName == NULL) {
- 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: - Should really use EFI_UNICODE_COLLATION_PROTOCOL
- //
- 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 (stat (OldFileName, &OldAttr) != 0) {
- Status = ErrnoToEfiStatus ();
- 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 = rename (OldFileName, NewFileName);
- if (UnixStatus == 0) {
- //
- // modify file name
- //
- free (PrivateFile->FileName);
-
- PrivateFile->FileName = malloc (AsciiStrSize (NewFileName));
- if (PrivateFile->FileName == NULL) {
- 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 (ftruncate (PrivateFile->fd, NewFileInfo->FileSize) != 0) {
- Status = ErrnoToEfiStatus ();
- goto Done;
- }
-
- }
-
- //
- // Time change
- //
- if (TimeChangeFlag) {
- 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 = 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 = mktime (&NewLastWriteSystemTime);
-
- if (Utime.actime == (time_t)-1 || Utime.modtime == (time_t)-1) {
- goto Done;
- }
-
- if (utime (PrivateFile->FileName, &Utime) == -1) {
- Status = ErrnoToEfiStatus ();
- 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;
- }
-
- if (chmod (NewFileName, NewAttr) != 0) {
- Status = ErrnoToEfiStatus ();
- }
-
-Done:
- if (OldFileInfo != NULL) {
- free (OldFileInfo);
- }
-
- if (OldFileName != NULL) {
- free (OldFileName);
- }
-
- if (NewFileName != NULL) {
- free (NewFileName);
- }
-
- return Status;
-}
-
-
-/**
- Flush data back for the file handle.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to Open directory are not supported.
- @retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
-
-**/
-EFI_STATUS
-PosixFileFlush (
- IN EFI_FILE_PROTOCOL *This
- )
-{
- EMU_EFI_FILE_PRIVATE *PrivateFile;
-
-
- PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- return EFI_UNSUPPORTED;
- }
-
- if (PrivateFile->IsOpenedByRead) {
- return EFI_ACCESS_DENIED;
- }
-
- if (PrivateFile->fd < 0) {
- return EFI_DEVICE_ERROR;
- }
-
- if (fsync (PrivateFile->fd) != 0) {
- return ErrnoToEfiStatus ();
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-PosixFileSystmeThunkOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- UINTN i;
-
- if (This->Private != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (!CompareGuid (This->Protocol, &gEfiSimpleFileSystemProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = malloc (sizeof (EMU_SIMPLE_FILE_SYSTEM_PRIVATE));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->FilePath = malloc (StrLen (This->ConfigString) + 1);
- if (Private->FilePath == NULL) {
- free (Private);
- return EFI_OUT_OF_RESOURCES;
- }
-
- // Convert Unicode to Ascii
- for (i = 0; This->ConfigString[i] != 0; i++) {
- Private->FilePath[i] = This->ConfigString[i];
- }
- Private->FilePath[i] = 0;
-
-
- Private->VolumeLabel = malloc (StrSize (L"EFI_EMULATED"));
- if (Private->VolumeLabel == NULL) {
- free (Private->FilePath);
- free (Private);
- return EFI_OUT_OF_RESOURCES;
- }
- StrCpy (Private->VolumeLabel, L"EFI_EMULATED");
-
- Private->Signature = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
- Private->Thunk = This;
- CopyMem (&Private->SimpleFileSystem, &gPosixFileSystemProtocol, sizeof (Private->SimpleFileSystem));
- Private->FileHandlesOpen = FALSE;
-
- This->Interface = &Private->SimpleFileSystem;
- This->Private = Private;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-PosixFileSystmeThunkClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- if (!CompareGuid (This->Protocol, &gEfiSimpleFileSystemProtocolGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = This->Private;
-
- if (Private->FileHandlesOpen) {
- //
- // Close only supported if all the EFI_FILE_HANDLEs have been closed.
- //
- return EFI_NOT_READY;
- }
-
- if (This->Private != NULL) {
- if (Private->VolumeLabel != NULL) {
- free (Private->VolumeLabel);
- }
- free (This->Private);
- This->Private = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketPosixFileSystmeThunkOpen,
- GasketPosixFileSystmeThunkClose,
- NULL
-};
-
-
diff --git a/EmulatorPkg/Unix/Host/Pthreads.c b/EmulatorPkg/Unix/Host/Pthreads.c
deleted file mode 100644
index c60c298099..0000000000
--- a/EmulatorPkg/Unix/Host/Pthreads.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*++ @file
- POSIX Pthreads to emulate APs and implement threads
-
-Copyright (c) 2011, Apple Inc. All rights reserved.
-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.
-
-
-**/
-
-#include "Host.h"
-#include <pthread.h>
-
-
-UINTN
-EFIAPI
-PthreadMutexLock (
- IN VOID *Mutex
- )
-{
- return (UINTN)pthread_mutex_lock ((pthread_mutex_t *)Mutex);
-}
-
-
-
-UINTN
-EFIAPI
-PthreadMutexUnLock (
- IN VOID *Mutex
- )
-{
- return (UINTN)pthread_mutex_unlock ((pthread_mutex_t *)Mutex);
-}
-
-
-UINTN
-EFIAPI
-PthreadMutexTryLock (
- IN VOID *Mutex
- )
-{
- return (UINTN)pthread_mutex_trylock ((pthread_mutex_t *)Mutex);
-}
-
-
-VOID *
-PthreadMutexInit (
- IN VOID
- )
-{
- pthread_mutex_t *Mutex;
- int err;
-
- Mutex = malloc (sizeof (pthread_mutex_t));
- err = pthread_mutex_init (Mutex, NULL);
- if (err == 0) {
- return Mutex;
- }
-
- return NULL;
-}
-
-
-UINTN
-PthreadMutexDestroy (
- IN VOID *Mutex
- )
-{
- if (Mutex != NULL) {
- return pthread_mutex_destroy ((pthread_mutex_t *)Mutex);
- }
-
- return -1;
-}
-
-// Can't store this data on PthreadCreate stack so we need a global
-typedef struct {
- pthread_mutex_t Mutex;
- THREAD_THUNK_THREAD_ENTRY Start;
-} THREAD_MANGLE;
-
-THREAD_MANGLE mThreadMangle = {
- PTHREAD_MUTEX_INITIALIZER,
- NULL
-};
-
-VOID *
-SecFakePthreadStart (
- VOID *Context
- )
-{
- THREAD_THUNK_THREAD_ENTRY Start;
- sigset_t SigMask;
-
- // Save global on the stack before we unlock
- Start = mThreadMangle.Start;
- pthread_mutex_unlock (&mThreadMangle.Mutex);
-
- // Mask all signals to the APs
- sigfillset (&SigMask);
- pthread_sigmask (SIG_BLOCK, &SigMask, NULL);
-
- //
- // We have to start the thread in SEC as we need to follow
- // OS X calling conventions. We can then call back into
- // to the callers Start.
- //
- // This is a great example of how all problems in computer
- // science can be solved by adding another level of indirection
- //
- return (VOID *)ReverseGasketUint64 ((CALL_BACK)Start, (UINTN)Context);
-}
-
-UINTN
-PthreadCreate (
- IN VOID *Thread,
- IN VOID *Attribute,
- IN THREAD_THUNK_THREAD_ENTRY Start,
- IN VOID *Context
- )
-{
- int err;
- BOOLEAN EnabledOnEntry;
-
- //
- // Threads inherit interrupt state so disable interrupts before we start thread
- //
- if (SecInterruptEanbled ()) {
- SecDisableInterrupt ();
- EnabledOnEntry = TRUE;
- } else {
- EnabledOnEntry = FALSE;
- }
-
- // Aquire lock for global, SecFakePthreadStart runs in a different thread.
- pthread_mutex_lock (&mThreadMangle.Mutex);
- mThreadMangle.Start = Start;
-
- err = pthread_create (Thread, Attribute, SecFakePthreadStart, Context);
- if (err != 0) {
- // Thread failed to launch so release the lock;
- pthread_mutex_unlock (&mThreadMangle.Mutex);
- }
-
- if (EnabledOnEntry) {
- // Restore interrupt state
- SecEnableInterrupt ();
- }
-
- return err;
-}
-
-
-VOID
-PthreadExit (
- IN VOID *ValuePtr
- )
-{
- pthread_exit (ValuePtr);
- return;
-}
-
-
-UINTN
-PthreadSelf (
- VOID
- )
-{
- // POSIX currently allows pthread_t to be a structure or arithmetic type.
- // Check out sys/types.h to make sure this will work if you are porting.
- // On OS X (Darwin) pthread_t is a pointer to a structure so this code works.
- return (UINTN)pthread_self ();
-}
-
-
-EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
- GasketPthreadMutexLock,
- GasketPthreadMutexUnLock,
- GasketPthreadMutexTryLock,
- GasketPthreadMutexInit,
- GasketPthreadMutexDestroy,
- GasketPthreadCreate,
- GasketPthreadExit,
- GasketPthreadSelf
-};
-
-
-EFI_STATUS
-PthreadOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- if (This->Instance != 0) {
- // Only single instance is supported
- return EFI_NOT_FOUND;
- }
-
- if (This->ConfigString[0] == L'0') {
- // If AP count is zero no need for threads
- return EFI_NOT_FOUND;
- }
-
- This->Interface = &gPthreadThunk;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-PthreadClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- return EFI_SUCCESS;
-}
-
-
-EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
- &gEmuThreadThunkProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketPthreadOpen,
- GasketPthreadClose,
- NULL
-};
-
-
diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
deleted file mode 100644
index adb9b2b830..0000000000
--- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/*++ @file
-
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2011, 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 "Host.h"
-
-#include <sys/ipc.h>
-#include <sys/shm.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>
-
-#define KEYSYM_LOWER 0
-#define KEYSYM_UPPER 1
-
-
-struct uga_drv_shift_mask {
- unsigned char shift;
- unsigned char size;
- unsigned char csize;
-};
-
-#define NBR_KEYS 32
-typedef struct {
- EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsIo;
-
- 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;
- char *Title;
-
- unsigned int key_rd;
- unsigned int key_wr;
- unsigned int key_count;
- EFI_KEY_DATA keys[NBR_KEYS];
-
- EFI_KEY_STATE KeyState;
-
- EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeRegisterdKeyCallback;
- EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakRegisterdKeyCallback;
- VOID *RegisterdKeyCallbackContext;
-
- int previous_x;
- int previous_y;
- EFI_SIMPLE_POINTER_STATE pointer_state;
- int pointer_state_changed;
-} GRAPHICS_IO_PRIVATE;
-
-void
-HandleEvents(
- IN GRAPHICS_IO_PRIVATE *Drv
- );
-
-void
-fill_shift_mask (
- IN struct uga_drv_shift_mask *sm,
- IN 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 (
- IN GRAPHICS_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.
- //
- 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
-X11Size (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN UINT32 Width,
- IN UINT32 Height
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
- XSizeHints size_hints;
-
- // Destroy current buffer if created.
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
- 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 (
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN XEvent *ev,
- IN BOOLEAN Make
- )
-{
- KeySym *KeySym;
- EFI_KEY_DATA KeyData;
- int KeySymArraySize;
-
- if (Make) {
- if (Drv->key_count == NBR_KEYS) {
- return;
- }
- }
-
- // keycode is a physical key on the keyboard
- // KeySym is a mapping of a physical key
- // KeyboardMapping is the array of KeySym for a given keycode. key, shifted key, option key, command key, ...
- //
- // Returns an array of KeySymArraySize of KeySym for the keycode. [0] is lower case, [1] is upper case,
- // [2] and [3] are based on option and command modifiers. The problem we have is command V
- // could be mapped to a crazy Unicode character so the old scheme of returning a string.
- //
- KeySym = XGetKeyboardMapping (Drv->display, ev->xkey.keycode, 1, &KeySymArraySize);
-
- KeyData.Key.ScanCode = 0;
- KeyData.Key.UnicodeChar = 0;
- KeyData.KeyState.KeyShiftState = 0;
-
- //
- // 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 {
- if (Make) {
- Drv->KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
- }
- }
-
- // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED
-
- switch (*KeySym) {
- case XK_Control_R:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_CONTROL_PRESSED;
- }
- break;
- case XK_Control_L:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_LEFT_CONTROL_PRESSED;
- }
- break;
-
- case XK_Shift_R:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_SHIFT_PRESSED;
- }
- break;
- case XK_Shift_L:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_LEFT_SHIFT_PRESSED;
- }
- break;
-
- case XK_Mode_switch:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_LEFT_ALT_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_LEFT_ALT_PRESSED;
- }
- break;
-
- case XK_Meta_R:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_LOGO_PRESSED;
- }
- break;
- case XK_Meta_L:
- if (Make) {
- Drv->KeyState.KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
- } else {
- Drv->KeyState.KeyShiftState &= ~EFI_LEFT_LOGO_PRESSED;
- }
- break;
-
- case XK_KP_Home:
- case XK_Home: KeyData.Key.ScanCode = SCAN_HOME; break;
-
- case XK_KP_End:
- case XK_End: KeyData.Key.ScanCode = SCAN_END; break;
-
- case XK_KP_Left:
- case XK_Left: KeyData.Key.ScanCode = SCAN_LEFT; break;
-
- case XK_KP_Right:
- case XK_Right: KeyData.Key.ScanCode = SCAN_RIGHT; break;
-
- case XK_KP_Up:
- case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;
-
- case XK_KP_Down:
- case XK_Down: KeyData.Key.ScanCode = SCAN_DOWN; break;
-
- case XK_KP_Delete:
- case XK_Delete: KeyData.Key.ScanCode = SCAN_DELETE; break;
-
- case XK_KP_Insert:
- case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;
-
- case XK_KP_Page_Up:
- case XK_Page_Up: KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
-
- case XK_KP_Page_Down:
- 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_KP_F1:
- case XK_F1: KeyData.Key.ScanCode = SCAN_F1; break;
-
- case XK_KP_F2:
- case XK_F2: KeyData.Key.ScanCode = SCAN_F2; break;
-
- case XK_KP_F3:
- case XK_F3: KeyData.Key.ScanCode = SCAN_F3; break;
-
- case XK_KP_F4:
- 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;
-
- // Don't map into X11 by default on a Mac
- // System Preferences->Keyboard->Keyboard Shortcuts can be configured
- // to not use higher function keys as shortcuts and the will show up
- // in X11.
- case XK_F8: KeyData.Key.ScanCode = SCAN_F8; break;
- case XK_F9: KeyData.Key.ScanCode = SCAN_F9; break;
- case XK_F10: KeyData.Key.ScanCode = SCAN_F10; break;
-
- case XK_F11: KeyData.Key.ScanCode = SCAN_F11; break;
- case XK_F12: KeyData.Key.ScanCode = SCAN_F12; break;
-
- case XK_F13: KeyData.Key.ScanCode = SCAN_F13; break;
- case XK_F14: KeyData.Key.ScanCode = SCAN_F14; break;
- case XK_F15: KeyData.Key.ScanCode = SCAN_F15; break;
- case XK_F16: KeyData.Key.ScanCode = SCAN_F16; break;
- case XK_F17: KeyData.Key.ScanCode = SCAN_F17; break;
- case XK_F18: KeyData.Key.ScanCode = SCAN_F18; break;
- case XK_F19: KeyData.Key.ScanCode = SCAN_F19; break;
- case XK_F20: KeyData.Key.ScanCode = SCAN_F20; break;
- case XK_F21: KeyData.Key.ScanCode = SCAN_F21; break;
- case XK_F22: KeyData.Key.ScanCode = SCAN_F22; break;
- case XK_F23: KeyData.Key.ScanCode = SCAN_F23; break;
- case XK_F24: KeyData.Key.ScanCode = SCAN_F24; break;
-
- // No mapping in X11
- //case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_UP; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_DOWN; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_UP; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_DOWN; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_SUSPEND; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_HIBERNATE; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_TOGGLE_DISPLAY; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_RECOVERY; break;
- //case XK_: KeyData.Key.ScanCode = SCAN_EJECT; break;
-
- case XK_BackSpace: KeyData.Key.UnicodeChar = 0x0008; break;
-
- case XK_KP_Tab:
- case XK_Tab: KeyData.Key.UnicodeChar = 0x0009; break;
-
- case XK_Linefeed: KeyData.Key.UnicodeChar = 0x000a; break;
-
- case XK_KP_Enter:
- case XK_Return: KeyData.Key.UnicodeChar = 0x000d; break;
-
- case XK_KP_Equal : KeyData.Key.UnicodeChar = L'='; break;
- case XK_KP_Multiply : KeyData.Key.UnicodeChar = L'*'; break;
- case XK_KP_Add : KeyData.Key.UnicodeChar = L'+'; break;
- case XK_KP_Separator : KeyData.Key.UnicodeChar = L'~'; break;
- case XK_KP_Subtract : KeyData.Key.UnicodeChar = L'-'; break;
- case XK_KP_Decimal : KeyData.Key.UnicodeChar = L'.'; break;
- case XK_KP_Divide : KeyData.Key.UnicodeChar = L'/'; break;
-
- case XK_KP_0 : KeyData.Key.UnicodeChar = L'0'; break;
- case XK_KP_1 : KeyData.Key.UnicodeChar = L'1'; break;
- case XK_KP_2 : KeyData.Key.UnicodeChar = L'2'; break;
- case XK_KP_3 : KeyData.Key.UnicodeChar = L'3'; break;
- case XK_KP_4 : KeyData.Key.UnicodeChar = L'4'; break;
- case XK_KP_5 : KeyData.Key.UnicodeChar = L'5'; break;
- case XK_KP_6 : KeyData.Key.UnicodeChar = L'6'; break;
- case XK_KP_7 : KeyData.Key.UnicodeChar = L'7'; break;
- case XK_KP_8 : KeyData.Key.UnicodeChar = L'8'; break;
- case XK_KP_9 : KeyData.Key.UnicodeChar = L'9'; break;
-
- default:
- ;
- }
-
- // The global state is our state
- KeyData.KeyState.KeyShiftState = Drv->KeyState.KeyShiftState;
- KeyData.KeyState.KeyToggleState = Drv->KeyState.KeyToggleState;
-
- if (*KeySym < XK_BackSpace) {
- if (((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED)) != 0) ||
- ((Drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) != 0) ) {
-
- KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_UPPER];
-
- // Per UEFI spec since we converted the Unicode clear the shift bits we pass up
- KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);
- } else {
- KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_LOWER];
- }
- } else {
- // XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file
- ;
- }
-
- if (Make) {
- memcpy (&Drv->keys[Drv->key_wr], &KeyData, sizeof (EFI_KEY_DATA));
- Drv->key_wr = (Drv->key_wr + 1) % NBR_KEYS;
- Drv->key_count++;
- if (Drv->MakeRegisterdKeyCallback != NULL) {
- ReverseGasketUint64Uint64 (Drv->MakeRegisterdKeyCallback ,Drv->RegisterdKeyCallbackContext, &KeyData);
- }
- } else {
- if (Drv->BreakRegisterdKeyCallback != NULL) {
- ReverseGasketUint64Uint64 (Drv->BreakRegisterdKeyCallback ,Drv->RegisterdKeyCallbackContext, &KeyData);
- }
- }
-}
-
-
-void
-handleMouseMoved(
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN 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 (
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN XEvent *ev,
- IN 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 (
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN UINTN X,
- IN UINTN Y,
- IN UINTN Width,
- IN 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(GRAPHICS_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, TRUE);
- break;
- case KeyRelease:
- handleKeyEvent (Drv, ev, FALSE);
- 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 (
- IN GRAPHICS_IO_PRIVATE *Drv
- )
-{
- XEvent ev;
-
- while (XPending (Drv->display) != 0) {
- XNextEvent (Drv->display, &ev);
- HandleEvent (Drv, &ev);
- }
-}
-
-unsigned long
-X11PixelToColor (
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN 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
-X11ColorToPixel (
- IN GRAPHICS_IO_PRIVATE *Drv,
- IN unsigned long val
- )
-{
- EFI_UGA_PIXEL Pixel;
-
- memset (&Pixel, 0, sizeof (EFI_UGA_PIXEL));
-
- // Truncation not an issue since X11 and EFI are both using 8 bits per color
- Pixel.Red = (val >> Drv->r.shift) << Drv->r.csize;
- Pixel.Green = (val >> Drv->g.shift) << Drv->g.csize;
- Pixel.Blue = (val >> Drv->b.shift) << Drv->b.csize;
-
- return Pixel;
-}
-
-
-EFI_STATUS
-X11CheckKey (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- HandleEvents (Drv);
-
- if (Drv->key_count != 0) {
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_READY;
-}
-
-EFI_STATUS
-X11GetKey (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EFI_KEY_DATA *KeyData
- )
-{
- EFI_STATUS EfiStatus;
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- EfiStatus = X11CheckKey (GraphicsIo);
- if (EFI_ERROR (EfiStatus)) {
- return EfiStatus;
- }
-
- 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
-X11KeySetState (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- 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
-X11RegisterKeyNotify (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
- IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
- IN VOID *Context
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- Drv->MakeRegisterdKeyCallback = MakeCallBack;
- Drv->BreakRegisterdKeyCallback = BreakCallBack;
- Drv->RegisterdKeyCallbackContext = Context;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-X11Blt (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
- )
-{
- GRAPHICS_IO_PRIVATE *Private;
- UINTN DstY;
- UINTN SrcY;
- UINTN DstX;
- UINTN SrcX;
- UINTN Index;
- EFI_UGA_PIXEL *Blt;
- UINT8 *Dst;
- UINT8 *Src;
- UINTN Nbr;
- unsigned long Color;
- XEvent ev;
-
- Private = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
-
- //
- // 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++ = X11ColorToPixel (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, X11PixelToColor(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 = X11PixelToColor(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) {
- XNextEvent (Private->display, &ev);
- HandleEvent (Private, &ev);
- if (ev.type == NoExpose || ev.type == GraphicsExpose) {
- break;
- }
- }
- break;
- case EfiUgaVideoFill:
- Color = X11PixelToColor (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;
-}
-
-
-EFI_STATUS
-X11CheckPointer (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- HandleEvents (Drv);
- if (Drv->pointer_state_changed != 0) {
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_READY;
-}
-
-
-EFI_STATUS
-X11GetPointerState (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EFI_SIMPLE_POINTER_STATE *State
- )
-{
- EFI_STATUS EfiStatus;
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
-
- EfiStatus = X11CheckPointer (GraphicsIo);
- if (EfiStatus != EFI_SUCCESS) {
- return EfiStatus;
- }
-
- 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
-X11GraphicsWindowOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
- unsigned int border_width = 0;
- char *display_name = NULL;
-
- Drv = (GRAPHICS_IO_PRIVATE *)calloc (1, sizeof (GRAPHICS_IO_PRIVATE));
- if (Drv == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Drv->GraphicsIo.Size = GasketX11Size;
- Drv->GraphicsIo.CheckKey = GasketX11CheckKey;
- Drv->GraphicsIo.GetKey = GasketX11GetKey;
- Drv->GraphicsIo.KeySetState = GasketX11KeySetState;
- Drv->GraphicsIo.RegisterKeyNotify = GasketX11RegisterKeyNotify;
- Drv->GraphicsIo.Blt = GasketX11Blt;
- Drv->GraphicsIo.CheckPointer = GasketX11CheckPointer;
- Drv->GraphicsIo.GetPointerState = GasketX11GetPointerState;
-
-
- 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->MakeRegisterdKeyCallback = NULL;
- Drv->BreakRegisterdKeyCallback = 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));
-
- Drv->Title = malloc (StrSize (This->ConfigString));
- UnicodeStrToAsciiStr (This->ConfigString, Drv->Title);
- XStoreName (Drv->display, Drv->win, Drv->Title);
-
-// XAutoRepeatOff (Drv->display);
- XSelectInput (
- Drv->display, Drv->win,
- ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
- );
- Drv->gc = DefaultGC (Drv->display, Drv->screen);
-
- This->Private = (VOID *)Drv;
- This->Interface = (VOID *)Drv;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-X11GraphicsWindowClose (
- IN EMU_IO_THUNK_PROTOCOL *This
- )
-{
- GRAPHICS_IO_PRIVATE *Drv;
-
- Drv = (GRAPHICS_IO_PRIVATE *)This->Private;
-
- 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;
-}
-
-
-EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
- &gEmuGraphicsWindowProtocolGuid,
- NULL,
- NULL,
- 0,
- GasketX11GraphicsWindowOpen,
- GasketX11GraphicsWindowClose,
- NULL
-};
-
-
diff --git a/EmulatorPkg/Unix/Host/X11IncludeHack b/EmulatorPkg/Unix/Host/X11IncludeHack
deleted file mode 120000
index f7ab103f69..0000000000
--- a/EmulatorPkg/Unix/Host/X11IncludeHack
+++ /dev/null
@@ -1 +0,0 @@
-/opt/X11/include \ No newline at end of file
diff --git a/EmulatorPkg/Unix/Host/X64/Gasket.S b/EmulatorPkg/Unix/Host/X64/Gasket.S
deleted file mode 100644
index c339461cd8..0000000000
--- a/EmulatorPkg/Unix/Host/X64/Gasket.S
+++ /dev/null
@@ -1,1631 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Manage differenced between UNIX ABI and EFI/Windows ABI
-#
-# EFI Arg passing: RCX, RDX, R8, R9
-# Callee allocates 32 bytes on stack to spill registers
-# UNIX Arg passing: RDI, RSI, RDX, RCX, R8, R9
-# RSI, RDI calle-save on EFI, scatch on UNIX callign
-#
-# Copyright (c) 2008 - 2011, 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
-
-
-
- .text
-
-//
-// EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI)
-//
-
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr)
-ASM_PFX(GasketSecWriteStdErr):
- 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(SecWriteStdErr)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecConfigStdIn)
-ASM_PFX(GasketSecConfigStdIn):
- 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(SecConfigStdIn)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecWriteStdOut)
-ASM_PFX(GasketSecWriteStdOut):
- 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(SecWriteStdOut)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecReadStdIn)
-ASM_PFX(GasketSecReadStdIn):
- 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(SecReadStdIn)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecPollStdIn)
-ASM_PFX(GasketSecPollStdIn):
- 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(SecPollStdIn)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecMalloc)
-ASM_PFX(GasketSecMalloc):
- 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(SecMalloc)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecValloc)
-ASM_PFX(GasketSecValloc):
- 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(SecValloc)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecFree)
-ASM_PFX(GasketSecFree):
- 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(SecFree)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecSetTimer)
-ASM_PFX(GasketSecSetTimer):
- 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(SecSetTimer)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt)
-ASM_PFX(GasketSecEnableInterrupt):
- 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(SecEnableInterrupt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt)
-ASM_PFX(GasketSecDisableInterrupt):
- 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(SecDisableInterrupt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency)
-ASM_PFX(GasketQueryPerformanceFrequency):
- 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(QueryPerformanceFrequency)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter)
-ASM_PFX(GasketQueryPerformanceCounter):
- 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(QueryPerformanceCounter)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecSleep)
-ASM_PFX(GasketSecSleep):
- 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(SecSleep)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecCpuSleep)
-ASM_PFX(GasketSecCpuSleep):
- 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(SecCpuSleep)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecExit)
-ASM_PFX(GasketSecExit):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
-
- movq %rcx, %rdi // Swizzle args
- call ASM_PFX(SecExit) // 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(GasketSecGetTime)
-ASM_PFX(GasketSecGetTime):
- 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(SecGetTime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketSecSetTime)
-ASM_PFX(GasketSecSetTime):
- 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(SecSetTime)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol)
-ASM_PFX(GasketSecGetNextProtocol):
- 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(SecGetNextProtocol)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-// PPIs produced by SEC
-
-ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint)
-ASM_PFX(GasketSecPeCoffGetEntryPoint):
- 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(GasketSecPeCoffRelocateImageExtraAction)
-ASM_PFX(GasketSecPeCoffRelocateImageExtraAction):
- 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(GasketSecPeCoffUnloadImageExtraAction)
-ASM_PFX(GasketSecPeCoffUnloadImageExtraAction):
- 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(SecPeCoffUnloadImageExtraAction)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress)
-ASM_PFX(GasketSecEmuThunkAddress):
- 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(SecEmuThunkAddress)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-//
-// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
-//
-
-ASM_GLOBAL ASM_PFX(GasketX11Size)
-ASM_PFX(GasketX11Size):
- 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(X11Size)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11CheckKey)
-ASM_PFX(GasketX11CheckKey):
- 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(X11CheckKey)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketX11GetKey)
-ASM_PFX(GasketX11GetKey):
- 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(X11GetKey)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11KeySetState)
-ASM_PFX(GasketX11KeySetState):
- 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(X11KeySetState)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify)
-ASM_PFX(GasketX11RegisterKeyNotify):
- 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(X11RegisterKeyNotify)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11Blt)
-ASM_PFX(GasketX11Blt):
- 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(X11Blt)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11CheckPointer)
-ASM_PFX(GasketX11CheckPointer):
- 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(X11CheckPointer)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GetPointerState)
-ASM_PFX(GasketX11GetPointerState):
- 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(X11GetPointerState)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen)
-ASM_PFX(GasketX11GraphicsWindowOpen):
- 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(X11GraphicsWindowOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose)
-ASM_PFX(GasketX11GraphicsWindowClose):
- 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 %r9, %rcx
-
- call ASM_PFX(X11GraphicsWindowClose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-// Pthreads
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock)
-ASM_PFX(GasketPthreadMutexLock):
- 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(PthreadMutexLock)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock)
-ASM_PFX(GasketPthreadMutexUnLock):
- 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(PthreadMutexUnLock)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock)
-ASM_PFX(GasketPthreadMutexTryLock):
- 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(PthreadMutexTryLock)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit)
-ASM_PFX(GasketPthreadMutexInit):
- 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(PthreadMutexInit)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy)
-ASM_PFX(GasketPthreadMutexDestroy):
- 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(PthreadMutexDestroy)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadCreate)
-ASM_PFX(GasketPthreadCreate):
- 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(PthreadCreate)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadExit)
-ASM_PFX(GasketPthreadExit):
- 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(PthreadExit)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadSelf)
-ASM_PFX(GasketPthreadSelf):
- 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(PthreadSelf)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadOpen)
-ASM_PFX(GasketPthreadOpen):
- 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(PthreadOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPthreadClose)
-ASM_PFX(GasketPthreadClose):
- 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(PthreadClose)
-
- 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
-
-
-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(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
-
-
-// EmuIoThunk SimpleFileSystem
-
-ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume)
-ASM_PFX(GasketPosixOpenVolume):
- 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(PosixOpenVolume)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileOpen)
-ASM_PFX(GasketPosixFileOpen):
- 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 48(%rbp), %r8
-
- call ASM_PFX(PosixFileOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileCLose)
-ASM_PFX(GasketPosixFileCLose):
- 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(PosixFileCLose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileDelete)
-ASM_PFX(GasketPosixFileDelete):
- 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(PosixFileDelete)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileRead)
-ASM_PFX(GasketPosixFileRead):
- 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(PosixFileRead)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileWrite)
-ASM_PFX(GasketPosixFileWrite):
- 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(PosixFileWrite)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition)
-ASM_PFX(GasketPosixFileSetPossition):
- 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(PosixFileSetPossition)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition)
-ASM_PFX(GasketPosixFileGetPossition):
- 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(PosixFileGetPossition)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo)
-ASM_PFX(GasketPosixFileGetInfo):
- 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(PosixFileGetInfo)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo)
-ASM_PFX(GasketPosixFileSetInfo):
- 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(PosixFileSetInfo)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileFlush)
-ASM_PFX(GasketPosixFileFlush):
- 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(PosixFileFlush)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen)
-ASM_PFX(GasketPosixFileSystmeThunkOpen):
- 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(PosixFileSystmeThunkOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose)
-ASM_PFX(GasketPosixFileSystmeThunkClose):
- 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(PosixFileSystmeThunkClose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset)
-ASM_PFX(GasketEmuBlockIoReset):
- 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(EmuBlockIoReset)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks)
-ASM_PFX(GasketEmuBlockIoReadBlocks):
- 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 48(%rbp), %r8
- movq 56(%rbp), %r9
-
- call ASM_PFX(EmuBlockIoReadBlocks)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks)
-ASM_PFX(GasketEmuBlockIoWriteBlocks):
- 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 48(%rbp), %r8
- movq 56(%rbp), %r9
-
- call ASM_PFX(EmuBlockIoWriteBlocks)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks)
-ASM_PFX(GasketEmuBlockIoFlushBlocks):
- 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(EmuBlockIoFlushBlocks)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping)
-ASM_PFX(GasketEmuBlockIoCreateMapping):
- 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(EmuBlockIoCreateMapping)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen)
-ASM_PFX(GasketBlockIoThunkOpen):
- 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(EmuBlockIoThunkOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose)
-ASM_PFX(GasketBlockIoThunkClose):
- 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(EmuBlockIoThunkClose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpCreateMapping)
-ASM_PFX(GasketSnpCreateMapping):
- 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(EmuSnpCreateMapping)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStart)
-ASM_PFX(GasketSnpStart):
- 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(EmuSnpStart)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStop)
-ASM_PFX(GasketSnpStop):
- 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(EmuSnpStop)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpInitialize)
-ASM_PFX(GasketSnpInitialize):
- 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(EmuSnpInitialize)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReset)
-ASM_PFX(GasketSnpReset):
- 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(EmuSnpReset)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpShutdown)
-ASM_PFX(GasketSnpShutdown):
- 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(EmuSnpShutdown)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReceiveFilters)
-ASM_PFX(GasketSnpReceiveFilters):
- 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 48(%rbp), %r8
- movq 56(%rbp), %r9
-
- call ASM_PFX(EmuSnpReceiveFilters)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStationAddress)
-ASM_PFX(GasketSnpStationAddress):
- 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(EmuSnpStationAddress)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpStatistics)
-ASM_PFX(GasketSnpStatistics):
- 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(EmuSnpStatistics)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpMCastIpToMac)
-ASM_PFX(GasketSnpMCastIpToMac):
- 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(EmuSnpMCastIpToMac)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpNvData)
-ASM_PFX(GasketSnpNvData):
- 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 48(%rbp), %r8
-
- call ASM_PFX(EmuSnpNvData)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpGetStatus)
-ASM_PFX(GasketSnpGetStatus):
- 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(EmuSnpGetStatus)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpTransmit)
-ASM_PFX(GasketSnpTransmit):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
- subq $16, %rsp // Allocate space for args on the stack
-
- 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 48(%rbp), %r8
- movq 56(%rbp), %r9
- movq 64(%rbp), %rax
- movq %rax, (%rsp)
-
- call ASM_PFX(EmuSnpTransmit)
- addq $16, %rsp
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpReceive)
-ASM_PFX(GasketSnpReceive):
- pushq %rbp // stack frame is for the debugger
- movq %rsp, %rbp
- subq $16, %rsp // Allocate space for args on the stack
-
- 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 48(%rbp), %r8
- movq 56(%rbp), %r9
- movq 64(%rbp), %rax
- movq %rax, (%rsp)
-
- call ASM_PFX(EmuSnpReceive)
- addq $16, %rsp
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpThunkOpen)
-ASM_PFX(GasketSnpThunkOpen):
- 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(EmuSnpThunkOpen)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
-ASM_GLOBAL ASM_PFX(GasketSnpThunkClose)
-ASM_PFX(GasketSnpThunkClose):
- 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(EmuSnpThunkClose)
-
- popq %rdi // restore state
- popq %rsi
- popq %rbp
- ret
-
-
diff --git a/EmulatorPkg/Unix/Host/X64/SwitchStack.S b/EmulatorPkg/Unix/Host/X64/SwitchStack.S
deleted file mode 100644
index e82b352b6a..0000000000
--- a/EmulatorPkg/Unix/Host/X64/SwitchStack.S
+++ /dev/null
@@ -1,53 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# Portitions copyright (c) 2011, Apple Inc. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# Routine Description:
-#
-# Routine for switching stacks with 2 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) NewStack - The pointer to new stack.
-#
-# Returns:
-#
-# None
-#
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
-ASM_PFX(PeiSwitchStacks):
- pushq $0 // tells gdb to stop unwinding frame
- movq %rsp, %rbp
-
- movq %rcx, %rsp // update stack pointer
-
- movq %rdi, %rax // entry point to %rax
- movq %rsi, %rcx // Adjust Context1
- // Context2 already in the rigth spot
-
- #
- # 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
-
-
-
diff --git a/EmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh b/EmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh
deleted file mode 100755
index 6e432dd81e..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
-#
-# Copyright (c) 2008 - 2011, 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.
-#
-
-# force exit on error
-set -e
-
-#
-# Source the workspace and set up the environment variables we need
-#
-cd ../../..
-./build.sh -a IA32 $1 $2 $3 $4 $5 $6 $8
diff --git a/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/default.pbxuser b/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/default.pbxuser
deleted file mode 100644
index 85913859c3..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/default.pbxuser
+++ /dev/null
@@ -1,191 +0,0 @@
-// !$*UTF8*$!
-{
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- activeBuildConfigurationName = Debug;
- activeExecutable = BA11A1010FB10BCE00D06FEC /* Host.dll */;
- activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
- breakpoints = (
- BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */,
- );
- codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
- executables = (
- BA11A1010FB10BCE00D06FEC /* Host.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 /* Host.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 /* Host.dll */;
- libgmallocEnabled = 0;
- name = Host.dll;
- savedGlobals = {
- };
- showTypeColumn = 0;
- sourceDirectories = (
- );
- startupPath = ../../../../Build/Emulator32/DEBUG_XCLANG/IA32;
- };
- BA11A1020FB10BCE00D06FEC /* Host.dll */ = {
- isa = PBXFileReference;
- lastKnownFileType = "compiled.mach-o.executable";
- name = Host.dll;
- path = ../../../../Build/Emulator32/DEBUG_XCLANG/IA32/Host;
- sourceTree = SOURCE_ROOT;
- };
- BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */ = {
- isa = PBXSymbolicBreakpoint;
- actions = (
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
- );
- breakpointStyle = 1;
- continueAfterActions = 1;
- countType = 0;
- delayBeforeContinue = 0;
- hitCount = 0;
- ignoreCount = 0;
- location = Host;
- modificationTime = 263261853.260195;
- originalNumberOfMultipleMatches = 1;
- state = 1;
- symbolName = SecGdbConfigBreak;
- };
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
- isa = XCBreakpointCommandAction;
- command = "set gInXcode=1\nsource ../../../../EmulatorPkg/Unix/GdbRun";
- fallbackIsa = XCBreakpointAction;
- logCommand = 0;
- useDebuggerSideImplementation = 1;
- };
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- activeExec = 0;
- };
-}
diff --git a/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/project.pbxproj b/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/project.pbxproj
deleted file mode 100644
index 8ff531ef6c..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project32/xcode_project.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,124 +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";
- developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- English,
- Japanese,
- French,
- German,
- );
- 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_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/EmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh b/EmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh
deleted file mode 100755
index ac26dc60c4..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
-#
-# Copyright (c) 2008 - 2011, 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.
-#
-
-# 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/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser b/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser
deleted file mode 100644
index 7e7ce697af..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser
+++ /dev/null
@@ -1,191 +0,0 @@
-// !$*UTF8*$!
-{
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- activeBuildConfigurationName = Debug;
- activeExecutable = BA11A1010FB10BCE00D06FEC /* Host.dll */;
- activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
- breakpoints = (
- BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */,
- );
- codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
- executables = (
- BA11A1010FB10BCE00D06FEC /* Host.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 /* Host.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 /* Host.dll */;
- libgmallocEnabled = 0;
- name = Host.dll;
- savedGlobals = {
- };
- showTypeColumn = 0;
- sourceDirectories = (
- );
- startupPath = ../../../../Build/Emulator/DEBUG_XCLANG/X64;
- };
- BA11A1020FB10BCE00D06FEC /* Host.dll */ = {
- isa = PBXFileReference;
- lastKnownFileType = "compiled.mach-o.executable";
- name = Host.dll;
- path = ../../../../Build/Emulator/DEBUG_XCLANG/X64/Host;
- sourceTree = SOURCE_ROOT;
- };
- BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */ = {
- isa = PBXSymbolicBreakpoint;
- actions = (
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
- );
- breakpointStyle = 1;
- continueAfterActions = 1;
- countType = 0;
- delayBeforeContinue = 0;
- hitCount = 0;
- ignoreCount = 0;
- location = Host;
- modificationTime = 263261853.260195;
- originalNumberOfMultipleMatches = 1;
- state = 1;
- symbolName = SecGdbConfigBreak;
- };
- BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
- isa = XCBreakpointCommandAction;
- command = "set gInXcode=1\nsource ../../../../EmulatorPkg/Unix/GdbRun";
- fallbackIsa = XCBreakpointAction;
- logCommand = 0;
- useDebuggerSideImplementation = 1;
- };
- D28A88AD04BDD90700651E21 /* xcode_project */ = {
- activeExec = 0;
- };
-}
diff --git a/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj b/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj
deleted file mode 100644
index 9bd13bd63f..0000000000
--- a/EmulatorPkg/Unix/Xcode/xcode_project64/xcode_project.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,124 +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";
- developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- English,
- Japanese,
- French,
- German,
- );
- 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/EmulatorPkg/Unix/lldbefi.py b/EmulatorPkg/Unix/lldbefi.py
deleted file mode 100755
index 64549ce3ec..0000000000
--- a/EmulatorPkg/Unix/lldbefi.py
+++ /dev/null
@@ -1,540 +0,0 @@
-#!/usr/bin/python
-
-#
-# Copyright 2014 Apple Inc. All righes reserved.
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-import lldb
-import os
-import uuid
-import string
-import commands
-import optparse
-import shlex
-
-guid_dict = {}
-
-
-def EFI_GUID_TypeSummary (valobj,internal_dict):
- """ Type summary for EFI GUID, print C Name if known
- """
- # typedef struct {
- # UINT32 Data1;
- # UINT16 Data2;
- # UINT16 Data3;
- # UINT8 Data4[8];
- # } EFI_GUID;
- SBError = lldb.SBError()
-
- data1_val = valobj.GetChildMemberWithName('Data1')
- data1 = data1_val.GetValueAsUnsigned(0)
- data2_val = valobj.GetChildMemberWithName('Data2')
- data2 = data2_val.GetValueAsUnsigned(0)
- data3_val = valobj.GetChildMemberWithName('Data3')
- data3 = data3_val.GetValueAsUnsigned(0)
- str = "%x-%x-%x-" % (data1, data2, data3)
-
- data4_val = valobj.GetChildMemberWithName('Data4')
- for i in range (data4_val.num_children):
- if i == 2:
- str +='-'
- str += "%02x" % data4_val.GetChildAtIndex(i).data.GetUnsignedInt8(SBError, 0)
-
- return guid_dict.get (str.upper(), '')
-
-
-
-EFI_STATUS_Dict = {
- (0x8000000000000000 | 1): "Load Error",
- (0x8000000000000000 | 2): "Invalid Parameter",
- (0x8000000000000000 | 3): "Unsupported",
- (0x8000000000000000 | 4): "Bad Buffer Size",
- (0x8000000000000000 | 5): "Buffer Too Small",
- (0x8000000000000000 | 6): "Not Ready",
- (0x8000000000000000 | 7): "Device Error",
- (0x8000000000000000 | 8): "Write Protected",
- (0x8000000000000000 | 9): "Out of Resources",
- (0x8000000000000000 | 10): "Volume Corrupt",
- (0x8000000000000000 | 11): "Volume Full",
- (0x8000000000000000 | 12): "No Media",
- (0x8000000000000000 | 13): "Media changed",
- (0x8000000000000000 | 14): "Not Found",
- (0x8000000000000000 | 15): "Access Denied",
- (0x8000000000000000 | 16): "No Response",
- (0x8000000000000000 | 17): "No mapping",
- (0x8000000000000000 | 18): "Time out",
- (0x8000000000000000 | 19): "Not started",
- (0x8000000000000000 | 20): "Already started",
- (0x8000000000000000 | 21): "Aborted",
- (0x8000000000000000 | 22): "ICMP Error",
- (0x8000000000000000 | 23): "TFTP Error",
- (0x8000000000000000 | 24): "Protocol Error",
-
- 0 : "Success",
- 1 : "Warning Unknown Glyph",
- 2 : "Warning Delete Failure",
- 3 : "Warning Write Failure",
- 4 : "Warning Buffer Too Small",
-
- (0x80000000 | 1): "Load Error",
- (0x80000000 | 2): "Invalid Parameter",
- (0x80000000 | 3): "Unsupported",
- (0x80000000 | 4): "Bad Buffer Size",
- (0x80000000 | 5): "Buffer Too Small",
- (0x80000000 | 6): "Not Ready",
- (0x80000000 | 7): "Device Error",
- (0x80000000 | 8): "Write Protected",
- (0x80000000 | 9): "Out of Resources",
- (0x80000000 | 10): "Volume Corrupt",
- (0x80000000 | 11): "Volume Full",
- (0x80000000 | 12): "No Media",
- (0x80000000 | 13): "Media changed",
- (0x80000000 | 14): "Not Found",
- (0x80000000 | 15): "Access Denied",
- (0x80000000 | 16): "No Response",
- (0x80000000 | 17): "No mapping",
- (0x80000000 | 18): "Time out",
- (0x80000000 | 19): "Not started",
- (0x80000000 | 20): "Already started",
- (0x80000000 | 21): "Aborted",
- (0x80000000 | 22): "ICMP Error",
- (0x80000000 | 23): "TFTP Error",
- (0x80000000 | 24): "Protocol Error",
-}
-
-def EFI_STATUS_TypeSummary (valobj,internal_dict):
- #
- # Return summary string for EFI_STATUS from dictionary
- #
- Status = valobj.GetValueAsUnsigned(0)
- return EFI_STATUS_Dict.get (Status, '')
-
-
-def EFI_TPL_TypeSummary (valobj,internal_dict):
- #
- # Return TPL values
- #
-
- if valobj.TypeIsPointerType():
- return ""
-
- Tpl = valobj.GetValueAsUnsigned(0)
- if Tpl < 4:
- Str = "%d" % Tpl
- elif Tpl == 6:
- Str = "TPL_DRIVER (Obsolete Concept in edk2)"
- elif Tpl < 8:
- Str = "TPL_APPLICATION"
- if Tpl - 4 > 0:
- Str += " + " + "%d" % (Tpl - 4)
- elif Tpl < 16:
- Str = "TPL_CALLBACK"
- if Tpl - 8 > 0:
- Str += " + " + "%d" % (Tpl - 4)
- elif Tpl < 31:
- Str = "TPL_NOTIFY"
- if Tpl - 16 > 0:
- Str += " + " + "%d" % (Tpl - 4)
- elif Tpl == 31:
- Str = "TPL_HIGH_LEVEL"
- else:
- Str = "Invalid TPL"
-
- return Str
-
-
-def CHAR16_TypeSummary (valobj,internal_dict):
- #
- # Display EFI CHAR16 'unsigned short' as string
- #
- SBError = lldb.SBError()
- Str = ''
- if valobj.TypeIsPointerType():
- if valobj.GetValueAsUnsigned () == 0:
- return "NULL"
-
- # CHAR16 * max string size 1024
- for i in range (1024):
- Char = valobj.GetPointeeData(i,1).GetUnsignedInt16(SBError, 0)
- if SBError.fail or Char == 0:
- break
- Str += unichr (Char)
- Str = 'L"' + Str + '"'
- return Str.encode ('utf-8', 'replace')
-
- if valobj.num_children == 0:
- # CHAR16
- if chr (valobj.unsigned) in string.printable:
- Str = "L'" + unichr (valobj.unsigned) + "'"
- return Str.encode ('utf-8', 'replace')
- else:
- # CHAR16 []
- for i in range (valobj.num_children):
- Char = valobj.GetChildAtIndex(i).data.GetUnsignedInt16(SBError, 0)
- if Char == 0:
- break
- Str += unichr (Char)
- Str = 'L"' + Str + '"'
- return Str.encode ('utf-8', 'replace')
-
- return Str
-
-def CHAR8_TypeSummary (valobj,internal_dict):
- #
- # Display EFI CHAR8 'signed char' as string
- # unichr() is used as a junk string can produce an error message like this:
- # UnicodeEncodeError: 'ascii' codec can't encode character u'\x90' in position 1: ordinal not in range(128)
- #
- SBError = lldb.SBError()
- Str = ''
- if valobj.TypeIsPointerType():
- if valobj.GetValueAsUnsigned () == 0:
- return "NULL"
-
- # CHAR8 * max string size 1024
- for i in range (1024):
- Char = valobj.GetPointeeData(i,1).GetUnsignedInt8(SBError, 0)
- if SBError.fail or Char == 0:
- break
- Str += unichr (Char)
- Str = '"' + Str + '"'
- return Str.encode ('utf-8', 'replace')
-
- if valobj.num_children == 0:
- # CHAR8
- if chr (valobj.unsigned) in string.printable:
- Str = '"' + unichr (valobj.unsigned) + '"'
- return Str.encode ('utf-8', 'replace')
- else:
- # CHAR8 []
- for i in range (valobj.num_children):
- Char = valobj.GetChildAtIndex(i).data.GetUnsignedInt8(SBError, 0)
- if Char == 0:
- break
- Str += unichr (Char)
- Str = '"' + Str + '"'
- return Str.encode ('utf-8', 'replace')
-
- return Str
-
-device_path_dict = {
- (0x01, 0x01): "PCI_DEVICE_PATH",
- (0x01, 0x02): "PCCARD_DEVICE_PATH",
- (0x01, 0x03): "MEMMAP_DEVICE_PATH",
- (0x01, 0x04): "VENDOR_DEVICE_PATH",
- (0x01, 0x05): "CONTROLLER_DEVICE_PATH",
- (0x02, 0x01): "ACPI_HID_DEVICE_PATH",
- (0x02, 0x02): "ACPI_EXTENDED_HID_DEVICE_PATH",
- (0x02, 0x03): "ACPI_ADR_DEVICE_PATH",
- (0x03, 0x01): "ATAPI_DEVICE_PATH",
- (0x03, 0x12): "SATA_DEVICE_PATH",
- (0x03, 0x02): "SCSI_DEVICE_PATH",
- (0x03, 0x03): "FIBRECHANNEL_DEVICE_PATH",
- (0x03, 0x04): "F1394_DEVICE_PATH",
- (0x03, 0x05): "USB_DEVICE_PATH",
- (0x03, 0x0f): "USB_CLASS_DEVICE_PATH",
- (0x03, 0x10): "FW_SBP2_UNIT_LUN_DEVICE_PATH",
- (0x03, 0x11): "DEVICE_LOGICAL_UNIT_DEVICE_PATH",
- (0x03, 0x06): "I2O_DEVICE_PATH",
- (0x03, 0x0b): "MAC_ADDR_DEVICE_PATH",
- (0x03, 0x0c): "IPv4_DEVICE_PATH",
- (0x03, 0x09): "INFINIBAND_DEVICE_PATH",
- (0x03, 0x0e): "UART_DEVICE_PATH",
- (0x03, 0x0a): "VENDOR_DEVICE_PATH",
- (0x03, 0x13): "ISCSI_DEVICE_PATH",
- (0x04, 0x01): "HARDDRIVE_DEVICE_PATH",
- (0x04, 0x02): "CDROM_DEVICE_PATH",
- (0x04, 0x03): "VENDOR_DEVICE_PATH",
- (0x04, 0x04): "FILEPATH_DEVICE_PATH",
- (0x04, 0x05): "MEDIA_PROTOCOL_DEVICE_PATH",
- (0x05, 0x01): "BBS_BBS_DEVICE_PATH",
- (0x7F, 0xFF): "EFI_DEVICE_PATH_PROTOCOL",
- (0xFF, 0xFF): "EFI_DEVICE_PATH_PROTOCOL",
-}
-
-def EFI_DEVICE_PATH_PROTOCOL_TypeSummary (valobj,internal_dict):
- #
- #
- #
- if valobj.TypeIsPointerType():
- # EFI_DEVICE_PATH_PROTOCOL *
- return ""
-
- Str = ""
- if valobj.num_children == 3:
- # EFI_DEVICE_PATH_PROTOCOL
- Type = valobj.GetChildMemberWithName('Type').unsigned
- SubType = valobj.GetChildMemberWithName('SubType').unsigned
- if (Type, SubType) in device_path_dict:
- TypeStr = device_path_dict[Type, SubType]
- else:
- TypeStr = ""
-
- LenLow = valobj.GetChildMemberWithName('Length').GetChildAtIndex(0).unsigned
- LenHigh = valobj.GetChildMemberWithName('Length').GetChildAtIndex(1).unsigned
- Len = LenLow + (LenHigh >> 8)
-
- Address = long ("%d" % valobj.addr)
- if (Address == lldb.LLDB_INVALID_ADDRESS):
- # Need to reserach this, it seems to be the nested struct case
- ExprStr = ""
- elif (Type & 0x7f == 0x7f):
- ExprStr = "End Device Path" if SubType == 0xff else "End This Instance"
- else:
- ExprStr = "expr *(%s *)0x%08x" % (TypeStr, Address)
-
- Str = " {\n"
- Str += " (UINT8) Type = 0x%02x // %s\n" % (Type, "END" if (Type & 0x7f == 0x7f) else "")
- Str += " (UINT8) SubType = 0x%02x // %s\n" % (SubType, ExprStr)
- Str += " (UINT8 [2]) Length = { // 0x%04x (%d) bytes\n" % (Len, Len)
- Str += " (UINT8) [0] = 0x%02x\n" % LenLow
- Str += " (UINT8) [1] = 0x%02x\n" % LenHigh
- Str += " }\n"
- if (Type & 0x7f == 0x7f) and (SubType == 0xff):
- pass
- elif ExprStr != "":
- NextNode = Address + Len
- Str += "// Next node 'expr *(EFI_DEVICE_PATH_PROTOCOL *)0x%08x'\n" % NextNode
-
- return Str
-
-
-
-def TypePrintFormating(debugger):
- #
- # Set the default print formating for EFI types in lldb.
- # seems lldb defaults to decimal.
- #
- category = debugger.GetDefaultCategory()
- FormatBool = lldb.SBTypeFormat(lldb.eFormatBoolean)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("BOOLEAN"), FormatBool)
-
- FormatHex = lldb.SBTypeFormat(lldb.eFormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("UINT64"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("INT64"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("UINT32"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("INT32"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("UINT16"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("INT16"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("UINT8"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("INT8"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("UINTN"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("INTN"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("CHAR8"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("CHAR16"), FormatHex)
-
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_PHYSICAL_ADDRESS"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("PHYSICAL_ADDRESS"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_STATUS"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_TPL"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_LBA"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_BOOT_MODE"), FormatHex)
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("EFI_FV_FILETYPE"), FormatHex)
-
- #
- # Smart type printing for EFI
- #
- debugger.HandleCommand("type summary add EFI_GUID --python-function lldbefi.EFI_GUID_TypeSummary")
- debugger.HandleCommand("type summary add EFI_STATUS --python-function lldbefi.EFI_STATUS_TypeSummary")
- debugger.HandleCommand("type summary add EFI_TPL --python-function lldbefi.EFI_TPL_TypeSummary")
- debugger.HandleCommand("type summary add EFI_DEVICE_PATH_PROTOCOL --python-function lldbefi.EFI_DEVICE_PATH_PROTOCOL_TypeSummary")
-
- debugger.HandleCommand("type summary add CHAR16 --python-function lldbefi.CHAR16_TypeSummary")
- debugger.HandleCommand('type summary add --regex "CHAR16 \[[0-9]+\]" --python-function lldbefi.CHAR16_TypeSummary')
- debugger.HandleCommand("type summary add CHAR8 --python-function lldbefi.CHAR8_TypeSummary")
- debugger.HandleCommand('type summary add --regex "CHAR8 \[[0-9]+\]" --python-function lldbefi.CHAR8_TypeSummary')
-
-
-gEmulatorBreakWorkaroundNeeded = True
-
-def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict):
- #
- # This is an lldb breakpoint script, and assumes the breakpoint is on a
- # function with the same prototype as SecGdbScriptBreak(). The
- # argument names are important as lldb looks them up.
- #
- # VOID
- # SecGdbScriptBreak (
- # char *FileName,
- # int FileNameLength,
- # long unsigned int LoadAddress,
- # int AddSymbolFlag
- # )
- # {
- # return;
- # }
- #
- # When the emulator loads a PE/COFF image, it calls the stub function with
- # the filename of the symbol file, the length of the FileName, the
- # load address and a flag to indicate if this is a load or unload operation
- #
- global gEmulatorBreakWorkaroundNeeded
-
- if gEmulatorBreakWorkaroundNeeded:
- # turn off lldb debug prints on SIGALRM (EFI timer tick)
- frame.thread.process.target.debugger.HandleCommand("process handle SIGALRM -n false")
- gEmulatorBreakWorkaroundNeeded = False
-
- # Convert C string to Python string
- Error = lldb.SBError()
- FileNamePtr = frame.FindVariable ("FileName").GetValueAsUnsigned()
- FileNameLen = frame.FindVariable ("FileNameLength").GetValueAsUnsigned()
- FileName = frame.thread.process.ReadCStringFromMemory (FileNamePtr, FileNameLen, Error)
- if not Error.Success():
- print "!ReadCStringFromMemory() did not find a %d byte C string at %x" % (FileNameLen, FileNamePtr)
- # make breakpoint command contiue
- frame.GetThread().GetProcess().Continue()
-
- debugger = frame.thread.process.target.debugger
- if frame.FindVariable ("AddSymbolFlag").GetValueAsUnsigned() == 1:
- LoadAddress = frame.FindVariable ("LoadAddress").GetValueAsUnsigned()
-
- debugger.HandleCommand ("target modules add %s" % FileName)
- print "target modules load --slid 0x%x %s" % (LoadAddress, FileName)
- debugger.HandleCommand ("target modules load --slide 0x%x --file %s" % (LoadAddress, FileName))
- else:
- target = debugger.GetSelectedTarget()
- for SBModule in target.module_iter():
- ModuleName = SBModule.GetFileSpec().GetDirectory() + '/'
- ModuleName += SBModule.GetFileSpec().GetFilename()
- if FileName == ModuleName or FileName == SBModule.GetFileSpec().GetFilename():
- target.ClearModuleLoadAddress (SBModule)
- if not target.RemoveModule (SBModule):
- print "!lldb.target.RemoveModule (%s) FAILED" % SBModule
-
- # make breakpoint command contiue
- frame.thread.process.Continue()
-
-def GuidToCStructStr (guid, Name=False):
- #
- # Convert a 16-byte bytesarry (or bytearray compat object) to C guid string
- # { 0xB402621F, 0xA940, 0x1E4A, { 0x86, 0x6B, 0x4D, 0xC9, 0x16, 0x2B, 0x34, 0x7C } }
- #
- # Name=True means lookup name in GuidNameDict and us it if you find it
- #
-
- if not isinstance (guid, bytearray):
- # convert guid object to UUID, and UUID to bytearray
- Uuid = uuid.UUID(guid)
- guid = bytearray (Uuid.bytes_le)
-
- return "{ 0x%02.2X%02.2X%02.2X%02.2X, 0x%02.2X%02.2X, 0x%02.2X%02.2X, { 0x%02.2X, 0x%02.2X, 0x%02.2X, 0x%02.2X, 0x%02.2X, 0x%02.2X, 0x%02.2X, 0x%02.2X } }" % \
- (guid[3], guid[2], guid[1], guid[0], guid[5], guid[4], guid[7], guid[6], guid[8], guid[9], guid[10], guid[11], guid[12], guid[13], guid[14], guid[15])
-
-def ParseGuidString(GuidStr):
- #
- # Error check and convert C Guid init to string
- # ParseGuidString("49152E77-1ADA-4764-B7A2-7AFEFED95E8B")
- # ParseGuidString("{ 0xBA24B391, 0x73FD, 0xC54C, { 0x9E, 0xAF, 0x0C, 0xA7, 0x8A, 0x35, 0x46, 0xD1 } }")
- #
-
- if "{" in GuidStr :
- # convert C form "{ 0xBA24B391, 0x73FD, 0xC54C, { 0x9E, 0xAF, 0x0C, 0xA7, 0x8A, 0x35, 0x46, 0xD1 } }"
- # to string form BA24B391-73FD-C54C-9EAF-0CA78A3546D1
- # make a list of Hex numbers like: ['0xBA24B391', '0x73FD', '0xC54C', '0x9E', '0xAF', '0x0C', '0xA7', '0x8A', '0x35', '0x46', '0xD1']
- Hex = ''.join(x for x in GuidStr if x not in '{,}').split()
- Str = "%08X-%04X-%04X-%02.2X%02.2X-%02.2X%02.2X%02.2X%02.2X%02.2X%02.2X" % \
- (int(Hex[0], 0), int(Hex[1], 0), int(Hex[2], 0), int(Hex[3], 0), int(Hex[4], 0), \
- int(Hex[5], 0), int(Hex[6], 0), int(Hex[7], 0), int(Hex[8], 0), int(Hex[9], 0), int(Hex[10], 0))
- elif GuidStr.count('-') == 4:
- # validate "49152E77-1ADA-4764-B7A2-7AFEFED95E8B" form
- Check = "%s" % str(uuid.UUID(GuidStr)).upper()
- if GuidStr.upper() == Check:
- Str = GuidStr.upper()
- else:
- Ste = ""
- else:
- Str = ""
-
- return Str
-
-
-def create_guid_options():
- usage = "usage: %prog [data]"
- description='''lookup EFI_GUID by CName, C struct, or GUID string and print out all three.
- '''
- parser = optparse.OptionParser(description=description, prog='guid',usage=usage)
- return parser
-
-def efi_guid_command(debugger, command, result, dict):
- # Use the Shell Lexer to properly parse up command options just like a
- # shell would
- command_args = shlex.split(command)
- parser = create_guid_options()
- try:
- (options, args) = parser.parse_args(command_args)
- if len(args) >= 1:
- if args[0] == "{":
- # caller forgot to quote the string"
- # mark arg[0] a string containing all args[n]
- args[0] = ' '.join(args)
- GuidStr = ParseGuidString (args[0])
- if GuidStr == "":
- # return Key of GuidNameDict for value args[0]
- GuidStr = [Key for Key, Value in guid_dict.iteritems() if Value == args[0]][0]
- GuidStr = GuidStr.upper()
- except:
- # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
- # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
- result.SetError ("option parsing failed")
- return
-
-
- if len(args) >= 1:
- if GuidStr in guid_dict:
- print "%s = %s" % (guid_dict[GuidStr], GuidStr)
- print "%s = %s" % (guid_dict[GuidStr], GuidToCStructStr (GuidStr))
- else:
- print GuidStr
- else:
- # dump entire dictionary
- width = max(len(v) for k,v in guid_dict.iteritems())
- for value in sorted(guid_dict, key=guid_dict.get):
- print '%-*s %s %s' % (width, guid_dict[value], value, GuidToCStructStr(value))
-
- return
-
-
-#
-########## Code that runs when this script is imported into LLDB ###########
-#
-def __lldb_init_module (debugger, internal_dict):
- # This initializer is being run from LLDB in the embedded command interpreter
- # Make the options so we can generate the help text for the new LLDB
- # command line command prior to registering it with LLDB below
-
- global guid_dict
-
- # Source Guid.xref file if we can find it
- inputfile = os.getcwd()
- inputfile += os.sep + os.pardir + os.sep + 'FV' + os.sep + 'Guid.xref'
- with open(inputfile) as f:
- for line in f:
- data = line.split(' ')
- if len(data) >= 2:
- guid_dict[data[0].upper()] = data[1].strip('\n')
-
- # init EFI specific type formaters
- TypePrintFormating (debugger)
-
-
- # add guid command
- parser = create_guid_options()
- efi_guid_command.__doc__ = parser.format_help()
- debugger.HandleCommand('command script add -f lldbefi.efi_guid_command guid')
-
-
- Target = debugger.GetTargetAtIndex(0)
- if Target:
- Breakpoint = Target.BreakpointCreateByName('SecGdbScriptBreak')
- if Breakpoint.GetNumLocations() == 1:
- # Set the emulator breakpoints, if we are in the emulator
- debugger.HandleCommand("breakpoint command add -s python -F lldbefi.LoadEmulatorEfiSymbols {id}".format(id=Breakpoint.GetID()))
- print 'Type r to run emulator. SecLldbScriptBreak armed. EFI modules should now get source level debugging in the emulator.'
diff --git a/EmulatorPkg/Unix/lldbinit b/EmulatorPkg/Unix/lldbinit
deleted file mode 100644
index 16b34e362b..0000000000
--- a/EmulatorPkg/Unix/lldbinit
+++ /dev/null
@@ -1,3 +0,0 @@
-setting set frame-format "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{:${function.name}()${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}\n"
-command script import lldbefi.py
-run
diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
deleted file mode 100755
index 5b3992cedf..0000000000
--- a/EmulatorPkg/build.sh
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2010 - 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.
-#
-
-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
-
-#
-# Configure defaults for various options
-#
-
-PROCESSOR=
-BUILDTARGET=DEBUG
-BUILD_OPTIONS=
-PLATFORMFILE=
-LAST_ARG=
-RUN_EMULATOR=no
-CLEAN_TYPE=none
-TARGET_TOOLS=GCC44
-NETWORK_SUPPORT=
-BUILD_NEW_SHELL=
-BUILD_FAT=
-HOST_PROCESSOR=X64
-
-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
- CLANG_VER=$(clang -ccc-host-triple x86_64-pc-win32-macho 2>&1 >/dev/null) || true
- if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
- then
- # only older versions of Xcode support -ccc-host-tripe, for newer versions
- # it is -target
- HOST_TOOLS=XCODE32
- TARGET_TOOLS=XCODE5
- else
- HOST_TOOLS=XCODE32
- TARGET_TOOLS=XCLANG
- fi
- fi
- BUILD_NEW_SHELL="-D BUILD_NEW_SHELL"
- BUILD_FAT="-D BUILD_FAT"
- ;;
- Linux*)
- case `uname -m` in
- i386)
- HOST_PROCESSOR=IA32
- ;;
- i686)
- HOST_PROCESSOR=IA32
- ;;
- x86_64)
- HOST_PROCESSOR=X64
- ;;
- esac
-
- gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
- case $gcc_version in
- 4.5.*)
- TARGET_TOOLS=GCC45
- ;;
- 4.6.*)
- TARGET_TOOLS=GCC46
- ;;
- 4.7.*)
- TARGET_TOOLS=GCC47
- ;;
- 4.8.*)
- TARGET_TOOLS=GCC48
- ;;
- 4.9.*|4.1[0-9].*)
- TARGET_TOOLS=GCC49
- ;;
- *)
- TARGET_TOOLS=GCC44
- ;;
- esac
- ;;
-esac
-
-#
-# Scan command line to override defaults
-#
-
-for arg in "$@"
-do
- if [ -z "$LAST_ARG" ]; then
- case $arg in
- -a|-b|-t|-p)
- LAST_ARG=$arg
- ;;
- run)
- RUN_EMULATOR=yes
- shift
- break
- ;;
- clean|cleanall)
- CLEAN_TYPE=$arg
- shift
- break
- ;;
- *)
- BUILD_OPTIONS="$BUILD_OPTIONS $arg"
- ;;
- esac
- else
- case $LAST_ARG in
- -a)
- PROCESSOR=$arg
- ;;
- -b)
- BUILDTARGET=$arg
- ;;
- -p)
- PLATFORMFILE=$arg
- ;;
- -t)
- HOST_TOOLS=$arg
- ;;
- *)
- BUILD_OPTIONS="$BUILD_OPTIONS $arg"
- ;;
- esac
- LAST_ARG=
- fi
- shift
-done
-if [ -z "$HOST_TOOLS" ]
-then
- HOST_TOOLS=$TARGET_TOOLS
-fi
-
-if [ -z "$PROCESSOR" ]
-then
- PROCESSOR=$HOST_PROCESSOR
-fi
-
-case $PROCESSOR in
- IA32)
- ARCH_SIZE=32
- BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator32
- LIB_NAMES="ld-linux.so.2 libdl.so.2 crt1.o crti.o crtn.o"
- LIB_SEARCH_PATHS="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 /usr/lib /lib"
- ;;
- X64)
- ARCH_SIZE=64
- BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator
- LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
- LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/lib /lib"
- ;;
-esac
-
-for libname in $LIB_NAMES
-do
- for dirname in $LIB_SEARCH_PATHS
- do
- if [ -e $dirname/$libname ]; then
- export HOST_DLINK_PATHS="$HOST_DLINK_PATHS $dirname/$libname"
- break
- fi
- done
-done
-
-PLATFORMFILE=$WORKSPACE/EmulatorPkg/EmulatorPkg.dsc
-BUILD_DIR=$BUILD_OUTPUT_DIR/DEBUG_"$TARGET_TOOLS"
-BUILD_ROOT_ARCH=$BUILD_DIR/$PROCESSOR
-
-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
-
-
-if [[ "$RUN_EMULATOR" == "yes" ]]; 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 Host
- #
- if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
- then
- # only older versions of Xcode support -ccc-host-tripe, for newer versions
- # it is -target
- cp $WORKSPACE/EmulatorPkg/Unix/lldbefi.py $BUILD_OUTPUT_DIR/DEBUG_"$TARGET_TOOLS"/$PROCESSOR
- cd $BUILD_ROOT_ARCH; /usr/bin/lldb --source $WORKSPACE/EmulatorPkg/Unix/lldbinit Host
- exit $?
- else
- cp $WORKSPACE/EmulatorPkg/Unix/.gdbinit $BUILD_OUTPUT_DIR/DEBUG_"$TARGET_TOOLS"/$PROCESSOR
- fi
- ;;
- esac
-
- /usr/bin/gdb $BUILD_ROOT_ARCH/Host -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg/Unix/GdbRun
- exit
-fi
-
-case $CLEAN_TYPE in
- clean)
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD -n 3 clean
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
- exit $?
- ;;
- cleanall)
- make -C $WORKSPACE/BaseTools clean
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD -n 3 clean
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
- build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a IA32 -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
- exit $?
- ;;
-esac
-
-
-#
-# Build the edk2 EmulatorPkg
-#
-if [[ $HOST_TOOLS == $TARGET_TOOLS ]]; then
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_$ARCH_SIZE -D UNIX_SEC_BUILD $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3
-else
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D BUILD_$ARCH_SIZE -D UNIX_SEC_BUILD -D SKIP_MAIN_BUILD -n 3 modules
- build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_$ARCH_SIZE $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3
- cp $BUILD_OUTPUT_DIR/DEBUG_"$HOST_TOOLS"/$PROCESSOR/Host $BUILD_ROOT_ARCH
-fi
-exit $?
-