TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuDxe.h File Reference

Go to the source code of this file.

Functions

EFI_STATUS RegisterInterruptHandler (IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
 
EFI_STATUS RegisterDebuggerInterruptHandler (IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
 
EFI_STATUS EFIAPI CpuSetMemoryAttributes (IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
 
EFI_STATUS InitializeExceptions (IN EFI_CPU_ARCH_PROTOCOL *Cpu)
 
EFI_STATUS SyncCacheConfig (IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol)
 
UINT64 EfiAttributeToArmAttribute (IN UINT64 EfiAttributes)
 
EFI_STATUS GetMemoryRegion (IN OUT UINTN *BaseAddress, OUT UINTN *RegionLength, OUT UINTN *RegionAttributes)
 
EFI_STATUS SetGcdMemorySpaceAttributes (IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap, IN UINTN NumberOfDescriptors, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
 
UINT64 RegionAttributeToGcdAttribute (IN UINTN PageAttributes)
 

Variables

BOOLEAN mIsFlushingGCD
 
EFI_MEMORY_ATTRIBUTE_PROTOCOL mMemoryAttribute
 

Detailed Description

Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.

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

Definition in file CpuDxe.h.

Function Documentation

◆ CpuSetMemoryAttributes()

EFI_STATUS EFIAPI CpuSetMemoryAttributes ( IN EFI_CPU_ARCH_PROTOCOL This,
IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length,
IN UINT64  Attributes 
)

This function modifies the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
BaseAddressThe physical address that is the start address of a memory region.
LengthThe size in bytes of the memory region.
AttributesThe bit mask of attributes to set for the memory region.
Return values
EFI_SUCCESSThe attributes were set for the memory region.
EFI_ACCESS_DENIEDThe attributes for the memory resource range specified by BaseAddress and Length cannot be modified.
EFI_INVALID_PARAMETERLength is zero.
EFI_OUT_OF_RESOURCESThere are not enough system resources to modify the attributes of the memory resource range.
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 support for the memory resource range specified by BaseAddress and Length.

Implementation of SetMemoryAttributes() service of CPU Architecture Protocol.

This function modifies the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
BaseAddressThe physical address that is the start address of a memory region.
LengthThe size in bytes of the memory region.
AttributesThe bit mask of attributes to set for the memory region.
Return values
EFI_SUCCESSThe attributes were set for the memory region.
EFI_ACCESS_DENIEDThe attributes for the memory resource range specified by BaseAddress and Length cannot be modified.
EFI_INVALID_PARAMETERLength is zero. Attributes specified an illegal combination of attributes that cannot be set together.
EFI_OUT_OF_RESOURCESThere are not enough system resources to modify the attributes of the memory resource range.
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 support for the memory resource range specified by BaseAddress and Length.

This function modifies the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
BaseAddressThe physical address that is the start address of a memory region.
LengthThe size in bytes of the memory region.
EfiAttributesThe bit mask of attributes to set for the memory region.
Return values
EFI_SUCCESSThe attributes were set for the memory region.
EFI_ACCESS_DENIEDThe attributes for the memory resource range specified by BaseAddress and Length cannot be modified.
EFI_INVALID_PARAMETERLength is zero.
EFI_OUT_OF_RESOURCESThere are not enough system resources to modify the attributes of the memory resource range.
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 support for the memory resource range specified by BaseAddress and Length.

Definition at line 228 of file CpuMmuCommon.c.

◆ EfiAttributeToArmAttribute()

UINT64 EfiAttributeToArmAttribute ( IN UINT64  EfiAttributes)

Convert EFI memory attributes to ARM translation table attributes.

Parameters
[in]EfiAttributesEFI memory attributes.
Return values
Theanalogous translation table attributes.

Definition at line 354 of file Mmu.c.

◆ GetMemoryRegion()

EFI_STATUS GetMemoryRegion ( IN OUT UINTN BaseAddress,
OUT UINTN RegionLength,
OUT UINTN RegionAttributes 
)

Retrieves a memory region from a given base address.

This function retrieves a memory region starting from a given base address.

Parameters
[in,out]BaseAddressThe base address from which to retrieve the memory region. On successful return, this is updated to the end address of the retrieved region.
[out]RegionLengthThe length of the retrieved memory region.
[out]RegionAttributesThe attributes of the retrieved memory region.
Return values
EFI_STATUSReturns EFI_SUCCESS if the memory region is retrieved successfully, or the status of the recursive call to GetMemoryRegionRec.
EFI_NOT_FOUNDThe memory region was not found.
EFI_NO_MAPPINGThe translation table entry associated with BaseAddress is invalid.
EFI_INVALID_PARAMETEROne of the input parameters was NULL.

Get the memory region that contains the specified address. A memory region is defined as a contiguous set of pages with the same attributes.

RegionLength and RegionAttributes are only valid if EFI_SUCCESS is returned.

Parameters
[in,out]BaseAddressOn input, the address to search for. On output, the base address of the region found.
[out]RegionLengthThe length of the region found.
[out]RegionAttributesThe attributes of the region found.
Return values
EFI_SUCCESSRegion found
EFI_NOT_FOUNDRegion not found
EFI_UNSUPPORTEDLarge pages are unsupported
EFI_NO_MAPPINGThe page specified by BaseAddress is unmapped
EFI_INVALID_PARAMETERThe BaseAddress exceeds the addressable range of the translation table.

Definition at line 515 of file Mmu.c.

◆ InitializeExceptions()

EFI_STATUS InitializeExceptions ( IN EFI_CPU_ARCH_PROTOCOL Cpu)

Initialize interrupt handling for DXE phase.

Parameters
CpuA pointer of EFI_CPU_ARCH_PROTOCOL instance.
Returns
VOID.

Definition at line 15 of file Exception.c.

◆ RegionAttributeToGcdAttribute()

UINT64 RegionAttributeToGcdAttribute ( IN UINTN  PageAttributes)

Convert an arch specific set of page attributes into a mask of EFI_MEMORY_xx constants.

Parameters
PageAttributesThe set of page attributes.
Return values
Themask of EFI_MEMORY_xx constants.

Convert an arch specific set of page attributes into a mask of EFI_MEMORY_xx constants.

Parameters
[in]PageAttributesThe set of page attributes.
Return values
EFI_SUCCESSThe attributes were converted successfully.
EFI_UNSUPPORTEDThe section attributes did not have a GCD transation.

Definition at line 111 of file Mmu.c.

◆ RegisterDebuggerInterruptHandler()

EFI_STATUS RegisterDebuggerInterruptHandler ( IN EFI_EXCEPTION_TYPE  InterruptType,
IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler 
)

This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception.

Parameters
InterruptTypeA pointer to the processor's current interrupt state. Set to TRUE if interrupts are enabled and FALSE if interrupts are disabled.
InterruptHandlerA pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs. If this parameter is NULL, then the handler will be uninstalled.
Return values
EFI_SUCCESSThe handler for the processor interrupt was successfully installed or uninstalled.
EFI_ALREADY_STARTEDInterruptHandler is not NULL, and a handler for InterruptType was previously installed.
EFI_INVALID_PARAMETERInterruptHandler is NULL, and a handler for InterruptType was not previously installed.
EFI_UNSUPPORTEDThe interrupt specified by InterruptType is not supported.

◆ RegisterInterruptHandler()

EFI_STATUS RegisterInterruptHandler ( IN EFI_EXCEPTION_TYPE  InterruptType,
IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler 
)

This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception.

Parameters
InterruptTypeA pointer to the processor's current interrupt state. Set to TRUE if interrupts are enabled and FALSE if interrupts are disabled.
InterruptHandlerA pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs. If this parameter is NULL, then the handler will be uninstalled.
Return values
EFI_SUCCESSThe handler for the processor interrupt was successfully installed or uninstalled.
EFI_ALREADY_STARTEDInterruptHandler is not NULL, and a handler for InterruptType was previously installed.
EFI_INVALID_PARAMETERInterruptHandler is NULL, and a handler for InterruptType was not previously installed.
EFI_UNSUPPORTEDThe interrupt specified by InterruptType is not supported.

Definition at line 93 of file Exception.c.

◆ SetGcdMemorySpaceAttributes()

EFI_STATUS SetGcdMemorySpaceAttributes ( IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemorySpaceMap,
IN UINTN  NumberOfDescriptors,
IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length,
IN UINT64  Attributes 
)

Sets the attributes for a specified range in Gcd Memory Space Map.

This function sets the attributes for a specified range in Gcd Memory Space Map.

Parameters
MemorySpaceMapGcd Memory Space Map as array
NumberOfDescriptorsNumber of descriptors in map
BaseAddressBaseAddress for the range
LengthLength for the range
AttributesAttributes to set
Return values
EFI_SUCCESSMemory attributes set successfully
EFI_NOT_FOUNDThe specified range does not exist in Gcd Memory Space

Definition at line 79 of file CpuMmuCommon.c.

◆ SyncCacheConfig()

EFI_STATUS SyncCacheConfig ( IN EFI_CPU_ARCH_PROTOCOL CpuProtocol)

Sync the GCD memory space attributes with the translation table.

Parameters
[in]CpuProtocolThe CPU architectural protocol instance.
Return values
EFI_SUCCESSThe GCD memory space attributes are synced with the MMU page table.
OthersThe return value of GetMemorySpaceMap().

Definition at line 269 of file Mmu.c.

Variable Documentation

◆ mIsFlushingGCD

BOOLEAN mIsFlushingGCD
extern

Definition at line 16 of file CpuDxe.c.

◆ mMemoryAttribute

EFI_MEMORY_ATTRIBUTE_PROTOCOL mMemoryAttribute
extern

Definition at line 290 of file MemoryAttribute.c.