]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
UefiCpuPkg/MpLib.c: Load microcode before mtrr sync per IA32 SDM
[mirror_edk2.git] / ArmPkg / Drivers / ArmCpuLib / ArmCortexA5xLib / ArmCortexA5xLib.c
... / ...
CommitLineData
1/** @file\r
2\r
3 Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
4\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Base.h>\r
16#include <Library/ArmLib.h>\r
17#include <Library/ArmCpuLib.h>\r
18#include <Library/ArmGenericTimerCounterLib.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/PcdLib.h>\r
21\r
22#include <Chipset/ArmCortexA5x.h>\r
23\r
24VOID\r
25ArmCpuSetup (\r
26 IN UINTN MpId\r
27 )\r
28{\r
29 // Check if Architectural Timer frequency is valid number (should not be 0)\r
30 ASSERT (PcdGet32 (PcdArmArchTimerFreqInHz));\r
31 ASSERT (ArmIsArchTimerImplemented () != 0);\r
32\r
33 // Note: System Counter frequency can only be set in Secure privileged mode,\r
34 // if security extensions are implemented.\r
35 ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));\r
36\r
37 if (ArmIsMpCore ()) {\r
38 // Turn on SMP coherency\r
39 ArmSetCpuExCrBit (A5X_FEATURE_SMP);\r
40 }\r
41\r
42 //\r
43 // If CPU is CortexA57 r0p0 apply Errata workarounds\r
44 //\r
45 if ((ArmReadMidr () & ((ARM_CPU_TYPE_MASK << 4) | ARM_CPU_REV_MASK)) ==\r
46 ((ARM_CPU_TYPE_A57 << 4) | ARM_CPU_REV(0,0))) {\r
47\r
48 // Errata 806969: DisableLoadStoreWB (1ULL << 49)\r
49 // Errata 813420: Execute Data Cache clean as Data Cache clean/invalidate (1ULL << 44)\r
50 // Errata 814670: disable DMB nullification (1ULL << 58)\r
51 ArmSetCpuActlrBit ( (1ULL << 49) | (1ULL << 44) | (1ULL << 58) );\r
52 }\r
53}\r
54\r
55VOID\r
56ArmCpuSetupSmpNonSecure (\r
57 IN UINTN MpId\r
58 )\r
59{\r
60}\r
61\r
62VOID\r
63EFIAPI\r
64ArmSetCpuExCrBit (\r
65 IN UINT64 Bits\r
66 )\r
67{\r
68 UINT64 Value;\r
69 Value = ArmReadCpuExCr ();\r
70 Value |= Bits;\r
71 ArmWriteCpuExCr (Value);\r
72}\r
73\r
74VOID\r
75EFIAPI\r
76ArmUnsetCpuExCrBit (\r
77 IN UINT64 Bits\r
78 )\r
79{\r
80 UINT64 Value;\r
81 Value = ArmReadCpuExCr ();\r
82 Value &= ~Bits;\r
83 ArmWriteCpuExCr (Value);\r
84}\r