ArmPkg/ArmSmcPsciResetSystemLib: add missing call to ExitBootServices()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 20 Nov 2018 01:53:13 +0000 (17:53 -0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 21 Nov 2018 11:02:34 +0000 (12:02 +0100)
commit6556224e1f262d1d3d3aecab6e86b14edefe95b7
treebee6da6a54da3284bbf32f5ab658850542a27857
parent8611bf99e05faa22c252e1a9db675faee5e6da3d
ArmPkg/ArmSmcPsciResetSystemLib: add missing call to ExitBootServices()

Our poor man's implementation of EnterS3WithImmediateWake () currently
sets a high TPL level to disable interrupts, and simply calls the
PEI entrypoint again after disabling the MMU.

Unfortunately, this is not sufficient: DMA capable devices such as
network controllers or USB controllers may still be enabled and
writing to memory, e.g., in response to incoming network packets.

So instead, do the full ExitBootServices() dance: allocate space and
get the memory map, call ExitBootServices(), and in case it fails, get
the memory map again and call ExitBootServices() again. This ensures
that all cleanup related to DMA capable devices is performed before
doing the warm reset.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmSmcPsciResetSystemLib/AArch64/Reset.S [new file with mode: 0644]
ArmPkg/Library/ArmSmcPsciResetSystemLib/AArch64/Reset.asm [new file with mode: 0644]
ArmPkg/Library/ArmSmcPsciResetSystemLib/Arm/Reset.S [new file with mode: 0644]
ArmPkg/Library/ArmSmcPsciResetSystemLib/Arm/Reset.asm [new file with mode: 0644]
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf