This causes the device to forget about the reply frame. We allocated the reply frame in EfiBootServicesData type memory, and code executing after ExitBootServices() is permitted to overwrite it.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390 Signed-off-by: Nikita Leshenko <nikita.leshche...@oracle.com> --- OvmfPkg/MptScsiDxe/MptScsi.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 3ea08857df5d..e632b076fc4a 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -45,6 +45,7 @@ typedef struct { EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; EFI_PCI_IO_PROTOCOL *PciIo; UINT64 OriginalPciAttributes; + EFI_EVENT ExitBoot; UINT32 StallPerPollUsec; UINT8 MaxTarget; MPT_SCSI_DMA_BUFFER *Dma; @@ -696,6 +697,19 @@ MptScsiResetChannel ( return EFI_UNSUPPORTED; } +STATIC +VOID +EFIAPI +MptScsiExitBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + MPT_SCSI_DEV *Dev; + + Dev = Context; + MptScsiReset (Dev); +} STATIC EFI_STATUS EFIAPI @@ -861,6 +875,17 @@ MptScsiControllerStart ( goto Unmap; } + Status = gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_CALLBACK, + &MptScsiExitBoot, + Dev, + &Dev->ExitBoot + ); + if (EFI_ERROR (Status)) { + goto UninitDev; + } + // // Host adapter channel, doesn't exist // @@ -885,11 +910,14 @@ MptScsiControllerStart ( &Dev->PassThru ); if (EFI_ERROR (Status)) { - goto UninitDev; + goto CloseExitBoot; } return EFI_SUCCESS; +CloseExitBoot: + gBS->CloseEvent (Dev->ExitBoot); + UninitDev: MptScsiReset (Dev); @@ -964,6 +992,8 @@ MptScsiControllerStop ( return Status; } + gBS->CloseEvent (Dev->ExitBoot); + MptScsiReset (Dev); Dev->PciIo->Unmap ( -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57372): https://edk2.groups.io/g/devel/message/57372 Mute This Topic: https://groups.io/mt/73015395/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-