refactor: add interrupt_bitmap struct

Since bitmaps for tracking interrupt IDs are used in both
manifest parsing as well as interrupt handling make a common
struct that can be used. Also introduce helper functions for
accessing and modifying the bitmap.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: Icbbc931d732bf7075f854adbe517c6ea341dc5d0
diff --git a/src/manifest.c b/src/manifest.c
index 58a2ff2..1108c93 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -43,7 +43,7 @@
  * in the manifest.
  */
 struct allocated_fields {
-	uint32_t intids[HF_NUM_INTIDS / INTERRUPT_REGISTER_BITS];
+	struct interrupt_bitmap intids;
 	struct {
 		uintptr_t base;
 		uintptr_t limit;
@@ -543,7 +543,7 @@
 	struct uint32list_iter list;
 	uint16_t i = 0;
 	uint32_t j = 0;
-	uint32_t *allocated_intids = allocated_fields->intids;
+	struct interrupt_bitmap allocated_intids = allocated_fields->intids;
 
 	dlog_verbose("  Partition Device Regions\n");
 
@@ -604,23 +604,19 @@
 		while (uint32list_has_next(&list) &&
 		       j < PARTITION_MAX_INTERRUPTS_PER_DEVICE) {
 			uint32_t intid;
-			uint32_t intid_index;
-			uint32_t intid_mask;
 
 			TRY(uint32list_get_next(
 				&list, &dev_regions[i].interrupts[j].id));
 			intid = dev_regions[i].interrupts[j].id;
-			intid_index = INTID_INDEX(intid);
-			intid_mask = INTID_MASK(1U, intid);
 
 			dlog_verbose("        ID = %u\n", intid);
 
-			if ((allocated_intids[intid_index] & intid_mask) !=
-			    0U) {
+			if (interrupt_bitmap_get_value(&allocated_intids,
+						       intid) == 1U) {
 				return MANIFEST_ERROR_INTERRUPT_ID_REPEATED;
 			}
 
-			allocated_intids[intid_index] |= intid_mask;
+			interrupt_bitmap_set_value(&allocated_intids, intid);
 
 			if (uint32list_has_next(&list)) {
 				TRY(uint32list_get_next(&list,