ArchPrePi.c 788 B

12345678910111213141516171819202122232425262728293031323334
  1. /** @file
  2. *
  3. * Copyright (c) 2011-2017, ARM Limited. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. *
  7. **/
  8. #include "PrePi.h"
  9. #include <Chipset/AArch64.h>
  10. VOID
  11. ArchInitialize (
  12. VOID
  13. )
  14. {
  15. // Enable Floating Point
  16. if (FixedPcdGet32 (PcdVFPEnabled)) {
  17. ArmEnableVFP ();
  18. }
  19. if (ArmReadCurrentEL () == AARCH64_EL2) {
  20. // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
  21. ArmWriteHcr (ARM_HCR_TGE);
  22. /* Enable Timer access for non-secure EL1 and EL0
  23. The cnthctl_el2 register bits are architecturally
  24. UNKNOWN on reset.
  25. Disable event stream as it is not in use at this stage
  26. */
  27. ArmWriteCntHctl (CNTHCTL_EL2_EL1PCTEN | CNTHCTL_EL2_EL1PCEN);
  28. }
  29. }