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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI CpuFlushCpuDataCache (IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Length, IN EFI_CPU_FLUSH_TYPE FlushType)
 
EFI_STATUS EFIAPI CpuEnableInterrupt (IN EFI_CPU_ARCH_PROTOCOL *This)
 
EFI_STATUS EFIAPI CpuDisableInterrupt (IN EFI_CPU_ARCH_PROTOCOL *This)
 
EFI_STATUS EFIAPI CpuGetInterruptState (IN EFI_CPU_ARCH_PROTOCOL *This, OUT BOOLEAN *State)
 
EFI_STATUS EFIAPI CpuInit (IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_CPU_INIT_TYPE InitType)
 
EFI_STATUS EFIAPI CpuRegisterInterruptHandler (IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
 
EFI_STATUS EFIAPI CpuGetTimerValue (IN EFI_CPU_ARCH_PROTOCOL *This, IN UINT32 TimerIndex, OUT UINT64 *TimerValue, OUT UINT64 *TimerPeriod OPTIONAL)
 
VOID EFIAPI IdleLoopEventCallback (IN EFI_EVENT Event, IN VOID *Context)
 
STATIC VOID InitializeDma (IN OUT EFI_CPU_ARCH_PROTOCOL *CpuArchProtocol)
 
STATIC VOID RemapUnusedMemoryNx (VOID)
 
EFI_STATUS CpuDxeInitialize (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

BOOLEAN mIsFlushingGCD
 
EFI_HANDLE mCpuHandle = NULL
 
EFI_CPU_ARCH_PROTOCOL mCpu
 

Detailed Description

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

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

Definition in file CpuDxe.c.

Function Documentation

◆ CpuDisableInterrupt()

EFI_STATUS EFIAPI CpuDisableInterrupt ( IN EFI_CPU_ARCH_PROTOCOL This)

This function disables interrupt processing by the processor.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
Return values
EFI_SUCCESSInterrupts are disabled on the processor.
EFI_DEVICE_ERRORInterrupts could not be disabled on the processor.

Definition at line 102 of file CpuDxe.c.

◆ CpuDxeInitialize()

EFI_STATUS CpuDxeInitialize ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Definition at line 304 of file CpuDxe.c.

◆ CpuEnableInterrupt()

EFI_STATUS EFIAPI CpuEnableInterrupt ( IN EFI_CPU_ARCH_PROTOCOL This)

This function enables interrupt processing by the processor.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
Return values
EFI_SUCCESSInterrupts are enabled on the processor.
EFI_DEVICE_ERRORInterrupts could not be enabled on the processor.

Definition at line 82 of file CpuDxe.c.

◆ CpuFlushCpuDataCache()

EFI_STATUS EFIAPI CpuFlushCpuDataCache ( IN EFI_CPU_ARCH_PROTOCOL This,
IN EFI_PHYSICAL_ADDRESS  Start,
IN UINT64  Length,
IN EFI_CPU_FLUSH_TYPE  FlushType 
)

This function flushes the range of addresses from Start to Start+Length from the processor's data cache. If Start is not aligned to a cache line boundary, then the bytes before Start to the preceding cache line boundary are also flushed. If Start+Length is not aligned to a cache line boundary, then the bytes past Start+Length to the end of the next cache line boundary are also flushed. The FlushType of EfiCpuFlushTypeWriteBackInvalidate must be supported. If the data cache is fully coherent with all DMA operations, then this function can just return EFI_SUCCESS. If the processor does not support flushing a range of the data cache, then the entire data cache can be flushed.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
StartThe beginning physical address to flush from the processor's data cache.
LengthThe number of bytes to flush from the processor's data cache. This function may flush more bytes than Length specifies depending upon the granularity of the flush operation that the processor supports.
FlushTypeSpecifies the type of flush operation to perform.
Return values
EFI_SUCCESSThe address range from Start to Start+Length was flushed from the processor's data cache.
EFI_UNSUPPORTEDThe processor does not support the cache flush type specified by FlushType.
EFI_DEVICE_ERRORThe address range from Start to Start+Length could not be flushed from the processor's data cache.

Definition at line 47 of file CpuDxe.c.

◆ CpuGetInterruptState()

EFI_STATUS EFIAPI CpuGetInterruptState ( IN EFI_CPU_ARCH_PROTOCOL This,
OUT BOOLEAN *  State 
)

This function retrieves the processor's current interrupt state a returns it in State. If interrupts are currently enabled, then TRUE is returned. If interrupts are currently disabled, then FALSE is returned.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
StateA pointer to the processor's current interrupt state. Set to TRUE if interrupts are enabled and FALSE if interrupts are disabled.
Return values
EFI_SUCCESSThe processor's current interrupt state was returned in State.
EFI_INVALID_PARAMETERState is NULL.

Definition at line 126 of file CpuDxe.c.

◆ CpuGetTimerValue()

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.

Parameters
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.
Return values
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.

Definition at line 178 of file CpuDxe.c.

◆ CpuInit()

EFI_STATUS EFIAPI CpuInit ( IN EFI_CPU_ARCH_PROTOCOL This,
IN EFI_CPU_INIT_TYPE  InitType 
)

This function generates an INIT on the processor. If this function succeeds, then the processor will be reset, and control will not be returned to the caller. If InitType is not supported by this processor, or the processor cannot programmatically generate an INIT without help from external hardware, then EFI_UNSUPPORTED is returned. If an error occurs attempting to generate an INIT, then EFI_DEVICE_ERROR is returned.

Parameters
ThisThe EFI_CPU_ARCH_PROTOCOL instance.
InitTypeThe type of processor INIT to perform.
Return values
EFI_SUCCESSThe processor INIT was performed. This return code should never be seen.
EFI_UNSUPPORTEDThe processor INIT operation specified by InitType is not supported by this processor.
EFI_DEVICE_ERRORThe processor INIT failed.

Definition at line 157 of file CpuDxe.c.

◆ CpuRegisterInterruptHandler()

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.

Parameters
ThisProtocol instance structure
InterruptTypeDefines which interrupt to hook. IA-32 valid range is 0x00 through 0xFF
InterruptHandlerA 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.
Return values
EFI_SUCCESSIf handler 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 167 of file CpuDxe.c.

◆ IdleLoopEventCallback()

VOID EFIAPI IdleLoopEventCallback ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Callback function for idle events.

Parameters
EventEvent whose notification function is being invoked.
ContextThe pointer to the notification function's context, which is implementation-dependent.

Definition at line 198 of file CpuDxe.c.

◆ InitializeDma()

STATIC VOID InitializeDma ( IN OUT EFI_CPU_ARCH_PROTOCOL CpuArchProtocol)

Definition at line 225 of file CpuDxe.c.

◆ RemapUnusedMemoryNx()

STATIC VOID RemapUnusedMemoryNx ( VOID  )

Map all EfiConventionalMemory regions in the memory map with NX attributes so that allocating or freeing EfiBootServicesData regions does not result in changes to memory permission attributes.

Definition at line 240 of file CpuDxe.c.

Variable Documentation

◆ mCpu

Initial value:
= {
0,
2048,
}
EFI_STATUS EFIAPI CpuGetInterruptState(IN EFI_CPU_ARCH_PROTOCOL *This, OUT BOOLEAN *State)
Definition: CpuDxe.c:126
EFI_STATUS EFIAPI CpuRegisterInterruptHandler(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
Definition: CpuDxe.c:167
EFI_STATUS EFIAPI CpuGetTimerValue(IN EFI_CPU_ARCH_PROTOCOL *This, IN UINT32 TimerIndex, OUT UINT64 *TimerValue, OUT UINT64 *TimerPeriod OPTIONAL)
Definition: CpuDxe.c:178
EFI_STATUS EFIAPI CpuDisableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
Definition: CpuDxe.c:102
EFI_STATUS EFIAPI CpuInit(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_CPU_INIT_TYPE InitType)
Definition: CpuDxe.c:157
EFI_STATUS EFIAPI CpuFlushCpuDataCache(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Length, IN EFI_CPU_FLUSH_TYPE FlushType)
Definition: CpuDxe.c:47
EFI_STATUS EFIAPI CpuEnableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
Definition: CpuDxe.c:82
EFI_STATUS EFIAPI CpuSetMemoryAttributes(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
Definition: CpuMmuCommon.c:228

Definition at line 210 of file CpuDxe.c.

◆ mCpuHandle

EFI_HANDLE mCpuHandle = NULL

Definition at line 209 of file CpuDxe.c.

◆ mIsFlushingGCD

BOOLEAN mIsFlushingGCD

Definition at line 16 of file CpuDxe.c.