SmmSwDispatch2Protocol - Registering an SMI - Can't find protocol with OVMF


smcmillan000@...
 

Hi,

Trying to register a SMI in my custom SMM module here, and I'm running into an issue.

Before registering the SMI, the code looks for the specific protocol this way:
Status = gSmst->SmmLocateProtocol(
&gEfiSmmSwDispatch2ProtocolGuid,
NULL,
(VOID**)&SwDispatch
);
DEBUG ( (EFI_D_INFO, "SmmSwDispatch2Protocol Status: 0x%x\n", Status) );
ASSERT_EFI_ERROR(Status);

Unfortunately, while starting OVMF, boot hangs and the following message appears:
SmmSwDispatch2Protocol Status: 0xE
ASSERT_EFI_ERROR (Status = Not Found)

Adding gEfiSmmSwDispatch2ProtocolGuid to the Depex section of my INF file doesn't solve the issue, in fact it prevents the custom code from being loaded at all.

For info in OVMF, I simply added a reference to the inf file in the DSC file, so that my custom code is built along OVMF:

custom_code/custom_code.inf

OVMF is built with the following options:
build -DSMM_REQUIRE

Then the SMM module is converted to the right format and injected manually with UEFITool.

Would anyone be of help with this situation? Or could give me an advice of what would be wrong or missing?

Join discuss@edk2.groups.io to automatically receive all group messages.