VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h@ 101291

最後變更 在這個檔案從101291是 101291,由 vboxsync 提交於 18 月 前

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 6.6 KB
 
1/** @file
2 RISC-V CPU DXE module header file.
3
4 Copyright (c) 2016 - 2022, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef CPU_DXE_H_
11#define CPU_DXE_H_
12
13#include <PiDxe.h>
14
15#include <Protocol/Cpu.h>
16#include <Protocol/RiscVBootProtocol.h>
17#include <Library/BaseRiscVSbiLib.h>
18#include <Library/BaseRiscVMmuLib.h>
19#include <Library/BaseLib.h>
20#include <Library/CpuExceptionHandlerLib.h>
21#include <Library/DebugLib.h>
22#include <Library/UefiBootServicesTableLib.h>
23#include <Library/UefiDriverEntryPoint.h>
24#include <Register/RiscV64/RiscVEncoding.h>
25
26/**
27 Flush CPU data cache. If the instruction cache is fully coherent
28 with all DMA operations then function can just return EFI_SUCCESS.
29
30 @param This Protocol instance structure
31 @param Start Physical address to start flushing from.
32 @param Length Number of bytes to flush. Round up to chipset
33 granularity.
34 @param FlushType Specifies the type of flush operation to perform.
35
36 @retval EFI_SUCCESS If cache was flushed
37 @retval EFI_UNSUPPORTED If flush type is not supported.
38 @retval EFI_DEVICE_ERROR If requested range could not be flushed.
39
40**/
41EFI_STATUS
42EFIAPI
43CpuFlushCpuDataCache (
44 IN EFI_CPU_ARCH_PROTOCOL *This,
45 IN EFI_PHYSICAL_ADDRESS Start,
46 IN UINT64 Length,
47 IN EFI_CPU_FLUSH_TYPE FlushType
48 );
49
50/**
51 Enables CPU interrupts.
52
53 @param This Protocol instance structure
54
55 @retval EFI_SUCCESS If interrupts were enabled in the CPU
56 @retval EFI_DEVICE_ERROR If interrupts could not be enabled on the CPU.
57
58**/
59EFI_STATUS
60EFIAPI
61CpuEnableInterrupt (
62 IN EFI_CPU_ARCH_PROTOCOL *This
63 );
64
65/**
66 Disables CPU interrupts.
67
68 @param This Protocol instance structure
69
70 @retval EFI_SUCCESS If interrupts were disabled in the CPU.
71 @retval EFI_DEVICE_ERROR If interrupts could not be disabled on the CPU.
72
73**/
74EFI_STATUS
75EFIAPI
76CpuDisableInterrupt (
77 IN EFI_CPU_ARCH_PROTOCOL *This
78 );
79
80/**
81 Return the state of interrupts.
82
83 @param This Protocol instance structure
84 @param State Pointer to the CPU's current interrupt state
85
86 @retval EFI_SUCCESS If interrupts were disabled in the CPU.
87 @retval EFI_INVALID_PARAMETER State is NULL.
88
89**/
90EFI_STATUS
91EFIAPI
92CpuGetInterruptState (
93 IN EFI_CPU_ARCH_PROTOCOL *This,
94 OUT BOOLEAN *State
95 );
96
97/**
98 Generates an INIT to the CPU.
99
100 @param This Protocol instance structure
101 @param InitType Type of CPU INIT to perform
102
103 @retval EFI_SUCCESS If CPU INIT occurred. This value should never be
104 seen.
105 @retval EFI_DEVICE_ERROR If CPU INIT failed.
106 @retval EFI_UNSUPPORTED Requested type of CPU INIT not supported.
107
108**/
109EFI_STATUS
110EFIAPI
111CpuInit (
112 IN EFI_CPU_ARCH_PROTOCOL *This,
113 IN EFI_CPU_INIT_TYPE InitType
114 );
115
116/**
117 Registers a function to be called from the CPU interrupt handler.
118
119 @param This Protocol instance structure
120 @param InterruptType Defines which interrupt to hook. IA-32
121 valid range is 0x00 through 0xFF
122 @param InterruptHandler A pointer to a function of type
123 EFI_CPU_INTERRUPT_HANDLER that is called
124 when a processor interrupt occurs. A null
125 pointer is an error condition.
126
127 @retval EFI_SUCCESS If handler installed or uninstalled.
128 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler
129 for InterruptType was previously installed.
130 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for
131 InterruptType was not previously installed.
132 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType
133 is not supported.
134
135**/
136EFI_STATUS
137EFIAPI
138CpuRegisterInterruptHandler (
139 IN EFI_CPU_ARCH_PROTOCOL *This,
140 IN EFI_EXCEPTION_TYPE InterruptType,
141 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
142 );
143
144/**
145 Returns a timer value from one of the CPU's internal timers. There is no
146 inherent time interval between ticks but is a function of the CPU frequency.
147
148 @param This - Protocol instance structure.
149 @param TimerIndex - Specifies which CPU timer is requested.
150 @param TimerValue - Pointer to the returned timer value.
151 @param TimerPeriod - A pointer to the amount of time that passes
152 in femtoseconds (10-15) for each increment
153 of TimerValue. If TimerValue does not
154 increment at a predictable rate, then 0 is
155 returned. The amount of time that has
156 passed between two calls to GetTimerValue()
157 can be calculated with the formula
158 (TimerValue2 - TimerValue1) * TimerPeriod.
159 This parameter is optional and may be NULL.
160
161 @retval EFI_SUCCESS - If the CPU timer count was returned.
162 @retval EFI_UNSUPPORTED - If the CPU does not have any readable timers.
163 @retval EFI_DEVICE_ERROR - If an error occurred while reading the timer.
164 @retval EFI_INVALID_PARAMETER - TimerIndex is not valid or TimerValue is NULL.
165
166**/
167EFI_STATUS
168EFIAPI
169CpuGetTimerValue (
170 IN EFI_CPU_ARCH_PROTOCOL *This,
171 IN UINT32 TimerIndex,
172 OUT UINT64 *TimerValue,
173 OUT UINT64 *TimerPeriod OPTIONAL
174 );
175
176/**
177 Set memory cacheability attributes for given range of memeory.
178
179 @param This Protocol instance structure
180 @param BaseAddress Specifies the start address of the
181 memory range
182 @param Length Specifies the length of the memory range
183 @param Attributes The memory cacheability for the memory range
184
185 @retval EFI_SUCCESS If the cacheability of that memory range is
186 set successfully
187 @retval EFI_UNSUPPORTED If the desired operation cannot be done
188 @retval EFI_INVALID_PARAMETER The input parameter is not correct,
189 such as Length = 0
190
191**/
192EFI_STATUS
193EFIAPI
194CpuSetMemoryAttributes (
195 IN EFI_CPU_ARCH_PROTOCOL *This,
196 IN EFI_PHYSICAL_ADDRESS BaseAddress,
197 IN UINT64 Length,
198 IN UINT64 Attributes
199 );
200
201#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette