]> git.proxmox.com Git - mirror_edk2.git/blob - EmbeddedPkg/TemplateCpuDxe/CpuDxe.h
Fix VS2003 cast issue
[mirror_edk2.git] / EmbeddedPkg / TemplateCpuDxe / CpuDxe.h
1 /** @file
2
3 Copyright (c) 2006 - 2008, Intel Corporation <BR>
4 Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
5
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16
17 #include <PiDxe.h>
18
19 #include <Library/BaseLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/MemoryAllocationLib.h>
25 #include <Library/DxeServicesTableLib.h>
26 #include <Library/UefiRuntimeServicesTableLib.h>
27 #include <Library/PcdLib.h>
28
29 #include <Protocol/Cpu.h>
30 #include <Protocol/DebugSupport.h>
31
32
33
34 /**
35 This function registers and enables the handler specified by InterruptHandler for a processor
36 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
37 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
38 The installed handler is called once for each processor interrupt or exception.
39
40 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
41 are enabled and FALSE if interrupts are disabled.
42 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
43 when a processor interrupt occurs. If this parameter is NULL, then the handler
44 will be uninstalled.
45
46 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
47 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
48 previously installed.
49 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
50 previously installed.
51 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
52
53 **/
54 EFI_STATUS
55 RegisterInterruptHandler (
56 IN EFI_EXCEPTION_TYPE InterruptType,
57 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
58 );
59
60
61 EFI_STATUS
62 InitializeExceptions (
63 IN EFI_CPU_ARCH_PROTOCOL *Cpu
64 );
65
66
67 /**
68 This function reads the processor timer specified by TimerIndex and returns it in TimerValue.
69
70 @param TimerIndex Specifies which processor timer is to be returned in TimerValue. This parameter
71 must be between 0 and NumberOfTimers-1.
72 @param TimerValue Pointer to the returned timer value.
73 @param TimerPeriod A pointer to the amount of time that passes in femtoseconds for each increment
74 of TimerValue.
75
76 @retval EFI_SUCCESS The processor timer value specified by TimerIndex was returned in TimerValue.
77 @retval EFI_DEVICE_ERROR An error occurred attempting to read one of the processor's timers.
78 @retval EFI_INVALID_PARAMETER TimerValue is NULL or TimerIndex is not valid.
79 @retval EFI_UNSUPPORTED The processor does not have any readable timers.
80
81 **/
82 EFI_STATUS
83 GetTimerValue (
84 IN UINT32 TimerIndex,
85 OUT UINT64 *TimerValue,
86 OUT UINT64 *TimerPeriod OPTIONAL
87 );
88
89
90 /**
91 This function flushes the range of addresses from Start to Start+Length
92 from the processor's data cache. If Start is not aligned to a cache line
93 boundary, then the bytes before Start to the preceding cache line boundary
94 are also flushed. If Start+Length is not aligned to a cache line boundary,
95 then the bytes past Start+Length to the end of the next cache line boundary
96 are also flushed. The FlushType of EfiCpuFlushTypeWriteBackInvalidate must be
97 supported. If the data cache is fully coherent with all DMA operations, then
98 this function can just return EFI_SUCCESS. If the processor does not support
99 flushing a range of the data cache, then the entire data cache can be flushed.
100
101 @param Start The beginning physical address to flush from the processor's data
102 cache.
103 @param Length The number of bytes to flush from the processor's data cache. This
104 function may flush more bytes than Length specifies depending upon
105 the granularity of the flush operation that the processor supports.
106 @param FlushType Specifies the type of flush operation to perform.
107
108 @retval EFI_SUCCESS The address range from Start to Start+Length was flushed from
109 the processor's data cache.
110 @retval EFI_UNSUPPORTED The processor does not support the cache flush type specified
111 by FlushType.
112 @retval EFI_DEVICE_ERROR The address range from Start to Start+Length could not be flushed
113 from the processor's data cache.
114
115 **/
116 EFI_STATUS
117 EFIAPI
118 FlushCpuDataCache (
119 IN EFI_PHYSICAL_ADDRESS Start,
120 IN UINT64 Length,
121 IN EFI_CPU_FLUSH_TYPE FlushType
122 );
123
124