ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver
[mirror_edk2.git] / ArmPkg / Drivers / ArmGic / ArmGicDxe.h
1 /*++
2
3 Copyright (c) 2013-2017, ARM Ltd. All rights reserved.<BR>
4
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 __ARM_GIC_DXE_H__
16 #define __ARM_GIC_DXE_H__
17
18 #include <Library/ArmGicLib.h>
19 #include <Library/ArmLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/IoLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/UefiLib.h>
25
26 #include <Protocol/Cpu.h>
27 #include <Protocol/HardwareInterrupt.h>
28 #include <Protocol/HardwareInterrupt2.h>
29
30 extern UINTN mGicNumInterrupts;
31 extern HARDWARE_INTERRUPT_HANDLER *gRegisteredInterruptHandlers;
32
33 // Common API
34 EFI_STATUS
35 InstallAndRegisterInterruptService (
36 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *InterruptProtocol,
37 IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *Interrupt2Protocol,
38 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler,
39 IN EFI_EVENT_NOTIFY ExitBootServicesEvent
40 );
41
42 EFI_STATUS
43 EFIAPI
44 RegisterInterruptSource (
45 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
46 IN HARDWARE_INTERRUPT_SOURCE Source,
47 IN HARDWARE_INTERRUPT_HANDLER Handler
48 );
49
50 // GicV2 API
51 EFI_STATUS
52 GicV2DxeInitialize (
53 IN EFI_HANDLE ImageHandle,
54 IN EFI_SYSTEM_TABLE *SystemTable
55 );
56
57 // GicV3 API
58 EFI_STATUS
59 GicV3DxeInitialize (
60 IN EFI_HANDLE ImageHandle,
61 IN EFI_SYSTEM_TABLE *SystemTable
62 );
63
64
65 // Shared code
66
67 /**
68 Calculate GICD_ICFGRn base address and corresponding bit
69 field Int_config[1] of the GIC distributor register.
70
71 @param Source Hardware source of the interrupt.
72 @param RegAddress Corresponding GICD_ICFGRn base address.
73 @param Config1Bit Bit number of F Int_config[1] bit in the register.
74
75 @retval EFI_SUCCESS Source interrupt supported.
76 @retval EFI_UNSUPPORTED Source interrupt is not supported.
77 **/
78 EFI_STATUS
79 GicGetDistributorIcfgBaseAndBit (
80 IN HARDWARE_INTERRUPT_SOURCE Source,
81 OUT UINTN *RegAddress,
82 OUT UINTN *Config1Bit
83 );
84
85 #endif