3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/DebugLib.h>
12 #include <Library/HobLib.h>
13 #include <Library/EmuThunkLib.h>
14 #include <Library/BaseMemoryLib.h>
16 EMU_THUNK_PROTOCOL
*gEmuThunk
= NULL
;
20 The constructor function caches the pointer of EMU Thunk protocol.
22 @param ImageHandle The firmware allocated handle for the EFI image.
23 @param SystemTable A pointer to the EFI System Table.
25 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
30 DxeEmuLibConstructor (
31 IN EFI_HANDLE ImageHandle
,
32 IN EFI_SYSTEM_TABLE
*SystemTable
35 EFI_HOB_GUID_TYPE
*GuidHob
;
37 GuidHob
= GetFirstGuidHob (&gEmuThunkProtocolGuid
);
38 ASSERT (GuidHob
!= NULL
);
40 gEmuThunk
= (EMU_THUNK_PROTOCOL
*)(*(UINTN
*)(GET_GUID_HOB_DATA (GuidHob
)));
41 ASSERT (gEmuThunk
!= NULL
);
48 Serach the EMU IO Thunk database for a matching EMU IO Thunk
51 @param Protocol Protocol to search for.
52 @param Instance Instance of protocol to search for.
54 @retval NULL Protocol and Instance not found.
55 @retval other EMU IO Thunk protocol that matched.
58 EMU_IO_THUNK_PROTOCOL
*
61 IN EFI_GUID
*Protocol
,
66 EMU_IO_THUNK_PROTOCOL
*EmuIoThunk
;
68 for (Status
= EFI_SUCCESS
, EmuIoThunk
= NULL
; !EFI_ERROR (Status
); ) {
69 Status
= gEmuThunk
->GetNextProtocol (FALSE
, &EmuIoThunk
);
70 if (EFI_ERROR (Status
)) {
74 if (EmuIoThunk
->Instance
== Instance
) {
75 if (CompareGuid (EmuIoThunk
->Protocol
, Protocol
)) {