StarFiveJH7110.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. { .compatible = "starfive,jh7110" },
  38. { },
  39. };
  40. const struct platform_override sifive_fu540 = {
  41. .match_table = sifive_fu540_match,
  42. .tlbr_flush_limit = sifive_fu540_tlbr_flush_limit,
  43. .fdt_fixup = sifive_fu540_fdt_fixup,
  44. };
  45. const struct platform_override *special_platforms[] = {
  46. &sifive_fu540,
  47. };
  48. INTN NumberOfPlaformsInArray = array_size(special_platforms);