iommu: msm: don't rely on structure format coming from TZ
The format of the secure fault register dump structure in TZ could
change over time. However, it should always adhere to the following
format (each row is 4 bytes wide):
|-----------|
| dump_size |
| reg1_addr |
| reg1_val |
| ... |
| regn_addr |
| regn_val |
|-----------|
Rather than relying on the format of the structure, iterate over
the (addr, value) pairs.
Change-Id: I811c7781d6db11ef1eb07c0c1608b8db6978a758
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/iommu.h b/arch/arm/mach-msm/include/mach/iommu.h
index 68cfb2e..eeda7ce 100644
--- a/arch/arm/mach-msm/include/mach/iommu.h
+++ b/arch/arm/mach-msm/include/mach/iommu.h
@@ -188,21 +188,31 @@
int attach_count;
};
-struct msm_iommu_context_regs {
- uint32_t far;
- uint32_t par;
- uint32_t fsr;
- uint32_t fsynr0;
- uint32_t fsynr1;
- uint32_t ttbr0;
- uint32_t ttbr1;
- uint32_t sctlr;
- uint32_t actlr;
- uint32_t prrr;
- uint32_t nmrr;
+enum dump_reg {
+ DUMP_REG_FAR0,
+ DUMP_REG_FAR1,
+ DUMP_REG_PAR0,
+ DUMP_REG_PAR1,
+ DUMP_REG_FSR,
+ DUMP_REG_FSYNR0,
+ DUMP_REG_FSYNR1,
+ DUMP_REG_TTBR0,
+ DUMP_REG_TTBR1,
+ DUMP_REG_SCTLR,
+ DUMP_REG_ACTLR,
+ DUMP_REG_PRRR,
+ DUMP_REG_NMRR,
+ MAX_DUMP_REGS,
};
-void print_ctx_regs(struct msm_iommu_context_regs *regs);
+#define COMBINE_DUMP_REG(upper, lower) (((u64) upper << 32) | lower)
+
+struct msm_iommu_context_reg {
+ uint32_t val;
+ bool valid;
+};
+
+void print_ctx_regs(struct msm_iommu_context_reg regs[]);
/*
* Interrupt handler for the IOMMU context fault interrupt. Hooking the