brbe.c 512 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <arch_features.h>
  8. #include <arch_helpers.h>
  9. #include <lib/extensions/brbe.h>
  10. void brbe_init_el3(void)
  11. {
  12. uint64_t val;
  13. /*
  14. * MDCR_EL3.SBRBE = 0b01
  15. *
  16. * Allows BRBE usage in non-secure world and prohibited in
  17. * secure world.
  18. */
  19. val = read_mdcr_el3();
  20. val &= ~(MDCR_SBRBE_MASK << MDCR_SBRBE_SHIFT);
  21. val |= (0x1UL << MDCR_SBRBE_SHIFT);
  22. write_mdcr_el3(val);
  23. }