2007-06-19 12:55:24 +02:00
|
|
|
/** @file
|
2008-11-14 04:45:34 +01:00
|
|
|
Provides CPU architecture specific functions that can not be defined
|
|
|
|
in the Base Library due to dependencies on the PAL Library
|
2018-06-27 15:11:33 +02:00
|
|
|
|
2008-11-19 11:00:35 +01:00
|
|
|
The CPU Library provides services to flush CPU TLBs and place the CPU in a sleep state.
|
2009-06-04 18:16:15 +02:00
|
|
|
The implementation of these services on Itanium processors requires the use of PAL Calls.
|
2008-11-19 11:00:35 +01:00
|
|
|
PAL Calls require PEI and DXE specific mechanisms to look up PAL Entry Point.
|
|
|
|
As a result, these services could not be defined in the Base Library.
|
2007-06-19 12:55:24 +02:00
|
|
|
|
2018-06-27 15:11:33 +02:00
|
|
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
2024-01-03 03:27:56 +01:00
|
|
|
Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
|
2019-04-04 01:06:00 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2007-06-19 12:55:24 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __CPU_LIB_H__
|
|
|
|
#define __CPU_LIB_H__
|
|
|
|
|
2008-10-31 05:22:58 +01:00
|
|
|
/**
|
|
|
|
Places the CPU in a sleep state until an interrupt is received.
|
|
|
|
|
|
|
|
Places the CPU in a sleep state until an interrupt is received. If interrupts
|
|
|
|
are disabled prior to calling this function, then the CPU will be placed in a
|
|
|
|
sleep state indefinitely.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
CpuSleep (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
|
|
|
|
|
|
|
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
CpuFlushTlb (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2024-01-03 03:27:56 +01:00
|
|
|
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined (MDE_CPU_LOONGARCH64)
|
2022-03-29 05:28:32 +02:00
|
|
|
|
|
|
|
/**
|
2024-01-03 03:27:56 +01:00
|
|
|
Initialize the CPU floating point units.
|
|
|
|
|
2022-03-29 05:28:32 +02:00
|
|
|
Initializes floating point units for requirement of UEFI specification.
|
2024-01-03 03:27:56 +01:00
|
|
|
For IA32 and X64, this function initializes floating-point control word to 0x027F
|
|
|
|
(all exceptions masked,double-precision, round-to-nearest) and multimedia-extensions
|
|
|
|
control word (if supported) to 0x1F80 (all exceptions masked, round-to-nearest,
|
|
|
|
flush to zero for masked underflow).
|
2022-03-29 05:28:32 +02:00
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
InitializeFloatingPointUnits (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2024-01-03 03:27:56 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
|
|
|
|
|
2022-03-29 05:28:32 +02:00
|
|
|
/**
|
|
|
|
Determine if the standard CPU signature is "AuthenticAMD".
|
|
|
|
@retval TRUE The CPU signature matches.
|
|
|
|
@retval FALSE The CPU signature does not match.
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
StandardSignatureIsAuthenticAMD (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return the 32bit CPU family and model value.
|
|
|
|
@return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
|
|
|
|
**/
|
|
|
|
UINT32
|
|
|
|
EFIAPI
|
|
|
|
GetCpuFamilyModel (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return the CPU stepping ID.
|
|
|
|
@return CPU stepping ID value in CPUID[01h].EAX.
|
|
|
|
**/
|
|
|
|
UINT8
|
|
|
|
EFIAPI
|
|
|
|
GetCpuSteppingId (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2024-01-03 03:27:56 +01:00
|
|
|
#if defined (MDE_CPU_LOONGARCH64)
|
|
|
|
|
|
|
|
/**
|
|
|
|
Enable the CPU floating point units.
|
|
|
|
|
|
|
|
Enable the CPU floating point units.
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
EnableFloatingPointUnits (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Disable the CPU floating point units.
|
|
|
|
|
|
|
|
Disable the CPU floating point units.
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
DisableFloatingPointUnits (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-01-24 06:28:11 +01:00
|
|
|
#endif
|