91ae2b598ac384aea303f26ca578c327edb5c4fc
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuDxe.h
1 /** @file
2 CPU DXE Module.
3
4 Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _CPU_DXE_H
16 #define _CPU_DXE_H
17
18 #include <PiDxe.h>
19
20 #include <Protocol/Cpu.h>
21
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/DxeServicesTableLib.h>
25 #include <Library/BaseLib.h>
26 #include <Library/CpuLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/MtrrLib.h>
31
32 //
33 //
34 //
35 #define INTERRUPT_VECTOR_NUMBER 256
36
37 #define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \
38 EFI_MEMORY_WC | \
39 EFI_MEMORY_WT | \
40 EFI_MEMORY_WB | \
41 EFI_MEMORY_UCE \
42 )
43
44
45 //
46 // Function declarations
47 //
48 EFI_STATUS
49 EFIAPI
50 CpuFlushCpuDataCache (
51 IN EFI_CPU_ARCH_PROTOCOL *This,
52 IN EFI_PHYSICAL_ADDRESS Start,
53 IN UINT64 Length,
54 IN EFI_CPU_FLUSH_TYPE FlushType
55 );
56
57 EFI_STATUS
58 EFIAPI
59 CpuEnableInterrupt (
60 IN EFI_CPU_ARCH_PROTOCOL *This
61 );
62
63 EFI_STATUS
64 EFIAPI
65 CpuDisableInterrupt (
66 IN EFI_CPU_ARCH_PROTOCOL *This
67 );
68
69 EFI_STATUS
70 EFIAPI
71 CpuGetInterruptState (
72 IN EFI_CPU_ARCH_PROTOCOL *This,
73 OUT BOOLEAN *State
74 );
75
76 EFI_STATUS
77 EFIAPI
78 CpuInit (
79 IN EFI_CPU_ARCH_PROTOCOL *This,
80 IN EFI_CPU_INIT_TYPE InitType
81 );
82
83 EFI_STATUS
84 EFIAPI
85 CpuRegisterInterruptHandler (
86 IN EFI_CPU_ARCH_PROTOCOL *This,
87 IN EFI_EXCEPTION_TYPE InterruptType,
88 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
89 );
90
91 EFI_STATUS
92 EFIAPI
93 CpuGetTimerValue (
94 IN EFI_CPU_ARCH_PROTOCOL *This,
95 IN UINT32 TimerIndex,
96 OUT UINT64 *TimerValue,
97 OUT UINT64 *TimerPeriod OPTIONAL
98 );
99
100 EFI_STATUS
101 EFIAPI
102 CpuSetMemoryAttributes (
103 IN EFI_CPU_ARCH_PROTOCOL *This,
104 IN EFI_PHYSICAL_ADDRESS BaseAddress,
105 IN UINT64 Length,
106 IN UINT64 Attributes
107 );
108
109 VOID
110 EFIAPI
111 AsmIdtVector00 (
112 VOID
113 );
114
115 VOID
116 EFIAPI
117 InitializeExternalVectorTablePtr (
118 EFI_CPU_INTERRUPT_HANDLER *VectorTable
119 );
120
121 VOID
122 InitGlobalDescriptorTable (
123 VOID
124 );
125
126 VOID
127 EFIAPI
128 SetCodeSelector (
129 UINT16 Selector
130 );
131
132 VOID
133 EFIAPI
134 SetDataSelectors (
135 UINT16 Selector
136 );
137
138
139 #endif
140