diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-03-03 17:11:09 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-11 12:59:55 +0300 |
commit | a4a6a81b7d69b39f4d806e96e6b54a9e0e36d3f3 (patch) | |
tree | e176a44772efabfc73b110fdbd80a8c295dc8fdb /lib/sbi/sbi_ecall_replace.c | |
parent | d6d7e18d1d12c8eda2591f21a70d31dd95c2d32e (diff) | |
download | opensbi-a4a6a81b7d69b39f4d806e96e6b54a9e0e36d3f3.tar.xz |
lib: Introduce SBI_TLB_INFO_INIT() helper macro
We introduce SBI_TLB_INFO_INIT() helper macro to help easy
initialization of struct sbi_tlb_info which is passed to the
sbi_tlb_request() API.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ecall_replace.c')
-rw-r--r-- | lib/sbi/sbi_ecall_replace.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/lib/sbi/sbi_ecall_replace.c b/lib/sbi/sbi_ecall_replace.c index 7728d60..57760f8 100644 --- a/lib/sbi/sbi_ecall_replace.c +++ b/lib/sbi/sbi_ecall_replace.c @@ -59,58 +59,40 @@ static int sbi_ecall_rfence_handler(struct sbi_scratch *scratch, switch (funcid) { case SBI_EXT_RFENCE_REMOTE_FENCE_I: - tlb_info.start = 0; - tlb_info.size = 0; - tlb_info.type = SBI_ITLB_FLUSH; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, + SBI_ITLB_FLUSH, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.type = SBI_TLB_FLUSH_GVMA; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, + SBI_TLB_FLUSH_GVMA, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.asid = (unsigned long)args[4]; - tlb_info.type = SBI_TLB_FLUSH_GVMA_VMID; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4], + SBI_TLB_FLUSH_GVMA_VMID, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.type = SBI_TLB_FLUSH_VVMA; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, + SBI_TLB_FLUSH_VVMA, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.asid = (unsigned long)args[4]; - tlb_info.type = SBI_TLB_FLUSH_VVMA_ASID; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4], + SBI_TLB_FLUSH_VVMA_ASID, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.type = SBI_TLB_FLUSH_VMA; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], 0, + SBI_TLB_FLUSH_VMA, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID: - tlb_info.start = (unsigned long)args[2]; - tlb_info.size = (unsigned long)args[3]; - tlb_info.asid = (unsigned long)args[4]; - tlb_info.type = SBI_TLB_FLUSH_VMA_ASID; - tlb_info.shart_mask = 1UL << source_hart; + SBI_TLB_INFO_INIT(&tlb_info, args[2], args[3], args[4], + SBI_TLB_FLUSH_VMA_ASID, source_hart); ret = sbi_tlb_request(scratch, args[0], args[1], &tlb_info); break; - default: ret = SBI_ENOTSUPP; }; |