From fd220166c435479a81dfe8519c92abec9acf7d82 Mon Sep 17 00:00:00 2001 From: Star Zeng <star.zeng@intel.com> Date: Tue, 27 Jun 2017 09:34:13 +0800 Subject: [PATCH] Revert "MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol" This reverts commit 45cfcd8dccf84b8abbc1d6f587fedb5d2037ec79 since it is breaking OVMF platform and also real platforms. REF: https://www.mail-archive.com/edk2-devel@lists.01.org/msg26882.html https://www.mail-archive.com/edk2-devel@lists.01.org/msg26820.html Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index fe58b6c583..59b89148c8 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1006,8 +1006,12 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { - return EFI_INVALID_PARAMETER; + if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { + if (Interface == NULL) { + return EFI_INVALID_PARAMETER; + } else { + *Interface = NULL; + } } // @@ -1071,13 +1075,15 @@ CoreOpenProtocol ( Prot = CoreGetProtocolInterface (UserHandle, Protocol); if (Prot == NULL) { Status = EFI_UNSUPPORTED; - if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL){ - //Return NULL Interface if Unsupported Protocol - *Interface = NULL; - } goto Done; } + // + // This is the protocol interface entry for this protocol + // + if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { + *Interface = Prot->Interface; + } Status = EFI_SUCCESS; ByDriver = FALSE; @@ -1171,14 +1177,6 @@ CoreOpenProtocol ( } Done: - - // - // This is the protocol interface entry for this protocol. - // In case of any Error, Interface should not be updated as per spec. - // - if (!EFI_ERROR (Status) && (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) { - *Interface = Prot->Interface; - } // // Done. Release the database lock are return //