[Sound-open-firmware] [PATCH] sram: registers: Fix panic so ROM status is not clobbered.

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Feb 21 18:26:27 CET 2018


Make sure we dont over write any ROM status and move "register" macros
into memory.h.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/platform/apollolake/include/platform/memory.h   |  6 ++++++
 src/platform/apollolake/include/platform/platform.h | 14 ++------------
 src/platform/cannonlake/include/platform/memory.h   |  6 ++++++
 src/platform/cannonlake/include/platform/platform.h | 16 +++-------------
 4 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/src/platform/apollolake/include/platform/memory.h b/src/platform/apollolake/include/platform/memory.h
index eca9a53..157be82 100644
--- a/src/platform/apollolake/include/platform/memory.h
+++ b/src/platform/apollolake/include/platform/memory.h
@@ -244,6 +244,12 @@
 #define SRAM_SW_REG_BASE	(SRAM_INBOX_BASE + SRAM_INBOX_SIZE)
 #define SRAM_SW_REG_SIZE	0x1000
 
+/* SRAM window 0 FW "registers" */
+#define SRAM_REG_ROM_STATUS	0x0
+#define SRAM_REG_FW_STATUS	0x4
+#define SRAM_REG_FW_TRACEP	0x8
+#define SRAM_REG_FW_END		0xc
+
 #define SRAM_OUTBOX_BASE	(SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE)
 #define SRAM_OUTBOX_SIZE	0x1000
 
diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h
index 4165b95..8e18d53 100644
--- a/src/platform/apollolake/include/platform/platform.h
+++ b/src/platform/apollolake/include/platform/platform.h
@@ -85,10 +85,6 @@ struct reef;
 /* Host finish work(drain from host to dai) timeout in microseconds */
 #define PLATFORM_HOST_FINISH_TIMEOUT	50000
 
-// TODO: move to SW reg header
-#define SW_REG_STATUS	0x0
-#define SW_REG_ERRCODE	0x04
-
 /* local buffer size of DMA tracing */
 #define DMA_TRACE_LOCAL_SIZE	HOST_PAGE_SIZE
 
@@ -109,17 +105,11 @@ struct reef;
 
 /* Platform defined panic code */
 #define platform_panic(__x) \
-	sw_reg_write(SW_REG_STATUS, (0xdead000 | __x) & 0x3fffffff)
+	sw_reg_write(SRAM_REG_FW_STATUS, (0xdead000 | __x) & 0x3fffffff)
 
 /* Platform defined trace code */
-#if USE_SW_REG_STATUS
-#define platform_trace_point(__x) \
-	sw_reg_write(SW_REG_STATUS, (0xace0000 | __x) & 0x3fffffff));\
-	sw_reg_write(SW_REG_ERRCODE, __x)
-#else	//using SW_REG_STATUS may influence the ROM status, don't do that atm.
 #define platform_trace_point(__x) \
-	sw_reg_write(SW_REG_ERRCODE, __x)
-#endif
+	sw_reg_write(SRAM_REG_FW_TRACEP, __x)
 
 struct timer *platform_timer;
 
diff --git a/src/platform/cannonlake/include/platform/memory.h b/src/platform/cannonlake/include/platform/memory.h
index 06b27f3..7e7af82 100644
--- a/src/platform/cannonlake/include/platform/memory.h
+++ b/src/platform/cannonlake/include/platform/memory.h
@@ -189,6 +189,12 @@
 #define SRAM_SW_REG_BASE	(HP_SRAM_BASE + 0x4000)
 #define SRAM_SW_REG_SIZE	0x1000
 
+/* SRAM window 0 FW "registers" */
+#define SRAM_REG_ROM_STATUS	0x0
+#define SRAM_REG_FW_STATUS	0x4
+#define SRAM_REG_FW_TRACEP	0x8
+#define SRAM_REG_FW_END		0xc
+
 #define SRAM_OUTBOX_BASE	(SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE)
 #define SRAM_OUTBOX_SIZE	0x1000
 
diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h
index f29af95..06a5599 100644
--- a/src/platform/cannonlake/include/platform/platform.h
+++ b/src/platform/cannonlake/include/platform/platform.h
@@ -89,10 +89,6 @@ struct reef;
 /* Host finish work(drain from host to dai) timeout in microseconds */
 #define PLATFORM_HOST_FINISH_TIMEOUT	50000
 
-// TODO: move to SW reg header
-#define SW_REG_STATUS	0x0
-#define SW_REG_ERRCODE	0x04
-
 /* local buffer size of DMA tracing */
 #define DMA_TRACE_LOCAL_SIZE	HOST_PAGE_SIZE
 
@@ -111,19 +107,13 @@ struct reef;
 /* DSP should be idle in this time frame */
 #define PLATFORM_IDLE_TIME	750000
 
-/* Platform defined panic code */
+/* Platform defined trace code */
 #define platform_panic(__x) \
-	sw_reg_write(SW_REG_STATUS, (0xdead000 | __x) & 0x3fffffff)
+	sw_reg_write(SRAM_REG_FW_STATUS, (0xdead000 | __x) & 0x3fffffff)
 
 /* Platform defined trace code */
-#if USE_SW_REG_STATUS
 #define platform_trace_point(__x) \
-	sw_reg_write(SW_REG_STATUS, (0xace0000 | __x) & 0x3fffffff));\
-	sw_reg_write(SW_REG_ERRCODE, __x)
-#else	//using SW_REG_STATUS may influence the ROM status, don't do that atm.
-#define platform_trace_point(__x) \
-	sw_reg_write(SW_REG_ERRCODE, __x)
-#endif
+	sw_reg_write(SRAM_REG_FW_TRACEP, __x)
 
 struct timer *platform_timer;
 
-- 
2.14.1



More information about the Sound-open-firmware mailing list