]> git.proxmox.com Git - mirror_edk2.git/commit
StandaloneMmPkg/Core: stop abusing EFI_HANDLE for FwVolHeader tracking
authorLaszlo Ersek <lersek@redhat.com>
Tue, 17 Sep 2019 14:59:09 +0000 (16:59 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 9 Oct 2019 07:40:10 +0000 (09:40 +0200)
commit7f72ec0b15fdc30899452279c988bf5dfb311951
treed04882f3da40c33fcf60b28b827a1d425c485c1c
parent7eb6160d4fdff25ca623a4006e6f93e5e81038bf
StandaloneMmPkg/Core: stop abusing EFI_HANDLE for FwVolHeader tracking

The FvHasBeenProcessed() and FvIsBeingProcesssed() functions make sure
that every firmware volume is processed only once (every driver in every
firmware volume should be discovered only once). For this, the functions
use a linked list.

In MdeModulePkg's DXE Core and SMM Core, the key used for identifying
those firmware volumes that have been processed is the EFI_HANDLE on which
the DXE or SMM firmware volume protocol is installed. In the
StandaloneMmPkg core however, the key is the address of the firmware
volume header; that is, it has type (EFI_FIRMWARE_VOLUME_HEADER*).

(EFI_FIRMWARE_VOLUME_HEADER*) has nothing to do with EFI_HANDLE.
EFI_HANDLE just happens to be specified as (VOID*), and therefore the
conversion between (EFI_FIRMWARE_VOLUME_HEADER*) and EFI_HANDLE is silent.

(The FvHasBeenProcessed() and FvIsBeingProcesssed() functions were likely
copied verbatim from MdeModulePkg's DXE Core and/or the SMM Core, and not
flagged by the compiler in StandaloneMmPkg due to UEFI regrettably
specifying EFI_HANDLE as (VOID*), thereby enabling the above implicit
conversion.)

We should not exploit this circumstance. Represent the key type faithfully
instead.

This is a semantic fix; there is no change in operation.

Cc: Achin Gupta <achin.gupta@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
StandaloneMmPkg/Core/Dispatcher.c
StandaloneMmPkg/Core/FwVol.c
StandaloneMmPkg/Core/StandaloneMmCore.h