]> git.proxmox.com Git - mirror_edk2.git/blob - InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h
a836f631d1c56aaa5fcfb8e8e724deb2bf2ac0e5
[mirror_edk2.git] / InOsEmuPkg / CpuRuntimeDxe / CpuDriver.h
1 /*++ @file
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
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_ARCHITECTURAL_PROTOCOL_DRIVER_H_
16 #define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
17
18
19 #include <FrameworkDxe.h>
20 #include <IndustryStandard/SmBios.h>
21 #include <Protocol/Cpu.h>
22 #include <Protocol/Smbios.h>
23 #include <Protocol/FrameworkHii.h>
24 #include <Guid/DataHubRecords.h>
25 #include <Protocol/CpuIo2.h>
26 #include <Library/BaseLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/HiiLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/EmuThunkLib.h>
34
35
36 extern UINT8 CpuStrings[];
37
38 //
39 // Internal Data Structures
40 //
41 #define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd')
42
43 typedef struct {
44 UINTN Signature;
45 EFI_HANDLE Handle;
46
47 EFI_CPU_ARCH_PROTOCOL Cpu;
48 EFI_CPU_IO2_PROTOCOL CpuIo;
49
50 //
51 // Local Data for CPU interface goes here
52 //
53 BOOLEAN InterruptState;
54
55 } CPU_ARCH_PROTOCOL_PRIVATE;
56
57 #define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
58 CR (a, \
59 CPU_ARCH_PROTOCOL_PRIVATE, \
60 Cpu, \
61 CPU_ARCH_PROT_PRIVATE_SIGNATURE \
62 )
63
64 EFI_STATUS
65 EFIAPI
66 CpuMemoryServiceRead (
67 IN EFI_CPU_IO2_PROTOCOL *This,
68 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
69 IN UINT64 Address,
70 IN UINTN Count,
71 IN OUT VOID *Buffer
72 );
73
74 EFI_STATUS
75 EFIAPI
76 CpuMemoryServiceWrite (
77 IN EFI_CPU_IO2_PROTOCOL *This,
78 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
79 IN UINT64 Address,
80 IN UINTN Count,
81 IN OUT VOID *Buffer
82 );
83
84 EFI_STATUS
85 EFIAPI
86 CpuIoServiceRead (
87 IN EFI_CPU_IO2_PROTOCOL *This,
88 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
89 IN UINT64 UserAddress,
90 IN UINTN Count,
91 IN OUT VOID *UserBuffer
92 );
93
94 EFI_STATUS
95 EFIAPI
96 CpuIoServiceWrite (
97 IN EFI_CPU_IO2_PROTOCOL *This,
98 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
99 IN UINT64 UserAddress,
100 IN UINTN Count,
101 IN OUT VOID *UserBuffer
102 );
103
104 EFI_STATUS
105 EFIAPI
106 InitializeCpu (
107 IN EFI_HANDLE ImageHandle,
108 IN EFI_SYSTEM_TABLE *SystemTable
109 );
110
111 EFI_STATUS
112 EFIAPI
113 EmuFlushCpuDataCache (
114 IN EFI_CPU_ARCH_PROTOCOL *This,
115 IN EFI_PHYSICAL_ADDRESS Start,
116 IN UINT64 Length,
117 IN EFI_CPU_FLUSH_TYPE FlushType
118 );
119
120 EFI_STATUS
121 EFIAPI
122 EmuEnableInterrupt (
123 IN EFI_CPU_ARCH_PROTOCOL *This
124 );
125
126 EFI_STATUS
127 EFIAPI
128 EmuDisableInterrupt (
129 IN EFI_CPU_ARCH_PROTOCOL *This
130 );
131
132 EFI_STATUS
133 EFIAPI
134 EmuGetInterruptState (
135 IN EFI_CPU_ARCH_PROTOCOL *This,
136 OUT BOOLEAN *State
137 );
138
139 EFI_STATUS
140 EFIAPI
141 EmuInit (
142 IN EFI_CPU_ARCH_PROTOCOL *This,
143 IN EFI_CPU_INIT_TYPE InitType
144 );
145
146 EFI_STATUS
147 EFIAPI
148 EmuRegisterInterruptHandler (
149 IN EFI_CPU_ARCH_PROTOCOL *This,
150 IN EFI_EXCEPTION_TYPE InterruptType,
151 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
152 );
153
154 EFI_STATUS
155 EFIAPI
156 EmuGetTimerValue (
157 IN EFI_CPU_ARCH_PROTOCOL *This,
158 IN UINT32 TimerIndex,
159 OUT UINT64 *TimerValue,
160 OUT UINT64 *TimerPeriod OPTIONAL
161 );
162
163 EFI_STATUS
164 EFIAPI
165 EmuSetMemoryAttributes (
166 IN EFI_CPU_ARCH_PROTOCOL *This,
167 IN EFI_PHYSICAL_ADDRESS BaseAddress,
168 IN UINT64 Length,
169 IN UINT64 Attributes
170 );
171
172 #endif