lib: sbi: Detect number of bits implemented in mhpmcounter
authorAtish Patra <atish.patra@wdc.com>
Sat, 10 Jul 2021 16:18:05 +0000 (09:18 -0700)
committerAnup Patel <anup@brainfault.org>
Sun, 11 Jul 2021 04:43:04 +0000 (10:13 +0530)
commit0829f2bc284c07576a0dc9a569beea2a2d68dc3d
treee8356644ff35aad82bcca04a0cce4d6dd91f0e76
parentd3a96cc46989783c2fbb47e11349dbd5d652938d
lib: sbi: Detect number of bits implemented in mhpmcounter

RISC-V privilege specification allows the implementation to have less
than 64 bits.

Add a function to detect the number of implemented bits in mhpmcounter
dynamically at runtime.

Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
include/sbi/sbi_hart.h
lib/sbi/sbi_hart.c