On 07/08/20 10:10, Guomin Jiang wrote:
> From: Michael Kubacki <michael.a.kuba...@intel.com>
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1614
> 
> Adds a PEIM that republishes structures produced in SEC. This
> is done because SEC modules may not be shadowed in some platforms
> due to space constraints or special alignment requirements. The
> SecMigrationPei module locates interfaces that may be published in
> SEC and reinstalls the interface with permanent memory addresses.
> 
> This is important if pre-memory address access is forbidden after
> memory initialization and data such as a PPI descriptor, PPI GUID,
> or PPI inteface reside in pre-memory.

[...]

> +EFI_STATUS
> +EFIAPI
> +SecMigrationPeiInitialize (
> +  IN EFI_PEI_FILE_HANDLE     FileHandle,
> +  IN CONST EFI_PEI_SERVICES  **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status = EFI_SUCCESS;
> +
> +  if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
> +    Status = PeiServicesInstallPpi (&mEdkiiRepublishSecPpiDescriptor);
> +    ASSERT_EFI_ERROR (Status);
> +  }
> +
> +  return Status;
> +}

Thank you for squashing the PCD check into the patch that introduces the
PEIM.

I have two superficial comments:

(a) In the edk2 coding style, we don't initialize local variables
(meaning "initialization" in the strict C language sense). That is,

  EFI_STATUS  Status = EFI_whatever;

should be replaced with

  EFI_STATUS Status;

  Status = EFI_whatever;

(b) If the PCD is false (and so we don't install the PPI), then keeping
the PEIM loaded seems useless. When a module determines that it should
not stay resident (because it does not expose services to other
modules), it usually returns EFI_ABORTED or something similar from the
entry point function. Then the PEI or DXE (or SMM) core unloads the
module at once.

Therefore I think it would make sense to set Status to EFI_ABORTED,
before the PCD check.

With (a) and (b) updated:

Acked-by: Laszlo Ersek <ler...@redhat.com>

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62256): https://edk2.groups.io/g/devel/message/62256
Mute This Topic: https://groups.io/mt/75372252/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to