diff options
Diffstat (limited to 'InOsEmuPkg/Library')
-rw-r--r-- | InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c | 42 | ||||
-rw-r--r-- | InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf | 1 |
2 files changed, 40 insertions, 3 deletions
diff --git a/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c b/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c index 79e9fbc1ee..2e42ea6151 100644 --- a/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c +++ b/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c @@ -17,9 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/EmuThunkLib.h>
-
-#include <Protocol/EmuThunk.h>
-
+#include <Library/BaseMemoryLib.h>
EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
@@ -50,3 +48,41 @@ DxeEmuLibConstructor ( 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/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf b/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf index de395d6272..0f7f0ddeca 100644 --- a/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf +++ b/InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf @@ -38,6 +38,7 @@ [LibraryClasses]
HobLib
DebugLib
+ BaseMemoryLib
[Protocols]
|