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>
This commit is contained in:
Star Zeng 2017-06-27 09:34:13 +08:00
parent 061ead7a2d
commit fd220166c4

View File

@ -1006,8 +1006,12 @@ CoreOpenProtocol (
// //
// Check for invalid Interface // Check for invalid Interface
// //
if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) { if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
if (Interface == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} else {
*Interface = NULL;
}
} }
// //
@ -1071,13 +1075,15 @@ CoreOpenProtocol (
Prot = CoreGetProtocolInterface (UserHandle, Protocol); Prot = CoreGetProtocolInterface (UserHandle, Protocol);
if (Prot == NULL) { if (Prot == NULL) {
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL){
//Return NULL Interface if Unsupported Protocol
*Interface = NULL;
}
goto Done; goto Done;
} }
//
// This is the protocol interface entry for this protocol
//
if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
*Interface = Prot->Interface;
}
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
ByDriver = FALSE; ByDriver = FALSE;
@ -1171,14 +1177,6 @@ CoreOpenProtocol (
} }
Done: 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 // Done. Release the database lock are return
// //