summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2019-05-24 05:28:05 +0300
committerAnup Patel <anup@brainfault.org>2019-05-24 05:52:47 +0300
commit95b7480ab4b438cf545afae200b40012e83f1dda (patch)
tree44e30d69d4222833e36d3092005ac0a09b45f391 /include
parent2dfed32c463eef80a0eea7108117ce18dc80c527 (diff)
downloadopensbi-95b7480ab4b438cf545afae200b40012e83f1dda.tar.xz
lib: Factor-out TLB management from IPI management
This patch factor-out TLB management from IPI management to separate sources sbi_tlb.c and sbi_tlb.h. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/riscv_asm.h3
-rw-r--r--include/sbi/sbi_ipi.h16
-rw-r--r--include/sbi/sbi_tlb.h48
3 files changed, 48 insertions, 19 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h
index 704c53c..4f12c03 100644
--- a/include/sbi/riscv_asm.h
+++ b/include/sbi/riscv_asm.h
@@ -32,9 +32,6 @@
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
-#define SBI_TLB_FLUSH_ALL ((unsigned long)-1)
-#define SBI_TLB_FLUSH_MAX_SIZE (1UL << 30)
-
#define REG_L __REG_SEL(ld, lw)
#define REG_S __REG_SEL(sd, sw)
#define SZREG __REG_SEL(8, 4)
diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h
index 108e5aa..b8afb5b 100644
--- a/include/sbi/sbi_ipi.h
+++ b/include/sbi/sbi_ipi.h
@@ -22,28 +22,12 @@
/* clang-format on */
-#define SBI_TLB_FIFO_NUM_ENTRIES 4
-enum sbi_tlb_info_types {
- SBI_TLB_FLUSH_VMA,
- SBI_TLB_FLUSH_VMA_ASID,
- SBI_TLB_FLUSH_VMA_VMID
-};
-
struct sbi_scratch;
struct sbi_ipi_data {
unsigned long ipi_type;
};
-struct sbi_tlb_info {
- unsigned long start;
- unsigned long size;
- unsigned long asid;
- unsigned long type;
-};
-
-#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
-
int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong *pmask, u32 event,
void *data);
diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h
new file mode 100644
index 0000000..f3d93d4
--- /dev/null
+++ b/include/sbi/sbi_tlb.h
@@ -0,0 +1,48 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates.
+ *
+ * Authors:
+ * Atish Patra <atish.patra@wdc.com>
+ * Anup Patel <anup.patel@wdc.com>
+ */
+
+#ifndef __SBI_TLB_H__
+#define __SBI_TLB_H__
+
+#include <sbi/sbi_types.h>
+
+/* clang-format off */
+
+#define SBI_TLB_FLUSH_ALL ((unsigned long)-1)
+#define SBI_TLB_FLUSH_MAX_SIZE (1UL << 30)
+
+/* clang-format on */
+
+#define SBI_TLB_FIFO_NUM_ENTRIES 4
+
+enum sbi_tlb_info_types {
+ SBI_TLB_FLUSH_VMA,
+ SBI_TLB_FLUSH_VMA_ASID,
+ SBI_TLB_FLUSH_VMA_VMID
+};
+
+struct sbi_scratch;
+
+struct sbi_tlb_info {
+ unsigned long start;
+ unsigned long size;
+ unsigned long asid;
+ unsigned long type;
+};
+
+#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
+
+int sbi_tlb_fifo_update(struct sbi_scratch *scratch, u32 event, void *data);
+
+void sbi_tlb_fifo_process(struct sbi_scratch *scratch, u32 event);
+
+int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot);
+
+#endif