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

Yao, Jiewen

EfiSmmSwDispatch2Protocol is produced by a PchChildDispatch module on a real machine.

There is no such protocol in OVMF environment, because it is emulated.

I recommend you use gSmst->MmiHandlerRegister() to register your SMI handler.

Thank you
Yao Jiewen

-----Original Message-----
From: <> On Behalf Of Simon
Sent: Tuesday, September 29, 2020 8:33 PM
Subject: [edk2-discuss] SmmSwDispatch2Protocol - Registering an SMI - Can't
find protocol with OVMF


Trying to register a SMI in my custom SMM module I'm running into issues.

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

Unfortunately, while starting OVMF, boot hangs and the following message
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

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:


OVMF is built with the following options:

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 to automatically receive all group messages.