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


Yao, Jiewen
 

Hey
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: discuss@edk2.groups.io <discuss@edk2.groups.io> On Behalf Of Simon
McMillan
Sent: Tuesday, September 29, 2020 8:33 PM
To: discuss@edk2.groups.io
Subject: [edk2-discuss] SmmSwDispatch2Protocol - Registering an SMI - Can't
find protocol with OVMF

Hi,

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(
&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.