summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_bitops.h16
-rw-r--r--include/sbi/sbi_hart.h2
2 files changed, 16 insertions, 2 deletions
diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h
index 2e08947b..48a20901 100644
--- a/include/sbi/sbi_bitops.h
+++ b/include/sbi/sbi_bitops.h
@@ -112,6 +112,22 @@ static inline unsigned long sbi_fls(unsigned long word)
return num;
}
+/**
+ * sbi_popcount - find the number of set bit in a long word
+ * @word: the word to search
+ */
+static inline unsigned long sbi_popcount(unsigned long word)
+{
+ unsigned long count = 0;
+
+ while (word) {
+ word &= word - 1;
+ count++;
+ }
+
+ return count;
+}
+
#define for_each_set_bit(bit, addr, size) \
for ((bit) = find_first_bit((addr), (size)); \
(bit) < (size); \
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 17d3ada9..e60f4150 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -69,7 +69,6 @@ struct sbi_hart_features {
unsigned int pmp_count;
unsigned int pmp_addr_bits;
unsigned long pmp_gran;
- unsigned int mhpm_count;
unsigned int mhpm_mask;
unsigned int mhpm_bits;
};
@@ -85,7 +84,6 @@ static inline ulong sbi_hart_expected_trap_addr(void)
return (ulong)sbi_hart_expected_trap;
}
-unsigned int sbi_hart_mhpm_count(struct sbi_scratch *scratch);
unsigned int sbi_hart_mhpm_mask(struct sbi_scratch *scratch);
void sbi_hart_delegation_dump(struct sbi_scratch *scratch,
const char *prefix, const char *suffix);