diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-28 16:47:23 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-28 16:47:23 +0000 |
commit | bb89ec1a7ec2f8d35033df9e47b3604925da3bd3 (patch) | |
tree | 32d38e02ccab98dbac4c3014a12ac365775e8eb3 /EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c | |
parent | d3e0289ccf641481f2cbdcbb0d5868c393b7edbb (diff) | |
download | edk2-bb89ec1a7ec2f8d35033df9e47b3604925da3bd3.tar.gz edk2-bb89ec1a7ec2f8d35033df9e47b3604925da3bd3.tar.bz2 edk2-bb89ec1a7ec2f8d35033df9e47b3604925da3bd3.zip |
InOsEmuPkg: Rename package to EmulatorPkg & Sec to Host
* Rename InOsEmuPkg to EmulatorPkg
* Rename Unix/Sec to Unix/Host
Signed-off-by: jljusten
Reviewed-by: andrewfish
Reviewed-by: geekboy15a
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11918 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c')
-rw-r--r-- | EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c b/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c new file mode 100644 index 0000000000..2e42ea6151 --- /dev/null +++ b/EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.c @@ -0,0 +1,88 @@ +/*++ @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 |