TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuPei.c File Reference
#include <PiPei.h>
#include <Ppi/ArmMpCoreInfo.h>
#include <Ppi/MemoryAttribute.h>
#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Library/ArmLib.h>
#include <Library/ArmMmuLib.h>

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI SetMemoryPermissions (IN EDKII_MEMORY_ATTRIBUTE_PPI *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask)
 
EFI_STATUS EFIAPI InitializeCpuPeim (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 

Variables

STATIC CONST EDKII_MEMORY_ATTRIBUTE_PPI mMemoryAttributePpi
 
STATIC CONST EFI_PEI_PPI_DESCRIPTOR mMemoryAttributePpiDesc
 

Detailed Description

Copyright (c) 2006, Intel Corporation. All rights reserved.
Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.
Copyright (c) 2011-2013, ARM Limited. All rights reserved.
Copyright (c) 2023, Google, LLC. All rights reserved.

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

Module Name:

MemoryInit.c

Abstract:

PEIM to provide fake memory init

Definition in file CpuPei.c.

Function Documentation

◆ InitializeCpuPeim()

EFI_STATUS EFIAPI InitializeCpuPeim ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

Definition at line 127 of file CpuPei.c.

◆ SetMemoryPermissions()

STATIC EFI_STATUS EFIAPI SetMemoryPermissions ( IN EDKII_MEMORY_ATTRIBUTE_PPI This,
IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length,
IN UINT64  Attributes,
IN UINT64  AttributeMask 
)

Set the requested memory permission attributes on a region of memory.

BaseAddress and Length must be aligned to EFI_PAGE_SIZE.

Attributes must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and EFI_MEMORY_XP, and specifies the attributes that must be set for the region in question. Attributes that are omitted will be cleared from the region only if they are set in AttributeMask.

AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and EFI_MEMORY_XP, and specifies the attributes that the call will operate on. AttributeMask must not be 0x0, and must contain at least the bits set in Attributes.

Parameters
[in]ThisThe protocol instance pointer.
[in]BaseAddressThe physical address that is the start address of a memory region.
[in]LengthThe size in bytes of the memory region.
[in]AttributesMemory attributes to set or clear.
[in]AttributeMaskMask of memory attributes to operate on.
Return values
EFI_SUCCESSThe attributes were set for the memory region.
EFI_INVALID_PARAMETERLength is zero. AttributeMask is zero. AttributeMask lacks bits set in Attributes. BaseAddress or Length is not suitably aligned.
EFI_UNSUPPORTEDThe processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length.
EFI_OUT_OF_RESOURCESRequested attributes cannot be applied due to lack of system resources.

Definition at line 81 of file CpuPei.c.

Variable Documentation

◆ mMemoryAttributePpi

Initial value:
= {
}
STATIC EFI_STATUS EFIAPI SetMemoryPermissions(IN EDKII_MEMORY_ATTRIBUTE_PPI *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask)
Definition: CpuPei.c:81

Definition at line 101 of file CpuPei.c.

◆ mMemoryAttributePpiDesc

STATIC CONST EFI_PEI_PPI_DESCRIPTOR mMemoryAttributePpiDesc
Initial value:
= {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEdkiiMemoryAttributePpiGuid,
(VOID *)&mMemoryAttributePpi
}

Definition at line 105 of file CpuPei.c.