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>
This commit is contained in:
Anup Patel
2020-03-03 19:41:09 +05:30
committed by Anup Patel
parent d6d7e18d1d
commit a4a6a81b7d
3 changed files with 36 additions and 49 deletions

View File

@@ -41,7 +41,16 @@ struct sbi_tlb_info {
unsigned long shart_mask;
};
#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
#define SBI_TLB_INFO_INIT(__ptr, __start, __size, __asid, __type, __src_hart) \
do { \
(__ptr)->start = (__start); \
(__ptr)->size = (__size); \
(__ptr)->asid = (__asid); \
(__ptr)->type = (__type); \
(__ptr)->shart_mask = 1UL << (__src_hart); \
} while (0)
#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
int sbi_tlb_request(struct sbi_scratch *scratch, ulong hmask,
ulong hbase, struct sbi_tlb_info *tinfo);