From: Marcin Maka marcin.maka@linux.intel.com
Common platform API separated to avoid duplicated declarations and indicate public functions implemented by all platforms.
Signed-off-by: Marcin Maka marcin.maka@linux.intel.com
# Conflicts: # src/platform/apollolake/include/platform/platform.h # src/platform/baytrail/include/platform/platform.h # src/platform/cannonlake/include/platform/platform.h # src/platform/haswell/include/platform/platform.h --- src/include/sof/panic.h | 4 +- src/include/sof/platform.h | 60 +++++++++++++++++++ .../apollolake/include/platform/platform.h | 15 ++--- .../baytrail/include/platform/platform.h | 8 ++- .../cannonlake/include/platform/platform.h | 14 ++--- .../haswell/include/platform/platform.h | 6 +- 6 files changed, 82 insertions(+), 25 deletions(-) create mode 100644 src/include/sof/platform.h
diff --git a/src/include/sof/panic.h b/src/include/sof/panic.h index 3efb659..7c19939 100644 --- a/src/include/sof/panic.h +++ b/src/include/sof/panic.h @@ -58,9 +58,7 @@ static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames) p = dump_stack(p, ext_offset, stack_rewind_frames, count * sizeof(uint32_t));
- /* TODO: send IPC oops message to host */ - - /* panic */ + /* panic - send IPC oops message to host */ platform_panic(p);
/* flush last trace messages */ diff --git a/src/include/sof/platform.h b/src/include/sof/platform.h new file mode 100644 index 0000000..8b228ee --- /dev/null +++ b/src/include/sof/platform.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Marcin Maka marcin.maka@linux.intel.com + */ + +#ifndef __INCLUDE_SOF_PLATFORM_H__ +#define __INCLUDE_SOF_PLATFORM_H__ + +#include <sof/sof.h> + +/* + * APIs declared here are defined for every platform. + */ + +/** + * \brief Platform specific implementation of the On Boot Complete handler. + * \param[in] boot_message Boot status code. + * \return 0 if successful, error code otherwise. + */ +int platform_boot_complete(uint32_t boot_message); + +/** + * \brief Platform initialization entry, called during FW initialization. + * \param[in] sof Context. + * \return 0 if successful, error code otherwise. + */ +int platform_init(struct sof *sof); + +/** + * \brief Called by the panic handler. + * \param[in] p Panic cause, one of SOF_IPC_PANIC_... codes. + */ +static inline void platform_panic(uint32_t p); + +#endif diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h index aefa9b2..24848ac 100644 --- a/src/platform/apollolake/include/platform/platform.h +++ b/src/platform/apollolake/include/platform/platform.h @@ -27,20 +27,18 @@ * * Author: Liam Girdwood liam.r.girdwood@linux.intel.com * Keyon Jie yang.jie@linux.intel.com - * Xiuli Pan xiuli.pan@linux.intel.com */
#ifndef __PLATFORM_PLATFORM_H__ #define __PLATFORM_PLATFORM_H__
+#include <platform/platcfg.h> #include <platform/shim.h> #include <platform/interrupt.h> #include <uapi/ipc.h>
struct sof;
-#define MAX_CORE_COUNT 2 - /* Host page size */ #define HOST_PAGE_SIZE 4096 #define PLATFORM_PAGE_TABLE_SIZE 256 @@ -119,16 +117,15 @@ struct sof; #define PLATFORM_NUM_SSP 6
/* Platform defined panic code */ -#define platform_panic(__x) { \ - mailbox_sw_reg_write(SRAM_REG_FW_STATUS, \ - (0xdead000 | (__x)) & 0x3fffffff); \ - ipc_write(IPC_DIPCIE, MAILBOX_EXCEPTION_OFFSET + 2 * 0x20000); \ - ipc_write(IPC_DIPCI, 0x80000000 | ((0xdead000 | (__x)) & 0x3fffffff)); \ +static inline void platform_panic(uint32_t p) +{ + sw_reg_write(SRAM_REG_FW_STATUS, p & 0x3fffffff); + ipc_write(IPC_DIPCI, 0x80000000 | (p & 0x3fffffff)); }
/* Platform defined trace code */ #define platform_trace_point(__x) \ - mailbox_sw_reg_write(SRAM_REG_FW_TRACEP, (__x)) + sw_reg_write(SRAM_REG_FW_TRACEP, __x)
extern struct timer *platform_timer;
diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 6a7ebc9..d4d4710 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -33,6 +33,7 @@ #ifndef __PLATFORM_PLATFORM_H__ #define __PLATFORM_PLATFORM_H__
+#include <sof/platform.h> #include <platform/shim.h> #include <platform/interrupt.h> #include <uapi/ipc.h> @@ -102,9 +103,10 @@ struct sof; #define PLATFORM_IDLE_TIME 750000
/* Platform defined panic code */ -#define platform_panic(__x) { \ - shim_write(SHIM_IPCDL, (0xdead000 | (__x & 0xfff))); \ - shim_write(SHIM_IPCDH, (SHIM_IPCDH_BUSY | MAILBOX_EXCEPTION_OFFSET)); \ +static inline void platform_panic(uint32_t p) +{ + shim_write(SHIM_IPCDL, p); + shim_write(SHIM_IPCDH, SHIM_IPCDH_BUSY); }
/* Platform defined trace code */ diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h index 35219d7..9474103 100644 --- a/src/platform/cannonlake/include/platform/platform.h +++ b/src/platform/cannonlake/include/platform/platform.h @@ -34,6 +34,8 @@ #ifndef __PLATFORM_PLATFORM_H__ #define __PLATFORM_PLATFORM_H__
+#include <sof/platform.h> +#include <platform/platcfg.h> #include <platform/shim.h> #include <platform/interrupt.h> #include <uapi/ipc.h> @@ -116,17 +118,15 @@ struct sof; #define PLATFORM_IDLE_TIME 750000
/* Platform defined trace code */ -#define platform_panic(__x) { \ - mailbox_sw_reg_write(SRAM_REG_FW_STATUS, \ - (0xdead000 | (__x)) & 0x3fffffff); \ - ipc_write(IPC_DIPCIDD, MAILBOX_EXCEPTION_OFFSET + 2 * 0x20000); \ - ipc_write(IPC_DIPCIDR, 0x80000000 | \ - ((0xdead000 | (__x)) & 0x3fffffff)); \ +static inline void platform_panic(uint32_t p) +{ + sw_reg_write(SRAM_REG_FW_STATUS, p & 0x3fffffff); + ipc_write(IPC_DIPCIDR, 0x80000000 | (p & 0x3fffffff)); }
/* Platform defined trace code */ #define platform_trace_point(__x) \ - mailbox_sw_reg_write(SRAM_REG_FW_TRACEP, (__x)) + sw_reg_write(SRAM_REG_FW_TRACEP, __x)
extern struct timer *platform_timer;
diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index d30f329..426f538 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -101,9 +101,9 @@ struct sof; #define PLATFORM_IDLE_TIME 750000
/* Platform defined panic code */ -#define platform_panic(__x) { \ - shim_write(SHIM_IPCX, MAILBOX_EXCEPTION_OFFSET & 0x3fffffff); \ - shim_write(SHIM_IPCD, (SHIM_IPCD_BUSY | 0xdead000 | __x)); \ +static inline void platform_panic(uint32_t p) +{ + shim_write(SHIM_IPCD, (SHIM_IPCD_BUSY | p)) }
/* Platform defined trace code */