dev-arm: Define enum masks for SMMU_CR0 register
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 22 Jul 2019 16:38:29 +0000 (17:38 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 25 Jul 2019 12:49:27 +0000 (12:49 +0000)
The configuration register is a vital register in the SMMU, and using
enum masks will make the code more readable/understandable

Change-Id: Ia117db56c457fe876ae38be391c386e502f34384
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Michiel Van Tol <michiel.vantol@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19632
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/arm/smmu_v3_defs.hh
src/dev/arm/smmu_v3_transl.cc

index 991e90c7bf4b13b5e89d4c68544d343d03bfaca1..d993fd7151b3cf9480efb628f6cc7c4fb9117c1d 100644 (file)
@@ -311,6 +311,15 @@ struct ContextDescriptor
     uint64_t _pad[3];
 };
 
+enum {
+    CR0_SMMUEN_MASK = 0x1,
+    CR0_PRIQEN_MASK = 0x2,
+    CR0_EVENTQEN_MASK = 0x4,
+    CR0_CMDQEN_MASK = 0x8,
+    CR0_ATSCHK_MASK = 0x10,
+    CR0_VMW_MASK = 0x1C0,
+};
+
 enum SMMUCommandType {
     CMD_PRF_CONFIG   = 0x1000,
     CMD_PRF_ADDR     = 0x1001,
index c1d998ea0f2f2b8da4fb5a37dc2ca07c2f2fd295..d7d5768830e64f0a271a6ae7992399c9d633879c 100644 (file)
@@ -155,8 +155,7 @@ SMMUTranslationProcess::main(Yield &yield)
 
     recvTick = curTick();
 
-
-    if (!(smmu.regs.cr0 & 0x1)) {
+    if (!(smmu.regs.cr0 & CR0_SMMUEN_MASK)) {
         // SMMU disabled
         doDelay(yield, Cycles(1));
         completeTransaction(yield, bypass(request.addr));