3 Copyright (c) 2008-2009, Apple Inc. All rights reserved.
5 All rights reserved. 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
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.
17 BOOLEAN mInterruptState
= FALSE
;
21 CpuFlushCpuDataCache (
22 IN EFI_CPU_ARCH_PROTOCOL
*This
,
23 IN EFI_PHYSICAL_ADDRESS Start
,
25 IN EFI_CPU_FLUSH_TYPE FlushType
29 case EfiCpuFlushTypeWriteBack
:
30 WriteBackDataCacheRange ((VOID
*)(UINTN
)Start
, (UINTN
)Length
);
32 case EfiCpuFlushTypeInvalidate
:
33 InvalidateDataCacheRange ((VOID
*)(UINTN
)Start
, (UINTN
)Length
);
35 case EfiCpuFlushTypeWriteBackInvalidate
:
36 WriteBackInvalidateDataCacheRange ((VOID
*)(UINTN
)Start
, (UINTN
)Length
);
39 return EFI_INVALID_PARAMETER
;
48 IN EFI_CPU_ARCH_PROTOCOL
*This
51 ArmEnableInterrupts ();
53 mInterruptState
= TRUE
;
61 IN EFI_CPU_ARCH_PROTOCOL
*This
64 ArmDisableInterrupts ();
66 mInterruptState
= FALSE
;
72 CpuGetInterruptState (
73 IN EFI_CPU_ARCH_PROTOCOL
*This
,
78 return EFI_INVALID_PARAMETER
;
81 *State
= mInterruptState
;
88 IN EFI_CPU_ARCH_PROTOCOL
*This
,
89 IN EFI_CPU_INIT_TYPE InitType
92 return EFI_UNSUPPORTED
;
97 CpuRegisterInterruptHandler (
98 IN EFI_CPU_ARCH_PROTOCOL
*This
,
99 IN EFI_EXCEPTION_TYPE InterruptType
,
100 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
103 return RegisterInterruptHandler (InterruptType
, InterruptHandler
);
109 IN EFI_CPU_ARCH_PROTOCOL
*This
,
110 IN UINT32 TimerIndex
,
111 OUT UINT64
*TimerValue
,
112 OUT UINT64
*TimerPeriod OPTIONAL
115 return EFI_UNSUPPORTED
;
120 CpuSetMemoryAttributes (
121 IN EFI_CPU_ARCH_PROTOCOL
*This
,
122 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
127 return EFI_UNSUPPORTED
;
131 // Globals used to initialize the protocol
133 EFI_HANDLE mCpuHandle
= NULL
;
134 EFI_CPU_ARCH_PROTOCOL mCpu
= {
135 CpuFlushCpuDataCache
,
138 CpuGetInterruptState
,
140 CpuRegisterInterruptHandler
,
142 CpuSetMemoryAttributes
,
144 4, // DmaBufferAlignment
149 IN EFI_HANDLE ImageHandle
,
150 IN EFI_SYSTEM_TABLE
*SystemTable
153 InitializeExceptions (&mCpu
);
154 return gBS
->InstallMultipleProtocolInterfaces (&mCpuHandle
, &gEfiCpuArchProtocolGuid
, &mCpu
, NULL
);