refactor(mm): add `arch_mm_pte_type`
Add an `mm_pte_type` enum, and rewrite the
`arch_mm_pte_is_{absent,present,valid,block}` functions in terms of the
`arch_mm_pte_type` function.
In future commits, chains of if-else blocks can be replaced by a
`switch` on the enum.
Change-Id: I7434b3571cbc4303f13e54dae7fad1608c990b2a
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/inc/hf/mm.h b/inc/hf/mm.h
index 6023817..a307d5a 100644
--- a/inc/hf/mm.h
+++ b/inc/hf/mm.h
@@ -22,6 +22,22 @@
typedef uint8_t mm_level_t;
typedef uint16_t mm_asid_t;
+/*
+ * A page table entry (PTE) will take one of the following forms:
+ *
+ * 1. absent : There is no mapping.
+ * 2. invalid block : Represents a block that is not in the address space.
+ * 3. valid block : Represents a block that is in the address space.
+ * 4. table : Represents a reference to a table of PTEs.
+ * See Arm ARM, D8.3 (Translation table descriptor formats).
+ */
+enum mm_pte_type {
+ PTE_TYPE_ABSENT,
+ PTE_TYPE_INVALID_BLOCK,
+ PTE_TYPE_VALID_BLOCK,
+ PTE_TYPE_TABLE,
+};
+
/* Keep macro alignment */
/* clang-format off */