1 | /** @file
|
---|
2 | Provides CPU architecture specific functions that can not be defined
|
---|
3 | in the Base Library due to dependencies on the PAL Library
|
---|
4 |
|
---|
5 | The CPU Library provides services to flush CPU TLBs and place the CPU in a sleep state.
|
---|
6 | The implementation of these services on Itanium processors requires the use of PAL Calls.
|
---|
7 | PAL Calls require PEI and DXE specific mechanisms to look up PAL Entry Point.
|
---|
8 | As a result, these services could not be defined in the Base Library.
|
---|
9 |
|
---|
10 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
11 | Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
|
---|
12 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
13 |
|
---|
14 | **/
|
---|
15 |
|
---|
16 | #ifndef __CPU_LIB_H__
|
---|
17 | #define __CPU_LIB_H__
|
---|
18 |
|
---|
19 | /**
|
---|
20 | Places the CPU in a sleep state until an interrupt is received.
|
---|
21 |
|
---|
22 | Places the CPU in a sleep state until an interrupt is received. If interrupts
|
---|
23 | are disabled prior to calling this function, then the CPU will be placed in a
|
---|
24 | sleep state indefinitely.
|
---|
25 |
|
---|
26 | **/
|
---|
27 | VOID
|
---|
28 | EFIAPI
|
---|
29 | CpuSleep (
|
---|
30 | VOID
|
---|
31 | );
|
---|
32 |
|
---|
33 | /**
|
---|
34 | Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
---|
35 |
|
---|
36 | Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
---|
37 |
|
---|
38 | **/
|
---|
39 | VOID
|
---|
40 | EFIAPI
|
---|
41 | CpuFlushTlb (
|
---|
42 | VOID
|
---|
43 | );
|
---|
44 |
|
---|
45 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) || defined (MDE_CPU_LOONGARCH64)
|
---|
46 |
|
---|
47 | /**
|
---|
48 | Initialize the CPU floating point units.
|
---|
49 |
|
---|
50 | Initializes floating point units for requirement of UEFI specification.
|
---|
51 | For IA32 and X64, this function initializes floating-point control word to 0x027F
|
---|
52 | (all exceptions masked,double-precision, round-to-nearest) and multimedia-extensions
|
---|
53 | control word (if supported) to 0x1F80 (all exceptions masked, round-to-nearest,
|
---|
54 | flush to zero for masked underflow).
|
---|
55 | **/
|
---|
56 | VOID
|
---|
57 | EFIAPI
|
---|
58 | InitializeFloatingPointUnits (
|
---|
59 | VOID
|
---|
60 | );
|
---|
61 |
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
|
---|
65 |
|
---|
66 | /**
|
---|
67 | Determine if the standard CPU signature is "AuthenticAMD".
|
---|
68 | @retval TRUE The CPU signature matches.
|
---|
69 | @retval FALSE The CPU signature does not match.
|
---|
70 | **/
|
---|
71 | BOOLEAN
|
---|
72 | EFIAPI
|
---|
73 | StandardSignatureIsAuthenticAMD (
|
---|
74 | VOID
|
---|
75 | );
|
---|
76 |
|
---|
77 | /**
|
---|
78 | Return the 32bit CPU family and model value.
|
---|
79 | @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
|
---|
80 | **/
|
---|
81 | UINT32
|
---|
82 | EFIAPI
|
---|
83 | GetCpuFamilyModel (
|
---|
84 | VOID
|
---|
85 | );
|
---|
86 |
|
---|
87 | /**
|
---|
88 | Return the CPU stepping ID.
|
---|
89 | @return CPU stepping ID value in CPUID[01h].EAX.
|
---|
90 | **/
|
---|
91 | UINT8
|
---|
92 | EFIAPI
|
---|
93 | GetCpuSteppingId (
|
---|
94 | VOID
|
---|
95 | );
|
---|
96 |
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #if defined (MDE_CPU_LOONGARCH64)
|
---|
100 |
|
---|
101 | /**
|
---|
102 | Enable the CPU floating point units.
|
---|
103 |
|
---|
104 | Enable the CPU floating point units.
|
---|
105 | **/
|
---|
106 | VOID
|
---|
107 | EFIAPI
|
---|
108 | EnableFloatingPointUnits (
|
---|
109 | VOID
|
---|
110 | );
|
---|
111 |
|
---|
112 | /**
|
---|
113 | Disable the CPU floating point units.
|
---|
114 |
|
---|
115 | Disable the CPU floating point units.
|
---|
116 | **/
|
---|
117 | VOID
|
---|
118 | EFIAPI
|
---|
119 | DisableFloatingPointUnits (
|
---|
120 | VOID
|
---|
121 | );
|
---|
122 |
|
---|
123 | #endif
|
---|
124 |
|
---|
125 | #endif
|
---|