]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Drivers/CpuDxe/Exception.c
ArmPkg: delete references to unused guids/Pcds from CpuDxe
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / Exception.c
CommitLineData
5811eea0
EC
1/** @file\r
2\r
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
4 Portions Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "CpuDxe.h"\r
17#include <Library/CpuExceptionHandlerLib.h>\r
18#include <Guid/VectorHandoffTable.h>\r
19\r
20EFI_STATUS\r
21InitializeExceptions (\r
22 IN EFI_CPU_ARCH_PROTOCOL *Cpu\r
23 ) {\r
24 EFI_STATUS Status;\r
25 EFI_VECTOR_HANDOFF_INFO *VectorInfoList;\r
26 EFI_VECTOR_HANDOFF_INFO *VectorInfo;\r
27 BOOLEAN IrqEnabled;\r
28 BOOLEAN FiqEnabled;\r
29\r
30 VectorInfo = (EFI_VECTOR_HANDOFF_INFO *)NULL;\r
31 Status = EfiGetSystemConfigurationTable(&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);\r
32 if (Status == EFI_SUCCESS && VectorInfoList != NULL) {\r
33 VectorInfo = VectorInfoList;\r
34 }\r
35\r
36 // intialize the CpuExceptionHandlerLib so we take over the exception vector table from the DXE Core\r
37 InitializeCpuExceptionHandlers(VectorInfo);\r
38\r
39 Status = EFI_SUCCESS;\r
40\r
41 //\r
42 // Disable interrupts\r
43 //\r
44 Cpu->GetInterruptState (Cpu, &IrqEnabled);\r
45 Cpu->DisableInterrupt (Cpu);\r
46\r
47 //\r
48 // EFI does not use the FIQ, but a debugger might so we must disable\r
49 // as we take over the exception vectors.\r
50 //\r
51 FiqEnabled = ArmGetFiqState ();\r
52 ArmDisableFiq ();\r
53\r
54 if (FiqEnabled) {\r
55 ArmEnableFiq ();\r
56 }\r
57\r
58 if (IrqEnabled) {\r
59 //\r
60 // Restore interrupt state\r
61 //\r
62 Status = Cpu->EnableInterrupt (Cpu);\r
63 }\r
64\r
3b3593b5
AB
65 //\r
66 // On a DEBUG build, unmask SErrors so they are delivered right away rather\r
67 // than when the OS unmasks them. This gives us a better chance of figuring\r
68 // out the cause.\r
69 //\r
70 DEBUG_CODE (\r
71 ArmEnableAsynchronousAbort ();\r
72 );\r
73\r
5811eea0
EC
74 return Status;\r
75}\r
76\r
77/**\r
78This function registers and enables the handler specified by InterruptHandler for a processor\r
79interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
80handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
81The installed handler is called once for each processor interrupt or exception.\r
82\r
83@param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts\r
84are enabled and FALSE if interrupts are disabled.\r
85@param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
86when a processor interrupt occurs. If this parameter is NULL, then the handler\r
87will be uninstalled.\r
88\r
89@retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
90@retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was\r
91previously installed.\r
92@retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
93previously installed.\r
94@retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
95\r
96**/\r
97EFI_STATUS\r
98RegisterInterruptHandler(\r
99 IN EFI_EXCEPTION_TYPE InterruptType,\r
100 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
101 ) {\r
102 // pass down to CpuExceptionHandlerLib\r
103 return (EFI_STATUS)RegisterCpuInterruptHandler(InterruptType, InterruptHandler);\r
104}\r