summaryrefslogtreecommitdiff
path: root/platform/generic/starfive/dubhe.c
diff options
context:
space:
mode:
authorWei Liang Lim <weiliang.lim@starfivetech.com>2023-12-01 18:14:15 +0300
committerWei Liang Lim <weiliang.lim@starfivetech.com>2023-12-01 18:14:15 +0300
commit8ce81d0fbcbb10d4ad9e924c8cd64925b79e0cb6 (patch)
tree1cbe18738902e003105f48aeed84a8bcf4507169 /platform/generic/starfive/dubhe.c
parenta10e0837f215fb4ed25f195f2c511a41deb9c324 (diff)
downloadopensbi-starfive-v1.2-dubhe.tar.xz
platform: generic: starfive: Changing naming from jh8100 to dubheREL_DUBHE_DEC2023starfive-v1.2-dubhe
Signed-off-by: Wei Liang Lim <weiliang.lim@starfivetech.com>
Diffstat (limited to 'platform/generic/starfive/dubhe.c')
-rw-r--r--platform/generic/starfive/dubhe.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/platform/generic/starfive/dubhe.c b/platform/generic/starfive/dubhe.c
new file mode 100644
index 0000000..95ef611
--- /dev/null
+++ b/platform/generic/starfive/dubhe.c
@@ -0,0 +1,47 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2022 StarFive Technology Co., Ltd.
+ *
+ * Author: Jun Liang Tan <junliang.tan@linux.starfivetech.com>
+ *
+ */
+
+#include <cache.h>
+#include <dubhe.h>
+#include <platform_override.h>
+#include <sbi/sbi_console.h>
+#include <sbi_utils/fdt/fdt_helper.h>
+
+static int starfive_vendor_ext_provider(long extid, long funcid,
+ const struct sbi_trap_regs *regs,
+ unsigned long *out_value,
+ struct sbi_trap_info *out_trap,
+ const struct fdt_match *match)
+{
+ int ret = 0;
+
+ switch (funcid) {
+ case SBI_EXT_STARFIVE_DUBHE_L2_FLUSH:
+ __sbi_dubhe_L2_flush_range(regs->a0, regs->a1);
+ break;
+ case SBI_EXT_STARFIVE_DUBHE_L2_INVALIDATE:
+ __sbi_dubhe_L2_inv_range(regs->a0, regs->a1);
+ break;
+ default:
+ sbi_printf("Unsupported vendor sbi call : %ld\n", funcid);
+ asm volatile("ebreak");
+ }
+
+ return ret;
+}
+
+static const struct fdt_match starfive_dubhe_match[] = {
+ { .compatible = "starfive,dubhe" },
+ { },
+};
+
+const struct platform_override starfive_dubhe = {
+ .match_table = starfive_dubhe_match,
+ .vendor_ext_provider = starfive_vendor_ext_provider,
+};