SifiveFu540.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2020 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
  9. SPDX-License-Identifier: BSD-2-Clause-Patent
  10. */
  11. #include <Library/RiscVSpecialPlatformLib.h>
  12. #include <sbi_utils/fdt/fdt_helper.h>
  13. #include <sbi_utils/fdt/fdt_fixup.h>
  14. static u64 sifive_fu540_tlbr_flush_limit(const struct fdt_match *match)
  15. {
  16. /*
  17. * The sfence.vma by virtual address does not work on
  18. * SiFive FU540 so we return remote TLB flush limit as zero.
  19. */
  20. return 0;
  21. }
  22. static int sifive_fu540_fdt_fixup(void *fdt, const struct fdt_match *match)
  23. {
  24. /*
  25. * SiFive Freedom U540 has an erratum that prevents S-mode software
  26. * to access a PMP protected region using 1GB page table mapping, so
  27. * always add the no-map attribute on this platform.
  28. */
  29. fdt_reserved_memory_nomap_fixup(fdt);
  30. return 0;
  31. }
  32. static const struct fdt_match sifive_fu540_match[] = {
  33. { .compatible = "sifive,fu540" },
  34. { .compatible = "sifive,fu540g" },
  35. { .compatible = "sifive,fu540-c000" },
  36. { .compatible = "sifive,hifive-unleashed-a00" },
  37. { },
  38. };
  39. const struct platform_override sifive_fu540 = {
  40. .match_table = sifive_fu540_match,
  41. .tlbr_flush_limit = sifive_fu540_tlbr_flush_limit,
  42. .fdt_fixup = sifive_fu540_fdt_fixup,
  43. };
  44. const struct platform_override *special_platforms[] = {
  45. &sifive_fu540,
  46. };
  47. INTN NumberOfPlaformsInArray = array_size(special_platforms);