]>
Commit | Line | Data |
---|---|---|
15c9b25e AB |
1 | /** @file\r |
2 | ArmGicArchLib library class implementation for DT based virt platforms\r | |
3 | \r | |
4 | Copyright (c) 2015, Linaro 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 <Base.h>\r | |
17 | \r | |
18 | #include <Library/ArmGicLib.h>\r | |
19 | #include <Library/ArmGicArchLib.h>\r | |
20 | #include <Library/PcdLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | \r | |
23 | STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;\r | |
24 | \r | |
25 | RETURN_STATUS\r | |
26 | EFIAPI\r | |
27 | ArmVirtGicArchLibConstructor (\r | |
28 | VOID\r | |
29 | )\r | |
30 | {\r | |
31 | UINT32 IccSre;\r | |
32 | \r | |
33 | switch (PcdGet32 (PcdArmGicRevision)) {\r | |
34 | \r | |
35 | case 3:\r | |
36 | //\r | |
37 | // The default implementation of ArmGicArchLib is responsible for enabling\r | |
38 | // the system register interface on the GICv3 if one is found. So let's do\r | |
39 | // the same here.\r | |
40 | //\r | |
41 | IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r | |
42 | if (!(IccSre & ICC_SRE_EL2_SRE)) {\r | |
43 | ArmGicV3SetControlSystemRegisterEnable (IccSre | ICC_SRE_EL2_SRE);\r | |
44 | IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r | |
45 | }\r | |
46 | \r | |
47 | //\r | |
48 | // Unlike the default implementation, there is no fall through to GICv2\r | |
49 | // mode if this GICv3 cannot be driven in native mode due to the fact\r | |
50 | // that the System Register interface is unavailable.\r | |
51 | //\r | |
52 | ASSERT (IccSre & ICC_SRE_EL2_SRE);\r | |
53 | \r | |
54 | mGicArchRevision = ARM_GIC_ARCH_REVISION_3;\r | |
55 | break;\r | |
56 | \r | |
57 | case 2:\r | |
58 | mGicArchRevision = ARM_GIC_ARCH_REVISION_2;\r | |
59 | break;\r | |
60 | \r | |
61 | default:\r | |
62 | DEBUG ((EFI_D_ERROR, "%a: No GIC revision specified!\n", __FUNCTION__));\r | |
63 | return RETURN_NOT_FOUND;\r | |
64 | }\r | |
65 | return RETURN_SUCCESS;\r | |
66 | }\r | |
67 | \r | |
68 | ARM_GIC_ARCH_REVISION\r | |
69 | EFIAPI\r | |
70 | ArmGicGetSupportedArchRevision (\r | |
71 | VOID\r | |
72 | )\r | |
73 | {\r | |
74 | return mGicArchRevision;\r | |
75 | }\r |