TianoCore EDK2 master
Loading...
Searching...
No Matches
MemTypeInfo.c File Reference

Go to the source code of this file.

Macros

#define MEMORY_TYPE_INFO_DEFAULT(Type)    { Type, FixedPcdGet32 (PcdMemoryType ## Type) }
 

Functions

STATIC VOID BuildMemTypeInfoHob (VOID)
 
STATIC VOID RefreshMemTypeInfo (IN EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2)
 
STATIC EFI_STATUS EFIAPI OnReadOnlyVariable2Available (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
VOID MemTypeInfoInitialization (IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob)
 

Variables

STATIC EFI_MEMORY_TYPE_INFORMATION mMemoryTypeInformation []
 
STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mReadOnlyVariable2Notify
 

Detailed Description

Produce the memory type information HOB.

Copyright (C) 2017-2020, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MemTypeInfo.c.

Macro Definition Documentation

◆ MEMORY_TYPE_INFO_DEFAULT

#define MEMORY_TYPE_INFO_DEFAULT (   Type)     { Type, FixedPcdGet32 (PcdMemoryType ## Type) }

Definition at line 20 of file MemTypeInfo.c.

Function Documentation

◆ BuildMemTypeInfoHob()

STATIC VOID BuildMemTypeInfoHob ( VOID  )

Definition at line 34 of file MemTypeInfo.c.

◆ MemTypeInfoInitialization()

VOID MemTypeInfoInitialization ( IN OUT EFI_HOB_PLATFORM_INFO PlatformInfoHob)

Definition at line 205 of file MemTypeInfo.c.

◆ OnReadOnlyVariable2Available()

STATIC EFI_STATUS EFIAPI OnReadOnlyVariable2Available ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

Notification function called when EFI_PEI_READ_ONLY_VARIABLE2_PPI becomes available.

Parameters
[in]PeiServicesIndirect reference to the PEI Services Table.
[in]NotifyDescriptorAddress of the notification descriptor data structure.
[in]PpiAddress of the PPI that was installed.
Returns
Status of the notification. The status code returned from this function is ignored.

Definition at line 180 of file MemTypeInfo.c.

◆ RefreshMemTypeInfo()

STATIC VOID RefreshMemTypeInfo ( IN EFI_PEI_READ_ONLY_VARIABLE2_PPI ReadOnlyVariable2)

Refresh the mMemoryTypeInformation array (which we'll turn into the MemoryTypeInformation HOB) from the MemoryTypeInformation UEFI variable.

Normally, the DXE IPL PEIM builds the HOB from the UEFI variable. But it does so transparently. Instead, we consider the UEFI variable as a list of hints, for updating our HOB defaults:

  • Record types not covered in mMemoryTypeInformation are ignored. In particular, this hides record types from the UEFI variable that may lead to reboots without benefiting SMM security, such as EfiBootServicesData.
  • Records that would lower the defaults in mMemoryTypeInformation are also ignored.
Parameters
[in]ReadOnlyVariable2The EFI_PEI_READ_ONLY_VARIABLE2_PPI used for retrieving the MemoryTypeInformation UEFI variable.

Definition at line 66 of file MemTypeInfo.c.

Variable Documentation

◆ mMemoryTypeInformation

STATIC EFI_MEMORY_TYPE_INFORMATION mMemoryTypeInformation[]
Initial value:
= {
MEMORY_TYPE_INFO_DEFAULT (EfiACPIMemoryNVS),
MEMORY_TYPE_INFO_DEFAULT (EfiACPIReclaimMemory),
MEMORY_TYPE_INFO_DEFAULT (EfiReservedMemoryType),
MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesCode),
MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesData),
{ EfiMaxMemoryType, 0}
}
@ EfiReservedMemoryType
@ EfiACPIMemoryNVS
@ EfiACPIReclaimMemory
@ EfiRuntimeServicesCode
@ EfiRuntimeServicesData

Definition at line 23 of file MemTypeInfo.c.

◆ mReadOnlyVariable2Notify

STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mReadOnlyVariable2Notify
Initial value:
= {
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH |
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiReadOnlyVariable2PpiGuid,
}
STATIC EFI_STATUS EFIAPI OnReadOnlyVariable2Available(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
Definition: MemTypeInfo.c:180

Definition at line 197 of file MemTypeInfo.c.