TianoCore EDK2 master
|
Go to the source code of this file.
Macros | |
#define | CPU_INTERRUPT_NUM 256 |
Variables | |
BOOLEAN | InterruptState = FALSE |
EFI_HANDLE | mCpuHandle = NULL |
BOOLEAN | mIsFlushingGCD |
BOOLEAN | mIsAllocatingPageTable = FALSE |
UINT64 | mTimerPeriod = 0 |
EFI_CPU_ARCH_PROTOCOL | gCpu |
CPU DXE Module to produce CPU ARCH Protocol.
Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CpuDxe.c.
VOID AddLocalApicMemorySpace | ( | IN EFI_HANDLE | ImageHandle | ) |
EFI_STATUS AddMemoryMappedIoSpace | ( | IN UINT64 | Base, |
IN UINT64 | Length, | ||
IN UINT64 | Capabilities | ||
) |
Add MMIO space to GCD. The routine checks the GCD database and only adds those which are not added in the specified range to GCD.
Base | Base address of the MMIO space. |
Length | Length of the MMIO space. |
Capabilities | Capabilities of the MMIO space. |
EFI_SUCCESS | The MMIO space was added successfully. |
EFI_STATUS EFIAPI CpuDisableInterrupt | ( | IN EFI_CPU_ARCH_PROTOCOL * | This | ) |
EFI_STATUS EFIAPI CpuEnableInterrupt | ( | IN EFI_CPU_ARCH_PROTOCOL * | This | ) |
EFI_STATUS EFIAPI CpuFlushCpuDataCache | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | Start, | ||
IN UINT64 | Length, | ||
IN EFI_CPU_FLUSH_TYPE | FlushType | ||
) |
Flush CPU data cache. If the instruction cache is fully coherent with all DMA operations then function can just return EFI_SUCCESS.
This | Protocol instance structure |
Start | Physical address to start flushing from. |
Length | Number of bytes to flush. Round up to chipset granularity. |
FlushType | Specifies the type of flush operation to perform. |
EFI_SUCCESS | If cache was flushed |
EFI_UNSUPPORTED | If flush type is not supported. |
EFI_DEVICE_ERROR | If requested range could not be flushed. |
EFI_STATUS EFIAPI CpuGetInterruptState | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
OUT BOOLEAN * | State | ||
) |
EFI_STATUS EFIAPI CpuGetTimerValue | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
IN UINT32 | TimerIndex, | ||
OUT UINT64 * | TimerValue, | ||
OUT UINT64 *TimerPeriod | OPTIONAL | ||
) |
Returns a timer value from one of the CPU's internal timers. There is no inherent time interval between ticks but is a function of the CPU frequency.
This | - Protocol instance structure. |
TimerIndex | - Specifies which CPU timer is requested. |
TimerValue | - Pointer to the returned timer value. |
TimerPeriod | - A pointer to the amount of time that passes in femtoseconds (10-15) for each increment of TimerValue. If TimerValue does not increment at a predictable rate, then 0 is returned. The amount of time that has passed between two calls to GetTimerValue() can be calculated with the formula (TimerValue2 - TimerValue1) * TimerPeriod. This parameter is optional and may be NULL. |
EFI_SUCCESS | - If the CPU timer count was returned. |
EFI_UNSUPPORTED | - If the CPU does not have any readable timers. |
EFI_DEVICE_ERROR | - If an error occurred while reading the timer. |
EFI_INVALID_PARAMETER | - TimerIndex is not valid or TimerValue is NULL. |
EFI_STATUS EFIAPI CpuInit | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
IN EFI_CPU_INIT_TYPE | InitType | ||
) |
Generates an INIT to the CPU.
This | Protocol instance structure |
InitType | Type of CPU INIT to perform |
EFI_SUCCESS | If CPU INIT occurred. This value should never be seen. |
EFI_DEVICE_ERROR | If CPU INIT failed. |
EFI_UNSUPPORTED | Requested type of CPU INIT not supported. |
EFI_STATUS EFIAPI CpuRegisterInterruptHandler | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
IN EFI_EXCEPTION_TYPE | InterruptType, | ||
IN EFI_CPU_INTERRUPT_HANDLER | InterruptHandler | ||
) |
Registers a function to be called from the CPU interrupt handler.
This | Protocol instance structure |
InterruptType | Defines which interrupt to hook. IA-32 valid range is 0x00 through 0xFF |
InterruptHandler | A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs. A null pointer is an error condition. |
EFI_SUCCESS | If handler installed or uninstalled. |
EFI_ALREADY_STARTED | InterruptHandler is not NULL, and a handler for InterruptType was previously installed. |
EFI_INVALID_PARAMETER | InterruptHandler is NULL, and a handler for InterruptType was not previously installed. |
EFI_UNSUPPORTED | The interrupt specified by InterruptType is not supported. |
EFI_STATUS EFIAPI CpuSetMemoryAttributes | ( | IN EFI_CPU_ARCH_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
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.
This | The EFI_CPU_ARCH_PROTOCOL instance. |
BaseAddress | The physical address that is the start address of a memory region. |
Length | The size in bytes of the memory region. |
Attributes | The bit mask of attributes to set for the memory region. |
EFI_SUCCESS | The attributes were set for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The 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. |
UINT64 GetMemorySpaceAttributeFromMtrrType | ( | IN MTRR_MEMORY_CACHE_TYPE | Type | ) |
EFI_STATUS EFIAPI InitializeCpu | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Initialize the state information for the CPU Architectural Protocol.
ImageHandle | Image handle this driver. |
SystemTable | Pointer to the System Table. |
EFI_SUCCESS | Thread can be successfully created |
EFI_OUT_OF_RESOURCES | Cannot allocate protocol data structure |
EFI_DEVICE_ERROR | Cannot create the thread |
VOID InitInterruptDescriptorTable | ( | VOID | ) |
EFI_STATUS IntersectMemoryDescriptor | ( | IN UINT64 | Base, |
IN UINT64 | Length, | ||
IN UINT64 | Capabilities, | ||
IN CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR * | Descriptor | ||
) |
Ensure the compatibility of a memory space descriptor with the MMIO aperture.
The memory space descriptor can come from the GCD memory space map, or it can represent a gap between two neighboring memory space descriptors. In the latter case, the GcdMemoryType field is expected to be EfiGcdMemoryTypeNonExistent.
If the memory space descriptor already has type EfiGcdMemoryTypeMemoryMappedIo, and its capabilities are a superset of the required capabilities, then no action is taken – it is by definition compatible with the aperture.
Otherwise, the intersection of the memory space descriptor is calculated with the aperture. If the intersection is the empty set (no overlap), no action is taken; the memory space descriptor is compatible with the aperture.
Otherwise, the type of the descriptor is investigated again. If the type is EfiGcdMemoryTypeNonExistent (representing a gap, or a genuine descriptor with such a type), then an attempt is made to add the intersection as MMIO space to the GCD memory space map, with the specified capabilities. This ensures continuity for the aperture, and the descriptor is deemed compatible with the aperture.
Otherwise, the memory space descriptor is incompatible with the MMIO aperture.
[in] | Base | Base address of the aperture. |
[in] | Length | Length of the aperture. |
[in] | Capabilities | Capabilities required by the aperture. |
[in] | Descriptor | The descriptor to ensure compatibility with the aperture for. |
EFI_SUCCESS | The descriptor is compatible. The GCD memory space map may have been updated, for continuity within the aperture. |
EFI_INVALID_PARAMETER | The descriptor is incompatible. |
BOOLEAN IsPagingAndPageAddressExtensionsEnabled | ( | VOID | ) |
VOID RefreshGcdMemoryAttributes | ( | VOID | ) |
VOID RefreshMemoryAttributesFromMtrr | ( | VOID | ) |
EFI_STATUS SearchGcdMemorySpaces | ( | IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR * | MemorySpaceMap, |
IN UINTN | NumberOfDescriptors, | ||
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
OUT UINTN * | StartIndex, | ||
OUT UINTN * | EndIndex | ||
) |
Searches memory descriptors covered by given memory range.
This function searches into the Gcd Memory Space for descriptors (from StartIndex to EndIndex) that contains the memory range specified by BaseAddress and Length.
MemorySpaceMap | Gcd Memory Space Map as array. |
NumberOfDescriptors | Number of descriptors in map. |
BaseAddress | BaseAddress for the requested range. |
Length | Length for the requested range. |
StartIndex | Start index into the Gcd Memory Space Map. |
EndIndex | End index into the Gcd Memory Space Map. |
EFI_SUCCESS | Search successfully. |
EFI_NOT_FOUND | The requested descriptors does not exist. |
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.
MemorySpaceMap | Gcd Memory Space Map as array |
NumberOfDescriptors | Number of descriptors in map |
BaseAddress | BaseAddress for the range |
Length | Length for the range |
Attributes | Attributes to set |
EFI_SUCCESS | Memory attributes set successfully |
EFI_NOT_FOUND | The specified range does not exist in Gcd Memory Space |
VOID EFIAPI SetMtrrsFromBuffer | ( | IN VOID * | Buffer | ) |
A minimal wrapper function that allows MtrrSetAllMtrrs() to be passed to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() as Procedure.
[in] | Buffer | Pointer to an MTRR_SETTINGS object, to be passed to MtrrSetAllMtrrs(). |
EFI_HANDLE mCpuHandle = NULL |