[Sound-open-firmware] [PATCH] platform: byt: move DW-DMA specific headers into DMA driver.
Lets keep all the DW-DMA register/bits in one place.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/drivers/dw-dma.c | 33 ++++++++++++++++++++++++++++ src/platform/baytrail/include/platform/dma.h | 26 ---------------------- 2 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index 5374f94..22e90b7 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -163,6 +163,39 @@ /* default initial setup register values */ #define DW_CFG_LOW_DEF 0x0 #define DW_CFG_HIGH_DEF 0x4 + +#elif defined (CONFIG_BAYTRAIL) || defined (CONFIG_CHERRYTRAIL) +/* baytrail specific registers */ + +/* CTL_LO */ +#define DW_CTLL_S_GATH_EN (1 << 17) +#define DW_CTLL_D_SCAT_EN (1 << 18) + +/* CTL_HI */ +#define DW_CTLH_DONE 0x00020000 +#define DW_CTLH_BLOCK_TS_MASK 0x0001ffff +#define DW_CTLH_CLASS(x) ((x) << 29) +#define DW_CTLH_WEIGHT(x) ((x) << 18) + +/* CFG_LO */ +#define DW_CFG_CH_DRAIN 0x400 + +/* CFG_HI */ +#define DW_CFGH_SRC_PER(x) ((x) << 0) +#define DW_CFGH_DST_PER(x) ((x) << 4) + +/* FIFO Partition */ +#define DW_FIFO_PARTITION +#define DW_FIFO_PART0_LO 0x0400 +#define DW_FIFO_PART0_HI 0x0404 +#define DW_FIFO_PART1_LO 0x0408 +#define DW_FIFO_PART1_HI 0x040C +#define DW_CH_SAI_ERR 0x0410 + +/* default initial setup register values */ +#define DW_CFG_LOW_DEF 0x00000003 +#define DW_CFG_HIGH_DEF 0x0 + #endif
/* tracing */ diff --git a/src/platform/baytrail/include/platform/dma.h b/src/platform/baytrail/include/platform/dma.h index 37ae067..eec501a 100644 --- a/src/platform/baytrail/include/platform/dma.h +++ b/src/platform/baytrail/include/platform/dma.h @@ -38,32 +38,6 @@ #define DMA_ID_DMAC1 1 #define DMA_ID_DMAC2 2
-/* baytrail specific registers */ -/* CTL_LO */ -#define DW_CTLL_S_GATH_EN (1 << 17) -#define DW_CTLL_D_SCAT_EN (1 << 18) -/* CTL_HI */ -#define DW_CTLH_DONE 0x00020000 -#define DW_CTLH_BLOCK_TS_MASK 0x0001ffff -#define DW_CTLH_CLASS(x) ((x) << 29) -#define DW_CTLH_WEIGHT(x) ((x) << 18) -/* CFG_LO */ -#define DW_CFG_CH_DRAIN 0x400 -/* CFG_HI */ -#define DW_CFGH_SRC_PER(x) ((x) << 0) -#define DW_CFGH_DST_PER(x) ((x) << 4) -/* FIFO Partition */ -#define DW_FIFO_PARTITION -#define DW_FIFO_PART0_LO 0x0400 -#define DW_FIFO_PART0_HI 0x0404 -#define DW_FIFO_PART1_LO 0x0408 -#define DW_FIFO_PART1_HI 0x040C -#define DW_CH_SAI_ERR 0x0410 - -/* default initial setup register values */ -#define DW_CFG_LOW_DEF 0x00000003 -#define DW_CFG_HIGH_DEF 0x0 - #define DMA_HANDSHAKE_SSP0_RX 0 #define DMA_HANDSHAKE_SSP0_TX 1 #define DMA_HANDSHAKE_SSP1_RX 2
Not used on Haswell or Broadwell.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/platform.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index 89afb8e..1b82464 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -34,7 +34,6 @@ #include <platform/dma.h> #include <platform/clk.h> #include <platform/timer.h> -#include <platform/pmc.h> #include <uapi/ipc.h> #include <reef/mailbox.h> #include <reef/dai.h>
From: Keyon Jie yang.jie@linux.intel.com
Allow interrupts to have a parent and child relationship in order to support nested interrupts between different HW interrupt controllers.
This patch allows child handler to be registered for secondary interrupt controllers and allow multiple child interrupt sources to share a single interrupt pin.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/include/reef/interrupt.h | 57 +++--- src/lib/Makefile.am | 3 +- src/lib/interrupt.c | 204 +++++++++++++++++++++ src/platform/baytrail/include/platform/interrupt.h | 17 ++ 4 files changed, 256 insertions(+), 25 deletions(-) create mode 100644 src/lib/interrupt.c
diff --git a/src/include/reef/interrupt.h b/src/include/reef/interrupt.h index ea7d057..33733ff 100644 --- a/src/include/reef/interrupt.h +++ b/src/include/reef/interrupt.h @@ -33,40 +33,47 @@
#include <stdint.h> #include <arch/interrupt.h> +#include <platform/interrupt.h> #include <reef/trace.h> #include <reef/debug.h> +#include <reef/lock.h>
-#define trace_irq(__e) trace_event(TRACE_CLASS_IRQ | __e) +#define trace_irq(__e) trace_event(TRACE_CLASS_IRQ, __e) +#define trace_irq_error(__e) trace_error(TRACE_CLASS_IRQ, __e)
-static inline int interrupt_register(int irq, - void(*handler)(void *arg), void *arg) -{ - return arch_interrupt_register(irq, handler, arg); -} +/* child interrupt source */ +struct irq_child { + uint32_t enabled;
-static inline void interrupt_unregister(int irq) -{ - arch_interrupt_unregister(irq); -} + void (*handler)(void *arg); + void *handler_arg; +};
-static inline uint32_t interrupt_enable(uint32_t irq) -{ - return arch_interrupt_enable_mask(1 << irq); -} +/* parent source */ +struct irq_parent { + int num; + void (*handler)(void *arg); + uint32_t enabled_count; + spinlock_t lock;
-static inline uint32_t interrupt_disable(uint32_t irq) -{ - return arch_interrupt_disable_mask(1 <<irq); -} + uint32_t num_children; + struct irq_child *child[PLATFORM_IRQ_CHILDREN]; +}; + +int interrupt_register(uint32_t irq, + void(*handler)(void *arg), void *arg); +void interrupt_unregister(uint32_t irq); +uint32_t interrupt_enable(uint32_t irq); +uint32_t interrupt_disable(uint32_t irq);
static inline void interrupt_set(int irq) { - arch_interrupt_set(irq); + arch_interrupt_set(REEF_IRQ_NUMBER(irq)); }
static inline void interrupt_clear(int irq) { - arch_interrupt_clear(irq); + arch_interrupt_clear(REEF_IRQ_NUMBER(irq)); }
static inline uint32_t interrupt_global_disable(void) @@ -79,9 +86,11 @@ static inline void interrupt_global_enable(uint32_t flags) arch_interrupt_global_enable(flags); }
-uint32_t platform_interrupt_get_enabled(void); -void platform_interrupt_clear(uint32_t irq, uint32_t mask); -void platform_interrupt_mask(uint32_t irq, uint32_t mask); -void platform_interrupt_unmask(uint32_t irq, uint32_t mask); +/* called by platform interrupt ops */ +int irq_register_child(struct irq_parent *parent, int irq, + void (*handler)(void *arg), void *arg); +void irq_unregister_child(struct irq_parent *parent, int irq); +uint32_t irq_enable_child(struct irq_parent *parent, int irq); +uint32_t irq_disable_child(struct irq_parent *parent, int irq);
#endif diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 0a566d0..c4da98c 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -7,7 +7,8 @@ libcore_a_SOURCES = \ notifier.c \ trace.c \ schedule.c \ - agent.c + agent.c \ + interrupt.c
if BUILD_DMA_TRACE libcore_a_SOURCES += \ diff --git a/src/lib/interrupt.c b/src/lib/interrupt.c new file mode 100644 index 0000000..4516cf3 --- /dev/null +++ b/src/lib/interrupt.c @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2017, 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: Keyon Jie yang.jie@linux.intel.com + * Liam Girdwood liam.r.girdwood@linux.intel.com + * + */ + +#include <reef/interrupt.h> +#include <reef/interrupt-map.h> +#include <reef/alloc.h> +#include <arch/interrupt.h> +#include <platform/interrupt.h> +#include <stdint.h> +#include <stdlib.h> + +int irq_register_child(struct irq_parent *parent, int irq, + void (*handler)(void *arg), void *arg) +{ + int ret = 0; + + if (parent == NULL) + return -EINVAL; + + spin_lock(&parent->lock); + + /* does child already exist ? */ + if (parent->child[REEF_IRQ_BIT(irq)]) { + /* already registered, return */ + goto finish; + } + + /* init child */ + parent->child[REEF_IRQ_BIT(irq)] = + rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct irq_child)); + parent->child[REEF_IRQ_BIT(irq)]->enabled = 0; + parent->child[REEF_IRQ_BIT(irq)]->handler = handler; + parent->child[REEF_IRQ_BIT(irq)]->handler_arg = arg; + + /* do we need to register parent ? */ + if (parent->num_children == 0) { + ret = arch_interrupt_register(parent->num, + parent->handler, parent); + } + + /* increment number of children */ + parent->num_children += 1; + +finish: + spin_unlock(&parent->lock); + return ret; + +} + +void irq_unregister_child(struct irq_parent *parent, int irq) +{ + spin_lock(&parent->lock); + + /* does child already exist ? */ + if (parent->child[REEF_IRQ_BIT(irq)] == NULL) + goto finish; + + /* free child */ + parent->num_children -= 1; + rfree(parent->child[REEF_IRQ_BIT(irq)]); + parent->child[REEF_IRQ_BIT(irq)] = NULL; + + /* + * unregister the root interrupt if the this l2 is + * the last registered one. + */ + if (parent->num_children == 0) + arch_interrupt_unregister(parent->num); + +finish: + spin_unlock(&parent->lock); +} + +uint32_t irq_enable_child(struct irq_parent *parent, int irq) +{ + struct irq_child *child; + + spin_lock(&parent->lock); + + child =parent->child[REEF_IRQ_BIT(irq)]; + + /* already enabled ? */ + if (child->enabled) + goto finish; + + /* enable the parent interrupt */ + if (parent->enabled_count == 0) + arch_interrupt_enable_mask(1 << REEF_IRQ_NUMBER(irq)); + child->enabled = 1; + parent->enabled_count++; + + /* enable the child interrupt */ + platform_interrupt_unmask(irq, 0); + +finish: + spin_unlock(&parent->lock); + return 0; + +} + +uint32_t irq_disable_child(struct irq_parent *parent, int irq) +{ + struct irq_child *child; + + spin_lock(&parent->lock); + + child =parent->child[REEF_IRQ_BIT(irq)]; + + /* already disabled ? */ + if (!child->enabled) + goto finish; + + /* disable the child interrupt */ + platform_interrupt_mask(irq, 0); + child->enabled = 0; + + /* disable the parent interrupt */ + parent->enabled_count--; + if (parent->enabled_count == 0) + arch_interrupt_disable_mask(1 << REEF_IRQ_NUMBER(irq)); + +finish: + spin_unlock(&parent->lock); + return 0; + +} + +int interrupt_register(uint32_t irq, + void (*handler)(void *arg), void *arg) +{ + struct irq_parent *parent; + + /* no parent means we are registering DSP internal IRQ */ + parent = platform_irq_get_parent(irq); + if (parent == NULL) + return arch_interrupt_register(irq, handler, arg); + else + return irq_register_child(parent, irq, handler, arg); +} + +void interrupt_unregister(uint32_t irq) +{ + struct irq_parent *parent; + + /* no parent means we are unregistering DSP internal IRQ */ + parent = platform_irq_get_parent(irq); + if (parent == NULL) + arch_interrupt_unregister(irq); + else + irq_unregister_child(parent, irq); +} + +uint32_t interrupt_enable(uint32_t irq) +{ + struct irq_parent *parent; + + /* no parent means we are enabling DSP internal IRQ */ + parent = platform_irq_get_parent(irq); + if (parent == NULL) + return arch_interrupt_enable_mask(1 << irq); + else + return irq_enable_child(parent, irq); +} + +uint32_t interrupt_disable(uint32_t irq) +{ + struct irq_parent *parent; + + /* no parent means we are disabling DSP internal IRQ */ + parent = platform_irq_get_parent(irq); + if (parent == NULL) + return arch_interrupt_disable_mask(1 << irq); + else + return irq_disable_child(parent, irq); +} diff --git a/src/platform/baytrail/include/platform/interrupt.h b/src/platform/baytrail/include/platform/interrupt.h index d197d67..650a797 100644 --- a/src/platform/baytrail/include/platform/interrupt.h +++ b/src/platform/baytrail/include/platform/interrupt.h @@ -32,6 +32,7 @@ #define __INCLUDE_PLATFORM_INTERRUPT__
#include <stdint.h> +#include <string.h> #include <reef/interrupt-map.h>
/* IRQ numbers */ @@ -84,4 +85,20 @@ #define IRQ_MASK_EXT_SSP2 (1 << IRQ_NUM_EXT_SSP2) #define IRQ_MASK_EXT_DMAC2 (1 << IRQ_NUM_EXT_DMAC2)
+/* no nested interrupts */ +#define PLATFORM_IRQ_CHILDREN 0 + +static inline void platform_interrupt_init(void) {} + +static inline struct irq_parent *platform_irq_get_parent(uint32_t irq) +{ + return NULL; +} + +void platform_interrupt_set(int irq); +void platform_interrupt_clear(uint32_t irq, uint32_t mask); +uint32_t platform_interrupt_get_enabled(void); +void platform_interrupt_mask(uint32_t irq, uint32_t mask); +void platform_interrupt_unmask(uint32_t irq, uint32_t mask); + #endif
Add LX6 version of wait_for_interrupt() as this will be needed for cannonlake.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/Makefile.am | 1 - src/arch/xtensa/include/arch/Makefile.am | 3 +- src/arch/xtensa/{wait.S => include/arch/wait.h} | 51 ++++++++++++++++++------- src/include/reef/wait.h | 1 + 4 files changed, 41 insertions(+), 15 deletions(-) rename src/arch/xtensa/{wait.S => include/arch/wait.h} (71%)
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index 00f6b68..fe27c24 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -31,7 +31,6 @@ reef_SOURCES = \ crt1-boards.S \ _vectors.S \ init.c \ - wait.S \ timer.c \ task.c
diff --git a/src/arch/xtensa/include/arch/Makefile.am b/src/arch/xtensa/include/arch/Makefile.am index d8ba0df..42b3b70 100644 --- a/src/arch/xtensa/include/arch/Makefile.am +++ b/src/arch/xtensa/include/arch/Makefile.am @@ -4,4 +4,5 @@ noinst_HEADERS = \ reef.h \ spinlock.h \ task.h \ - timer.h + timer.h \ + wait.h diff --git a/src/arch/xtensa/wait.S b/src/arch/xtensa/include/arch/wait.h similarity index 71% rename from src/arch/xtensa/wait.S rename to src/arch/xtensa/include/arch/wait.h index df9893d..2f6e4f5 100644 --- a/src/arch/xtensa/wait.S +++ b/src/arch/xtensa/include/arch/wait.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Intel Corporation + * Copyright (c) 2017, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +28,42 @@ * Author: Liam Girdwood liam.r.girdwood@linux.intel.com */
-#include <xtensa/coreasm.h> -#include <xtensa/config/specreg.h> -#include "xtos-internal.h" +#include <xtensa/xtruntime.h>
- .text - .align 4 - .global arch_wait_for_interrupt - .type arch_wait_for_interrupt,@function -arch_wait_for_interrupt: - abi_entry - waiti 0 - abi_return +#if defined(CONFIG_CANNONLAKE) + +static inline void arch_wait_for_interrupt(int level) +{ + int i; + + /* this sequnce must be atomic on LX6 */ + XTOS_SET_INTLEVEL(5); + + /* LX6 needs a delay */ + for (i = 0; i < 128; i++) + asm volatile("nop"); + + /* and to flush all loads/stores prior to wait */ + asm volatile("isync"); + asm volatile("extw"); + + /* now wait */ + asm volatile("waiti 0"); +} + +#else + +static inline void arch_wait_for_interrupt(int level) +{ + asm volatile("waiti 0"); +} + +#endif + +static inline void idelay(int n) +{ + while (n--) { + asm volatile("nop"); + } +}
- .size arch_wait_for_interrupt, . - arch_wait_for_interrupt diff --git a/src/include/reef/wait.h b/src/include/reef/wait.h index 3354eb4..a598d48 100644 --- a/src/include/reef/wait.h +++ b/src/include/reef/wait.h @@ -35,6 +35,7 @@
#include <stdint.h> #include <errno.h> +#include <arch/wait.h> #include <reef/debug.h> #include <reef/work.h> #include <reef/timer.h>
Page tables are not used by DMA trace on CNL and APL. Make sure they are not built in.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/ipc/intel-ipc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 5a98e1f..54a0812 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -598,13 +598,15 @@ static int ipc_glb_pm_message(uint32_t header)
static int ipc_dma_trace_config(uint32_t header) { +#ifdef CONFIG_HOST_PTABLE struct intel_ipc_data *iipc = ipc_get_drvdata(_ipc); struct sof_ipc_dma_trace_params *params = _ipc->comp_data; +#endif struct sof_ipc_reply reply; int err;
trace_ipc_error("DA1"); - +#ifdef CONFIG_HOST_PTABLE /* use DMA to read in compressed page table ringbuffer from host */ err = get_page_descriptors(iipc, ¶ms->buffer); if (err < 0) { @@ -621,7 +623,7 @@ static int ipc_dma_trace_config(uint32_t header) trace_ipc_error("ePP"); goto error; } - +#endif trace_ipc("DAp");
err = dma_trace_enable(&_ipc->dmat);
Set ASSEMBLY when we are building .S files so that C headers can be included.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- configure.ac | 4 ++++ src/arch/xtensa/Makefile.am | 2 ++ 2 files changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac index 40e8b9b..20c5ab4 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,10 @@ AC_CANONICAL_HOST # General compiler flags CFLAGS="${CFLAGS:+$CFLAGS } -O2 -g -Wall -Werror -Wl,-EL -fno-inline-functions -nostdlib -Wmissing-prototypes"
+# General assembler flags +ASFLAGS="-DASSEMBLY" +AC_SUBST(ASFLAGS) + # Cross compiler tool libgcc and headers AC_ARG_WITH([root-dir], AS_HELP_STRING([--with-root-dir], [Specify location of cross gcc libraries and headers]), diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index fe27c24..c8414a1 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -23,6 +23,7 @@ libreset_a_SOURCES = \
libreset_a_CCASFLAGS = \ $(ARCH_INCDIR) \ + $(ASFLAGS) \ $(ARCH_ASFLAGS) \ $(PLATFORM_INCDIR) \ -mtext-section-literals @@ -42,6 +43,7 @@ reef_CFLAGS = \
reef_CCASFLAGS = \ $(ARCH_INCDIR) \ + $(ASFLAGS) \ $(ARCH_ASFLAGS) \ $(PLATFORM_INCDIR)
Add uapi header for Intel manifest based firmware file format.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/uapi/Makefile.am | 3 +- src/include/uapi/manifest.h | 214 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/include/uapi/manifest.h
diff --git a/src/include/uapi/Makefile.am b/src/include/uapi/Makefile.am index 103d692..257fff0 100644 --- a/src/include/uapi/Makefile.am +++ b/src/include/uapi/Makefile.am @@ -4,4 +4,5 @@ include_HEADERS = \ ipc.h \ abi.h \ eq.h \ - tone.h + tone.h \ + manifest.h diff --git a/src/include/uapi/manifest.h b/src/include/uapi/manifest.h new file mode 100644 index 0000000..ace9883 --- /dev/null +++ b/src/include/uapi/manifest.h @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +#ifndef SOF_UAPI_MANIFEST_H +#define SOF_UAPI_MANIFEST_H + +#include <stdint.h> + +/* start offset for base FW module */ +#define SOF_MAN_ELF_TEXT_OFFSET 0x2000 + +/* FW Extended Manifest Header id = $AE1 */ +#define SOF_MAN_EXT_HEADER_MAGIC 0x31454124 + +/* module type load type */ +#define SOF_MAN_MOD_TYPE_BUILTIN 0 +#define SOF_MAN_MOD_TYPE_MODULE 1 + +struct sof_man_module_type { + uint32_t load_type:4; /* SOF_MAN_MOD_TYPE_ */ + uint32_t auto_start:1; + uint32_t domain_ll:1; + uint32_t domain_dp:1; + uint32_t rsvd_:25; +}; + +/* segment flags.type */ +#define SOF_MAN_SEGMENT_TEXT 0 +#define SOF_MAN_SEGMENT_RODATA 1 +#define SOF_MAN_SEGMENT_DATA 1 +#define SOF_MAN_SEGMENT_BSS 2 +#define SOF_MAN_SEGMENT_EMPTY 15 + +union sof_man_segment_flags { + uint32_t ul; + struct { + uint32_t contents:1; + uint32_t alloc:1; + uint32_t load:1; + uint32_t readonly:1; + uint32_t code:1; + uint32_t data:1; + uint32_t _rsvd0:2; + uint32_t type:4; /* MAN_SEGMENT_ */ + uint32_t _rsvd1:4; + uint32_t length:16; /* of segment in pages */ + } r; +} __attribute__((packed)); + +/* + * Module segment descriptor. + */ +struct sof_man_segment_desc { + union sof_man_segment_flags flags; + uint32_t v_base_addr; + uint32_t file_offset; +} __attribute__((packed)); + +/* + * The firmware binary can be split into several modules. + */ + +#define SOF_MAN_MOD_ID_LEN 4 +#define SOF_MAN_MOD_NAME_LEN 8 +#define SOF_MAN_MOD_SHA256_LEN 32 +#define SOF_MAN_MOD_ID {'$', 'A', 'M', 'E'} + +/* + * Each module has an entry in the FW header. + */ +struct sof_man_module { + uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */ + uint8_t name[SOF_MAN_MOD_NAME_LEN]; + uint8_t uuid[16]; + struct sof_man_module_type type; + uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; + uint32_t entry_point; + uint16_t cfg_offset; + uint16_t cfg_count; + uint32_t affinity_mask; + uint16_t instance_max_count; /* max number of instances */ + uint16_t instance_bss_size; /* instance (pages) */ + struct sof_man_segment_desc segment[3]; +} __attribute__((packed)); + +/* + * Each module has a configuration in the FW header. + */ +struct sof_man_mod_config { + uint32_t par[4]; /* module parameters */ + uint32_t is_pages; /* actual size of instance .bss (pages) */ + uint32_t cps; /* cycles per second */ + uint32_t ibs; /* input buffer size (bytes) */ + uint32_t obs; /* output buffer size (bytes) */ + uint32_t module_flags; /* flags, reserved for future use */ + uint32_t cpc; /* cycles per single run */ + uint32_t obls; /* output block size, reserved for future use */ +} __attribute__((packed)); + + +/* + * FW Manifest Header + */ + +#define SOF_MAN_FW_HDR_FW_NAME_LEN 8 +#define SOF_MAN_FW_HDR_ID {'$', 'A', 'M', '1'} +#define SOF_MAN_FW_HDR_NAME "ADSPFW" +#define SOF_MAN_FW_HDR_FLAGS 0x0 +#define SOF_MAN_FW_HDR_FEATURES 0x1f + +/* + * The firmware has a standard header that is checked by the ROM on firmware + * loading. + * preload_page_count is used by DMA code loader and is entire image size on + * CNL. i.e. CNL: total size of the binary’s .text and .rodata + */ +struct sof_man_fw_header { + uint8_t header_id[4]; + uint32_t header_len; + uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN]; + /* number of pages of preloaded image loaded by driver */ + uint32_t preload_page_count; + uint32_t fw_image_flags; + uint32_t feature_mask; + uint16_t major_version; + uint16_t minor_version; + uint16_t hotfix_version; + uint16_t build_version; + uint32_t num_module_entries; + uint32_t hw_buf_base_addr; + uint32_t hw_buf_length; + /* target address for binary loading as offset in IMR - must be == base offset */ + uint32_t load_offset; +} __attribute__((packed)); + +/* + * Firmware manifest descriptor. This can contain N modules and N module + * configs. + */ +struct sof_man_fw_desc { + struct sof_man_fw_header header; + + /* Warning - hack for module arrays. For some unknown reason the we + * have a variable size array of struct man_module followed by a + * variable size array of struct mod_config. These should have been + * merged into a variable array of a parent structure. We have to hack + * around this in many places.... + * + * struct sof_man_module man_module[]; + * struct sof_man_mod_config mod_config[]; + */ + +} __attribute__((packed)); + +/* + * Component Descriptor + */ +struct sof_man_component_desc { + uint32_t reserved[2]; /* all 0 */ + uint32_t version; + uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; + uint32_t base_offset; + uint32_t limit_offset; + uint32_t attributes[4]; +} __attribute__((packed)); + + +/* + * Audio DSP extended metadata. + */ +struct sof_man_adsp_meta_file_ext { + uint32_t ext_type; /* always 17 for ADSP extension */ + uint32_t ext_len; + uint32_t imr_type; + uint8_t reserved[16]; /* all 0 */ + struct sof_man_component_desc comp_desc[1]; +} __attribute__((packed)); + +/* utility to get module pointer from position */ +static inline struct sof_man_module *sof_man_get_module( + struct sof_man_fw_desc *desc, int index) +{ + return (void *)desc + sizeof(struct sof_man_fw_header) + + index * sizeof(struct sof_man_module); +} + +#endif
This one only applies with git am --no-utf8 for some reason.
On 01/23/2018 10:39 AM, Liam Girdwood wrote:
Add uapi header for Intel manifest based firmware file format.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com
src/include/uapi/Makefile.am | 3 +- src/include/uapi/manifest.h | 214 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/include/uapi/manifest.h
diff --git a/src/include/uapi/Makefile.am b/src/include/uapi/Makefile.am index 103d692..257fff0 100644 --- a/src/include/uapi/Makefile.am +++ b/src/include/uapi/Makefile.am @@ -4,4 +4,5 @@ include_HEADERS = \ ipc.h \ abi.h \ eq.h \
- tone.h
- tone.h \
- manifest.h
diff --git a/src/include/uapi/manifest.h b/src/include/uapi/manifest.h new file mode 100644 index 0000000..ace9883 --- /dev/null +++ b/src/include/uapi/manifest.h @@ -0,0 +1,214 @@ +/*
- Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com
- */
+#ifndef SOF_UAPI_MANIFEST_H +#define SOF_UAPI_MANIFEST_H
+#include <stdint.h>
+/* start offset for base FW module */ +#define SOF_MAN_ELF_TEXT_OFFSET 0x2000
+/* FW Extended Manifest Header id = $AE1 */ +#define SOF_MAN_EXT_HEADER_MAGIC 0x31454124
+/* module type load type */ +#define SOF_MAN_MOD_TYPE_BUILTIN 0 +#define SOF_MAN_MOD_TYPE_MODULE 1
+struct sof_man_module_type {
- uint32_t load_type:4; /* SOF_MAN_MOD_TYPE_ */
- uint32_t auto_start:1;
- uint32_t domain_ll:1;
- uint32_t domain_dp:1;
- uint32_t rsvd_:25;
+};
+/* segment flags.type */ +#define SOF_MAN_SEGMENT_TEXT 0 +#define SOF_MAN_SEGMENT_RODATA 1 +#define SOF_MAN_SEGMENT_DATA 1 +#define SOF_MAN_SEGMENT_BSS 2 +#define SOF_MAN_SEGMENT_EMPTY 15
+union sof_man_segment_flags {
- uint32_t ul;
- struct {
uint32_t contents:1;
uint32_t alloc:1;
uint32_t load:1;
uint32_t readonly:1;
uint32_t code:1;
uint32_t data:1;
uint32_t _rsvd0:2;
uint32_t type:4; /* MAN_SEGMENT_ */
uint32_t _rsvd1:4;
uint32_t length:16; /* of segment in pages */
- } r;
+} __attribute__((packed));
+/*
- Module segment descriptor.
- */
+struct sof_man_segment_desc {
- union sof_man_segment_flags flags;
- uint32_t v_base_addr;
- uint32_t file_offset;
+} __attribute__((packed));
+/*
- The firmware binary can be split into several modules.
- */
+#define SOF_MAN_MOD_ID_LEN 4 +#define SOF_MAN_MOD_NAME_LEN 8 +#define SOF_MAN_MOD_SHA256_LEN 32 +#define SOF_MAN_MOD_ID {'$', 'A', 'M', 'E'}
+/*
- Each module has an entry in the FW header.
- */
+struct sof_man_module {
- uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */
- uint8_t name[SOF_MAN_MOD_NAME_LEN];
- uint8_t uuid[16];
- struct sof_man_module_type type;
- uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
- uint32_t entry_point;
- uint16_t cfg_offset;
- uint16_t cfg_count;
- uint32_t affinity_mask;
- uint16_t instance_max_count; /* max number of instances */
- uint16_t instance_bss_size; /* instance (pages) */
- struct sof_man_segment_desc segment[3];
+} __attribute__((packed));
+/*
- Each module has a configuration in the FW header.
- */
+struct sof_man_mod_config {
- uint32_t par[4]; /* module parameters */
- uint32_t is_pages; /* actual size of instance .bss (pages) */
- uint32_t cps; /* cycles per second */
- uint32_t ibs; /* input buffer size (bytes) */
- uint32_t obs; /* output buffer size (bytes) */
- uint32_t module_flags; /* flags, reserved for future use */
- uint32_t cpc; /* cycles per single run */
- uint32_t obls; /* output block size, reserved for future use */
+} __attribute__((packed));
+/*
- FW Manifest Header
- */
+#define SOF_MAN_FW_HDR_FW_NAME_LEN 8 +#define SOF_MAN_FW_HDR_ID {'$', 'A', 'M', '1'} +#define SOF_MAN_FW_HDR_NAME "ADSPFW" +#define SOF_MAN_FW_HDR_FLAGS 0x0 +#define SOF_MAN_FW_HDR_FEATURES 0x1f
+/*
- The firmware has a standard header that is checked by the ROM on firmware
- loading.
- preload_page_count is used by DMA code loader and is entire image size on
- CNL. i.e. CNL: total size of the binary’s .text and .rodata
- */
+struct sof_man_fw_header {
- uint8_t header_id[4];
- uint32_t header_len;
- uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN];
- /* number of pages of preloaded image loaded by driver */
- uint32_t preload_page_count;
- uint32_t fw_image_flags;
- uint32_t feature_mask;
- uint16_t major_version;
- uint16_t minor_version;
- uint16_t hotfix_version;
- uint16_t build_version;
- uint32_t num_module_entries;
- uint32_t hw_buf_base_addr;
- uint32_t hw_buf_length;
- /* target address for binary loading as offset in IMR - must be == base offset */
- uint32_t load_offset;
+} __attribute__((packed));
+/*
- Firmware manifest descriptor. This can contain N modules and N module
- configs.
- */
+struct sof_man_fw_desc {
- struct sof_man_fw_header header;
- /* Warning - hack for module arrays. For some unknown reason the we
* have a variable size array of struct man_module followed by a
* variable size array of struct mod_config. These should have been
* merged into a variable array of a parent structure. We have to hack
* around this in many places....
*
* struct sof_man_module man_module[];
* struct sof_man_mod_config mod_config[];
*/
+} __attribute__((packed));
+/*
- Component Descriptor
- */
+struct sof_man_component_desc {
- uint32_t reserved[2]; /* all 0 */
- uint32_t version;
- uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
- uint32_t base_offset;
- uint32_t limit_offset;
- uint32_t attributes[4];
+} __attribute__((packed));
+/*
- Audio DSP extended metadata.
- */
+struct sof_man_adsp_meta_file_ext {
- uint32_t ext_type; /* always 17 for ADSP extension */
- uint32_t ext_len;
- uint32_t imr_type;
- uint8_t reserved[16]; /* all 0 */
- struct sof_man_component_desc comp_desc[1];
+} __attribute__((packed));
+/* utility to get module pointer from position */ +static inline struct sof_man_module *sof_man_get_module(
- struct sof_man_fw_desc *desc, int index)
+{
- return (void *)desc + sizeof(struct sof_man_fw_header) +
index * sizeof(struct sof_man_module);
+}
+#endif
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
Some platforms had unresolved symbols when platform was linked before core. Fix that.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index c8414a1..32e4aa5 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -49,9 +49,9 @@ reef_CCASFLAGS = \
reef_LDADD = \ ../../init/libinit.a \ - ../../platform/$(PLATFORM)/libplatform.a \ ../../tasks/libtasks.a \ ../../lib/libcore.a \ + ../../platform/$(PLATFORM)/libplatform.a \ ../../ipc/libipc.a \ ../../audio/libaudio.a \ ../../math/libmath.a \
Apollolake and Cannonlake have some register differences in DW-DMA HW. Add macros to support those differences.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/drivers/dw-dma.c | 56 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 10 deletions(-)
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index 22e90b7..8248461 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -196,6 +196,39 @@ #define DW_CFG_LOW_DEF 0x00000003 #define DW_CFG_HIGH_DEF 0x0
+#elif defined (CONFIG_APOLLOLAKE) || defined (CONFIG_CANNONLAKE) + +/* CTL_LO */ +#define DW_CTLL_S_GATH_EN (1 << 17) +#define DW_CTLL_D_SCAT_EN (1 << 18) + +/* CTL_HI */ +#define DW_CTLH_DONE 0x00020000 +#define DW_CTLH_BLOCK_TS_MASK 0x0001ffff +#define DW_CTLH_CLASS(x) (x << 29) +#define DW_CTLH_WEIGHT(x) (x << 18) + +/* CFG_LO */ +#define DW_CFG_CH_DRAIN 0x400 + +/* CFG_HI */ +#define DW_CFGH_SRC_PER(x) (x << 0) +#define DW_CFGH_DST_PER(x) (x << 4) + +/* FIFO Partition */ +#define DW_FIFO_PARTITION +#define DW_FIFO_PART0_LO 0x0400 +#define DW_FIFO_PART0_HI 0x0404 +#define DW_FIFO_PART1_LO 0x0408 +#define DW_FIFO_PART1_HI 0x040C +#define DW_CH_SAI_ERR 0x0410 +#define DW_DMA_GLB_CFG 0x0418 + +/* default initial setup register values */ +#define DW_CFG_LOW_DEF 0x00000003 +#define DW_CFG_HIGH_DEF 0x0 + +#define DW_REG_MAX DW_DMA_GLB_CFG #endif
/* tracing */ @@ -653,11 +686,12 @@ static int dw_dma_set_config(struct dma *dma, int channel, }
/* set transfer size of element */ -#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL - lli_desc->ctrl_hi = DW_CTLH_CLASS(p->class) | - (sg_elem->size & DW_CTLH_BLOCK_TS_MASK); -#else - /* for the unit is transaction--TR_WIDTH. */ +#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL \ + || defined CONFIG_APOLLOLAKE || defined CONFIG_CANNONLAKE + lli_desc->ctrl_hi = DW_CTLH_CLASS(p->class) | + (sg_elem->size & DW_CTLH_BLOCK_TS_MASK); +#elif defined CONFIG_BROADWELL || defined CONFIG_HASWELL + /* for bdw, the unit is transaction--TR_WIDTH. */ lli_desc->ctrl_hi = (sg_elem->size / (1 << (lli_desc->ctrl_lo >> 4 & 0x7))) & DW_CTLH_BLOCK_TS_MASK; #endif @@ -765,10 +799,11 @@ static inline void dw_dma_chan_reload_next(struct dma *dma, int channel, dw_write(dma, DW_DAR(channel), next->dest);
/* set transfer size of element */ -#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL - lli->ctrl_hi = DW_CTLH_CLASS(p->class) | - (next->size & DW_CTLH_BLOCK_TS_MASK); -#else +#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL \ + || defined CONFIG_APOLLOLAKE || defined CONFIG_CANNONLAKE + lli->ctrl_hi = DW_CTLH_CLASS(p->class) | + (next->size & DW_CTLH_BLOCK_TS_MASK); +#elif defined CONFIG_BROADWELL || defined CONFIG_HASWELL /* for the unit is transaction--TR_WIDTH. */ lli->ctrl_hi = (next->size / (1 << (lli->ctrl_lo >> 4 & 0x7))) & DW_CTLH_BLOCK_TS_MASK; @@ -928,7 +963,8 @@ found:
/* set channel priorities */ for (i = 0; i < DW_MAX_CHAN; i++) { -#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL +#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL \ + || defined CONFIG_APOLLOLAKE || defined CONFIG_CANNONLAKE dw_write(dma, DW_CTRL_HIGH(i), DW_CTLH_CLASS(dp->chan[i].class)); #else dw_write(dma, DW_CFG_LOW(i), DW_CFG_CLASS(dp->chan[i].class));
From: Rander Wang rander.wang@linux.intel.com
Enable IO with 16 bit HW.
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/include/reef/io.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/src/include/reef/io.h b/src/include/reef/io.h index 4b608b2..3181d41 100644 --- a/src/include/reef/io.h +++ b/src/include/reef/io.h @@ -48,4 +48,14 @@ static inline void io_reg_update_bits(uint32_t reg, uint32_t mask, uint32_t valu io_reg_write(reg, (io_reg_read(reg) & (~mask)) | (value & mask)); }
+static inline uint16_t io_reg_read16(uint32_t reg) +{ + return *((volatile uint16_t*)reg); +} + +static inline void io_reg_write16(uint32_t reg, uint16_t val) +{ + *((volatile uint16_t*)reg) = val; +} + #endif
Add gaps in the platform init tarce macros to allow other items to be inserted.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/trace.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 4656ef7..d83f0f8 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -41,11 +41,12 @@ #include <platform/platform.h> #include <platform/timer.h>
+ /* general trace init codes - only used at boot when main trace is not available */ -#define TRACE_BOOT_START 0x1000 +#define TRACE_BOOT_START 0x1000 #define TRACE_BOOT_ARCH 0x2000 -#define TRACE_BOOT_SYS 0x3000 -#define TRACE_BOOT_PLATFORM 0x4000 +#define TRACE_BOOT_SYS 0x3000 +#define TRACE_BOOT_PLATFORM 0x4000
/* system specific codes */ #define TRACE_BOOT_SYS_WORK (TRACE_BOOT_SYS + 0x100) @@ -55,15 +56,16 @@ #define TRACE_BOOT_SYS_SCHED (TRACE_BOOT_SYS + 0x500)
/* platform/device specific codes */ -#define TRACE_BOOT_PLATFORM_MBOX (TRACE_BOOT_PLATFORM + 0x100) -#define TRACE_BOOT_PLATFORM_SHIM (TRACE_BOOT_PLATFORM + 0x101) -#define TRACE_BOOT_PLATFORM_PMC (TRACE_BOOT_PLATFORM + 0x102) -#define TRACE_BOOT_PLATFORM_TIMER (TRACE_BOOT_PLATFORM + 0x103) -#define TRACE_BOOT_PLATFORM_CLOCK (TRACE_BOOT_PLATFORM + 0x104) -#define TRACE_BOOT_PLATFORM_SSP_FREQ (TRACE_BOOT_PLATFORM + 0x105) -#define TRACE_BOOT_PLATFORM_IPC (TRACE_BOOT_PLATFORM + 0x106) -#define TRACE_BOOT_PLATFORM_DMA (TRACE_BOOT_PLATFORM + 0x107) -#define TRACE_BOOT_PLATFORM_SSP (TRACE_BOOT_PLATFORM + 0x108) +#define TRACE_BOOT_PLATFORM_ENTRY (TRACE_BOOT_PLATFORM + 0x100) +#define TRACE_BOOT_PLATFORM_MBOX (TRACE_BOOT_PLATFORM + 0x110) +#define TRACE_BOOT_PLATFORM_SHIM (TRACE_BOOT_PLATFORM + 0x120) +#define TRACE_BOOT_PLATFORM_PMC (TRACE_BOOT_PLATFORM + 0x130) +#define TRACE_BOOT_PLATFORM_TIMER (TRACE_BOOT_PLATFORM + 0x140) +#define TRACE_BOOT_PLATFORM_CLOCK (TRACE_BOOT_PLATFORM + 0x150) +#define TRACE_BOOT_PLATFORM_SSP_FREQ (TRACE_BOOT_PLATFORM + 0x160) +#define TRACE_BOOT_PLATFORM_IPC (TRACE_BOOT_PLATFORM + 0x170) +#define TRACE_BOOT_PLATFORM_DMA (TRACE_BOOT_PLATFORM + 0x180) +#define TRACE_BOOT_PLATFORM_SSP (TRACE_BOOT_PLATFORM + 0x190)
/* trace event classes - high 8 bits*/
From: Rander Wang rander.wang@linux.intel.com
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/include/reef/trace.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index d83f0f8..2e22b16 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -41,6 +41,11 @@ #include <platform/platform.h> #include <platform/timer.h>
+/* bootloader trace values */ +#define TRACE_BOOT_LDR_ENTRY 0x100 +#define TRACE_BOOT_LDR_HPSRAM 0x110 +#define TRACE_BOOT_LDR_MANIFEST 0x120 +#define TRACE_BOOT_LDR_JUMP 0x150
/* general trace init codes - only used at boot when main trace is not available */ #define TRACE_BOOT_START 0x1000
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore index 6c80aa1..00afa3d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ .build *.dis *.lst +.*
Makefile Makefile.in @@ -39,4 +40,8 @@ config.* *.gz *.xz src/arch/xtensa/reef -reef-v* +src/arch/xtensa/boot_ldr +reef-* +boot_ldr-* +boot_module +module
Add the xtensa ISA headers for Intel Apollolake platform.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/apollolake/include/xtensa/Makefile.am | 1 + .../apollolake/include/xtensa/config/Makefile.am | 8 + .../apollolake/include/xtensa/config/core-isa.h | 602 +++++++++++++++++++++ .../apollolake/include/xtensa/config/core-matmap.h | 313 +++++++++++ .../apollolake/include/xtensa/config/defs.h | 38 ++ .../apollolake/include/xtensa/config/specreg.h | 106 ++++ .../apollolake/include/xtensa/config/system.h | 271 ++++++++++ .../apollolake/include/xtensa/config/tie-asm.h | 239 ++++++++ .../apollolake/include/xtensa/config/tie.h | 169 ++++++ 9 files changed, 1747 insertions(+) create mode 100644 src/platform/apollolake/include/xtensa/Makefile.am create mode 100644 src/platform/apollolake/include/xtensa/config/Makefile.am create mode 100644 src/platform/apollolake/include/xtensa/config/core-isa.h create mode 100644 src/platform/apollolake/include/xtensa/config/core-matmap.h create mode 100644 src/platform/apollolake/include/xtensa/config/defs.h create mode 100644 src/platform/apollolake/include/xtensa/config/specreg.h create mode 100644 src/platform/apollolake/include/xtensa/config/system.h create mode 100644 src/platform/apollolake/include/xtensa/config/tie-asm.h create mode 100644 src/platform/apollolake/include/xtensa/config/tie.h
diff --git a/src/platform/apollolake/include/xtensa/Makefile.am b/src/platform/apollolake/include/xtensa/Makefile.am new file mode 100644 index 0000000..a85a5bb --- /dev/null +++ b/src/platform/apollolake/include/xtensa/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = config diff --git a/src/platform/apollolake/include/xtensa/config/Makefile.am b/src/platform/apollolake/include/xtensa/config/Makefile.am new file mode 100644 index 0000000..99c21a5 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/Makefile.am @@ -0,0 +1,8 @@ +noinst_HEADERS = \ + core-isa.h \ + core-matmap.h \ + defs.h \ + specreg.h \ + system.h \ + tie.h \ + tie-asm.h diff --git a/src/platform/apollolake/include/xtensa/config/core-isa.h b/src/platform/apollolake/include/xtensa/config/core-isa.h new file mode 100644 index 0000000..5768437 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/core-isa.h @@ -0,0 +1,602 @@ +/* + * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa + * processor CORE configuration + * + * See <xtensa/config/core.h>, which includes this file, for more details. + */ + +/* Xtensa processor core configuration information. + + Customer ID=4313; Build=0x5483b; Copyright (c) 1999-2015 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_CONFIGURATION_H +#define _XTENSA_CORE_CONFIGURATION_H + + +/**************************************************************************** + Parameters Useful for Any Code, USER or PRIVILEGED + ****************************************************************************/ + +/* + * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is + * configured, and a value of 0 otherwise. These macros are always defined. + */ + + +/*---------------------------------------------------------------------- + ISA + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */ +#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */ +#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */ +#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ +#define XCHAL_MAX_INSTRUCTION_SIZE 8 /* max instr bytes (3..8) */ +#define XCHAL_HAVE_DEBUG 1 /* debug option */ +#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */ +#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */ +#define XCHAL_LOOP_BUFFER_SIZE 0 /* zero-ov. loop instr buffer size */ +#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */ +#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */ +#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */ +#define XCHAL_HAVE_DEPBITS 0 /* DEPBITS instruction */ +#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */ +#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */ +#define XCHAL_HAVE_MUL32 1 /* MULL instruction */ +#define XCHAL_HAVE_MUL32_HIGH 1 /* MULUH/MULSH instructions */ +#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */ +#define XCHAL_HAVE_L32R 1 /* L32R instruction */ +#define XCHAL_HAVE_ABSOLUTE_LITERALS 0 /* non-PC-rel (extended) L32R */ +#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */ +#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */ +#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */ +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */ +#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */ +#define XCHAL_HAVE_ABS 1 /* ABS instruction */ +/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */ +/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */ +#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */ +#define XCHAL_HAVE_S32C1I 1 /* S32C1I instruction */ +#define XCHAL_HAVE_SPECULATION 0 /* speculation */ +#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */ +#define XCHAL_NUM_CONTEXTS 1 /* */ +#define XCHAL_NUM_MISC_REGS 0 /* num of scratch regs (0..4) */ +#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */ +#define XCHAL_HAVE_PRID 1 /* processor ID register */ +#define XCHAL_HAVE_EXTERN_REGS 1 /* WER/RER instructions */ +#define XCHAL_HAVE_MX 0 /* MX core (Tensilica internal) */ +#define XCHAL_HAVE_MP_INTERRUPTS 0 /* interrupt distributor port */ +#define XCHAL_HAVE_MP_RUNSTALL 0 /* core RunStall control port */ +#define XCHAL_HAVE_PSO 0 /* Power Shut-Off */ +#define XCHAL_HAVE_PSO_CDM 0 /* core/debug/mem pwr domains */ +#define XCHAL_HAVE_PSO_FULL_RETENTION 0 /* all regs preserved on PSO */ +#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */ +#define XCHAL_HAVE_BOOLEANS 1 /* boolean registers */ +#define XCHAL_HAVE_CP 0 /* CPENABLE reg (coprocessor) */ +#define XCHAL_CP_MAXCFG 2 /* max allowed cp id plus one */ + + +#define XCHAL_HAVE_MAC16 0 /* MAC16 package */ + +#define XCHAL_HAVE_FUSION 0 /* Fusion*/ +#define XCHAL_HAVE_FUSION_FP 0 /* Fusion FP option */ +#define XCHAL_HAVE_FUSION_LOW_POWER 0 /* Fusion Low Power option */ +#define XCHAL_HAVE_FUSION_AES 0 /* Fusion BLE/Wifi AES-128 CCM option */ +#define XCHAL_HAVE_FUSION_CONVENC 0 /* Fusion Conv Encode option */ +#define XCHAL_HAVE_FUSION_LFSR_CRC 0 /* Fusion LFSR-CRC option */ +#define XCHAL_HAVE_FUSION_BITOPS 0 /* Fusion Bit Operations Support option */ +#define XCHAL_HAVE_FUSION_AVS 0 /* Fusion AVS option */ +#define XCHAL_HAVE_FUSION_16BIT_BASEBAND 0 /* Fusion 16-bit Baseband option */ +#define XCHAL_HAVE_HIFIPRO 0 /* HiFiPro Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4 0 /* HiFi4 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4_VFPU 0 /* HiFi4 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI3 1 /* HiFi3 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI3_VFPU 0 /* HiFi3 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI2EP 0 /* HiFi2EP */ +#define XCHAL_HAVE_HIFI2_MUL32X24 0 /* HiFi2 and 32x24 MACs */ +#define XCHAL_HAVE_HIFI_MINI 0 + + +#define XCHAL_HAVE_VECTORFPU2005 0 /* vector or user floating-point pkg */ +#define XCHAL_HAVE_USER_DPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_USER_SPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_FP 1 /* single prec floating point */ +#define XCHAL_HAVE_FP_DIV 0 /* FP with DIV instructions */ +#define XCHAL_HAVE_FP_RECIP 0 /* FP with RECIP instructions */ +#define XCHAL_HAVE_FP_SQRT 0 /* FP with SQRT instructions */ +#define XCHAL_HAVE_FP_RSQRT 0 /* FP with RSQRT instructions */ +#define XCHAL_HAVE_DFP 0 /* double precision FP pkg */ +#define XCHAL_HAVE_DFP_DIV 0 /* DFP with DIV instructions */ +#define XCHAL_HAVE_DFP_RECIP 0 /* DFP with RECIP instructions*/ +#define XCHAL_HAVE_DFP_SQRT 0 /* DFP with SQRT instructions */ +#define XCHAL_HAVE_DFP_RSQRT 0 /* DFP with RSQRT instructions*/ +#define XCHAL_HAVE_DFP_ACCEL 0 /* double precision FP acceleration pkg */ +#define XCHAL_HAVE_DFP_accel XCHAL_HAVE_DFP_ACCEL /* for backward compatibility */ + +#define XCHAL_HAVE_DFPU_SINGLE_ONLY 0 /* DFPU Coprocessor, single precision only */ +#define XCHAL_HAVE_DFPU_SINGLE_DOUBLE 0 /* DFPU Coprocessor, single and double precision */ +#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */ +#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */ +#define XCHAL_HAVE_PDX4 0 /* PDX4 */ +#define XCHAL_HAVE_CONNXD2 0 /* ConnX D2 pkg */ +#define XCHAL_HAVE_CONNXD2_DUALLSFLIX 0 /* ConnX D2 & Dual LoadStore Flix */ +#define XCHAL_HAVE_BBE16 0 /* ConnX BBE16 pkg */ +#define XCHAL_HAVE_BBE16_RSQRT 0 /* BBE16 & vector recip sqrt */ +#define XCHAL_HAVE_BBE16_VECDIV 0 /* BBE16 & vector divide */ +#define XCHAL_HAVE_BBE16_DESPREAD 0 /* BBE16 & despread */ +#define XCHAL_HAVE_BBENEP 0 /* ConnX BBENEP pkgs */ +#define XCHAL_HAVE_BSP3 0 /* ConnX BSP3 pkg */ +#define XCHAL_HAVE_BSP3_TRANSPOSE 0 /* BSP3 & transpose32x32 */ +#define XCHAL_HAVE_SSP16 0 /* ConnX SSP16 pkg */ +#define XCHAL_HAVE_SSP16_VITERBI 0 /* SSP16 & viterbi */ +#define XCHAL_HAVE_TURBO16 0 /* ConnX Turbo16 pkg */ +#define XCHAL_HAVE_BBP16 0 /* ConnX BBP16 pkg */ +#define XCHAL_HAVE_FLIX3 0 /* basic 3-way FLIX option */ +#define XCHAL_HAVE_GRIVPEP 0 /* GRIVPEP is General Release of IVPEP */ +#define XCHAL_HAVE_GRIVPEP_HISTOGRAM 0 /* Histogram option on GRIVPEP */ + + +/*---------------------------------------------------------------------- + MISC + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_LOADSTORE_UNITS 2 /* load/store units */ +#define XCHAL_NUM_WRITEBUFFER_ENTRIES 8 /* size of write buffer */ +#define XCHAL_INST_FETCH_WIDTH 8 /* instr-fetch width in bytes */ +#define XCHAL_DATA_WIDTH 8 /* data width in bytes */ +#define XCHAL_DATA_PIPE_DELAY 1 /* d-side pipeline delay + (1 = 5-stage, 2 = 7-stage) */ +#define XCHAL_CLOCK_GATING_GLOBAL 1 /* global clock gating */ +#define XCHAL_CLOCK_GATING_FUNCUNIT 1 /* funct. unit clock gating */ +/* In T1050, applies to selected core load and store instructions (see ISA): */ +#define XCHAL_UNALIGNED_LOAD_EXCEPTION 0 /* unaligned loads cause exc. */ +#define XCHAL_UNALIGNED_STORE_EXCEPTION 0 /* unaligned stores cause exc.*/ +#define XCHAL_UNALIGNED_LOAD_HW 1 /* unaligned loads work in hw */ +#define XCHAL_UNALIGNED_STORE_HW 1 /* unaligned stores work in hw*/ + +#define XCHAL_SW_VERSION 1100002 /* sw version of this header */ + +#define XCHAL_CORE_ID "hifi3" /* alphanum core name + (CoreID) set in the Xtensa + Processor Generator */ + +#define XCHAL_BUILD_UNIQUE_ID 0x0005483B /* 22-bit sw build ID */ + +/* + * These definitions describe the hardware targeted by this software. + */ +#define XCHAL_HW_CONFIGID0 0xC3F3FBFE /* ConfigID hi 32 bits*/ +#define XCHAL_HW_CONFIGID1 0x1544813C /* ConfigID lo 32 bits*/ +#define XCHAL_HW_VERSION_NAME "LX4.0.5" /* full version name */ +#define XCHAL_HW_VERSION_MAJOR 2400 /* major ver# of targeted hw */ +#define XCHAL_HW_VERSION_MINOR 5 /* minor ver# of targeted hw */ +#define XCHAL_HW_VERSION 240005 /* major*100+minor */ +#define XCHAL_HW_REL_LX6 1 +#define XCHAL_HW_REL_LX6_0 1 +#define XCHAL_HW_REL_LX6_0_2 1 +#define XCHAL_HW_CONFIGID_RELIABLE 1 +/* If software targets a *range* of hardware versions, these are the bounds: */ +#define XCHAL_HW_MIN_VERSION_MAJOR 2600 /* major v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION_MINOR 2 /* minor v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION 260002 /* earliest targeted hw */ +#define XCHAL_HW_MAX_VERSION_MAJOR 2600 /* major v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION_MINOR 2 /* minor v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION 260002 /* latest targeted hw */ + + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_ICACHE_LINESIZE 64 /* I-cache line size in bytes */ +#define XCHAL_DCACHE_LINESIZE 64 /* D-cache line size in bytes */ +#define XCHAL_ICACHE_LINEWIDTH 6 /* log2(I line size in bytes) */ +#define XCHAL_DCACHE_LINEWIDTH 6 /* log2(D line size in bytes) */ + +#define XCHAL_ICACHE_SIZE 16384 /* I-cache size in bytes or 0 */ +#define XCHAL_DCACHE_SIZE 49152 /* D-cache size in bytes or 0 */ + +#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */ +#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */ + +#define XCHAL_HAVE_PREFETCH 1 /* PREFCTL register */ +#define XCHAL_HAVE_PREFETCH_L1 1 /* prefetch to L1 dcache */ +#define XCHAL_PREFETCH_CASTOUT_LINES 2 /* dcache pref. castout bufsz */ +#define XCHAL_PREFETCH_ENTRIES 8 /* cache prefetch entries */ +#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */ +#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */ +#define XCHAL_HAVE_ICACHE_TEST 0 /* Icache test instructions */ +#define XCHAL_HAVE_DCACHE_TEST 0 /* Dcache test instructions */ +#define XCHAL_HAVE_ICACHE_DYN_WAYS 0 /* Icache dynamic way support */ +#define XCHAL_HAVE_DCACHE_DYN_WAYS 0 /* Dcache dynamic way support */ + + + + +/**************************************************************************** + Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code + ****************************************************************************/ + + +#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */ + +/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */ + +/* Number of cache sets in log2(lines per way): */ +#define XCHAL_ICACHE_SETWIDTH 7 +#define XCHAL_DCACHE_SETWIDTH 8 + +/* Cache set associativity (number of ways): */ +#define XCHAL_ICACHE_WAYS 2 +#define XCHAL_DCACHE_WAYS 3 + +/* Cache features: */ +#define XCHAL_ICACHE_LINE_LOCKABLE 1 +#define XCHAL_DCACHE_LINE_LOCKABLE 1 +#define XCHAL_ICACHE_ECC_PARITY XTHAL_MEMEP_ECC +#define XCHAL_DCACHE_ECC_PARITY XTHAL_MEMEP_ECC + +/* Cache access size in bytes (affects operation of SICW instruction): */ +#define XCHAL_ICACHE_ACCESS_SIZE 8 +#define XCHAL_DCACHE_ACCESS_SIZE 8 + +#define XCHAL_DCACHE_BANKS 2 /* number of banks */ + +/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */ +#define XCHAL_CA_BITS 4 + +/* Whether MEMCTL register has anything useful */ +#define XCHAL_USE_MEMCTL (((XCHAL_LOOP_BUFFER_SIZE > 0) || \ + XCHAL_DCACHE_IS_COHERENT || \ + XCHAL_HAVE_ICACHE_DYN_WAYS || \ + XCHAL_HAVE_DCACHE_DYN_WAYS) && \ + (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RE_2012_0)) + + +/*---------------------------------------------------------------------- + INTERNAL I/D RAM/ROMs and XLMI + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */ +#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */ +#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */ +#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */ +#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/ +#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */ + +/* Instruction RAM 0: */ +#define XCHAL_INSTRAM0_VADDR 0x80000000 /* virtual address */ +#define XCHAL_INSTRAM0_PADDR 0x80000000 /* physical address */ +#define XCHAL_INSTRAM0_SIZE 0x20000 /* size in bytes */ +#define XCHAL_INSTRAM0_ECC_PARITY 1 /* ECC/parity type, 0=none */ + +/* Data RAM 0: */ +#define XCHAL_DATARAM0_VADDR 0xbefe0000 /* virtual address */ +#define XCHAL_DATARAM0_PADDR 0xbefe0000 /* physical address */ +#define XCHAL_DATARAM0_SIZE 0x28000 /* size in bytes */ +#define XCHAL_DATARAM0_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_DATARAM0_BANKS 1 /* number of banks */ + + +#define XCHAL_HAVE_IMEM_LOADSTORE 1 /* can load/store to IROM/IRAM*/ + + +/*---------------------------------------------------------------------- + INTERRUPTS and TIMERS + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */ +#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */ +#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */ +#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */ +#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ +#define XCHAL_NUM_INTERRUPTS 21 /* number of interrupts */ +#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */ +#define XCHAL_NUM_EXTINTERRUPTS 8 /* num of external interrupts */ +#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels + (not including level zero) */ +#define XCHAL_EXCM_LEVEL 5 /* level masked by PS.EXCM */ + /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */ + +/* Masks of interrupts at each interrupt level: */ +#define XCHAL_INTLEVEL1_MASK 0x0000000F +#define XCHAL_INTLEVEL2_MASK 0x000000F0 +#define XCHAL_INTLEVEL3_MASK 0x00000F00 +#define XCHAL_INTLEVEL4_MASK 0x00007000 +#define XCHAL_INTLEVEL5_MASK 0x000F8000 +#define XCHAL_INTLEVEL6_MASK 0x00000000 +#define XCHAL_INTLEVEL7_MASK 0x00100000 + +/* Masks of interrupts at each range 1..n of interrupt levels: */ +#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x0000000F +#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x000000FF +#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x00000FFF +#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x00007FFF +#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x001FFFFF + +/* Level of each interrupt: */ +#define XCHAL_INT0_LEVEL 1 +#define XCHAL_INT1_LEVEL 1 +#define XCHAL_INT2_LEVEL 1 +#define XCHAL_INT3_LEVEL 1 + +#define XCHAL_INT4_LEVEL 2 +#define XCHAL_INT5_LEVEL 2 +#define XCHAL_INT6_LEVEL 2 +#define XCHAL_INT7_LEVEL 2 + +#define XCHAL_INT8_LEVEL 3 +#define XCHAL_INT9_LEVEL 3 +#define XCHAL_INT10_LEVEL 3 +#define XCHAL_INT11_LEVEL 3 + +#define XCHAL_INT12_LEVEL 4 +#define XCHAL_INT13_LEVEL 4 +#define XCHAL_INT14_LEVEL 4 +#define XCHAL_INT15_LEVEL 5 + +#define XCHAL_INT16_LEVEL 5 +#define XCHAL_INT17_LEVEL 5 +#define XCHAL_INT18_LEVEL 5 +#define XCHAL_INT19_LEVEL 5 + +#define XCHAL_INT20_LEVEL 7 + + +#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */ +#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */ +#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with + EXCSAVE/EPS/EPC_n, RFI n) */ + +/* Type of each interrupt: */ +#define XCHAL_INT0_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT1_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT3_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT4_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT5_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT8_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT9_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT10_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT11_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT12_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT13_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT19_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT20_TYPE XTHAL_INTTYPE_NMI + +/* Masks of interrupts for each type of interrupt: */ +#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFE00000 +#define XCHAL_INTTYPE_MASK_SOFTWARE 0x0008D999 +#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000000 +#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x00072444 +#define XCHAL_INTTYPE_MASK_TIMER 0x00000222 +#define XCHAL_INTTYPE_MASK_NMI 0x00100000 +#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000 +#define XCHAL_INTTYPE_MASK_PROFILING 0x00000000 + +/* Interrupt numbers assigned to specific interrupt sources: */ +#define XCHAL_TIMER0_INTERRUPT 1 /* CCOMPARE0 */ +#define XCHAL_TIMER1_INTERRUPT 5 /* CCOMPARE1 */ +#define XCHAL_TIMER2_INTERRUPT 9 /* CCOMPARE2 */ +#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED +#define XCHAL_NMI_INTERRUPT 20 /* non-maskable interrupt */ + +/* Interrupt numbers for levels at which only one interrupt is configured: */ +//#define XCHAL_INTLEVEL2_NUM 8 +//#define XCHAL_INTLEVEL4_NUM 12 +//#define XCHAL_INTLEVEL5_NUM 13 +#define XCHAL_INTLEVEL7_NUM 20 +/* (There are many interrupts each at level(s) 1, 3.) */ + + +/* + * External interrupt mapping. + * These macros describe how Xtensa processor interrupt numbers + * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) + * map to external BInterrupt<n> pins, for those interrupts + * configured as external (level-triggered, edge-triggered, or NMI). + * See the Xtensa processor databook for more details. + */ + +/* Core interrupt numbers mapped to each EXTERNAL BInterrupt pin number: */ +#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */ +#define XCHAL_EXTINT1_NUM 1 /* (intlevel 1) */ +#define XCHAL_EXTINT2_NUM 2 /* (intlevel 1) */ +#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */ +#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */ +#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */ +#define XCHAL_EXTINT6_NUM 8 /* (intlevel 2) */ +#define XCHAL_EXTINT7_NUM 9 /* (intlevel 3) */ +#define XCHAL_EXTINT8_NUM 12 /* (intlevel 4) */ +#define XCHAL_EXTINT9_NUM 14 /* (intlevel 7) */ +#define XCHAL_EXTINT10_NUM 15 /* (intlevel 1) */ +#define XCHAL_EXTINT11_NUM 16 /* (intlevel 1) */ +#define XCHAL_EXTINT12_NUM 17 /* (intlevel 1) */ +#define XCHAL_EXTINT13_NUM 18 /* (intlevel 1) */ +#define XCHAL_EXTINT14_NUM 19 /* (intlevel 1) */ +#define XCHAL_EXTINT15_NUM 20 /* (intlevel 1) */ +#define XCHAL_EXTINT16_NUM 21 /* (intlevel 3) */ +/* EXTERNAL BInterrupt pin numbers mapped to each core interrupt number: */ +#define XCHAL_INT0_EXTNUM 0 /* (intlevel 1) */ +#define XCHAL_INT1_EXTNUM 1 /* (intlevel 1) */ +#define XCHAL_INT2_EXTNUM 2 /* (intlevel 1) */ +#define XCHAL_INT3_EXTNUM 3 /* (intlevel 1) */ +#define XCHAL_INT4_EXTNUM 4 /* (intlevel 1) */ +#define XCHAL_INT5_EXTNUM 5 /* (intlevel 1) */ +#define XCHAL_INT8_EXTNUM 6 /* (intlevel 2) */ +#define XCHAL_INT9_EXTNUM 7 /* (intlevel 3) */ +#define XCHAL_INT12_EXTNUM 8 /* (intlevel 4) */ +#define XCHAL_INT14_EXTNUM 9 /* (intlevel 7) */ +#define XCHAL_INT15_EXTNUM 10 /* (intlevel 1) */ +#define XCHAL_INT16_EXTNUM 11 /* (intlevel 1) */ +#define XCHAL_INT17_EXTNUM 12 /* (intlevel 1) */ +#define XCHAL_INT18_EXTNUM 13 /* (intlevel 1) */ +#define XCHAL_INT19_EXTNUM 14 /* (intlevel 1) */ +#define XCHAL_INT20_EXTNUM 15 /* (intlevel 1) */ +#define XCHAL_INT21_EXTNUM 16 /* (intlevel 3) */ + + +/*---------------------------------------------------------------------- + EXCEPTIONS and VECTORS + ----------------------------------------------------------------------*/ + +#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture + number: 1 == XEA1 (old) + 2 == XEA2 (new) + 0 == XEAX (extern) or TX */ +#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */ +#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */ +#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */ +#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */ +#define XCHAL_HAVE_HALT 0 /* halt architecture option */ +#define XCHAL_HAVE_BOOTLOADER 0 /* boot loader (for TX) */ +#define XCHAL_HAVE_MEM_ECC_PARITY 1 /* local memory ECC/parity */ +#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */ +#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */ +#define XCHAL_VECBASE_RESET_VADDR 0xa000a400 /* VECBASE reset value */ +#define XCHAL_VECBASE_RESET_PADDR 0xa000a400 +#define XCHAL_RESET_VECBASE_OVERLAP 0 + +#define XCHAL_RESET_VECTOR0_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR0_PADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR1_VADDR 0xBE800000 +#define XCHAL_RESET_VECTOR1_PADDR 0xBE800000 +#define XCHAL_RESET_VECTOR_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR_PADDR 0xBEFE0000 +#define XCHAL_MEMERROR_VECTOR0_VADDR 0xbefe0270 +#define XCHAL_MEMERROR_VECTOR0_PADDR 0xbefe0270 +#define XCHAL_MEMERROR_VECTOR1_VADDR 0xBE800400 +#define XCHAL_MEMERROR_VECTOR1_PADDR 0xBE800400 +#define XCHAL_MEMERROR_VECTOR_VADDR 0xbefe0270 +#define XCHAL_MEMERROR_VECTOR_PADDR 0xbefe0270 +#define XCHAL_USER_VECOFS 0x00000340 +#define XCHAL_USER_VECTOR_VADDR 0xa000a740 +#define XCHAL_USER_VECTOR_PADDR 0xa000a740 +#define XCHAL_KERNEL_VECOFS 0x00000300 +#define XCHAL_KERNEL_VECTOR_VADDR 0xa000a700 +#define XCHAL_KERNEL_VECTOR_PADDR 0xa000a700 +#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0 +#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xa000a7c0 +#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0xa000a7c0 +#define XCHAL_WINDOW_OF4_VECOFS 0x00000000 +#define XCHAL_WINDOW_UF4_VECOFS 0x00000040 +#define XCHAL_WINDOW_OF8_VECOFS 0x00000080 +#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0 +#define XCHAL_WINDOW_OF12_VECOFS 0x00000100 +#define XCHAL_WINDOW_UF12_VECOFS 0x00000140 +#define XCHAL_WINDOW_VECTORS_VADDR 0xa000a400 +#define XCHAL_WINDOW_VECTORS_PADDR 0xa000a400 +#define XCHAL_INTLEVEL2_VECOFS 0x00000180 +#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xa000a580 +#define XCHAL_INTLEVEL2_VECTOR_PADDR 0xa000a580 +#define XCHAL_INTLEVEL3_VECOFS 0x000001C0 +#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xa000a5c0 +#define XCHAL_INTLEVEL3_VECTOR_PADDR 0xa000a5c0 +#define XCHAL_INTLEVEL4_VECOFS 0x00000200 +#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xa000a600 +#define XCHAL_INTLEVEL4_VECTOR_PADDR 0xa000a600 +#define XCHAL_INTLEVEL5_VECOFS 0x00000240 +#define XCHAL_INTLEVEL5_VECTOR_VADDR 0xa000a640 +#define XCHAL_INTLEVEL5_VECTOR_PADDR 0xa000a640 +#define XCHAL_INTLEVEL6_VECOFS 0x00000280 +#define XCHAL_INTLEVEL6_VECTOR_VADDR 0xa000a680 +#define XCHAL_INTLEVEL6_VECTOR_PADDR 0xa000a680 +#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS +#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR +#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR +#define XCHAL_NMI_VECOFS 0x000002C0 +#define XCHAL_NMI_VECTOR_VADDR 0xa000a6c0 +#define XCHAL_NMI_VECTOR_PADDR 0xa000a6c0 +#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS +#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR +#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR + + +/*---------------------------------------------------------------------- + DEBUG MODULE + ----------------------------------------------------------------------*/ + +/* Misc */ +#define XCHAL_HAVE_DEBUG_ERI 0 /* ERI to debug module */ +#define XCHAL_HAVE_DEBUG_APB 0 /* APB to debug module */ +#define XCHAL_HAVE_DEBUG_JTAG 1 /* JTAG to debug module */ + +/* On-Chip Debug (OCD) */ +#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */ +#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ +#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ +#define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option (to LX4) */ +#define XCHAL_HAVE_OCD_LS32DDR 1 /* L32DDR/S32DDR (faster OCD) */ + +/* TRAX (in core) */ +#define XCHAL_HAVE_TRAX 0 /* TRAX in debug module */ +#define XCHAL_TRAX_MEM_SIZE 0 /* TRAX memory size in bytes */ +#define XCHAL_TRAX_MEM_SHAREABLE 0 /* start/end regs; ready sig. */ +#define XCHAL_TRAX_ATB_WIDTH 0 /* ATB width (bits), 0=no ATB */ +#define XCHAL_TRAX_TIME_WIDTH 0 /* timestamp bitwidth, 0=none */ + +/* Perf counters */ +#define XCHAL_NUM_PERF_COUNTERS 0 /* performance counters */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* See core-matmap.h header file for more details. */ + +#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */ +#define XCHAL_HAVE_SPANNING_WAY 1 /* one way maps I+D 4GB vaddr */ +#define XCHAL_SPANNING_WAY 0 /* TLB spanning way number */ +#define XCHAL_HAVE_IDENTITY_MAP 0 /* vaddr == paddr always */ +#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */ +#define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* region protection */ +#define XCHAL_HAVE_XLT_CACHEATTR 1 /* region prot. w/translation */ +#define XCHAL_HAVE_PTP_MMU 0 /* full MMU (with page table + [autorefill] and protection) + usable for an MMU-based OS */ +/* If none of the above last 4 are set, it's a custom TLB configuration. */ + +#define XCHAL_MMU_ASID_BITS 0 /* number of bits in ASIDs */ +#define XCHAL_MMU_RINGS 1 /* number of rings (1..4) */ +#define XCHAL_MMU_RING_BITS 0 /* num of bits in RING field */ + +#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ + + +#endif /* _XTENSA_CORE_CONFIGURATION_H */ diff --git a/src/platform/apollolake/include/xtensa/config/core-matmap.h b/src/platform/apollolake/include/xtensa/config/core-matmap.h new file mode 100644 index 0000000..c4f479a --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/core-matmap.h @@ -0,0 +1,313 @@ +/* + * xtensa/config/core-matmap.h -- Memory access and translation mapping + * parameters (CHAL) of the Xtensa processor core configuration. + * + * If you are using Xtensa Tools, see <xtensa/config/core.h> (which includes + * this file) for more details. + * + * In the Xtensa processor products released to date, all parameters + * defined in this file are derivable (at least in theory) from + * information contained in the core-isa.h header file. + * In particular, the following core configuration parameters are relevant: + * XCHAL_HAVE_CACHEATTR + * XCHAL_HAVE_MIMIC_CACHEATTR + * XCHAL_HAVE_XLT_CACHEATTR + * XCHAL_HAVE_PTP_MMU + * XCHAL_ITLB_ARF_ENTRIES_LOG2 + * XCHAL_DTLB_ARF_ENTRIES_LOG2 + * XCHAL_DCACHE_IS_WRITEBACK + * XCHAL_ICACHE_SIZE (presence of I-cache) + * XCHAL_DCACHE_SIZE (presence of D-cache) + * XCHAL_HW_VERSION_MAJOR + * XCHAL_HW_VERSION_MINOR + */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 1999-2015 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_CORE_MATMAP_H +#define XTENSA_CONFIG_CORE_MATMAP_H + + +/*---------------------------------------------------------------------- + CACHE (MEMORY ACCESS) ATTRIBUTES + ----------------------------------------------------------------------*/ + + +/* Cache Attribute encodings -- lists of access modes for each cache attribute: */ +#define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION +#define XCHAL_LCA_LIST XTHAL_LAM_CACHED_NOALLOC XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_ISOLATE XCHAL_SEP \ + XTHAL_LAM_EXCEPTION +#define XCHAL_SCA_LIST XTHAL_SAM_WRITETHRU XCHAL_SEP \ + XTHAL_SAM_WRITETHRU XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_WRITEBACK XCHAL_SEP \ + XTHAL_SAM_WRITEBACK_NOALLOC XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_ISOLATE XCHAL_SEP \ + XTHAL_SAM_EXCEPTION + + +/* + * Specific encoded cache attribute values of general interest. + * If a specific cache mode is not available, the closest available + * one is returned instead (eg. writethru instead of writeback, + * bypass instead of writethru). + */ +#define XCHAL_CA_BYPASS 2 /* cache disabled (bypassed) mode */ +#define XCHAL_CA_BYPASSBUF 6 /* cache disabled (bypassed) bufferable mode */ +#define XCHAL_CA_WRITETHRU 1 /* cache enabled (write-through) mode */ +#define XCHAL_CA_WRITEBACK 4 /* cache enabled (write-back) mode */ +#define XCHAL_HAVE_CA_WRITEBACK_NOALLOC 1 /* write-back no-allocate availability */ +#define XCHAL_CA_WRITEBACK_NOALLOC 5 /* cache enabled (write-back no-allocate) mode */ +#define XCHAL_CA_ILLEGAL 15 /* no access allowed (all cause exceptions) mode */ +#define XCHAL_CA_ISOLATE 14 /* cache isolate (accesses go to cache not memory) mode */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* + * General notes on MMU parameters. + * + * Terminology: + * ASID = address-space ID (acts as an "extension" of virtual addresses) + * VPN = virtual page number + * PPN = physical page number + * CA = encoded cache attribute (access modes) + * TLB = translation look-aside buffer (term is stretched somewhat here) + * I = instruction (fetch accesses) + * D = data (load and store accesses) + * way = each TLB (ITLB and DTLB) consists of a number of "ways" + * that simultaneously match the virtual address of an access; + * a TLB successfully translates a virtual address if exactly + * one way matches the vaddr; if none match, it is a miss; + * if multiple match, one gets a "multihit" exception; + * each way can be independently configured in terms of number of + * entries, page sizes, which fields are writable or constant, etc. + * set = group of contiguous ways with exactly identical parameters + * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE + * from the page table and storing it in one of the auto-refill ways; + * if this PTE load also misses, a miss exception is posted for s/w. + * min-wired = a "min-wired" way can be used to map a single (minimum-sized) + * page arbitrarily under program control; it has a single entry, + * is non-auto-refill (some other way(s) must be auto-refill), + * all its fields (VPN, PPN, ASID, CA) are all writable, and it + * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current + * restriction is that this be the only page size it supports). + * + * TLB way entries are virtually indexed. + * TLB ways that support multiple page sizes: + * - must have all writable VPN and PPN fields; + * - can only use one page size at any given time (eg. setup at startup), + * selected by the respective ITLBCFG or DTLBCFG special register, + * whose bits n*4+3 .. n*4 index the list of page sizes for way n + * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n); + * this list may be sparse for auto-refill ways because auto-refill + * ways have independent lists of supported page sizes sharing a + * common encoding with PTE entries; the encoding is the index into + * this list; unsupported sizes for a given way are zero in the list; + * selecting unsupported sizes results in undefined hardware behaviour; + * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition). + */ + +#define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */ +#define XCHAL_MMU_ASID_KERNEL 0 /* ASID value indicating kernel (ring 0) address space */ +#define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */ +#define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ +#define XCHAL_MMU_MAX_PTE_PAGE_SIZE 29 /* max page size in a PTE structure (log2) */ +#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 29 /* min page size in a PTE structure (log2) */ + + +/*** Instruction TLB: ***/ + +#define XCHAL_ITLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_ITLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_ITLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_ITLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_ITLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_ITLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* ITLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_ITLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_ITLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_ITLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_ITLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of ITLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of ITLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of ITLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_ITLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E7_CA_RESET 0x02 + + +/*** Data TLB: ***/ + +#define XCHAL_DTLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_DTLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_DTLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_DTLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_DTLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_DTLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_DTLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* DTLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_DTLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_DTLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_DTLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_DTLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of DTLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of DTLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of DTLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_DTLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E7_CA_RESET 0x02 + + + + +#endif /*XTENSA_CONFIG_CORE_MATMAP_H*/ diff --git a/src/platform/apollolake/include/xtensa/config/defs.h b/src/platform/apollolake/include/xtensa/config/defs.h new file mode 100644 index 0000000..b695e59 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/defs.h @@ -0,0 +1,38 @@ +/* Definitions for Xtensa instructions, types, and protos. */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 2003-2004 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* NOTE: This file exists only for backward compatibility with T1050 + and earlier Xtensa releases. It includes only a subset of the + available header files. */ + +#ifndef _XTENSA_BASE_HEADER +#define _XTENSA_BASE_HEADER + +#ifdef __XTENSA__ + +#include <xtensa/tie/xt_core.h> +#include <xtensa/tie/xt_misc.h> +#include <xtensa/tie/xt_booleans.h> + +#endif /* __XTENSA__ */ +#endif /* !_XTENSA_BASE_HEADER */ diff --git a/src/platform/apollolake/include/xtensa/config/specreg.h b/src/platform/apollolake/include/xtensa/config/specreg.h new file mode 100644 index 0000000..96bfa94 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/specreg.h @@ -0,0 +1,106 @@ +/* + * Xtensa Special Register symbolic names + */ + +/* $Id: //depot/rel/Eaglenest/Xtensa/SWConfig/hal/specreg.h.tpp#1 $ */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 1998-2002 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef XTENSA_SPECREG_H +#define XTENSA_SPECREG_H + +/* Include these special register bitfield definitions, for historical reasons: */ +#include <xtensa/corebits.h> + + +/* Special registers: */ +#define LBEG 0 +#define LEND 1 +#define LCOUNT 2 +#define SAR 3 +#define BR 4 +#define SCOMPARE1 12 +#define WINDOWBASE 72 +#define WINDOWSTART 73 +#define IBREAKENABLE 96 +#define ATOMCTL 99 +#define DDR 104 +#define IBREAKA_0 128 +#define IBREAKA_1 129 +#define DBREAKA_0 144 +#define DBREAKA_1 145 +#define DBREAKC_0 160 +#define DBREAKC_1 161 +#define EPC_1 177 +#define EPC_2 178 +#define EPC_3 179 +#define EPC_4 180 +#define EPC_5 181 +#define EPC_6 182 +#define EPC_7 183 +#define DEPC 192 +#define EPS_2 194 +#define EPS_3 195 +#define EPS_4 196 +#define EPS_5 197 +#define EPS_6 198 +#define EPS_7 199 +#define EXCSAVE_1 209 +#define EXCSAVE_2 210 +#define EXCSAVE_3 211 +#define EXCSAVE_4 212 +#define EXCSAVE_5 213 +#define EXCSAVE_6 214 +#define EXCSAVE_7 215 +#define CPENABLE 224 +#define INTERRUPT 226 +#define INTENABLE 228 +#define PS 230 +#define VECBASE 231 +#define EXCCAUSE 232 +#define DEBUGCAUSE 233 +#define CCOUNT 234 +#define PRID 235 +#define ICOUNT 236 +#define ICOUNTLEVEL 237 +#define EXCVADDR 238 +#define CCOMPARE_0 240 +#define CCOMPARE_1 241 +#define CCOMPARE_2 242 +#define MISC_REG_0 244 +#define MISC_REG_1 245 + +/* Special cases (bases of special register series): */ +#define IBREAKA 128 +#define DBREAKA 144 +#define DBREAKC 160 +#define EPC 176 +#define EPS 192 +#define EXCSAVE 208 +#define CCOMPARE 240 + +/* Special names for read-only and write-only interrupt registers: */ +#define INTREAD 226 +#define INTSET 226 +#define INTCLEAR 227 + +#endif /* XTENSA_SPECREG_H */ diff --git a/src/platform/apollolake/include/xtensa/config/system.h b/src/platform/apollolake/include/xtensa/config/system.h new file mode 100644 index 0000000..aad1d8c --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/system.h @@ -0,0 +1,271 @@ +/* + * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration + * + * NOTE: The location and contents of this file are highly subject to change. + * + * Source for configuration-independent binaries (which link in a + * configuration-specific HAL library) must NEVER include this file. + * The HAL itself has historically included this file in some instances, + * but this is not appropriate either, because the HAL is meant to be + * core-specific but system independent. + */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 2000-2010 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_SYSTEM_H +#define XTENSA_CONFIG_SYSTEM_H + +/*#include <xtensa/hal.h>*/ + + + +/*---------------------------------------------------------------------- + CONFIGURED SOFTWARE OPTIONS + ----------------------------------------------------------------------*/ + +#define XSHAL_USE_ABSOLUTE_LITERALS 0 /* (sw-only option, whether software uses absolute literals) */ +#define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals. */ + +#define XSHAL_ABI XTHAL_ABI_CALL0 /* (sw-only option, selected ABI) */ +/* The above maps to one of the following constants: */ +#define XTHAL_ABI_WINDOWED 0 +#define XTHAL_ABI_CALL0 1 +/* Alternatives: */ +/*#define XSHAL_WINDOWED_ABI 1*/ /* set if windowed ABI selected */ +/*#define XSHAL_CALL0_ABI 0*/ /* set if call0 ABI selected */ + +#define XSHAL_CLIB XTHAL_CLIB_NEWLIB /* (sw-only option, selected C library) */ +/* The above maps to one of the following constants: */ +#define XTHAL_CLIB_NEWLIB 0 +#define XTHAL_CLIB_UCLIBC 1 +#define XTHAL_CLIB_XCLIB 2 +/* Alternatives: */ +/*#define XSHAL_NEWLIB 1*/ /* set if newlib C library selected */ +/*#define XSHAL_UCLIBC 0*/ /* set if uCLibC C library selected */ +/*#define XSHAL_XCLIB 0*/ /* set if Xtensa C library selected */ + +#define XSHAL_USE_FLOATING_POINT 1 + +#define XSHAL_FLOATING_POINT_ABI 0 + +/*---------------------------------------------------------------------- + DEVICE ADDRESSES + ----------------------------------------------------------------------*/ + +/* + * Strange place to find these, but the configuration GUI + * allows moving these around to account for various core + * configurations. Specific boards (and their BSP software) + * will have specific meanings for these components. + */ + +/* I/O Block areas: */ +#define XSHAL_IOBLOCK_CACHED_VADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_PADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_SIZE 0x0E000000 + +#define XSHAL_IOBLOCK_BYPASS_VADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_PADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_SIZE 0x0E000000 + +/* System ROM: */ +#define XSHAL_ROM_VADDR 0x50000000 +#define XSHAL_ROM_PADDR 0x50000000 +#define XSHAL_ROM_SIZE 0x01000000 +/* Largest available area (free of vectors): */ +#define XSHAL_ROM_AVAIL_VADDR 0x50000300 +#define XSHAL_ROM_AVAIL_VSIZE 0x00FFFD00 + +/* System RAM: */ +#define XSHAL_RAM_VADDR 0x60000000 +#define XSHAL_RAM_PADDR 0x60000000 +#define XSHAL_RAM_VSIZE 0x04000000 +#define XSHAL_RAM_PSIZE 0x04000000 +#define XSHAL_RAM_SIZE XSHAL_RAM_PSIZE +/* Largest available area (free of vectors): */ +#define XSHAL_RAM_AVAIL_VADDR 0x60000400 +#define XSHAL_RAM_AVAIL_VSIZE 0x03FFFC00 + +/* + * Shadow system RAM (same device as system RAM, at different address). + * (Emulation boards need this for the SONIC Ethernet driver + * when data caches are configured for writeback mode.) + * NOTE: on full MMU configs, this points to the BYPASS virtual address + * of system RAM, ie. is the same as XSHAL_RAM_* except that virtual + * addresses are viewed through the BYPASS static map rather than + * the CACHED static map. + */ +#define XSHAL_RAM_BYPASS_VADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PSIZE 0x04000000 + +/* Alternate system RAM (different device than system RAM): */ +/*#define XSHAL_ALTRAM_[VP]ADDR ...not configured...*/ +/*#define XSHAL_ALTRAM_SIZE ...not configured...*/ + +/* Some available location in which to place devices in a simulation (eg. XTMP): */ +#define XSHAL_SIMIO_CACHED_VADDR 0xC0000000 +#define XSHAL_SIMIO_BYPASS_VADDR 0xC0000000 +#define XSHAL_SIMIO_PADDR 0xC0000000 +#define XSHAL_SIMIO_SIZE 0x20000000 + + +/*---------------------------------------------------------------------- + * For use by reference testbench exit and diagnostic routines. + */ +#define XSHAL_MAGIC_EXIT 0x0 + +/*---------------------------------------------------------------------- + * DEVICE-ADDRESS DEPENDENT... + * + * Values written to CACHEATTR special register (or its equivalent) + * to enable and disable caches in various modes. + *----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------- + BACKWARD COMPATIBILITY ... + ----------------------------------------------------------------------*/ + +/* + * NOTE: the following two macros are DEPRECATED. Use the latter + * board-specific macros instead, which are specially tuned for the + * particular target environments' memory maps. + */ +#define XSHAL_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS /* disable caches in bypass mode */ +#define XSHAL_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT /* default setting to enable caches (no writeback!) */ + +/*---------------------------------------------------------------------- + GENERIC + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains a system (PIF) RAM, + * system (PIF) ROM, local memory, or XLMI. */ + +/* These set any unused 512MB region to cache-BYPASS attribute: */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEBACK 0x22224442 /* enable caches in write-back mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEALLOC 0x22221112 /* enable caches in write-allocate mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITETHRU 0x22221112 /* enable caches in write-through mode */ +#define XSHAL_ALLVALID_CACHEATTR_BYPASS 0x22222222 /* disable caches in bypass mode */ +#define XSHAL_ALLVALID_CACHEATTR_DEFAULT XSHAL_ALLVALID_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set any unused 512MB region to ILLEGAL attribute: */ +#define XSHAL_STRICT_CACHEATTR_WRITEBACK 0xFFFF444F /* enable caches in write-back mode */ +#define XSHAL_STRICT_CACHEATTR_WRITEALLOC 0xFFFF111F /* enable caches in write-allocate mode */ +#define XSHAL_STRICT_CACHEATTR_WRITETHRU 0xFFFF111F /* enable caches in write-through mode */ +#define XSHAL_STRICT_CACHEATTR_BYPASS 0xFFFF222F /* disable caches in bypass mode */ +#define XSHAL_STRICT_CACHEATTR_DEFAULT XSHAL_STRICT_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set the first 512MB, if unused, to ILLEGAL attribute to help catch + * NULL-pointer dereference bugs; all other unused 512MB regions are set + * to cache-BYPASS attribute: */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEBACK 0x2222444F /* enable caches in write-back mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC 0x2222111F /* enable caches in write-allocate mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITETHRU 0x2222111F /* enable caches in write-through mode */ +#define XSHAL_TRAPNULL_CACHEATTR_BYPASS 0x2222222F /* disable caches in bypass mode */ +#define XSHAL_TRAPNULL_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/*---------------------------------------------------------------------- + ISS (Instruction Set Simulator) SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For now, ISS defaults to the TRAPNULL settings: */ +#define XSHAL_ISS_CACHEATTR_WRITEBACK XSHAL_TRAPNULL_CACHEATTR_WRITEBACK +#define XSHAL_ISS_CACHEATTR_WRITEALLOC XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC +#define XSHAL_ISS_CACHEATTR_WRITETHRU XSHAL_TRAPNULL_CACHEATTR_WRITETHRU +#define XSHAL_ISS_CACHEATTR_BYPASS XSHAL_TRAPNULL_CACHEATTR_BYPASS +#define XSHAL_ISS_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK + +#define XSHAL_ISS_PIPE_REGIONS 0 +#define XSHAL_ISS_SDRAM_REGIONS 0 + + +/*---------------------------------------------------------------------- + XT2000 BOARD SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains any system RAM, + * system ROM, local memory, XLMI, or other XT2000 board device or memory. + * Regions containing devices are forced to cache-BYPASS mode regardless + * of whether the macro is _WRITEBACK vs. _BYPASS etc. */ + +/* These set any 512MB region unused on the XT2000 to ILLEGAL attribute: */ +#define XSHAL_XT2000_CACHEATTR_WRITEBACK 0xFF22444F /* enable caches in write-back mode */ +#define XSHAL_XT2000_CACHEATTR_WRITEALLOC 0xFF22111F /* enable caches in write-allocate mode */ +#define XSHAL_XT2000_CACHEATTR_WRITETHRU 0xFF22111F /* enable caches in write-through mode */ +#define XSHAL_XT2000_CACHEATTR_BYPASS 0xFF22222F /* disable caches in bypass mode */ +#define XSHAL_XT2000_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +#define XSHAL_XT2000_PIPE_REGIONS 0x00000000 /* BusInt pipeline regions */ +#define XSHAL_XT2000_SDRAM_REGIONS 0x00000440 /* BusInt SDRAM regions */ + + +/*---------------------------------------------------------------------- + VECTOR INFO AND SIZES + ----------------------------------------------------------------------*/ + +#define XSHAL_VECTORS_PACKED 0 +#define XSHAL_STATIC_VECTOR_SELECT 0 +#define XSHAL_RESET_VECTOR_VADDR 0x50000000 +#define XSHAL_RESET_VECTOR_PADDR 0x50000000 + +/* + * Sizes allocated to vectors by the system (memory map) configuration. + * These sizes are constrained by core configuration (eg. one vector's + * code cannot overflow into another vector) but are dependent on the + * system or board (or LSP) memory map configuration. + * + * Whether or not each vector happens to be in a system ROM is also + * a system configuration matter, sometimes useful, included here also: + */ +#define XSHAL_RESET_VECTOR_SIZE 0x00000300 +#define XSHAL_RESET_VECTOR_ISROM 1 +#define XSHAL_USER_VECTOR_SIZE 0x00000038 +#define XSHAL_USER_VECTOR_ISROM 0 +#define XSHAL_PROGRAMEXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_USEREXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNEL_VECTOR_SIZE 0x00000038 +#define XSHAL_KERNEL_VECTOR_ISROM 0 +#define XSHAL_STACKEDEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNELEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_DOUBLEEXC_VECTOR_SIZE 0x00000040 +#define XSHAL_DOUBLEEXC_VECTOR_ISROM 0 +#define XSHAL_WINDOW_VECTORS_SIZE 0x00000178 +#define XSHAL_WINDOW_VECTORS_ISROM 0 +#define XSHAL_INTLEVEL2_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL2_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL3_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL3_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL4_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL4_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL5_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL5_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL6_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL6_VECTOR_ISROM 0 +#define XSHAL_DEBUG_VECTOR_SIZE XSHAL_INTLEVEL6_VECTOR_SIZE +#define XSHAL_DEBUG_VECTOR_ISROM XSHAL_INTLEVEL6_VECTOR_ISROM +#define XSHAL_NMI_VECTOR_SIZE 0x00000038 +#define XSHAL_NMI_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL7_VECTOR_SIZE XSHAL_NMI_VECTOR_SIZE + + +#endif /*XTENSA_CONFIG_SYSTEM_H*/ diff --git a/src/platform/apollolake/include/xtensa/config/tie-asm.h b/src/platform/apollolake/include/xtensa/config/tie-asm.h new file mode 100644 index 0000000..15f6e89 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/tie-asm.h @@ -0,0 +1,239 @@ +/* + * tie-asm.h -- compile-time HAL assembler definitions dependent on CORE & TIE + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file contains assembly-language definitions (assembly + macros, etc.) for this specific Xtensa processor's TIE extensions + and options. It is customized to this Xtensa processor configuration. + + Copyright (c) 1999-2015 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_ASM_H +#define _XTENSA_CORE_TIE_ASM_H + +/* Selection parameter values for save-area save/restore macros: */ +/* Option vs. TIE: */ +#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ +#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */ +#define XTHAL_SAS_ANYOT 0x0003 /* both of the above */ +/* Whether used automatically by compiler: */ +#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */ +#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */ +#define XTHAL_SAS_ANYCC 0x000C /* both of the above */ +/* ABI handling across function calls: */ +#define XTHAL_SAS_CALR 0x0010 /* caller-saved */ +#define XTHAL_SAS_CALE 0x0020 /* callee-saved */ +#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */ +#define XTHAL_SAS_ANYABI 0x0070 /* all of the above three */ +/* Misc */ +#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */ +#define XTHAL_SAS3(optie,ccuse,abi) ( ((optie) & XTHAL_SAS_ANYOT) \ + | ((ccuse) & XTHAL_SAS_ANYCC) \ + | ((abi) & XTHAL_SAS_ANYABI) ) + + + /* + * Macro to store all non-coprocessor (extra) custom TIE and optional state + * (not including zero-overhead loop registers). + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 4 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters: + * continue If macro invoked as part of a larger store sequence, set to 1 + * if this is not the first in the sequence. Defaults to 0. + * ofs Offset from start of larger sequence (from value of first ptr + * in sequence) at which to store. Defaults to next available space + * (or 0 if <continue> is 0). + * select Select what category(ies) of registers to store, as a bitmask + * (see XTHAL_SAS_xxx constants). Defaults to all registers. + * alloc Select what category(ies) of registers to allocate; if any + * category is selected here that is not in <select>, space for + * the corresponding registers is skipped without doing any store. + */ + .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Optional caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 1016, 4, 4 + rsr.BR \at1 // boolean option + s32i \at1, \ptr, .Lxchal_ofs_+0 + rsr.SCOMPARE1 \at1 // conditional store option + s32i \at1, \ptr, .Lxchal_ofs_+4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 1016, 4, 4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .endif + .endm // xchal_ncp_store + + /* + * Macro to load all non-coprocessor (extra) custom TIE and optional state + * (not including zero-overhead loop registers). + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 4 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters: + * continue If macro invoked as part of a larger load sequence, set to 1 + * if this is not the first in the sequence. Defaults to 0. + * ofs Offset from start of larger sequence (from value of first ptr + * in sequence) at which to load. Defaults to next available space + * (or 0 if <continue> is 0). + * select Select what category(ies) of registers to load, as a bitmask + * (see XTHAL_SAS_xxx constants). Defaults to all registers. + * alloc Select what category(ies) of registers to allocate; if any + * category is selected here that is not in <select>, space for + * the corresponding registers is skipped without doing any load. + */ + .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Optional caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 1016, 4, 4 + l32i \at1, \ptr, .Lxchal_ofs_+0 + wsr.BR \at1 // boolean option + l32i \at1, \ptr, .Lxchal_ofs_+4 + wsr.SCOMPARE1 \at1 // conditional store option + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 1016, 4, 4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .endif + .endm // xchal_ncp_load + + +#define XCHAL_NCP_NUM_ATMPS 1 + + /* + * Macro to store the state of TIE coprocessor AudioEngineLX. + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 8 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_CP1_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters are the same as for xchal_ncp_store. + */ +#define xchal_cp_AudioEngineLX_store xchal_cp1_store + .macro xchal_cp1_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Custom caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 0, 8, 8 + rur.AE_OVF_SAR \at1 // ureg 240 + s32i \at1, \ptr, .Lxchal_ofs_+0 + rur.AE_BITHEAD \at1 // ureg 241 + s32i \at1, \ptr, .Lxchal_ofs_+4 + rur.AE_TS_FTS_BU_BP \at1 // ureg 242 + s32i \at1, \ptr, .Lxchal_ofs_+8 + rur.AE_SD_NO \at1 // ureg 243 + s32i \at1, \ptr, .Lxchal_ofs_+12 + ae_sp24x2s.i aep0, \ptr, .Lxchal_ofs_+16 + ae_sp24x2s.i aep1, \ptr, .Lxchal_ofs_+24 + ae_sp24x2s.i aep2, \ptr, .Lxchal_ofs_+32 + ae_sp24x2s.i aep3, \ptr, .Lxchal_ofs_+40 + ae_sp24x2s.i aep4, \ptr, .Lxchal_ofs_+48 + ae_sp24x2s.i aep5, \ptr, .Lxchal_ofs_+56 + addi \ptr, \ptr, 64 + ae_sp24x2s.i aep6, \ptr, .Lxchal_ofs_+0 + ae_sp24x2s.i aep7, \ptr, .Lxchal_ofs_+8 + ae_sq56s.i aeq0, \ptr, .Lxchal_ofs_+16 + ae_sq56s.i aeq1, \ptr, .Lxchal_ofs_+24 + ae_sq56s.i aeq2, \ptr, .Lxchal_ofs_+32 + ae_sq56s.i aeq3, \ptr, .Lxchal_ofs_+40 + .set .Lxchal_pofs_, .Lxchal_pofs_ + 64 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 48 + .elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 0, 8, 8 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 112 + .endif + .endm // xchal_cp1_store + + /* + * Macro to load the state of TIE coprocessor AudioEngineLX. + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 8 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_CP1_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters are the same as for xchal_ncp_load. + */ +#define xchal_cp_AudioEngineLX_load xchal_cp1_load + .macro xchal_cp1_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Custom caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 0, 8, 8 + l32i \at1, \ptr, .Lxchal_ofs_+0 + wur.AE_OVF_SAR \at1 // ureg 240 + l32i \at1, \ptr, .Lxchal_ofs_+4 + wur.AE_BITHEAD \at1 // ureg 241 + l32i \at1, \ptr, .Lxchal_ofs_+8 + wur.AE_TS_FTS_BU_BP \at1 // ureg 242 + l32i \at1, \ptr, .Lxchal_ofs_+12 + wur.AE_SD_NO \at1 // ureg 243 + ae_lp24x2.i aep0, \ptr, .Lxchal_ofs_+16 + ae_lp24x2.i aep1, \ptr, .Lxchal_ofs_+24 + ae_lp24x2.i aep2, \ptr, .Lxchal_ofs_+32 + ae_lp24x2.i aep3, \ptr, .Lxchal_ofs_+40 + ae_lp24x2.i aep4, \ptr, .Lxchal_ofs_+48 + ae_lp24x2.i aep5, \ptr, .Lxchal_ofs_+56 + addi \ptr, \ptr, 64 + ae_lp24x2.i aep6, \ptr, .Lxchal_ofs_+0 + ae_lp24x2.i aep7, \ptr, .Lxchal_ofs_+8 + addi \ptr, \ptr, 16 + ae_lq56.i aeq0, \ptr, .Lxchal_ofs_+0 + ae_lq56.i aeq1, \ptr, .Lxchal_ofs_+8 + ae_lq56.i aeq2, \ptr, .Lxchal_ofs_+16 + ae_lq56.i aeq3, \ptr, .Lxchal_ofs_+24 + .set .Lxchal_pofs_, .Lxchal_pofs_ + 80 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 32 + .elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 0, 8, 8 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 112 + .endif + .endm // xchal_cp1_load + +#define XCHAL_CP1_NUM_ATMPS 1 +#define XCHAL_SA_NUM_ATMPS 1 + + /* Empty macros for unconfigured coprocessors: */ + .macro xchal_cp0_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp0_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp2_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp2_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp3_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp3_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp4_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp4_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp5_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp5_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp6_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp6_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + +#endif /*_XTENSA_CORE_TIE_ASM_H*/ diff --git a/src/platform/apollolake/include/xtensa/config/tie.h b/src/platform/apollolake/include/xtensa/config/tie.h new file mode 100644 index 0000000..d47e427 --- /dev/null +++ b/src/platform/apollolake/include/xtensa/config/tie.h @@ -0,0 +1,169 @@ +/* + * tie.h -- compile-time HAL definitions dependent on CORE & TIE configuration + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file describes this specific Xtensa processor's TIE extensions + that extend basic Xtensa core functionality. It is customized to this + Xtensa processor configuration. + + Copyright (c) 1999-2015 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_H +#define _XTENSA_CORE_TIE_H + +#define XCHAL_CP_NUM 1 /* number of coprocessors */ +#define XCHAL_CP_MAX 2 /* max CP ID + 1 (0 if none) */ +#define XCHAL_CP_MASK 0x02 /* bitmask of all CPs by ID */ +#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ + +/* Basic parameters of each coprocessor: */ +#define XCHAL_CP1_NAME "AudioEngineLX" +#define XCHAL_CP1_IDENT AudioEngineLX +#define XCHAL_CP1_SA_SIZE 112 /* size of state save area */ +#define XCHAL_CP1_SA_ALIGN 8 /* min alignment of save area */ +#define XCHAL_CP_ID_AUDIOENGINELX 1 /* coprocessor ID (0..7) */ + +/* Filler info for unassigned coprocessors, to simplify arrays etc: */ +#define XCHAL_CP0_SA_SIZE 0 +#define XCHAL_CP0_SA_ALIGN 1 +#define XCHAL_CP2_SA_SIZE 0 +#define XCHAL_CP2_SA_ALIGN 1 +#define XCHAL_CP3_SA_SIZE 0 +#define XCHAL_CP3_SA_ALIGN 1 +#define XCHAL_CP4_SA_SIZE 0 +#define XCHAL_CP4_SA_ALIGN 1 +#define XCHAL_CP5_SA_SIZE 0 +#define XCHAL_CP5_SA_ALIGN 1 +#define XCHAL_CP6_SA_SIZE 0 +#define XCHAL_CP6_SA_ALIGN 1 +#define XCHAL_CP7_SA_SIZE 0 +#define XCHAL_CP7_SA_ALIGN 1 + +/* Save area for non-coprocessor optional and custom (TIE) state: */ +#define XCHAL_NCP_SA_SIZE 8 +#define XCHAL_NCP_SA_ALIGN 4 + +/* Total save area for optional and custom state (NCP + CPn): */ +#define XCHAL_TOTAL_SA_SIZE 128 /* with 16-byte align padding */ +#define XCHAL_TOTAL_SA_ALIGN 8 /* actual minimum alignment */ + +/* + * Detailed contents of save areas. + * NOTE: caller must define the XCHAL_SA_REG macro (not defined here) + * before expanding the XCHAL_xxx_SA_LIST() macros. + * + * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize, + * dbnum,base,regnum,bitsz,gapsz,reset,x...) + * + * s = passed from XCHAL_*_LIST(s), eg. to select how to expand + * ccused = set if used by compiler without special options or code + * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global) + * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg) + * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg) + * name = lowercase reg name (no quotes) + * galign = group byte alignment (power of 2) (galign >= align) + * align = register byte alignment (power of 2) + * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz) + * (not including any pad bytes required to galign this or next reg) + * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>) + * base = reg shortname w/o index (or sr=special, ur=TIE user reg) + * regnum = reg index in regfile, or special/TIE-user reg number + * bitsz = number of significant bits (regfile width, or ur/sr mask bits) + * gapsz = intervening bits, if bitsz bits not stored contiguously + * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize) + * reset = register reset value (or 0 if undefined at reset) + * x = reserved for future use (0 until then) + * + * To filter out certain registers, e.g. to expand only the non-global + * registers used by the compiler, you can do something like this: + * + * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p) + * #define SELCC0(p...) + * #define SELCC1(abikind,p...) SELAK##abikind(p) + * #define SELAK0(p...) REG(p) + * #define SELAK1(p...) REG(p) + * #define SELAK2(p...) + * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \ + * ...what you want to expand... + */ + +#define XCHAL_NCP_SA_NUM 2 +#define XCHAL_NCP_SA_LIST(s) \ + XCHAL_SA_REG(s,0,0,0,1, br, 4, 4, 4,0x0204, sr,4 , 16,0,0,0) \ + XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) + +#define XCHAL_CP0_SA_NUM 0 +#define XCHAL_CP0_SA_LIST(s) /* empty */ + +#define XCHAL_CP1_SA_NUM 16 +#define XCHAL_CP1_SA_LIST(s) \ + XCHAL_SA_REG(s,0,0,1,0, ae_ovf_sar, 8, 4, 4,0x03F0, ur,240, 7,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0, ae_bithead, 4, 4, 4,0x03F1, ur,241, 32,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0,ae_ts_fts_bu_bp, 4, 4, 4,0x03F2, ur,242, 16,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0, ae_sd_no, 4, 4, 4,0x03F3, ur,243, 28,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep0, 8, 8, 8,0x0060, aep,0 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep1, 8, 8, 8,0x0061, aep,1 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep2, 8, 8, 8,0x0062, aep,2 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep3, 8, 8, 8,0x0063, aep,3 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep4, 8, 8, 8,0x0064, aep,4 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep5, 8, 8, 8,0x0065, aep,5 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep6, 8, 8, 8,0x0066, aep,6 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep7, 8, 8, 8,0x0067, aep,7 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq0, 8, 8, 8,0x0068, aeq,0 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq1, 8, 8, 8,0x0069, aeq,1 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq2, 8, 8, 8,0x006A, aeq,2 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq3, 8, 8, 8,0x006B, aeq,3 , 56,0,0,0) + +#define XCHAL_CP2_SA_NUM 0 +#define XCHAL_CP2_SA_LIST(s) /* empty */ + +#define XCHAL_CP3_SA_NUM 0 +#define XCHAL_CP3_SA_LIST(s) /* empty */ + +#define XCHAL_CP4_SA_NUM 0 +#define XCHAL_CP4_SA_LIST(s) /* empty */ + +#define XCHAL_CP5_SA_NUM 0 +#define XCHAL_CP5_SA_LIST(s) /* empty */ + +#define XCHAL_CP6_SA_NUM 0 +#define XCHAL_CP6_SA_LIST(s) /* empty */ + +#define XCHAL_CP7_SA_NUM 0 +#define XCHAL_CP7_SA_LIST(s) /* empty */ + +/* Byte length of instruction from its first nibble (op0 field), per FLIX. */ +#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8 +/* Byte length of instruction from its first byte, per FLIX. */ +#define XCHAL_BYTE0_FORMAT_LENGTHS \ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8 + +#endif /*_XTENSA_CORE_TIE_H*/
From: Keyon Jie yang.jie@linux.intel.com
Add platform headers for Intel Apollolake platform.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- .../apollolake/include/platform/Makefile.am | 9 + src/platform/apollolake/include/platform/clk.h | 43 +++ src/platform/apollolake/include/platform/dma.h | 75 +++++ .../apollolake/include/platform/interrupt.h | 174 ++++++++++ src/platform/apollolake/include/platform/mailbox.h | 83 +++++ src/platform/apollolake/include/platform/memory.h | 357 +++++++++++++++++++++ .../apollolake/include/platform/platform.h | 139 ++++++++ src/platform/apollolake/include/platform/shim.h | 220 +++++++++++++ src/platform/apollolake/include/platform/timer.h | 71 ++++ 9 files changed, 1171 insertions(+) create mode 100644 src/platform/apollolake/include/platform/Makefile.am create mode 100644 src/platform/apollolake/include/platform/clk.h create mode 100644 src/platform/apollolake/include/platform/dma.h create mode 100644 src/platform/apollolake/include/platform/interrupt.h create mode 100644 src/platform/apollolake/include/platform/mailbox.h create mode 100644 src/platform/apollolake/include/platform/memory.h create mode 100644 src/platform/apollolake/include/platform/platform.h create mode 100644 src/platform/apollolake/include/platform/shim.h create mode 100644 src/platform/apollolake/include/platform/timer.h
diff --git a/src/platform/apollolake/include/platform/Makefile.am b/src/platform/apollolake/include/platform/Makefile.am new file mode 100644 index 0000000..4e4e20d --- /dev/null +++ b/src/platform/apollolake/include/platform/Makefile.am @@ -0,0 +1,9 @@ +noinst_HEADERS = \ + clk.h \ + dma.h \ + interrupt.h \ + mailbox.h \ + memory.h \ + platform.h \ + shim.h \ + timer.h diff --git a/src/platform/apollolake/include/platform/clk.h b/src/platform/apollolake/include/platform/clk.h new file mode 100644 index 0000000..5a15b8a --- /dev/null +++ b/src/platform/apollolake/include/platform/clk.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_CLOCK__ +#define __PLATFORM_CLOCK__ + +#define CLK_CPU 0 +#define CLK_SSP 1 + +#define CLK_DEFAULT_CPU_HZ 400000000 +#define CLK_MAX_CPU_HZ 400000000 + +void init_platform_clocks(void); + +#endif diff --git a/src/platform/apollolake/include/platform/dma.h b/src/platform/apollolake/include/platform/dma.h new file mode 100644 index 0000000..497881a --- /dev/null +++ b/src/platform/apollolake/include/platform/dma.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_DMA_H__ +#define __PLATFORM_DMA_H__ + +#include <stdint.h> +#include <reef/io.h> +#include <arch/cache.h> + +/* available DMACs */ +#define DMA_GP_LP_DMAC0 0 +#define DMA_GP_LP_DMAC1 1 +#define DMA_GP_HP_DMAC0 2 +#define DMA_GP_HP_DMAC1 3 +#define DMA_HOST_IN_DMAC 4 +#define DMA_HOST_OUT_DMAC 5 +#define DMA_LINK_IN_DMAC 6 +#define DMA_LINK_OUT_DMAC 7 + +/* mappings - TODO improve API to get type */ +#define DMA_ID_DMAC0 DMA_HOST_IN_DMAC +#define DMA_ID_DMAC1 DMA_GP_LP_DMAC0 +#define DMA_ID_DMAC2 DMA_HOST_OUT_DMAC +#define DMA_ID_DMAC3 DMA_GP_HP_DMAC0 +#define DMA_ID_DMAC4 DMA_GP_LP_DMAC1 +#define DMA_ID_DMAC5 DMA_GP_HP_DMAC1 +#define DMA_ID_DMAC6 DMA_LINK_IN_DMAC +#define DMA_ID_DMAC7 DMA_LINK_OUT_DMAC + +/* handshakes */ +#define DMA_HANDSHAKE_DMIC_CH0 0 +#define DMA_HANDSHAKE_DMIC_CH1 1 +#define DMA_HANDSHAKE_SSP0_TX 2 +#define DMA_HANDSHAKE_SSP0_RX 3 +#define DMA_HANDSHAKE_SSP1_TX 4 +#define DMA_HANDSHAKE_SSP1_RX 5 +#define DMA_HANDSHAKE_SSP2_TX 6 +#define DMA_HANDSHAKE_SSP2_RX 7 +#define DMA_HANDSHAKE_SSP3_TX 8 +#define DMA_HANDSHAKE_SSP3_RX 9 +#define DMA_HANDSHAKE_SSP4_TX 10 +#define DMA_HANDSHAKE_SSP4_RX 11 +#define DMA_HANDSHAKE_SSP5_TX 12 +#define DMA_HANDSHAKE_SSP5_RX 13 + +#endif diff --git a/src/platform/apollolake/include/platform/interrupt.h b/src/platform/apollolake/include/platform/interrupt.h new file mode 100644 index 0000000..2fddea1 --- /dev/null +++ b/src/platform/apollolake/include/platform/interrupt.h @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __INCLUDE_PLATFORM_INTERRUPT__ +#define __INCLUDE_PLATFORM_INTERRUPT__ + +#include <stdint.h> +#include <reef/interrupt-map.h> + +#define PLATFORM_IRQ_CHILDREN 32 + +/* IRQ numbers - wrt Tensilica DSP */ +#define IRQ_NUM_SOFTWARE0 0 /* level 1 */ +#define IRQ_NUM_TIMER1 1 /* level 1 */ +#define IRQ_NUM_EXT_LEVEL1 2 /* level 1 */ +#define IRQ_NUM_SOFTWARE2 3 /* level 1 */ +#define IRQ_NUM_SOFTWARE3 4 /* level 2 */ +#define IRQ_NUM_TIMER2 5 /* level 2 */ +#define IRQ_NUM_EXT_LEVEL2 6 /* level 2 */ +#define IRQ_NUM_SOFTWARE4 7 /* level 2 */ +#define IRQ_NUM_SOFTWARE5 8 /* level 3 */ +#define IRQ_NUM_TIMER3 9 /* level 3 */ +#define IRQ_NUM_EXT_LEVEL3 10 /* level 3 */ +#define IRQ_NUM_SOFTWARE6 11 /* level 3 */ +#define IRQ_NUM_SOFTWARE7 12 /* level 4 */ +#define IRQ_NUM_EXT_LEVEL4 13 /* level 4 */ +#define IRQ_NUM_SOFTWARE8 14 /* level 4 */ +#define IRQ_NUM_SOFTWARE9 15 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL5 16 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL6 17 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL7 18 /* level 5 */ +#define IRQ_NUM_SOFTWARE10 19 /* level 5 */ +#define IRQ_NUM_NMI 20 /* level 7 */ + +/* IRQ Level 2 bits */ +#define IRQ_BIT_LVL2_HP_GP_DMA0(x) (x + 24) +#define IRQ_BIT_LVL2_WALL_CLK1 23 +#define IRQ_BIT_LVL2_WALL_CLK0 22 +#define IRQ_BIT_LVL2_L2_MEMERR 21 +#define IRQ_BIT_LVL2_SHA256 16 +#define IRQ_BIT_LVL2_L2_CACHE 15 +#define IRQ_BIT_LVL2_IDC 8 +#define IRQ_BIT_LVL2_HOST_IPC 7 +#define IRQ_BIT_LVL2_CSME_IPC 6 +#define IRQ_BIT_LVL2_PMC_IPC 5 + +/* IRQ Level 3 bits */ +#define IRQ_BIT_LVL3_CODE_LOADER 31 +#define IRQ_BIT_LVL3_HOST_STREAM_OUT(x) (16 + x) +#define IRQ_BIT_LVL3_HOST_STREAM_IN(x) (0 + x) + +/* IRQ Level 4 bits */ +#define IRQ_BIT_LVL4_LINK_STREAM_OUT(x) (16 + x) +#define IRQ_BIT_LVL4_LINK_STREAM_IN(x) (0 + x) + +/* IRQ Level 5 bits */ +#define IRQ_BIT_LVL5_LP_GP_DMA1(x) (24 + x) +#define IRQ_BIT_LVL5_LP_GP_DMA0(x) (16 + x) +#define IRQ_BIT_LVL5_DMIC 6 +#define IRQ_BIT_LVL5_SSP(x) (0 + x) + +/* Level 2 Peripheral IRQ mappings */ +#define IRQ_EXT_HP_GPDMA_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_HP_GP_DMA0(0), 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_IDC_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_IDC, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_IPC_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_HOST_IPC, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_TSTAMP1_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_WALL_CLK1, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_TSTAMP0_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_WALL_CLK0, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_MERR_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_L2_MEMERR, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_L2CACHE_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_L2_CACHE, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_SHA256_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_SHA256, 2, xcpu, IRQ_NUM_EXT_LEVEL2) + +/* Level 3 Peripheral IRQ mappings */ +#define IRQ_EXT_CODE_DMA_LVL3(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL3_CODE_LOADER, 3, xcpu, IRQ_NUM_EXT_LEVEL3) +#define IRQ_EXT_HOST_DMA_IN_LVL3(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL3_HOST_STREAM_IN(channel), 3, xcpu, IRQ_NUM_EXT_LEVEL3) +#define IRQ_EXT_HOST_DMA_OUT_LVL3(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL3_HOST_STREAM_OUT(channel), 3, xcpu, IRQ_NUM_EXT_LEVEL3) + +/* Level 4 Peripheral IRQ mappings */ +#define IRQ_EXT_LINK_DMA_IN_LVL4(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL4_LINK_STREAM_IN(channel), 4, xcpu, IRQ_NUM_EXT_LEVEL4) +#define IRQ_EXT_LINK_DMA_OUT_LVL4(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL4_LINK_STREAM_OUT(channel), 4, xcpu, IRQ_NUM_EXT_LEVEL4) + +/* Level 5 Peripheral IRQ mappings */ +#define IRQ_EXT_LP_GPDMA0_LVL5(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL5_LP_GP_DMA0(channel), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_LP_GPDMA1_LVL5(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL5_LP_GP_DMA1(channel), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP0_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(0), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP1_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(1), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP2_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(2), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP3_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(3), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP4_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(4), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP5_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(5), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_DMIC_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_DMIC, 5, xcpu, IRQ_NUM_EXT_LEVEL5) + + +/* IRQ Masks */ +#define IRQ_MASK_SOFTWARE0 (1 << IRQ_NUM_SOFTWARE0) +#define IRQ_MASK_TIMER1 (1 << IRQ_NUM_TIMER1) +#define IRQ_MASK_EXT_LEVEL1 (1 << IRQ_NUM_EXT_LEVEL1) +#define IRQ_MASK_SOFTWARE1 (1 << IRQ_NUM_SOFTWARE1) +#define IRQ_MASK_SOFTWARE2 (1 << IRQ_NUM_SOFTWARE2) +#define IRQ_MASK_TIMER2 (1 << IRQ_NUM_TIMER2) +#define IRQ_MASK_EXT_LEVEL2 (1 << IRQ_NUM_EXT_LEVEL2) +#define IRQ_MASK_SOFTWARE3 (1 << IRQ_NUM_SOFTWARE3) +#define IRQ_MASK_SOFTWARE4 (1 << IRQ_NUM_SOFTWARE4) +#define IRQ_MASK_TIMER3 (1 << IRQ_NUM_TIMER3) +#define IRQ_MASK_EXT_LEVEL3 (1 << IRQ_NUM_EXT_LEVEL3) +#define IRQ_MASK_SOFTWARE5 (1 << IRQ_NUM_SOFTWARE5) +#define IRQ_MASK_SOFTWARE6 (1 << IRQ_NUM_SOFTWARE6) +#define IRQ_MASK_EXT_LEVEL4 (1 << IRQ_NUM_EXT_LEVEL4) +#define IRQ_MASK_SOFTWARE7 (1 << IRQ_NUM_SOFTWARE7) +#define IRQ_MASK_SOFTWARE8 (1 << IRQ_NUM_SOFTWARE8) +#define IRQ_MASK_EXT_LEVEL5 (1 << IRQ_NUM_EXT_LEVEL5) +#define IRQ_MASK_EXT_LEVEL6 (1 << IRQ_NUM_EXT_LEVEL6) +#define IRQ_MASK_EXT_LEVEL7 (1 << IRQ_NUM_EXT_LEVEL7) +#define IRQ_MASK_SOFTWARE9 (1 << IRQ_NUM_SOFTWARE9) + +void platform_interrupt_init(void); + +struct irq_parent *platform_irq_get_parent(uint32_t irq); +void platform_interrupt_set(int irq); +void platform_interrupt_clear(uint32_t irq, uint32_t mask); +uint32_t platform_interrupt_get_enabled(void); +void platform_interrupt_mask(uint32_t irq, uint32_t mask); +void platform_interrupt_unmask(uint32_t irq, uint32_t mask); + +#endif diff --git a/src/platform/apollolake/include/platform/mailbox.h b/src/platform/apollolake/include/platform/mailbox.h new file mode 100644 index 0000000..8741f28 --- /dev/null +++ b/src/platform/apollolake/include/platform/mailbox.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __INCLUDE_PLATFORM_MAILBOX__ +#define __INCLUDE_PLATFORM_MAILBOX__ + +#include <platform/memory.h> + + +/* + * The Window Region on Broxton HPSRAM is organised like this :- + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_TRACE_BASE | Trace Buffer W3| SRAM_TRACE_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_DEBUG_BASE | Debug data W2 | SRAM_DEBUG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_INBOX_BASE | Inbox W1 | SRAM_INBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_OUTBOX_BASE | Outbox W0 | SRAM_MAILBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_SW_REG_BASE | SW Registers W0| SRAM_SW_REG_SIZE | + * +---------------------+----------------+-----------------------------------+ + */ + +/* window 3 - trace */ +#define MAILBOX_TRACE_SIZE SRAM_TRACE_SIZE +#define MAILBOX_TRACE_BASE SRAM_TRACE_BASE + +/* window 2 debug and exception */ +#define MAILBOX_DEBUG_SIZE (SRAM_DEBUG_SIZE - MAILBOX_EXCEPTION_SIZE) +#define MAILBOX_DEBUG_BASE SRAM_DEBUG_BASE + +#define MAILBOX_EXCEPTION_SIZE 0x100 +#define MAILBOX_EXCEPTION_BASE \ + (MAILBOX_DEBUG_BASE + MAILBOX_DEBUG_SIZE) + +/* window 1 inbox/downlink and FW registers */ +#define MAILBOX_HOSTBOX_SIZE SRAM_INBOX_SIZE +#define MAILBOX_HOSTBOX_BASE SRAM_INBOX_BASE + + +#define MAILBOX_STREAM_SIZE 0x200 +#define MAILBOX_STREAM_BASE \ + (MAILBOX_BASE + MAILBOX_STREAM_OFFSET) + +/* window 0 */ +#define MAILBOX_DSPBOX_SIZE SRAM_OUTBOX_SIZE +#define MAILBOX_DSPBOX_BASE SRAM_OUTBOX_BASE + +#define MAILBOX_SW_REG_SIZE SRAM_SW_REG_SIZE +#define MAILBOX_SW_REG_BASE SRAM_SW_REG_BASE + +#endif diff --git a/src/platform/apollolake/include/platform/memory.h b/src/platform/apollolake/include/platform/memory.h new file mode 100644 index 0000000..eca9a53 --- /dev/null +++ b/src/platform/apollolake/include/platform/memory.h @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_MEMORY_H__ +#define __PLATFORM_MEMORY_H__ + +#include <config.h> + +/* physical DSP addresses */ + +/* shim */ +#define SHIM_BASE 0x00001000 +#define SHIM_SIZE 0x00000100 + +/* cmd IO to audio codecs */ +#define CMD_BASE 0x00001100 +#define CMD_SIZE 0x00000010 + +/* resource allocation */ +#define RES_BASE 0x00001110 +#define RES_SIZE 0x00000010 + +/* IPC to the host */ +#define IPC_HOST_BASE 0x00001180 +#define IPC_HOST_SIZE 0x00000020 + +/* intra DSP IPC */ +#define IPC_DSP_SIZE 0x00000080 +#define IPC_DSP_BASE(x) (0x00001200 + x * IPC_DSP_SIZE) + +/* SRAM window for HOST */ +#define HOST_WIN_SIZE 0x00000008 +#define HOST_WIN_BASE(x) (0x00001580 + x * HOST_WIN_SIZE) + +/* IRQ controller */ +#define IRQ_BASE 0x00001600 +#define IRQ_SIZE 0x00000200 + +/* time stamping */ +#define TIME_BASE 0x00001800 +#define TIME_SIZE 0x00000200 + +/* M/N dividers */ +#define MN_BASE 0x00008E00 +#define MN_SIZE 0x00000200 + +/* low power DMA position */ +#define LP_GP_DMA_LINK_SIZE 0x00000080 +#define LP_GP_DMA_LINK_BASE(x) (0x00001C00 + x * LP_GP_DMA_LINK_SIZE) + +/* high performance DMA position */ +#define HP_GP_DMA_LINK_SIZE 0x00000800 +#define HP_GP_DMA_LINK_BASE(x) (0x00001D00 + x * HP_GP_DMA_LINK_SIZE) + +/* link DMAC stream */ +#define GTW_LINK_OUT_STREAM_SIZE 0x00000020 +#define GTW_LINK_OUT_STREAM_BASE(x) \ + (0x00002400 + x * GTW_LINK_OUT_STREAM_SIZE) + +#define GTW_LINK_IN_STREAM_SIZE 0x00000020 +#define GTW_LINK_IN_STREAM_BASE(x) \ + (0x00002600 + x * GTW_LINK_IN_STREAM_SIZE) + +/* host DMAC stream */ +#define GTW_HOST_OUT_STREAM_SIZE 0x00000040 +#define GTW_HOST_OUT_STREAM_BASE(x) \ + (0x00002800 + x * GTW_HOST_OUT_STREAM_SIZE) + +#define GTW_HOST_IN_STREAM_SIZE 0x00000040 +#define GTW_HOST_IN_STREAM_BASE(x) \ + (0x00002C00 + x * GTW_HOST_IN_STREAM_SIZE) + +/* code loader */ +#define GTW_CODE_LDR_SIZE 0x00000040 +#define GTW_CODE_LDR_BASE 0x00002BC0 + +/* L2 TLBs */ +#define L2_HP_SRAM_TLB_SIZE 0x00001000 +#define L2_HP_SRAM_TLB_BASE 0x00003000 + +/* DMICs */ +#define DMIC_BASE 0x00004000 +#define DMIC_SIZE 0x00004000 + +/* SSP */ +#define SSP_SIZE 0x0000200 +#define SSP_BASE(x) (0x00008000 + x * SSP_SIZE) + +/* low power DMACs */ +#define LP_GP_DMA_SIZE 0x00001000 +#define LP_GP_DMA_BASE(x) (0x0000C000 + x * LP_GP_DMA_SIZE) + +/* high performance DMACs */ +#define HP_GP_DMA_SIZE 0x00001000 +#define HP_GP_DMA_BASE(x) (0x0000E000 + x * HP_GP_DMA_SIZE) + +/* ROM */ +#define ROM_BASE 0xBEFE0000 +#define ROM_SIZE 0x00002000 + +/* + * The L2 SRAM Heap and Stack on Apololake are organised like this :- + * + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | L2_SRAM_BASE | RO Data | REEF_DATA_SIZE | + * | | Data | | + * | | BSS | | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_SYSTEM_BASE | System Heap | HEAP_SYSTEM_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_RUNTIME_BASE | Runtime Heap | HEAP_RUNTIME_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_BUFFER_BASE | Module Buffers | HEAP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_END | Stack | REEF_STACK_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_BASE | | | + * +---------------------+----------------+-----------------------------------+ + */ + +/* L2 SRAM */ +#define L2_SRAM_BASE 0xA000A000 +#define L2_SRAM_SIZE 0x00056000 + +/* Heap section sizes for module pool */ +#define HEAP_RT_COUNT8 0 +#define HEAP_RT_COUNT16 256 +#define HEAP_RT_COUNT32 128 +#define HEAP_RT_COUNT64 64 +#define HEAP_RT_COUNT128 32 +#define HEAP_RT_COUNT256 16 +#define HEAP_RT_COUNT512 8 +#define HEAP_RT_COUNT1024 4 + +/* text and data share the same L2 SRAM on Broxton */ +#define REEF_TEXT_START L2_SRAM_BASE +#define REEF_TEXT_START_SIZE 0x400 +#define L2_VECTOR_SIZE 0x1000 + +#define REEF_TEXT_BASE (L2_SRAM_BASE + L2_VECTOR_SIZE) +#define REEF_TEXT_SIZE 0x18000 + +/* initialized data */ +#define REEF_DATA_SIZE 0x18000 + +/* bss data */ +#define REEF_BSS_DATA_SIZE 0x2000 + +/* Heap configuration */ +#define HEAP_SYSTEM_BASE \ + (REEF_TEXT_START + REEF_TEXT_SIZE + \ + REEF_DATA_SIZE + REEF_BSS_DATA_SIZE) +#define HEAP_SYSTEM_SIZE 0x2000 + +#define HEAP_RUNTIME_BASE (HEAP_SYSTEM_BASE + HEAP_SYSTEM_SIZE) +#define HEAP_RUNTIME_SIZE \ + (HEAP_RT_COUNT8 * 8 + HEAP_RT_COUNT16 * 16 + \ + HEAP_RT_COUNT32 * 32 + HEAP_RT_COUNT64 * 64 + \ + HEAP_RT_COUNT128 * 128 + HEAP_RT_COUNT256 * 256 + \ + HEAP_RT_COUNT512 * 512 + HEAP_RT_COUNT1024 * 1024) + +#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE) +#define HEAP_BUFFER_SIZE \ + (L2_SRAM_SIZE - L2_VECTOR_SIZE - REEF_TEXT_SIZE - REEF_DATA_SIZE - \ + REEF_BSS_DATA_SIZE - HEAP_RUNTIME_SIZE - REEF_STACK_SIZE - HEAP_SYSTEM_SIZE) + +#define HEAP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) + + +/* Stack configuration */ +#define REEF_STACK_SIZE 0x1000 +#define REEF_STACK_BASE (L2_SRAM_BASE + L2_SRAM_SIZE) +#define REEF_STACK_END (REEF_STACK_BASE - REEF_STACK_SIZE) + +/* + * The HP SRAM Region Apololake is organised like this :- + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | HP_SRAM_BASE | DMA | HEAP_HP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_TRACE_BASE | Trace Buffer W3| SRAM_TRACE_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_DEBUG_BASE | Debug data W2 | SRAM_DEBUG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_INBOX_BASE | Inbox W1 | SRAM_INBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_SW_REG_BASE | SW Registers W0| SRAM_SW_REG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_OUTBOX_BASE | Outbox W0 | SRAM_MAILBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + */ + +/* HP SRAM */ +#define HP_SRAM_BASE 0xBE000000 +#define HP_SRAM_SIZE 0x00020000 + +/* HP SRAM windows */ + +/* window 3 */ +#define SRAM_TRACE_BASE (HEAP_HP_BUFFER_BASE + HEAP_HP_BUFFER_SIZE) +#define SRAM_TRACE_SIZE 0x2000 + +/* window 2 */ +#define SRAM_DEBUG_BASE (SRAM_TRACE_BASE + SRAM_TRACE_SIZE) +#define SRAM_DEBUG_SIZE 0x1000 + +/* window 1 */ +#define SRAM_INBOX_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE) +#define SRAM_INBOX_SIZE 0x2000 + +/* window 0 */ +#define SRAM_SW_REG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE) +#define SRAM_SW_REG_SIZE 0x1000 + +#define SRAM_OUTBOX_BASE (SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE) +#define SRAM_OUTBOX_SIZE 0x1000 + +#define HP_SRAM_WIN0_BASE SRAM_SW_REG_BASE +#define HP_SRAM_WIN0_SIZE (SRAM_SW_REG_SIZE + SRAM_OUTBOX_SIZE) +#define HP_SRAM_WIN1_BASE SRAM_INBOX_BASE +#define HP_SRAM_WIN1_SIZE SRAM_INBOX_SIZE +#define HP_SRAM_WIN2_BASE SRAM_DEBUG_BASE +#define HP_SRAM_WIN2_SIZE SRAM_DEBUG_SIZE +#define HP_SRAM_WIN3_BASE SRAM_TRACE_BASE +#define HP_SRAM_WIN3_SIZE SRAM_TRACE_SIZE + +/* DMA buffer heap is the HP physical memory on Broxton */ +#define HEAP_DMA_BUFFER_BASE HP_SRAM_BASE +#define HEAP_DMA_BUFFER_SIZE HEAP_HP_BUFFER_SIZE +#define HEAP_DMA_BUFFER_BLOCK_SIZE HEAP_HP_BUFFER_BLOCK_SIZE +#define HEAP_DMA_BUFFER_COUNT HEAP_HP_BUFFER_COUNT + +/* HP SRAM Heap */ +#define HEAP_HP_BUFFER_BASE HP_SRAM_BASE +#define HEAP_HP_BUFFER_SIZE \ + (HP_SRAM_SIZE - \ + SRAM_TRACE_SIZE - \ + SRAM_DEBUG_SIZE - \ + SRAM_INBOX_SIZE - \ + SRAM_OUTBOX_SIZE - \ + SRAM_SW_REG_SIZE) + +#define HEAP_HP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_HP_BUFFER_COUNT \ + (HEAP_HP_BUFFER_SIZE / HEAP_HP_BUFFER_BLOCK_SIZE) + +/* + * The LP SRAM Heap and Stack on Apololake are organised like this :- + * + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | LP_SRAM_BASE | RO Data | REEF_LP_DATA_SIZE | + * | | Data | | + * | | BSS | | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_SYSTEM_BASE | System Heap | HEAP_LP_SYSTEM_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_RUNTIME_BASE| Runtime Heap | HEAP_LP_RUNTIME_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_BUFFER_BASE | Module Buffers | HEAP_LP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_LP_STACK_END | Stack | REEF_LP_STACK_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_BASE | | | + * +---------------------+----------------+-----------------------------------+ + */ + +/* LP SRAM */ +#define LP_SRAM_BASE 0xBE800000 +#define LP_SRAM_SIZE 0x00020000 + +/* Heap section sizes for module pool */ +#define HEAP_RT_LP_COUNT8 0 +#define HEAP_RT_LP_COUNT16 256 +#define HEAP_RT_LP_COUNT32 128 +#define HEAP_RT_LP_COUNT64 64 +#define HEAP_RT_LP_COUNT128 32 +#define HEAP_RT_LP_COUNT256 16 +#define HEAP_RT_LP_COUNT512 8 +#define HEAP_RT_LP_COUNT1024 4 + +/* Heap configuration */ +#define REEF_LP_DATA_SIZE 0x4000 + +#define HEAP_LP_SYSTEM_BASE (LP_SRAM_BASE + REEF_LP_DATA_SIZE) +#define HEAP_LP_SYSTEM_SIZE 0x1000 + +#define HEAP_LP_RUNTIME_BASE \ + (HEAP_LP_SYSTEM_BASE + HEAP_LP_SYSTEM_SIZE) +#define HEAP_LP_RUNTIME_SIZE \ + (HEAP_RT_LP_COUNT8 * 8 + HEAP_RT_LP_COUNT16 * 16 + \ + HEAP_RT_LP_COUNT32 * 32 + HEAP_RT_LP_COUNT64 * 64 + \ + HEAP_RT_LP_COUNT128 * 128 + HEAP_RT_LP_COUNT256 * 256 + \ + HEAP_RT_LP_COUNT512 * 512 + HEAP_RT_LP_COUNT1024 * 1024) + +#define HEAP_LP_BUFFER_BASE \ + (HEAP_LP_RUNTIME_BASE + HEAP_LP_RUNTIME_SIZE) +#define HEAP_LP_BUFFER_SIZE \ + (LP_SRAM_SIZE - HEAP_LP_RUNTIME_SIZE - REEF_LP_STACK_SIZE - HEAP_LP_SYSTEM_SIZE) + +#define HEAP_LP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_LP_BUFFER_COUNT \ + (HEAP_LP_BUFFER_SIZE / HEAP_LP_BUFFER_BLOCK_SIZE) + + +/* Stack configuration */ +#define REEF_LP_STACK_SIZE 0x1000 +#define REEF_LP_STACK_BASE (LP_SRAM_BASE + LP_SRAM_SIZE) +#define REEF_LP_STACK_END (REEF_LP_STACK_BASE - REEF_LP_STACK_SIZE) + +/* Vector and literal sizes - not in core-isa.h */ +#define REEF_MEM_VECT_LIT_SIZE 0x8 +#define REEF_MEM_VECT_TEXT_SIZE 0x38 +#define REEF_MEM_VECT_SIZE (REEF_MEM_VECT_TEXT_SIZE + REEF_MEM_VECT_LIT_SIZE) + +#define REEF_MEM_ERROR_TEXT_SIZE 0x180 +#define REEF_MEM_ERROR_LIT_SIZE 0x8 + +#define REEF_MEM_RESET_TEXT_SIZE 0x268 +#define REEF_MEM_RESET_LIT_SIZE 0x8 +#define REEF_MEM_VECBASE_LIT_SIZE 0x178 + +#define REEF_MEM_RO_SIZE 0x8 +#endif diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h new file mode 100644 index 0000000..4165b95 --- /dev/null +++ b/src/platform/apollolake/include/platform/platform.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_PLATFORM_H__ +#define __PLATFORM_PLATFORM_H__ + +#include <platform/shim.h> +#include <platform/interrupt.h> +#include <uapi/ipc.h> + +struct reef; + +/* Host page size */ +#define HOST_PAGE_SIZE 4096 +#define PLATFORM_PAGE_TABLE_SIZE 256 + +/* IPC Interrupt */ +#define PLATFORM_IPC_INTERUPT IRQ_EXT_IPC_LVL2(0) + +/* pipeline IRQ */ +#define PLATFORM_SCHEDULE_IRQ IRQ_NUM_SOFTWARE5 + +#define PLATFORM_IRQ_TASK_HIGH IRQ_NUM_SOFTWARE4 +#define PLATFORM_IRQ_TASK_MED IRQ_NUM_SOFTWARE3 +#define PLATFORM_IRQ_TASK_LOW IRQ_NUM_SOFTWARE2 + +#define PLATFORM_SCHEDULE_COST 200 + +/* maximum preload pipeline depth */ +#define MAX_PRELOAD_SIZE 20 + +/* DMA treats PHY addresses as host address unless within DSP region */ +#define PLATFORM_HOST_DMA_MASK 0x00000000 + +/* Platform stream capabilities */ +#define PLATFORM_MAX_CHANNELS 4 +#define PLATFORM_MAX_STREAMS 5 + +/* clock source used by scheduler for deadline calculations */ +#define PLATFORM_SCHED_CLOCK CLK_SSP + +/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */ +#define PLATFORM_DMA_TIMEOUT 1333 + +/* DMA host transfer timeouts in microseconds */ +#define PLATFORM_HOST_DMA_TIMEOUT 50 + +/* WorkQ window size in microseconds */ +#define PLATFORM_WORKQ_WINDOW 2000 + +/* platform WorkQ clock */ +#define PLATFORM_WORKQ_CLOCK CLK_SSP + +/* Host finish work schedule delay in microseconds */ +#define PLATFORM_HOST_FINISH_DELAY 100 + +/* 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 + +/* the interval of DMA trace copying */ +#define DMA_TRACE_PERIOD 500000 + +/* + * the interval of reschedule DMA trace copying in special case like half + * fullness of local DMA trace buffer + */ +#define DMA_TRACE_RESCHEDULE_TIME 5000 + +/* DMAC used for trace DMA */ +#define PLATFORM_TRACE_DMAC DMA_ID_DMAC0 + +/* DSP should be idle in this time frame */ +#define PLATFORM_IDLE_TIME 750000 + +/* Platform defined panic code */ +#define platform_panic(__x) \ + sw_reg_write(SW_REG_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 + +struct timer *platform_timer; + +/* + * APIs declared here are defined for every platform and IPC mechanism. + */ + +int platform_boot_complete(uint32_t boot_message); + +int platform_init(struct reef *reef); + +int platform_ssp_set_mn(uint32_t ssp_port, uint32_t source, uint32_t rate, + uint32_t bclk_fs); + +void platform_ssp_disable_mn(uint32_t ssp_port); + +#endif diff --git a/src/platform/apollolake/include/platform/shim.h b/src/platform/apollolake/include/platform/shim.h new file mode 100644 index 0000000..c7fcc8f --- /dev/null +++ b/src/platform/apollolake/include/platform/shim.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_SHIM_H__ +#define __PLATFORM_SHIM_H__ + +#include <platform/memory.h> +#include <stdint.h> + +/* DSP IPC for Host Registers */ +#define IPC_DIPCT 0x00 +#define IPC_DIPCTE 0x04 +#define IPC_DIPCI 0x08 +#define IPC_DIPCIE 0x0c +#define IPC_DIPCCTL 0x10 + +/* DIPCT */ +#define IPC_DIPCT_BUSY (1 << 31) +#define IPC_DIPCT_MSG_MASK 0x7FFFFFFF + +/* DIPCTE */ +#define IPC_DIPCTE_MSG_MASK 0x3FFFFFFF + +/* DIPCI */ +#define IPC_DIPCI_BUSY (1 << 31) +#define IPC_DIPCI_MSG_MASK 0x7FFFFFFF + +/* DIPCIE */ +#define IPC_DIPCIE_DONE (1 << 30) +#define IPC_DIPCIE_MSG_MASK 0x3FFFFFFF + +/* DIPCCTL */ +#define IPC_DIPCCTL_IPCIDIE (1 << 1) +#define IPC_DIPCCTL_IPCTBIE (1 << 0) + +#define IRQ_CPU_OFFSET 0x40 + +#define REG_IRQ_IL2MSD(xcpu) (0x0 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2MCD(xcpu) (0x4 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2MD(xcpu) (0x8 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2SD(xcpu) (0xc + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL2MD_ALL 0x03F181F0 + +#define REG_IRQ_IL3MSD(xcpu) (0x10 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3MCD(xcpu) (0x14 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3MD(xcpu) (0x18 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3SD(xcpu) (0x1c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL3MD_ALL 0x807F81FF + +#define REG_IRQ_IL4MSD(xcpu) (0x20 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4MCD(xcpu) (0x24 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4MD(xcpu) (0x28 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4SD(xcpu) (0x2c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL4MD_ALL 0x807F81FF + +#define REG_IRQ_IL5MSD(xcpu) (0x30 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5MCD(xcpu) (0x34 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5MD(xcpu) (0x38 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5SD(xcpu) (0x3c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL5MD_ALL 0xFFFFC0CF + +#define REG_IRQ_IL2RSD 0x100 +#define REG_IRQ_IL3RSD 0x104 +#define REG_IRQ_IL4RSD 0x108 +#define REG_IRQ_IL5RSD 0x10c + +#define REG_IRQ_LVL5_LP_GPDMA0_MASK (0xff << 16) +#define REG_IRQ_LVL5_LP_GPDMA1_MASK (0xff << 24) + +/* DSP Shim Registers */ +#define SHIM_DSPWC 0x20 /* DSP Wall Clock */ +#define SHIM_DSPWCTCS 0x28 /* DSP Wall Clock Timer Control & Status */ +#define SHIM_DSPWCT0C 0x30 /* DSP Wall Clock Timer 0 Compare */ +#define SHIM_DSPWCT1C 0x38 /* DSP Wall Clock Timer 1 Compare */ + +#define SHIM_DSPWCTCS_T1T (0x1 << 5) /* Timer 1 triggered */ +#define SHIM_DSPWCTCS_T0T (0x1 << 4) /* Timer 0 triggered */ +#define SHIM_DSPWCTCS_T1A (0x1 << 1) /* Timer 1 armed */ +#define SHIM_DSPWCTCS_T0A (0x1 << 0) /* Timer 0 armed */ + +#define SHIM_CLKCTL 0x78 +#define SHIM_CLKSTS 0x7C + +#define SHIM_CLKCTL_RAPLLC (0x1 << 31) +#define SHIM_CLKCTL_RXOSCC (0x1 << 30) +#define SHIM_CLKCTL_RFROSCC (0x1 << 29) + +/* LP GPDMA Force Dynamic Clock Gating bits, 0--enable */ +#define SHIM_CLKCTL_LPGPDMAFDCGB(x) (0x1 << (26 + x)) +#define SHIM_CLKCTL_DMICFDCGB(x) (0x1 << 24) +#define SHIM_CLKCTL_I2SFDCGB(x) (0x1 << (20 + x)) +#define SHIM_CLKCTL_I2SEFDCGB(x) (0x1 << (18 + x)) +#define SHIM_CLKCTL_TCPLCG(x) (0x1 << (16 + x)) + +/* Core clock PLL divisor */ +#define SHIM_CLKCTL_DPCS_MASK(x) (0x3 << (8 + x * 2)) +/* Prevent Audio PLL Shutdown */ +#define SHIM_CLKCTL_TCPAPLLS (0x1 << 7) + +/* 0--from PLL, 1--from oscillator */ +#define SHIM_CLKCTL_HDCS (0x1 << 4) + +/* Oscillator select */ +#define SHIM_CLKCTL_HDOCS (0x1 << 2) + +/* HP memory clock PLL divisor */ +#define SHIM_CLKCTL_HPMPCS (0x1 << 0) + +#define SHIM_PWRCTL 0x90 +#define SHIM_PWRSTS 0x92 +#define SHIM_LPSCTL 0x94 + +#define SHIM_LPSCTL_FDSPRUN (0X1 << 9) +#define SHIM_LPSCTL_FDMARUN (0X1 << 8) + + +/* host windows */ +#define DMWBA(x) (HOST_WIN_BASE(x) + 0x0) +#define DMWLO(x) (HOST_WIN_BASE(x) + 0x4) + +#define DMWBA_ENABLE (1 << 0) +#define DMWBA_READONLY (1 << 1) + +static inline uint32_t shim_read(uint32_t reg) +{ + return *((volatile uint32_t*)(SHIM_BASE + reg)); +} + +static inline void shim_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(SHIM_BASE + reg)) = val; +} + +static inline uint64_t shim_read64(uint32_t reg) +{ + return *((volatile uint64_t*)(SHIM_BASE + reg)); +} + +static inline void shim_write64(uint32_t reg, uint64_t val) +{ + *((volatile uint64_t*)(SHIM_BASE + reg)) = val; +} + +static inline uint32_t sw_reg_read(uint32_t reg) +{ + return *((volatile uint32_t*)(SRAM_SW_REG_BASE + reg)); +} + +static inline void sw_reg_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(SRAM_SW_REG_BASE + reg)) = val; +} + +static inline uint32_t mn_reg_read(uint32_t reg) +{ + return *((volatile uint32_t*)(MN_BASE + reg)); +} + +static inline void mn_reg_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(MN_BASE + reg)) = val; +} + +static inline uint32_t irq_read(uint32_t reg) +{ + return *((volatile uint32_t*)(IRQ_BASE + reg)); +} + +static inline void irq_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(IRQ_BASE + reg)) = val; +} + +static inline uint32_t ipc_read(uint32_t reg) +{ + return *((volatile uint32_t*)(IPC_HOST_BASE + reg)); +} + +static inline void ipc_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(IPC_HOST_BASE + reg)) = val; +} + +#endif diff --git a/src/platform/apollolake/include/platform/timer.h b/src/platform/apollolake/include/platform/timer.h new file mode 100644 index 0000000..7609324 --- /dev/null +++ b/src/platform/apollolake/include/platform/timer.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#ifndef __PLATFORM_TIMER_H__ +#define __PLATFORM_TIMER_H__ + +#include <stdint.h> +#include <reef/timer.h> +#include <platform/interrupt.h> + +#define TIMER_COUNT 5 + +/* timer numbers must use associated IRQ number */ +#define TIMER0 IRQ_NUM_TIMER1 +#define TIMER1 IRQ_NUM_TIMER2 +#define TIMER2 IRQ_NUM_TIMER3 +#define TIMER3 IRQ_EXT_TSTAMP0_LVL2(0) +#define TIMER4 IRQ_EXT_TSTAMP1_LVL2(0) + +#define TIMER_AUDIO TIMER3 + +struct comp_dev; +struct sof_ipc_stream_posn; + +int platform_timer_set(struct timer *timer, uint64_t ticks); +void platform_timer_clear(struct timer *timer); +uint64_t platform_timer_get(struct timer *timer); +void platform_timer_start(struct timer *timer); +void platform_timer_stop(struct timer *timer); +int platform_timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg); + +/* get timestamp for host stream DMA position */ +void platform_host_timestamp(struct comp_dev *host, + struct sof_ipc_stream_posn *posn); + +/* get timestamp for DAI stream DMA position */ +void platform_dai_timestamp(struct comp_dev *dai, + struct sof_ipc_stream_posn *posn); + +/* get current wallclock for componnent */ +void platform_dai_wallclock(struct comp_dev *dai, uint64_t *wallclock); +#endif
From: Keyon Jie yang.jie@linux.intel.com
Add platform initialisation and drivers for Intel Apollolake platform.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/platform/apollolake/Makefile.am | 27 ++ src/platform/apollolake/apollolake.x.in | 542 ++++++++++++++++++++++++++++ src/platform/apollolake/base_module.c | 52 +++ src/platform/apollolake/clk.c | 212 +++++++++++ src/platform/apollolake/dai.c | 158 ++++++++ src/platform/apollolake/dma.c | 174 +++++++++ src/platform/apollolake/include/Makefile.am | 1 + src/platform/apollolake/interrupt.c | 304 ++++++++++++++++ src/platform/apollolake/platform.c | 252 +++++++++++++ src/platform/apollolake/timer.c | 133 +++++++ 10 files changed, 1855 insertions(+) create mode 100644 src/platform/apollolake/Makefile.am create mode 100644 src/platform/apollolake/apollolake.x.in create mode 100644 src/platform/apollolake/base_module.c create mode 100644 src/platform/apollolake/clk.c create mode 100644 src/platform/apollolake/dai.c create mode 100644 src/platform/apollolake/dma.c create mode 100644 src/platform/apollolake/include/Makefile.am create mode 100644 src/platform/apollolake/interrupt.c create mode 100644 src/platform/apollolake/platform.c create mode 100644 src/platform/apollolake/timer.c
diff --git a/src/platform/apollolake/Makefile.am b/src/platform/apollolake/Makefile.am new file mode 100644 index 0000000..d4fe06a --- /dev/null +++ b/src/platform/apollolake/Makefile.am @@ -0,0 +1,27 @@ +SUBDIRS = include + +noinst_LIBRARIES = libplatform.a + +libplatform_a_SOURCES = \ + platform.c \ + dai.c \ + dma.c \ + clk.c \ + timer.c \ + interrupt.c + +libplatform_a_CFLAGS = \ + $(ARCH_CFLAGS) \ + $(ARCH_INCDIR) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) + +noinst_PROGRAMS = module + +module_SOURCES = \ + base_module.c + +module_CFLAGS = \ + $(ARCH_INCDIR) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) diff --git a/src/platform/apollolake/apollolake.x.in b/src/platform/apollolake/apollolake.x.in new file mode 100644 index 0000000..5e95be1 --- /dev/null +++ b/src/platform/apollolake/apollolake.x.in @@ -0,0 +1,542 @@ +/* + * Linker Script for Apololake. + * + * This script is run through the GNU C preprocessor to align the memory + * offsets with headers. + * + * Use spaces for formatting as cpp ignore tab sizes. + */ + +#include <platform/memory.h> +#include <xtensa/config/core-isa.h> + +OUTPUT_ARCH(xtensa) + +MEMORY +{ + vector_reset_text : + org = XCHAL_RESET_VECTOR0_PADDR, + len = REEF_MEM_RESET_TEXT_SIZE + vector_reset_lit : + org = XCHAL_RESET_VECTOR0_PADDR + REEF_MEM_RESET_TEXT_SIZE, + len = REEF_MEM_RESET_LIT_SIZE + vector_memory_lit : + org = XCHAL_MEMERROR_VECTOR_PADDR + REEF_MEM_ERROR_LIT_SIZE, + len = REEF_MEM_ERROR_LIT_SIZE + vector_memory_text : + org = XCHAL_MEMERROR_VECTOR_PADDR, + len = REEF_MEM_ERROR_TEXT_SIZE + vector_base_text : + org = XCHAL_VECBASE_RESET_PADDR, + len = REEF_MEM_VECBASE_LIT_SIZE + vector_int2_lit : + org = XCHAL_INTLEVEL2_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int2_text : + org = XCHAL_INTLEVEL2_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int3_lit : + org = XCHAL_INTLEVEL3_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int3_text : + org = XCHAL_INTLEVEL3_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int4_lit : + org = XCHAL_INTLEVEL4_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int4_text : + org = XCHAL_INTLEVEL4_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int5_lit : + org = XCHAL_INTLEVEL5_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int5_text : + org = XCHAL_INTLEVEL5_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int6_lit : + org = XCHAL_INTLEVEL6_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int6_text : + org = XCHAL_INTLEVEL6_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int7_lit : + org = XCHAL_INTLEVEL7_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int7_text : + org = XCHAL_INTLEVEL7_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_kernel_lit : + org = XCHAL_KERNEL_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_kernel_text : + org = XCHAL_KERNEL_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_user_lit : + org = XCHAL_USER_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_user_text : + org = XCHAL_USER_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_double_lit : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_double_text : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + reef_text_start : + org = REEF_TEXT_START, + len = REEF_TEXT_START_SIZE, + reef_text : + org = REEF_TEXT_BASE, + len = REEF_TEXT_SIZE, + reef_data : + org = REEF_TEXT_BASE + REEF_TEXT_SIZE, + len = REEF_DATA_SIZE + reef_bss_data : + org = REEF_TEXT_BASE + REEF_TEXT_SIZE + REEF_DATA_SIZE, + len = REEF_BSS_DATA_SIZE + system_heap : + org = HEAP_SYSTEM_BASE, + len = HEAP_SYSTEM_SIZE + runtime_heap : + org = HEAP_RUNTIME_BASE, + len = HEAP_RUNTIME_SIZE + buffer_heap : + org = HEAP_BUFFER_BASE, + len = HEAP_BUFFER_SIZE + reef_stack : + org = REEF_STACK_END, + len = REEF_STACK_BASE - REEF_STACK_END +} + +PHDRS +{ + vector_reset_text_phdr PT_LOAD; + vector_reset_lit_phdr PT_LOAD; + vector_memory_lit_phdr PT_LOAD; + vector_memory_text_phdr PT_LOAD; + vector_base_text_phdr PT_LOAD; + vector_int2_lit_phdr PT_LOAD; + vector_int2_text_phdr PT_LOAD; + vector_int3_lit_phdr PT_LOAD; + vector_int3_text_phdr PT_LOAD; + vector_int4_lit_phdr PT_LOAD; + vector_int4_text_phdr PT_LOAD; + vector_int5_lit_phdr PT_LOAD; + vector_int5_text_phdr PT_LOAD; + vector_int6_lit_phdr PT_LOAD; + vector_int6_text_phdr PT_LOAD; + vector_int7_lit_phdr PT_LOAD; + vector_int7_text_phdr PT_LOAD; + vector_kernel_lit_phdr PT_LOAD; + vector_kernel_text_phdr PT_LOAD; + vector_user_lit_phdr PT_LOAD; + vector_user_text_phdr PT_LOAD; + vector_double_lit_phdr PT_LOAD; + vector_double_text_phdr PT_LOAD; + reef_text_start_phdr PT_LOAD; + reef_text_phdr PT_LOAD; + reef_data_phdr PT_LOAD; + reef_bss_data_phdr PT_LOAD; + system_heap_phdr PT_LOAD; + runtime_heap_phdr PT_LOAD; + buffer_heap_phdr PT_LOAD; + reef_stack_phdr PT_LOAD; +} + +/* Default entry point: */ +ENTRY(_ResetVector) +_rom_store_table = 0; + +/* ABI0 does not use Window base */ +PROVIDE(_memmap_vecbase_reset = XCHAL_VECBASE_RESET_PADDR); + +/* Various memory-map dependent cache attribute settings: */ +_memmap_cacheattr_wb_base = 0x44024000; +_memmap_cacheattr_wt_base = 0x11021000; +_memmap_cacheattr_bp_base = 0x22022000; +_memmap_cacheattr_unused_mask = 0x00F00FFF; +_memmap_cacheattr_wb_trapnull = 0x4422422F; +_memmap_cacheattr_wba_trapnull = 0x4422422F; +_memmap_cacheattr_wbna_trapnull = 0x25222222; +_memmap_cacheattr_wt_trapnull = 0x1122122F; +_memmap_cacheattr_bp_trapnull = 0x2222222F; +_memmap_cacheattr_wb_strict = 0x44F24FFF; +_memmap_cacheattr_wt_strict = 0x11F21FFF; +_memmap_cacheattr_bp_strict = 0x22F22FFF; +_memmap_cacheattr_wb_allvalid = 0x44224222; +_memmap_cacheattr_wt_allvalid = 0x11221222; +_memmap_cacheattr_bp_allvalid = 0x22222222; +PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull); + +SECTIONS +{ + .ResetVector.text : ALIGN(4) + { + _ResetVector_text_start = ABSOLUTE(.); + KEEP (*(.ResetVector.text)) + _ResetVector_text_end = ABSOLUTE(.); + } >vector_reset_text :vector_reset_text_phdr + + .ResetVector.literal : ALIGN(4) + { + _ResetVector_literal_start = ABSOLUTE(.); + *(.ResetVector.literal) + _ResetVector_literal_end = ABSOLUTE(.); + } >vector_reset_lit :vector_reset_lit_phdr + + .MemoryExceptionVector.literal : ALIGN(4) + { + _MemoryExceptionVector_literal_start = ABSOLUTE(.); + KEEP (*(.MemoryExceptionVector.literal)) + _MemoryExceptionVector_literal_end = ABSOLUTE(.); + } >vector_memory_lit :vector_memory_lit_phdr + + .MemoryExceptionVector.text : ALIGN(4) + { + _MemoryExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.MemoryExceptionVector.text)) + _MemoryExceptionVector_text_end = ABSOLUTE(.); + } >vector_memory_text :vector_memory_text_phdr + + .WindowVectors.text : ALIGN(4) + { + _WindowVectors_text_start = ABSOLUTE(.); + KEEP (*(.WindowVectors.text)) + _WindowVectors_text_end = ABSOLUTE(.); + } >vector_base_text :vector_base_text_phdr + + .Level2InterruptVector.literal : ALIGN(4) + { + _Level2InterruptVector_literal_start = ABSOLUTE(.); + *(.Level2InterruptVector.literal) + _Level2InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int2_lit :vector_int2_lit_phdr + + .Level2InterruptVector.text : ALIGN(4) + { + _Level2InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level2InterruptVector.text)) + _Level2InterruptVector_text_end = ABSOLUTE(.); + } >vector_int2_text :vector_int2_text_phdr + + .Level3InterruptVector.literal : ALIGN(4) + { + _Level3InterruptVector_literal_start = ABSOLUTE(.); + *(.Level3InterruptVector.literal) + _Level3InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int3_lit :vector_int3_lit_phdr + + .Level3InterruptVector.text : ALIGN(4) + { + _Level3InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level3InterruptVector.text)) + _Level3InterruptVector_text_end = ABSOLUTE(.); + } >vector_int3_text :vector_int3_text_phdr + + .Level4InterruptVector.literal : ALIGN(4) + { + _Level4InterruptVector_literal_start = ABSOLUTE(.); + *(.Level4InterruptVector.literal) + _Level4InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int4_lit :vector_int4_lit_phdr + + .Level4InterruptVector.text : ALIGN(4) + { + _Level4InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level4InterruptVector.text)) + _Level4InterruptVector_text_end = ABSOLUTE(.); + } >vector_int4_text :vector_int4_text_phdr + + .Level5InterruptVector.literal : ALIGN(4) + { + _Level5InterruptVector_literal_start = ABSOLUTE(.); + *(.Level5InterruptVector.literal) + _Level5InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int5_lit :vector_int5_lit_phdr + + .Level5InterruptVector.text : ALIGN(4) + { + _Level5InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level5InterruptVector.text)) + _Level5InterruptVector_text_end = ABSOLUTE(.); + } >vector_int5_text :vector_int5_text_phdr + + .DebugExceptionVector.literal : ALIGN(4) + { + _DebugExceptionVector_literal_start = ABSOLUTE(.); + *(.DebugExceptionVector.literal) + _DebugExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int6_lit :vector_int6_lit_phdr + + .DebugExceptionVector.text : ALIGN(4) + { + _DebugExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DebugExceptionVector.text)) + _DebugExceptionVector_text_end = ABSOLUTE(.); + } >vector_int6_text :vector_int6_text_phdr + + .NMIExceptionVector.literal : ALIGN(4) + { + _NMIExceptionVector_literal_start = ABSOLUTE(.); + *(.NMIExceptionVector.literal) + _NMIExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int7_lit :vector_int7_lit_phdr + + .NMIExceptionVector.text : ALIGN(4) + { + _NMIExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.NMIExceptionVector.text)) + _NMIExceptionVector_text_end = ABSOLUTE(.); + } >vector_int7_text :vector_int7_text_phdr + + .KernelExceptionVector.literal : ALIGN(4) + { + _KernelExceptionVector_literal_start = ABSOLUTE(.); + *(.KernelExceptionVector.literal) + _KernelExceptionVector_literal_end = ABSOLUTE(.); + } >vector_kernel_lit :vector_kernel_lit_phdr + + .KernelExceptionVector.text : ALIGN(4) + { + _KernelExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.KernelExceptionVector.text)) + _KernelExceptionVector_text_end = ABSOLUTE(.); + } >vector_kernel_text :vector_kernel_text_phdr + + .UserExceptionVector.literal : ALIGN(4) + { + _UserExceptionVector_literal_start = ABSOLUTE(.); + *(.UserExceptionVector.literal) + _UserExceptionVector_literal_end = ABSOLUTE(.); + } >vector_user_lit :vector_user_lit_phdr + + .UserExceptionVector.text : ALIGN(4) + { + _UserExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.UserExceptionVector.text)) + _UserExceptionVector_text_end = ABSOLUTE(.); + } >vector_user_text :vector_user_text_phdr + + .DoubleExceptionVector.literal : ALIGN(4) + { + _DoubleExceptionVector_literal_start = ABSOLUTE(.); + *(.DoubleExceptionVector.literal) + _DoubleExceptionVector_literal_end = ABSOLUTE(.); + } >vector_double_lit :vector_double_lit_phdr + + .DoubleExceptionVector.text : ALIGN(4) + { + _DoubleExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DoubleExceptionVector.text)) + _DoubleExceptionVector_text_end = ABSOLUTE(.); + } >vector_double_text :vector_double_text_phdr + + .ResetHandler.text : ALIGN(4) + { + _ResetHandler_text_start = ABSOLUTE(.); + KEEP (*(.ResetHandler.text)) + _ResetHandler_text_end = ABSOLUTE(.); + } >reef_text_start :reef_text_start_phdr + + .text : ALIGN(4) + { + _stext = .; + _text_start = ABSOLUTE(.); + *(.entry.text) + *(.init.literal) + KEEP(*(.init)) + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.fini.literal) + KEEP(*(.fini)) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + } >reef_text :reef_text_phdr + + .rodata : ALIGN(4) + { + _rodata_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); + KEEP (*(.xt_except_table)) + KEEP (*(.gcc_except_table)) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + KEEP (*(.eh_frame)) + /* C++ constructor and destructor tables, properly ordered: */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + . = ALIGN(4); /* this table MUST be 4-byte aligned */ + _bss_table_start = ABSOLUTE(.); + LONG(_bss_start) + LONG(_bss_end) + _bss_table_end = ABSOLUTE(.); + _rodata_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .data : ALIGN(4) + { + _data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + KEEP(*(.gnu.linkonce.d.*personality*)) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + KEEP(*(.jcr)) + _data_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .lit4 : ALIGN(4) + { + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + } >reef_bss_data :reef_bss_data_phdr + + /* stack */ + _end = REEF_STACK_END; + PROVIDE(end = REEF_STACK_END); + _stack_sentry = REEF_STACK_END; + __stack = REEF_STACK_BASE; + + /* System Heap */ + _system_heap = HEAP_SYSTEM_BASE; + + + /* module heap */ + _module_heap = HEAP_RUNTIME_BASE; + + /* buffer heap */ + _buffer_heap = HEAP_BUFFER_BASE; + _buffer_heap_end = _stack_sentry; + + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + .xt.insn 0 : + { + KEEP (*(.xt.insn)) + KEEP (*(.gnu.linkonce.x.*)) + } + .xt.prop 0 : + { + KEEP (*(.xt.prop)) + KEEP (*(.xt.prop.*)) + KEEP (*(.gnu.linkonce.prop.*)) + } + .xt.lit 0 : + { + KEEP (*(.xt.lit)) + KEEP (*(.xt.lit.*)) + KEEP (*(.gnu.linkonce.p.*)) + } + .xt.profile_range 0 : + { + KEEP (*(.xt.profile_range)) + KEEP (*(.gnu.linkonce.profile_range.*)) + } + .xt.profile_ranges 0 : + { + KEEP (*(.xt.profile_ranges)) + KEEP (*(.gnu.linkonce.xt.profile_ranges.*)) + } + .xt.profile_files 0 : + { + KEEP (*(.xt.profile_files)) + KEEP (*(.gnu.linkonce.xt.profile_files.*)) + } + + .system_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_SYSTEM_SIZE; + _system_heap_end = ABSOLUTE(.); + } >system_heap :system_heap_phdr + + .runtime_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _runtime_heap_start = ABSOLUTE(.); + . = . + HEAP_RUNTIME_SIZE; + _runtime_heap_end = ABSOLUTE(.); + } >runtime_heap :runtime_heap_phdr + + .buffer_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_BUFFER_SIZE; + _system_heap_end = ABSOLUTE(.); + } >buffer_heap :buffer_heap_phdr + + .reef_stack (NOLOAD) : ALIGN(8) + { + . = ALIGN (4096); + _reef_stack_start = ABSOLUTE(.); + . = . + REEF_STACK_SIZE; + _reef_stack_end = ABSOLUTE(.); + } >reef_stack :reef_stack_phdr +} diff --git a/src/platform/apollolake/base_module.c b/src/platform/apollolake/base_module.c new file mode 100644 index 0000000..2f4a6ee --- /dev/null +++ b/src/platform/apollolake/base_module.c @@ -0,0 +1,52 @@ +/* + * 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +#include <uapi/manifest.h> +#include <platform/memory.h> + +/* + * Each module has an entry in the FW manifest header. This is NOT part of + * the SOF executable image but is inserted by object copy as a ELF section + * for parsing by rimage (to genrate the manifest). + */ +struct sof_man_module apl_manifest = { + .name = "BASEFW", + .uuid = {0x2e, 0x9e, 0x86, 0xfc, 0xf8, 0x45, 0x45, 0x40, + 0xa4, 0x16, 0x89, 0x88, 0x0a, 0xe3, 0x20, 0xa9}, + .entry_point = REEF_TEXT_START, + .type = { + .load_type = SOF_MAN_MOD_TYPE_MODULE, + .domain_ll = 1, + }, + .affinity_mask = 3, +}; + +/* not used, but stops linker complaining */ +int _start; diff --git a/src/platform/apollolake/clk.c b/src/platform/apollolake/clk.c new file mode 100644 index 0000000..a10805b --- /dev/null +++ b/src/platform/apollolake/clk.c @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <reef/clock.h> +#include <reef/io.h> +#include <reef/reef.h> +#include <reef/list.h> +#include <reef/alloc.h> +#include <reef/notifier.h> +#include <reef/lock.h> +#include <platform/clk.h> +#include <platform/shim.h> +#include <platform/timer.h> +#include <config.h> +#include <stdint.h> +#include <limits.h> + +#define NUM_CLOCKS 2 + +struct clk_data { + uint32_t freq; + uint32_t ticks_per_usec; + spinlock_t lock; +}; + +struct clk_pdata { + struct clk_data clk[NUM_CLOCKS]; +}; + +struct freq_table { + uint32_t freq; + uint32_t ticks_per_usec; + uint32_t enc; +}; + +static struct clk_pdata *clk_pdata; + +/* increasing frequency order */ +static const struct freq_table cpu_freq[] = { + {100000000, 100, 0x3}, + {200000000, 200, 0x1}, + {400000000, 400, 0x0}, /* default */ +}; + +/* + * XTAL clock, used as Wall Clock(external timer), + * 19.2M for Atom and 24M for core + */ +static const struct freq_table ssp_freq[] = { + {19200000, 19,}, /* default */ + {24000000, 24,}, +}; + +#define CPU_DEFAULT_IDX 2 +#define SSP_DEFAULT_IDX 0 + +static inline uint32_t get_freq(const struct freq_table *table, int size, + unsigned int hz) +{ + uint32_t i; + + /* find lowest available frequency that is >= requested hz */ + for (i = 0; i < size; i++) { + if (hz <= table[i].freq) + return i; + } + + /* not found, so return max frequency */ + return size - 1; +} + +void clock_enable(int clock) +{ + switch (clock) { + case CLK_CPU: + break; + case CLK_SSP: + default: + break; + } +} + +void clock_disable(int clock) +{ + switch (clock) { + case CLK_CPU: + break; + case CLK_SSP: + default: + break; + } +} + +uint32_t clock_set_freq(int clock, uint32_t hz) +{ + struct clock_notify_data notify_data; + uint32_t idx; + uint32_t flags; + + notify_data.old_freq = clk_pdata->clk[clock].freq; + notify_data.old_ticks_per_usec = clk_pdata->clk[clock].ticks_per_usec; + + /* atomic context for chaning clocks */ + spin_lock_irq(&clk_pdata->clk[clock].lock, flags); + + switch (clock) { + case CLK_CPU: + /* get nearest frequency that is >= requested Hz */ + idx = get_freq(cpu_freq, ARRAY_SIZE(cpu_freq), hz); + notify_data.freq = cpu_freq[idx].freq; + + /* tell anyone interested we are about to change CPU freq */ + notifier_event(NOTIFIER_ID_CPU_FREQ, CLOCK_NOTIFY_PRE, + ¬ify_data); + + /* set CPU frequency request for CCU */ + io_reg_update_bits(SHIM_BASE + SHIM_CLKCTL, + SHIM_CLKCTL_HDCS, 0); + io_reg_update_bits(SHIM_BASE + SHIM_CLKCTL, + SHIM_CLKCTL_DPCS_MASK(0), cpu_freq[idx].enc); + + /* tell anyone interested we have now changed CPU freq */ + notifier_event(NOTIFIER_ID_CPU_FREQ, CLOCK_NOTIFY_POST, + ¬ify_data); + break; + case CLK_SSP: + default: + break; + } + + spin_unlock_irq(&clk_pdata->clk[clock].lock, flags); + return clk_pdata->clk[clock].freq; +} + +uint32_t clock_get_freq(int clock) +{ + return clk_pdata->clk[clock].freq; +} + +uint64_t clock_us_to_ticks(int clock, uint64_t us) +{ + return clk_pdata->clk[clock].ticks_per_usec * us; +} + +uint64_t clock_time_elapsed(int clock, uint64_t previous, uint64_t *current) +{ + uint64_t _current; + + // TODO: change timer APIs to clk APIs ?? + switch (clock) { + case CLK_CPU: + _current = arch_timer_get_system(NULL); + break; + case CLK_SSP: + _current = platform_timer_get(platform_timer); + break; + default: + return 0; + } + + *current = _current; + if (_current >= previous) + return (_current - previous) / + clk_pdata->clk[clock].ticks_per_usec; + else + return (_current + (ULONG_LONG_MAX - previous)) / + clk_pdata->clk[clock].ticks_per_usec; +} + +void init_platform_clocks(void) +{ + clk_pdata = rmalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*clk_pdata)); + + spinlock_init(&clk_pdata->clk[0].lock); + spinlock_init(&clk_pdata->clk[1].lock); + + /* set defaults */ + clk_pdata->clk[CLK_CPU].freq = cpu_freq[CPU_DEFAULT_IDX].freq; + clk_pdata->clk[CLK_CPU].ticks_per_usec = + cpu_freq[CPU_DEFAULT_IDX].ticks_per_usec; + clk_pdata->clk[CLK_SSP].freq = ssp_freq[SSP_DEFAULT_IDX].freq; + clk_pdata->clk[CLK_SSP].ticks_per_usec = + ssp_freq[SSP_DEFAULT_IDX].ticks_per_usec; +} diff --git a/src/platform/apollolake/dai.c b/src/platform/apollolake/dai.c new file mode 100644 index 0000000..6149d26 --- /dev/null +++ b/src/platform/apollolake/dai.c @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <reef/reef.h> +#include <reef/dai.h> +#include <reef/ssp.h> +#include <reef/stream.h> +#include <reef/audio/component.h> +#include <platform/memory.h> +#include <platform/interrupt.h> +#include <platform/dma.h> +#include <stdint.h> +#include <string.h> +#include <config.h> + +static struct dai ssp[6] = { +{ + .type = SOF_DAI_INTEL_SSP, + .index = 0, + .plat_data = { + .base = SSP_BASE(0), + .irq = IRQ_EXT_SSP0_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(0) + SSDR, + .handshake = DMA_HANDSHAKE_SSP0_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(0) + SSDR, + .handshake = DMA_HANDSHAKE_SSP0_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 1, + .plat_data = { + .base = SSP_BASE(1), + .irq = IRQ_EXT_SSP1_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(1) + SSDR, + .handshake = DMA_HANDSHAKE_SSP1_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(1) + SSDR, + .handshake = DMA_HANDSHAKE_SSP1_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 2, + .plat_data = { + .base = SSP_BASE(2), + .irq = IRQ_EXT_SSP2_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(2) + SSDR, + .handshake = DMA_HANDSHAKE_SSP2_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(2) + SSDR, + .handshake = DMA_HANDSHAKE_SSP2_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 3, + .plat_data = { + .base = SSP_BASE(3), + .irq = IRQ_EXT_SSP3_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(3) + SSDR, + .handshake = DMA_HANDSHAKE_SSP3_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(3) + SSDR, + .handshake = DMA_HANDSHAKE_SSP3_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 4, + .plat_data = { + .base = SSP_BASE(4), + .irq = IRQ_EXT_SSP4_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(4) + SSDR, + .handshake = DMA_HANDSHAKE_SSP4_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(4) + SSDR, + .handshake = DMA_HANDSHAKE_SSP4_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 5, + .plat_data = { + .base = SSP_BASE(5), + .irq = IRQ_EXT_SSP5_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(5) + SSDR, + .handshake = DMA_HANDSHAKE_SSP5_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(5) + SSDR, + .handshake = DMA_HANDSHAKE_SSP5_RX, + } + }, + .ops = &ssp_ops, +},}; + +struct dai *dai_get(uint32_t type, uint32_t index) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ssp); i++) { + if (ssp[i].type == type && ssp[i].index == index) + return &ssp[i]; + } + + return NULL; +} diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c new file mode 100644 index 0000000..d142fa0 --- /dev/null +++ b/src/platform/apollolake/dma.c @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <reef/dma.h> +#include <reef/dw-dma.h> +#include <platform/memory.h> +#include <platform/interrupt.h> +#include <platform/dma.h> +#include <stdint.h> +#include <string.h> + +static struct dw_drv_plat_data dmac0 = { + .chan[0] = { + .class = 1, + .weight = 0, + }, + .chan[1] = { + .class = 1, + .weight = 0, + }, + .chan[2] = { + .class = 1, + .weight = 0, + }, + .chan[3] = { + .class = 1, + .weight = 0, + }, + .chan[4] = { + .class = 1, + .weight = 0, + }, + .chan[5] = { + .class = 1, + .weight = 0, + }, + .chan[6] = { + .class = 1, + .weight = 0, + }, + .chan[7] = { + .class = 1, + .weight = 0, + }, +}; + +static struct dw_drv_plat_data dmac1 = { + .chan[0] = { + .class = 2, + .weight = 0, + }, + .chan[1] = { + .class = 2, + .weight = 0, + }, + .chan[2] = { + .class = 2, + .weight = 0, + }, + .chan[3] = { + .class = 2, + .weight = 0, + }, + .chan[4] = { + .class = 2, + .weight = 0, + }, + .chan[5] = { + .class = 2, + .weight = 0, + }, + .chan[6] = { + .class = 2, + .weight = 0, + }, + .chan[7] = { + .class = 2, + .weight = 0, + }, +}; + +static struct dma dma[] = { +{ /* Low Power GP DMAC 0 */ + .plat_data = { + .id = DMA_GP_LP_DMAC0, + .base = LP_GP_DMA_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0), + .drv_plat_data = &dmac0, + }, + .ops = &dw_dma_ops, +}, +{ /* Low Power GP DMAC 1 */ + .plat_data = { + .id = DMA_GP_LP_DMAC1, + .base = LP_GP_DMA_BASE(1), + .channels = 8, + .irq = IRQ_EXT_LP_GPDMA1_LVL5(0, 0), + .drv_plat_data = &dmac1, + }, + .ops = &dw_dma_ops, +}, +{ /* Host In DMAC */ + .plat_data = { + .id = DMA_HOST_IN_DMAC, + .base = GTW_HOST_IN_STREAM_BASE(0), + .channels = 7, + .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0), + }, +}, +{ /* Host out DMAC */ + .plat_data = { + .id = DMA_HOST_OUT_DMAC, + .base = GTW_HOST_OUT_STREAM_BASE(0), + .channels = 6, + .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0), + }, +}, +{ /* Link In DMAC */ + .plat_data = { + .id = DMA_LINK_IN_DMAC, + .base = GTW_LINK_IN_STREAM_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0), + }, +}, +{ /* Link out DMAC */ + .plat_data = { + .id = DMA_LINK_OUT_DMAC, + .base = GTW_LINK_OUT_STREAM_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0), + }, +},}; + +struct dma *dma_get(int dmac_id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + if (dma[i].plat_data.id == dmac_id) + return &dma[i]; + } + + return NULL; +} diff --git a/src/platform/apollolake/include/Makefile.am b/src/platform/apollolake/include/Makefile.am new file mode 100644 index 0000000..19f40eb --- /dev/null +++ b/src/platform/apollolake/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = platform xtensa diff --git a/src/platform/apollolake/interrupt.c b/src/platform/apollolake/interrupt.c new file mode 100644 index 0000000..3f799b7 --- /dev/null +++ b/src/platform/apollolake/interrupt.c @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2017, 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: Keyon Jie yang.jie@linux.intel.com + * Liam Girdwood liam.r.girdwood@linux.intel.com + * + */ + +#include <reef/reef.h> +#include <reef/interrupt.h> +#include <reef/interrupt-map.h> +#include <arch/interrupt.h> +#include <platform/interrupt.h> +#include <platform/shim.h> +#include <stdint.h> +#include <stdlib.h> + +static void parent_level2_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL2); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL2SD(0)); + irq_write(REG_IRQ_IL2MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL2MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL2); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL2); +} + +static void parent_level3_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL3); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL3SD(0)); + irq_write(REG_IRQ_IL3MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL3MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL3); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL3); +} + +static void parent_level4_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL4); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL4SD(0)); + irq_write(REG_IRQ_IL4MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL4MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL4); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL4); +} + +static void parent_level5_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL5); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL5SD(0)); + irq_write(REG_IRQ_IL5MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL5MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL5); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL5); +} + +/* DSP internal interrupts */ +static struct irq_parent dsp_irq[4] = { + {IRQ_NUM_EXT_LEVEL2, parent_level2_handler, }, + {IRQ_NUM_EXT_LEVEL3, parent_level3_handler, }, + {IRQ_NUM_EXT_LEVEL4, parent_level4_handler, }, + {IRQ_NUM_EXT_LEVEL5, parent_level5_handler, }, +}; + +struct irq_parent *platform_irq_get_parent(uint32_t irq) +{ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL2: + return &dsp_irq[0]; + case IRQ_NUM_EXT_LEVEL3: + return &dsp_irq[1]; + case IRQ_NUM_EXT_LEVEL4: + return &dsp_irq[2]; + case IRQ_NUM_EXT_LEVEL5: + return &dsp_irq[3]; + default: + return NULL; + } +} + +uint32_t platform_interrupt_get_enabled(void) +{ + return 0; +} + +void platform_interrupt_mask(uint32_t irq, uint32_t mask) +{ + /* mask external interrupt bit */ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL5: + irq_write(REG_IRQ_IL5MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL4: + irq_write(REG_IRQ_IL4MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL3: + irq_write(REG_IRQ_IL3MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL2: + irq_write(REG_IRQ_IL2MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + default: + break; + } + +} + +void platform_interrupt_unmask(uint32_t irq, uint32_t mask) +{ + /* unmask external interrupt bit */ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL5: + irq_write(REG_IRQ_IL5MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL4: + irq_write(REG_IRQ_IL4MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL3: + irq_write(REG_IRQ_IL3MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL2: + irq_write(REG_IRQ_IL2MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + default: + break; + } + +} + +void platform_interrupt_clear(uint32_t irq, uint32_t mask) +{ +} + +void platform_interrupt_init(void) +{ + int i; + + /* mask all external IRQs by default */ + irq_write(REG_IRQ_IL2MSD(0), REG_IRQ_IL2MD_ALL); + irq_write(REG_IRQ_IL3MSD(0), REG_IRQ_IL3MD_ALL); + irq_write(REG_IRQ_IL4MSD(0), REG_IRQ_IL4MD_ALL); + irq_write(REG_IRQ_IL5MSD(0), REG_IRQ_IL5MD_ALL); + + for (i = 0; i < ARRAY_SIZE(dsp_irq); i++) { + spinlock_init(&dsp_irq[i].lock); + } +} diff --git a/src/platform/apollolake/platform.c b/src/platform/apollolake/platform.c new file mode 100644 index 0000000..bb44634 --- /dev/null +++ b/src/platform/apollolake/platform.c @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <platform/memory.h> +#include <platform/mailbox.h> +#include <platform/shim.h> +#include <platform/dma.h> +#include <platform/clk.h> +#include <platform/timer.h> +#include <platform/interrupt.h> +#include <uapi/ipc.h> +#include <reef/mailbox.h> +#include <reef/dai.h> +#include <reef/dma.h> +#include <reef/reef.h> +#include <reef/agent.h> +#include <reef/work.h> +#include <reef/clock.h> +#include <reef/ipc.h> +#include <reef/io.h> +#include <reef/trace.h> +#include <reef/audio/component.h> +#include <string.h> +#include <version.h> + +static const struct sof_ipc_fw_ready ready = { + .hdr = { + .cmd = SOF_IPC_FW_READY, + .size = sizeof(struct sof_ipc_fw_ready), + }, + .version = { + .build = REEF_BUILD, + .minor = REEF_MINOR, + .major = REEF_MAJOR, + .date = __DATE__, + .time = __TIME__, + .tag = REEF_TAG, + }, +}; + +#define SRAM_WINDOW_HOST_OFFSET(x) (0x80000 + x * 0x20000) + +#define NUM_APL_WINDOWS 5 + +static const struct sof_ipc_window sram_window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window) + + sizeof(struct sof_ipc_window_elem) * NUM_APL_WINDOWS, + .type = SOF_IPC_EXT_WINDOW, + }, + .num_windows = NUM_APL_WINDOWS, + .window[0] = { + .type = SOF_IPC_REGION_REGS, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_SW_REG_SIZE, + .offset = 0, + }, + .window[1] = { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_SW_REG_SIZE, + }, + .window[2] = { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 1, /* map to host window 1 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = 0, + }, + .window[3] = { + .type = SOF_IPC_REGION_DEBUG, + .id = 2, /* map to host window 2 */ + .flags = 0, // TODO: set later + .size = SRAM_DEBUG_SIZE, + .offset = 0, + }, + .window[4] = { + .type = SOF_IPC_REGION_TRACE, + .id = 3, /* map to host window 3 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = 0, + }, + +}; + +static struct work_queue_timesource platform_generic_queue = { + .timer = { + .id = TIMER3, /* external timer, XTAL 19.2M */ + .irq = IRQ_EXT_TSTAMP0_LVL2(0), + }, + .clk = CLK_SSP, + .notifier = NOTIFIER_ID_SSP_FREQ, + .timer_set = platform_timer_set, + .timer_clear = platform_timer_clear, + .timer_get = platform_timer_get, +}; + +struct timer *platform_timer = &platform_generic_queue.timer; + +int platform_boot_complete(uint32_t boot_message) +{ + mailbox_dspbox_write(0, &ready, sizeof(ready)); + mailbox_dspbox_write(sizeof(ready), &sram_window, + sram_window.ext_hdr.hdr.size); + + /* boot now complete so we can relax the CPU */ + clock_set_freq(CLK_CPU, CLK_DEFAULT_CPU_HZ); + + /* tell host we are ready */ + ipc_write(IPC_DIPCIE, SRAM_WINDOW_HOST_OFFSET(0) >> 12); + ipc_write(IPC_DIPCI, 0x80000000 | SOF_IPC_FW_READY); + + return 0; +} + +static void platform_memory_windows_init(void) +{ + /* window0, for fw status & outbox/uplink mbox */ + io_reg_write(DMWLO(0), HP_SRAM_WIN0_SIZE | 0x7); + io_reg_write(DMWBA(0), HP_SRAM_WIN0_BASE + | DMWBA_READONLY | DMWBA_ENABLE); + + /* window1, for inbox/downlink mbox */ + io_reg_write(DMWLO(1), HP_SRAM_WIN1_SIZE | 0x7); + io_reg_write(DMWBA(1), HP_SRAM_WIN1_BASE + | DMWBA_ENABLE); + + /* window2, for debug */ + io_reg_write(DMWLO(2), HP_SRAM_WIN2_SIZE | 0x7); + io_reg_write(DMWBA(2), HP_SRAM_WIN2_BASE + | DMWBA_READONLY | DMWBA_ENABLE); + + /* window3, for trace */ + io_reg_write(DMWLO(3), HP_SRAM_WIN3_SIZE | 0x7); + io_reg_write(DMWBA(3), HP_SRAM_WIN3_BASE + | DMWBA_READONLY | DMWBA_ENABLE); +} + +static struct timer platform_ext_timer = { + .id = TIMER3, + .irq = IRQ_EXT_TSTAMP0_LVL2(0), +}; + +int platform_init(struct reef *reef) +{ + struct dma *dmac0; + struct dma *dmac1; + struct dai *ssp2; + + platform_interrupt_init(); + + trace_point(TRACE_BOOT_PLATFORM_MBOX); + platform_memory_windows_init(); + + trace_point(TRACE_BOOT_PLATFORM_SHIM); + + /* init work queues and clocks */ + trace_point(TRACE_BOOT_PLATFORM_TIMER); + platform_timer_start(&platform_ext_timer); + + trace_point(TRACE_BOOT_PLATFORM_CLOCK); + init_platform_clocks(); + + trace_point(TRACE_BOOT_SYS_WORK); + init_system_workq(&platform_generic_queue); + + /* init the system agent */ + sa_init(reef); + + /* Set CPU to default frequency for booting */ + trace_point(TRACE_BOOT_SYS_CPU_FREQ); + clock_set_freq(CLK_CPU, CLK_MAX_CPU_HZ); + + /* set SSP clock to 19.2M */ + trace_point(TRACE_BOOT_PLATFORM_SSP_FREQ); + clock_set_freq(CLK_SSP, 19200000); + + /* initialise the host IPC mechanisms */ + trace_point(TRACE_BOOT_PLATFORM_IPC); + ipc_init(reef); + + /* disable PM for boot */ + shim_write(SHIM_CLKCTL, shim_read(SHIM_CLKCTL) | + SHIM_CLKCTL_LPGPDMAFDCGB(0) | + SHIM_CLKCTL_LPGPDMAFDCGB(1) | + SHIM_CLKCTL_I2SFDCGB(3) | + SHIM_CLKCTL_I2SFDCGB(2) | + SHIM_CLKCTL_I2SFDCGB(1) | + SHIM_CLKCTL_I2SFDCGB(0) | + SHIM_CLKCTL_I2SEFDCGB(1) | + SHIM_CLKCTL_I2SEFDCGB(0) | + SHIM_CLKCTL_TCPAPLLS | + SHIM_CLKCTL_RAPLLC | + SHIM_CLKCTL_RXOSCC | + SHIM_CLKCTL_RFROSCC | + SHIM_CLKCTL_TCPLCG(0) | SHIM_CLKCTL_TCPLCG(1)); + + shim_write(SHIM_LPSCTL, shim_read(SHIM_LPSCTL)); + + /* init DMACs */ + trace_point(TRACE_BOOT_PLATFORM_DMA); + dmac0 = dma_get(DMA_GP_LP_DMAC0); + if (dmac0 == NULL) + return -ENODEV; + dma_probe(dmac0); + + dmac1 = dma_get(DMA_GP_LP_DMAC1); + if (dmac1 == NULL) + return -ENODEV; + dma_probe(dmac1); + + /* init SSP ports */ + trace_point(TRACE_BOOT_PLATFORM_SSP); + ssp2 = dai_get(SOF_DAI_INTEL_SSP, 4); + if (ssp2 == NULL) + return -ENODEV; + dai_probe(ssp2); + return 0; +} diff --git a/src/platform/apollolake/timer.c b/src/platform/apollolake/timer.c new file mode 100644 index 0000000..d7e5683 --- /dev/null +++ b/src/platform/apollolake/timer.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <platform/timer.h> +#include <platform/shim.h> +#include <reef/debug.h> +#include <reef/audio/component.h> +#include <stdint.h> + +void platform_timer_start(struct timer *timer) +{ + /* run timer */ + shim_write64(SHIM_DSPWCT0C, 0); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0A); +} + +void platform_timer_stop(struct timer *timer) +{ + /* stop timer */ + shim_write64(SHIM_DSPWCT0C, 0); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) & ~SHIM_DSPWCTCS_T0A); +} + +int platform_timer_set(struct timer *timer, uint64_t ticks) +{ + /* a tick value of 0 will not generate an IRQ */ + if (ticks == 0) + ticks = 1; + + /* set new value and run */ + shim_write64(SHIM_DSPWCT0C, (uint64_t)ticks); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0A); + + return 0; +} + +void platform_timer_clear(struct timer *timer) +{ + /* write 1 to clear the timer interrupt */ + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0T); +} + +uint64_t platform_timer_get(struct timer *timer) +{ +// return arch_timer_get_system(timer); + return (uint64_t)shim_read64(SHIM_DSPWC); +} + +/* get timestamp for host stream DMA position */ +void platform_host_timestamp(struct comp_dev *host, + struct sof_ipc_stream_posn *posn) +{ + int err; + + /* get host postion */ + err = comp_position(host, posn); + if (err == 0) + posn->flags |= SOF_TIME_HOST_VALID; +} + +/* get timestamp for DAI stream DMA position */ +void platform_dai_timestamp(struct comp_dev *dai, + struct sof_ipc_stream_posn *posn) +{ + int err; + + /* get DAI postion */ + err = comp_position(dai, posn); + if (err == 0) + posn->flags |= SOF_TIME_DAI_VALID; + + /* get SSP wallclock - DAI sets this to stream start value */ + posn->wallclock = shim_read64(SHIM_DSPWC) - posn->wallclock; + posn->flags |= SOF_TIME_WALL_VALID; +} + +/* get current wallclock for componnent */ +void platform_dai_wallclock(struct comp_dev *dai, uint64_t *wallclock) +{ + *wallclock = shim_read64(SHIM_DSPWC); +} + +int platform_timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg) +{ + return interrupt_register(timer->irq, handler, arg); +} + +int timer_register(struct timer *timer, void(*handler)(void *arg), void *arg) +{ + switch (timer->id) { + case TIMER0: + case TIMER1: + case TIMER2: + return arch_timer_register(timer, handler, arg); + case TIMER3: + return platform_timer_register(timer, handler, arg); + default: + return -EINVAL; + } +}
From: Keyon Jie yang.jie@linux.intel.com
Support IPC on Intel Apollolake platform.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/ipc/Makefile.am | 8 ++ src/ipc/apl-ipc.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 src/ipc/apl-ipc.c
diff --git a/src/ipc/Makefile.am b/src/ipc/Makefile.am index 5018da0..8438b70 100644 --- a/src/ipc/Makefile.am +++ b/src/ipc/Makefile.am @@ -34,6 +34,14 @@ libipc_a_SOURCES = \ dma-copy.c endif
+if BUILD_APOLLOLAKE +libipc_a_SOURCES = \ + ipc.c \ + intel-ipc.c \ + apl-ipc.c \ + dma-copy.c +endif + libipc_a_CFLAGS = \ $(ARCH_CFLAGS) \ $(ARCH_INCDIR) \ diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c new file mode 100644 index 0000000..c779062 --- /dev/null +++ b/src/ipc/apl-ipc.c @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + */ + +#include <reef/debug.h> +#include <reef/timer.h> +#include <reef/interrupt.h> +#include <reef/ipc.h> +#include <reef/mailbox.h> +#include <reef/reef.h> +#include <reef/stream.h> +#include <reef/dai.h> +#include <reef/dma.h> +#include <reef/alloc.h> +#include <reef/wait.h> +#include <reef/trace.h> +#include <reef/ssp.h> +#include <platform/interrupt.h> +#include <platform/mailbox.h> +#include <platform/shim.h> +#include <platform/dma.h> +#include <platform/platform.h> +#include <reef/audio/component.h> +#include <reef/audio/pipeline.h> +#include <uapi/ipc.h> +#include <reef/intel-ipc.h> + +extern struct ipc *_ipc; + +/* test code to check working IRQ */ +static void irq_handler(void *arg) +{ + uint32_t dipct; + uint32_t dipcie; + uint32_t msg = 0; + + trace_ipc("IRQ"); + + dipct = ipc_read(IPC_DIPCT); + dipcie = ipc_read(IPC_DIPCIE); + + /* new message from host */ + if (dipct & IPC_DIPCT_BUSY) { + trace_ipc("Nms"); + + /* mask Busy interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE); + + msg = dipct & IPC_DIPCT_MSG_MASK; + + /* TODO: place message in Q and process later */ + /* It's not Q ATM, may overwrite */ + if (_ipc->host_pending) + trace_ipc_error("Pen"); + _ipc->host_msg = msg; + _ipc->host_pending = 1; + + } + + /* reply message(done) from host */ + if (dipcie & IPC_DIPCIE_DONE) { + trace_ipc("Rpy"); + /* mask Done interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCIDIE); + + /* clear DONE bit - tell host we have completed the operation */ + ipc_write(IPC_DIPCIE, ipc_read(IPC_DIPCIE) |IPC_DIPCIE_DONE); + + /* unmask Done interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) | IPC_DIPCCTL_IPCIDIE); + } + +} + +void ipc_platform_do_cmd(struct ipc *ipc) +{ + struct intel_ipc_data *iipc = ipc_get_drvdata(ipc); + struct sof_ipc_reply reply; + int32_t err; + + trace_ipc("Cmd"); + + /* perform command and return any error */ + err = ipc_cmd(); + if (err > 0) { + goto done; /* reply created and copied by cmd() */ + } else if (err < 0) { + /* send std error reply */ + reply.error = err; + } else if (err == 0) { + /* send std reply */ + reply.error = 0; + } + + /* send std error/ok reply */ + reply.hdr.cmd = SOF_IPC_GLB_REPLY; + reply.hdr.size = sizeof(reply); + mailbox_hostbox_write(0, &reply, sizeof(reply)); + +done: + ipc->host_pending = 0; + + /* write 1 to clear busy, and trigger interrupt to host*/ + ipc_write(IPC_DIPCT, ipc_read(IPC_DIPCT) |IPC_DIPCT_BUSY ); + + /* unmask Busy interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) | IPC_DIPCCTL_IPCTBIE); + + // TODO: signal audio work to enter D3 in normal context + /* are we about to enter D3 ? */ + if (iipc->pm_prepare_D3) { + while (1) + wait_for_interrupt(0); + } + + tracev_ipc("CmD"); + +} + +void ipc_platform_send_msg(struct ipc *ipc) +{ + struct ipc_msg *msg; + uint32_t flags; + + spin_lock_irq(&ipc->lock, flags); + + /* any messages to send ? */ + if (list_is_empty(&ipc->msg_list)) { + ipc->dsp_pending = 0; + goto out; + } + + /* now send the message */ + msg = list_first_item(&ipc->msg_list, struct ipc_msg, list); + mailbox_dspbox_write(0, msg->tx_data, msg->tx_size); + list_item_del(&msg->list); + ipc->dsp_msg = msg; + tracev_ipc("Msg"); + + /* now interrupt host to tell it we have message sent */ + ipc_write(IPC_DIPCIE, 0); + ipc_write(IPC_DIPCI, 0x80000000 | msg->header); + +list_item_append(&msg->list, &ipc->empty_list); + +out: + spin_unlock_irq(&ipc->lock, flags); +} + +int platform_ipc_init(struct ipc *ipc) +{ + struct intel_ipc_data *iipc; + int i; + + _ipc = ipc; + + /* init ipc data */ + iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data)); + ipc_set_drvdata(_ipc, iipc); + _ipc->dsp_msg = NULL; + list_init(&ipc->empty_list); + list_init(&ipc->msg_list); + spinlock_init(&ipc->lock); + for (i = 0; i < MSG_QUEUE_SIZE; i++) + list_item_prepend(&ipc->message[i].list, &ipc->empty_list); + + /* allocate page table buffer */ + iipc->page_table = rballoc(RZONE_SYS, RFLAGS_NONE, + HOST_PAGE_SIZE); + if (iipc->page_table) + bzero(iipc->page_table, HOST_PAGE_SIZE); + + /* dma */ + iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0); + + /* PM */ + iipc->pm_prepare_D3 = 0; + + /* configure interrupt */ + interrupt_register(PLATFORM_IPC_INTERUPT, irq_handler, NULL); + interrupt_enable(PLATFORM_IPC_INTERUPT); + + /* enable IPC interrupts from host */ + ipc_write(IPC_DIPCCTL, IPC_DIPCCTL_IPCIDIE | IPC_DIPCCTL_IPCTBIE); + + return 0; +}
Build the Intel apollolake platform.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- configure.ac | 23 +++++++++++++++++++++++ src/arch/xtensa/hal/Makefile.am | 9 +++++++++ src/platform/Makefile.am | 4 ++++ 3 files changed, 36 insertions(+)
diff --git a/configure.ac b/configure.ac index 20c5ab4..744d815 100644 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,23 @@ case "$with_platform" in AC_DEFINE([CONFIG_CHERRYTRAIL], [1], [Configure for Cherrytrail]) AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table]) ;; + apollolake*) + + PLATFORM_LDSCRIPT="apollolake.x" + AC_SUBST(PLATFORM_LDSCRIPT) + + PLATFORM="apollolake" + AC_SUBST(PLATFORM) + + FW_NAME="apl" + AC_SUBST(FW_NAME) + + XTENSA_CORE="hifi3_std" + AC_SUBST(XTENSA_CORE) + + AC_DEFINE([CONFIG_APOLLOLAKE], [1], [Configure for Apololake]) + AC_DEFINE([CONFIG_IRQ_MAP], [1], [Configure IRQ maps]) + ;; haswell*)
PLATFORM_LDSCRIPT="haswell.x" @@ -150,6 +167,7 @@ AM_CONDITIONAL(BUILD_CHERRYTRAIL, test "$FW_NAME" = "cht") AM_CONDITIONAL(BUILD_HASWELL, test "$FW_NAME" = "hsw") AM_CONDITIONAL(BUILD_BROADWELL, test "$FW_NAME" = "bdw") AM_CONDITIONAL(BUILD_APOLLOLAKE, test "$FW_NAME" = "apl") +AM_CONDITIONAL(BUILD_MODULE, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
# DSP core support (Optional) AC_ARG_WITH([dsp-core], @@ -218,6 +236,11 @@ AC_CONFIG_FILES([ src/platform/baytrail/include/platform/Makefile src/platform/baytrail/include/xtensa/Makefile src/platform/baytrail/include/xtensa/config/Makefile + src/platform/apollolake/Makefile + src/platform/apollolake/include/Makefile + src/platform/apollolake/include/platform/Makefile + src/platform/apollolake/include/xtensa/Makefile + src/platform/apollolake/include/xtensa/config/Makefile src/platform/haswell/Makefile src/platform/haswell/include/Makefile src/platform/haswell/include/platform/Makefile diff --git a/src/arch/xtensa/hal/Makefile.am b/src/arch/xtensa/hal/Makefile.am index 23c1b79..247473e 100644 --- a/src/arch/xtensa/hal/Makefile.am +++ b/src/arch/xtensa/hal/Makefile.am @@ -152,6 +152,15 @@ PLATFORM_DEFS = \ $(CACHE_DEFS) endif
+if BUILD_APOLLOLAKE +PLATFORM_DEFS = \ + $(STATE_DEFS) \ + $(DISASS_DEFS) \ + $(MISC_DEFS) \ + $(INTERRUPTS_DEFS) \ + $(CACHE_DEFS) +endif + noinst_LIBRARIES = libhal.a
libhal_a_SOURCES = \ diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am index 9d360c3..79446d0 100644 --- a/src/platform/Makefile.am +++ b/src/platform/Makefile.am @@ -6,6 +6,10 @@ if BUILD_CHERRYTRAIL SUBDIRS = baytrail endif
+if BUILD_APOLLOLAKE +SUBDIRS = apollolake +endif + if BUILD_HASWELL SUBDIRS = haswell endif
Apollolake has reset vector in ROM and some other changes that need configured after reset.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/reset-vector.S | 57 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-)
diff --git a/src/arch/xtensa/reset-vector.S b/src/arch/xtensa/reset-vector.S index 1ddd6ca..be2eb7a 100644 --- a/src/arch/xtensa/reset-vector.S +++ b/src/arch/xtensa/reset-vector.S @@ -78,7 +78,26 @@ _ResetVector: wsr a0, MEMCTL #endif #endif + +/* Apollolake+ have reset vector in ROM */ +#if defined(CONFIG_BAYTRAIL) || defined(CONFIG_CHERRYTRAIL) \ + || defined (CONFIG_HASWELL) || defined(CONFIG_BROADWELL) j _ResetHandler +#else + + // This is our VM bxt ROM. It simply jumps to the reset handler. + j .sram_jump // jump over the literals + + .align 4 + .literal_position // tells the assembler/linker to place literals here + +_reset_sram: + .word _ResetHandler + .align 4 +.sram_jump: + l32r a0, _reset_sram // load SRAM reset hanler address + jx a0 // jump to the hanlder +#endif .size _ResetVector, . - _ResetVector
# if XCHAL_HAVE_HALT @@ -96,7 +115,7 @@ _ResetVector: # endif # endif
-#ifdef CONFIG_BROXTON +#if defined(CONFIG_APOLLOLAKE) || defined(CONFIG_CANNONLAKE) .section .ResetHandler.text, "ax" j _ResetHandler #endif @@ -105,6 +124,7 @@ _ResetVector:
.align 4 .global _ResetHandler + _ResetHandler: #endif
@@ -155,7 +175,19 @@ _ResetHandler:
#endif
+#if defined(CONFIG_APOLLOLAKE) + call0 _call_init +#endif + +#if defined(CONFIG_APOLLOLAKE) + movi a0, 0 // a0 is always 0 in this code, used to initialize lots of things + movi a0, 0 + movi a1, 0 + movi a2, 0 +#else movi a0, 0 // a0 is always 0 in this code, used to initialize lots of things +#endif +
#if XCHAL_HAVE_INTERRUPTS // technically this should be under !FULL_RESET, assuming hard reset wsr a0, INTENABLE // make sure that interrupts are shut off (*before* we lower PS.INTLEVEL and PS.EXCM!) @@ -249,6 +281,12 @@ _ResetHandler: extui a3, a3, 0, 8 // extract core ID (FIXME: need proper constants for PRID bits to extract) beqz a2, .Ldonesync // skip if no sync variable bnez a3, .Ldonesync // only do this on core 0 +#if defined(CONFIG_APOLLOLAKE) + movi a2, 100 // delay here for 100 iterations if we are not core 0 +2: addi.n a2, a2, -1 + bnez a2, 2b + j .Ldonesync +#endif s32i a0, a2, 0 // clear sync variable .Ldonesync: #endif @@ -312,7 +350,11 @@ _ResetHandler:
#if XCHAL_HAVE_PREFETCH /* Enable cache prefetch if present. */ +#if defined(CONFIG_APOLLOLAKE) + movi.n a2, 34 +#else movi.n a2, 68 +#endif wsr a2, PREFCTL #endif /* @@ -479,6 +521,7 @@ unpackdone: */ #if HAVE_XSR
+#if !XCHAL_HAVE_BOOTLOADER /* For asm macros; works for positive a,b smaller than 1000: */ # define GREATERTHAN(a,b) (((b)-(a)) & ~0xFFF)
@@ -517,7 +560,7 @@ unpackdone: init_vector 4 init_vector 5 init_vector 6 - +#endif #endif /*HAVE_XSR*/
@@ -553,6 +596,16 @@ unpackdone: .size _ResetVector, . - _ResetVector #endif
+#if defined(CONFIG_APOLLOLAKE) + .align 4 + .global _call_init + .type _call_init,@function + +_call_init: + ret.n + .size _call_init, . - _call_init +#endif + .text .global xthals_hw_configid0, xthals_hw_configid1 .global xthals_release_major, xthals_release_minor
From: Rander Wang rander.wang@linux.intel.com
Add xtensa headers for Intel Cannonlake platform
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/platform/cannonlake/include/xtensa/Makefile.am | 1 + .../cannonlake/include/xtensa/config/Makefile.am | 8 + .../include/xtensa/config/core-isa-boot.h | 557 +++++++++++++++++++++ .../cannonlake/include/xtensa/config/core-isa.h | 557 +++++++++++++++++++++ .../cannonlake/include/xtensa/config/core-matmap.h | 313 ++++++++++++ .../cannonlake/include/xtensa/config/defs.h | 38 ++ .../cannonlake/include/xtensa/config/specreg.h | 106 ++++ .../cannonlake/include/xtensa/config/system.h | 271 ++++++++++ .../cannonlake/include/xtensa/config/tie-asm.h | 239 +++++++++ .../cannonlake/include/xtensa/config/tie.h | 169 +++++++ 10 files changed, 2259 insertions(+) create mode 100644 src/platform/cannonlake/include/xtensa/Makefile.am create mode 100644 src/platform/cannonlake/include/xtensa/config/Makefile.am create mode 100644 src/platform/cannonlake/include/xtensa/config/core-isa-boot.h create mode 100644 src/platform/cannonlake/include/xtensa/config/core-isa.h create mode 100644 src/platform/cannonlake/include/xtensa/config/core-matmap.h create mode 100644 src/platform/cannonlake/include/xtensa/config/defs.h create mode 100644 src/platform/cannonlake/include/xtensa/config/specreg.h create mode 100644 src/platform/cannonlake/include/xtensa/config/system.h create mode 100644 src/platform/cannonlake/include/xtensa/config/tie-asm.h create mode 100644 src/platform/cannonlake/include/xtensa/config/tie.h
diff --git a/src/platform/cannonlake/include/xtensa/Makefile.am b/src/platform/cannonlake/include/xtensa/Makefile.am new file mode 100644 index 0000000..a85a5bb --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = config diff --git a/src/platform/cannonlake/include/xtensa/config/Makefile.am b/src/platform/cannonlake/include/xtensa/config/Makefile.am new file mode 100644 index 0000000..99c21a5 --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/Makefile.am @@ -0,0 +1,8 @@ +noinst_HEADERS = \ + core-isa.h \ + core-matmap.h \ + defs.h \ + specreg.h \ + system.h \ + tie.h \ + tie-asm.h diff --git a/src/platform/cannonlake/include/xtensa/config/core-isa-boot.h b/src/platform/cannonlake/include/xtensa/config/core-isa-boot.h new file mode 100644 index 0000000..186643b --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/core-isa-boot.h @@ -0,0 +1,557 @@ +/* + * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa + * processor CORE configuration + * + * See <xtensa/config/core.h>, which includes this file, for more details. + */ + +/* Xtensa processor core configuration information. + + Customer ID=10631; Build=0x60f88; Copyright (c) 1999-2016 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_BOOT_CONFIGURATION_H +#define _XTENSA_CORE_BOOT_CONFIGURATION_H + + +/**************************************************************************** + Parameters Useful for Any Code, USER or PRIVILEGED + ****************************************************************************/ + +/* + * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is + * configured, and a value of 0 otherwise. These macros are always defined. + */ + + +/*---------------------------------------------------------------------- + ISA + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */ +#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */ +#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */ +#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ +#define XCHAL_MAX_INSTRUCTION_SIZE 8 /* max instr bytes (3..8) */ +#define XCHAL_HAVE_DEBUG 1 /* debug option */ +#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */ +#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */ +#define XCHAL_LOOP_BUFFER_SIZE 64 /* zero-ov. loop instr buffer size */ +#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */ +#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */ +#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */ +#define XCHAL_HAVE_DEPBITS 0 /* DEPBITS instruction */ +#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */ +#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */ +#define XCHAL_HAVE_MUL32 1 /* MULL instruction */ +#define XCHAL_HAVE_MUL32_HIGH 1 /* MULUH/MULSH instructions */ +#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */ +#define XCHAL_HAVE_L32R 1 /* L32R instruction */ +#define XCHAL_HAVE_ABSOLUTE_LITERALS 0 /* non-PC-rel (extended) L32R */ +#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */ +#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */ +#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */ +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */ +#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */ +#define XCHAL_HAVE_ABS 1 /* ABS instruction */ +/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */ +/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */ +#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */ +#define XCHAL_HAVE_S32C1I 1 /* S32C1I instruction */ +#define XCHAL_HAVE_SPECULATION 0 /* speculation */ +#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */ +#define XCHAL_NUM_CONTEXTS 1 /* */ +#define XCHAL_NUM_MISC_REGS 0 /* num of scratch regs (0..4) */ +#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */ +#define XCHAL_HAVE_PRID 1 /* processor ID register */ +#define XCHAL_HAVE_EXTERN_REGS 1 /* WER/RER instructions */ +#define XCHAL_HAVE_MX 0 /* MX core (Tensilica internal) */ +#define XCHAL_HAVE_MP_INTERRUPTS 0 /* interrupt distributor port */ +#define XCHAL_HAVE_MP_RUNSTALL 0 /* core RunStall control port */ +#define XCHAL_HAVE_PSO 0 /* Power Shut-Off */ +#define XCHAL_HAVE_PSO_CDM 0 /* core/debug/mem pwr domains */ +#define XCHAL_HAVE_PSO_FULL_RETENTION 0 /* all regs preserved on PSO */ +#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */ +#define XCHAL_HAVE_BOOLEANS 1 /* boolean registers */ +/* TODO: CP is 1 - need assembler support */ +#define XCHAL_HAVE_CP 0 /* CPENABLE reg (coprocessor) */ +#define XCHAL_CP_MAXCFG 2 /* max allowed cp id plus one */ +#define XCHAL_HAVE_MAC16 0 /* MAC16 package */ + +#define XCHAL_HAVE_FUSION 0 /* Fusion*/ +#define XCHAL_HAVE_FUSION_FP 0 /* Fusion FP option */ +#define XCHAL_HAVE_FUSION_LOW_POWER 0 /* Fusion Low Power option */ +#define XCHAL_HAVE_FUSION_AES 0 /* Fusion BLE/Wifi AES-128 CCM option */ +#define XCHAL_HAVE_FUSION_CONVENC 0 /* Fusion Conv Encode option */ +#define XCHAL_HAVE_FUSION_LFSR_CRC 0 /* Fusion LFSR-CRC option */ +#define XCHAL_HAVE_FUSION_BITOPS 0 /* Fusion Bit Operations Support option */ +#define XCHAL_HAVE_FUSION_AVS 0 /* Fusion AVS option */ +#define XCHAL_HAVE_FUSION_16BIT_BASEBAND 0 /* Fusion 16-bit Baseband option */ +#define XCHAL_HAVE_FUSION_VITERBI 0 /* Fusion Viterbi option */ +#define XCHAL_HAVE_FUSION_SOFTDEMAP 0 /* Fusion Soft Bit Demap option */ +#define XCHAL_HAVE_HIFIPRO 0 /* HiFiPro Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4 0 /* HiFi4 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4_VFPU 0 /* HiFi4 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI3 1 /* HiFi3 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI3_VFPU 0 /* HiFi3 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI2EP 0 /* HiFi2EP */ +#define XCHAL_HAVE_HIFI_MINI 0 + + +#define XCHAL_HAVE_VECTORFPU2005 0 /* vector or user floating-point pkg */ +#define XCHAL_HAVE_USER_DPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_USER_SPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_FP 1 /* single prec floating point */ +#define XCHAL_HAVE_FP_DIV 1 /* FP with DIV instructions */ +#define XCHAL_HAVE_FP_RECIP 1 /* FP with RECIP instructions */ +#define XCHAL_HAVE_FP_SQRT 1 /* FP with SQRT instructions */ +#define XCHAL_HAVE_FP_RSQRT 1 /* FP with RSQRT instructions */ +#define XCHAL_HAVE_DFP 0 /* double precision FP pkg */ +#define XCHAL_HAVE_DFP_DIV 0 /* DFP with DIV instructions */ +#define XCHAL_HAVE_DFP_RECIP 0 /* DFP with RECIP instructions*/ +#define XCHAL_HAVE_DFP_SQRT 0 /* DFP with SQRT instructions */ +#define XCHAL_HAVE_DFP_RSQRT 0 /* DFP with RSQRT instructions*/ +#define XCHAL_HAVE_DFP_ACCEL 0 /* double precision FP acceleration pkg */ +#define XCHAL_HAVE_DFP_accel XCHAL_HAVE_DFP_ACCEL /* for backward compatibility */ + +#define XCHAL_HAVE_DFPU_SINGLE_ONLY 1 /* DFPU Coprocessor, single precision only */ +#define XCHAL_HAVE_DFPU_SINGLE_DOUBLE 0 /* DFPU Coprocessor, single and double precision */ +#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */ +#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */ +#define XCHAL_HAVE_PDX4 0 /* PDX4 */ +#define XCHAL_HAVE_CONNXD2 0 /* ConnX D2 pkg */ +#define XCHAL_HAVE_CONNXD2_DUALLSFLIX 0 /* ConnX D2 & Dual LoadStore Flix */ +#define XCHAL_HAVE_BBE16 0 /* ConnX BBE16 pkg */ +#define XCHAL_HAVE_BBE16_RSQRT 0 /* BBE16 & vector recip sqrt */ +#define XCHAL_HAVE_BBE16_VECDIV 0 /* BBE16 & vector divide */ +#define XCHAL_HAVE_BBE16_DESPREAD 0 /* BBE16 & despread */ +#define XCHAL_HAVE_BBENEP 0 /* ConnX BBENEP pkgs */ +#define XCHAL_HAVE_BSP3 0 /* ConnX BSP3 pkg */ +#define XCHAL_HAVE_BSP3_TRANSPOSE 0 /* BSP3 & transpose32x32 */ +#define XCHAL_HAVE_SSP16 0 /* ConnX SSP16 pkg */ +#define XCHAL_HAVE_SSP16_VITERBI 0 /* SSP16 & viterbi */ +#define XCHAL_HAVE_TURBO16 0 /* ConnX Turbo16 pkg */ +#define XCHAL_HAVE_BBP16 0 /* ConnX BBP16 pkg */ +#define XCHAL_HAVE_FLIX3 0 /* basic 3-way FLIX option */ +#define XCHAL_HAVE_GRIVPEP 0 /* GRIVPEP is General Release of IVPEP */ +#define XCHAL_HAVE_GRIVPEP_HISTOGRAM 0 /* Histogram option on GRIVPEP */ + + +/*---------------------------------------------------------------------- + MISC + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_LOADSTORE_UNITS 1 /* load/store units */ +#define XCHAL_NUM_WRITEBUFFER_ENTRIES 16 /* size of write buffer */ +#define XCHAL_INST_FETCH_WIDTH 8 /* instr-fetch width in bytes */ +#define XCHAL_DATA_WIDTH 8 /* data width in bytes */ +#define XCHAL_DATA_PIPE_DELAY 2 /* d-side pipeline delay + (1 = 5-stage, 2 = 7-stage) */ +#define XCHAL_CLOCK_GATING_GLOBAL 1 /* global clock gating */ +#define XCHAL_CLOCK_GATING_FUNCUNIT 1 /* funct. unit clock gating */ +/* In T1050, applies to selected core load and store instructions (see ISA): */ +#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */ +#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/ +#define XCHAL_UNALIGNED_LOAD_HW 0 /* unaligned loads work in hw */ +#define XCHAL_UNALIGNED_STORE_HW 0 /* unaligned stores work in hw*/ + +#define XCHAL_SW_VERSION 1100003 /* sw version of this header */ + +#define XCHAL_CORE_ID "cavs21_LX6HiFi3_RF3_WB16" /* alphanum core name + (CoreID) set in the Xtensa + Processor Generator */ + +#define XCHAL_BUILD_UNIQUE_ID 0x00060F88 /* 22-bit sw build ID */ + +/* + * These definitions describe the hardware targeted by this software. + */ +#define XCHAL_HW_CONFIGID0 0xC2F3FBFE /* ConfigID hi 32 bits*/ +#define XCHAL_HW_CONFIGID1 0x1CC60F88 /* ConfigID lo 32 bits*/ +#define XCHAL_HW_VERSION_NAME "LX6.0.3" /* full version name */ +#define XCHAL_HW_VERSION_MAJOR 2600 /* major ver# of targeted hw */ +#define XCHAL_HW_VERSION_MINOR 3 /* minor ver# of targeted hw */ +#define XCHAL_HW_VERSION 260003 /* major*100+minor */ +#define XCHAL_HW_REL_LX6 1 +#define XCHAL_HW_REL_LX6_0 1 +#define XCHAL_HW_REL_LX6_0_3 1 +#define XCHAL_HW_CONFIGID_RELIABLE 1 +/* If software targets a *range* of hardware versions, these are the bounds: */ +#define XCHAL_HW_MIN_VERSION_MAJOR 2600 /* major v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION_MINOR 3 /* minor v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION 260003 /* earliest targeted hw */ +#define XCHAL_HW_MAX_VERSION_MAJOR 2600 /* major v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION_MINOR 3 /* minor v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION 260003 /* latest targeted hw */ + + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_ICACHE_LINESIZE 64 /* I-cache line size in bytes */ +#define XCHAL_DCACHE_LINESIZE 64 /* D-cache line size in bytes */ +#define XCHAL_ICACHE_LINEWIDTH 6 /* log2(I line size in bytes) */ +#define XCHAL_DCACHE_LINEWIDTH 6 /* log2(D line size in bytes) */ + +#define XCHAL_ICACHE_SIZE 16384 /* I-cache size in bytes or 0 */ +#define XCHAL_DCACHE_SIZE 49152 /* D-cache size in bytes or 0 */ + +#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */ +#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */ + +#define XCHAL_HAVE_PREFETCH 1 /* PREFCTL register */ +#define XCHAL_HAVE_PREFETCH_L1 1 /* prefetch to L1 dcache */ +#define XCHAL_PREFETCH_CASTOUT_LINES 2 /* dcache pref. castout bufsz */ +#define XCHAL_PREFETCH_ENTRIES 8 /* cache prefetch entries */ +#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */ +#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */ +#define XCHAL_HAVE_ICACHE_TEST 1 /* Icache test instructions */ +#define XCHAL_HAVE_DCACHE_TEST 1 /* Dcache test instructions */ +#define XCHAL_HAVE_ICACHE_DYN_WAYS 1 /* Icache dynamic way support */ +#define XCHAL_HAVE_DCACHE_DYN_WAYS 1 /* Dcache dynamic way support */ + + + + +/**************************************************************************** + Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code + ****************************************************************************/ + + +#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */ +#define XCHAL_HAVE_AXI 0 /* AXI bus */ + +#define XCHAL_HAVE_PIF_WR_RESP 0 /* pif write response */ +#define XCHAL_HAVE_PIF_REQ_ATTR 1 /* pif attribute */ + +/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */ + +/* Number of cache sets in log2(lines per way): */ +#define XCHAL_ICACHE_SETWIDTH 6 +#define XCHAL_DCACHE_SETWIDTH 8 + +/* Cache set associativity (number of ways): */ +#define XCHAL_ICACHE_WAYS 4 +#define XCHAL_DCACHE_WAYS 3 + +/* Cache features: */ +#define XCHAL_ICACHE_LINE_LOCKABLE 1 +#define XCHAL_DCACHE_LINE_LOCKABLE 1 +#define XCHAL_ICACHE_ECC_PARITY XTHAL_MEMEP_ECC +#define XCHAL_DCACHE_ECC_PARITY XTHAL_MEMEP_ECC + +/* Cache access size in bytes (affects operation of SICW instruction): */ +#define XCHAL_ICACHE_ACCESS_SIZE 8 +#define XCHAL_DCACHE_ACCESS_SIZE 8 + +#define XCHAL_DCACHE_BANKS 1 /* number of banks */ + +/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */ +#define XCHAL_CA_BITS 4 + + +/*---------------------------------------------------------------------- + INTERNAL I/D RAM/ROMs and XLMI + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */ +#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */ +#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */ +#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */ +#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/ +#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */ + +#define XCHAL_HAVE_IMEM_LOADSTORE 1 /* can load/store to IROM/IRAM*/ + + +/*---------------------------------------------------------------------- + INTERRUPTS and TIMERS + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */ +#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */ +#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */ +#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */ +#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ +#define XCHAL_NUM_INTERRUPTS 21 /* number of interrupts */ +#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */ +#define XCHAL_NUM_EXTINTERRUPTS 8 /* num of external interrupts */ +#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels + (not including level zero) */ +#define XCHAL_EXCM_LEVEL 5 /* level masked by PS.EXCM */ + /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */ + +/* Masks of interrupts at each interrupt level: */ +#define XCHAL_INTLEVEL1_MASK 0x0000000F +#define XCHAL_INTLEVEL2_MASK 0x000000F0 +#define XCHAL_INTLEVEL3_MASK 0x00000F00 +#define XCHAL_INTLEVEL4_MASK 0x00007000 +#define XCHAL_INTLEVEL5_MASK 0x000F8000 +#define XCHAL_INTLEVEL6_MASK 0x00000000 +#define XCHAL_INTLEVEL7_MASK 0x00100000 + +/* Masks of interrupts at each range 1..n of interrupt levels: */ +#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x0000000F +#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x000000FF +#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x00000FFF +#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x00007FFF +#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x001FFFFF + +/* Level of each interrupt: */ +#define XCHAL_INT0_LEVEL 1 +#define XCHAL_INT1_LEVEL 1 +#define XCHAL_INT2_LEVEL 1 +#define XCHAL_INT3_LEVEL 1 +#define XCHAL_INT4_LEVEL 2 +#define XCHAL_INT5_LEVEL 2 +#define XCHAL_INT6_LEVEL 2 +#define XCHAL_INT7_LEVEL 2 +#define XCHAL_INT8_LEVEL 3 +#define XCHAL_INT9_LEVEL 3 +#define XCHAL_INT10_LEVEL 3 +#define XCHAL_INT11_LEVEL 3 +#define XCHAL_INT12_LEVEL 4 +#define XCHAL_INT13_LEVEL 4 +#define XCHAL_INT14_LEVEL 4 +#define XCHAL_INT15_LEVEL 5 +#define XCHAL_INT16_LEVEL 5 +#define XCHAL_INT17_LEVEL 5 +#define XCHAL_INT18_LEVEL 5 +#define XCHAL_INT19_LEVEL 5 +#define XCHAL_INT20_LEVEL 7 +#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */ +#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */ +#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with + EXCSAVE/EPS/EPC_n, RFI n) */ + +/* Type of each interrupt: */ +#define XCHAL_INT0_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT1_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT3_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT4_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT5_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT8_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT9_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT10_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT11_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT12_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT13_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT19_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT20_TYPE XTHAL_INTTYPE_NMI + +/* Masks of interrupts for each type of interrupt: */ +#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFE00000 +#define XCHAL_INTTYPE_MASK_SOFTWARE 0x0008D999 +#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000000 +#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x00072444 +#define XCHAL_INTTYPE_MASK_TIMER 0x00000222 +#define XCHAL_INTTYPE_MASK_NMI 0x00100000 +#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000 +#define XCHAL_INTTYPE_MASK_PROFILING 0x00000000 + +/* Interrupt numbers assigned to specific interrupt sources: */ +#define XCHAL_TIMER0_INTERRUPT 1 /* CCOMPARE0 */ +#define XCHAL_TIMER1_INTERRUPT 5 /* CCOMPARE1 */ +#define XCHAL_TIMER2_INTERRUPT 9 /* CCOMPARE2 */ +#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED +#define XCHAL_NMI_INTERRUPT 20 /* non-maskable interrupt */ + +/* Interrupt numbers for levels at which only one interrupt is configured: */ +#define XCHAL_INTLEVEL7_NUM 20 +/* (There are many interrupts each at level(s) 1, 2, 3, 4, 5.) */ + + +/* + * External interrupt mapping. + * These macros describe how Xtensa processor interrupt numbers + * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) + * map to external BInterrupt<n> pins, for those interrupts + * configured as external (level-triggered, edge-triggered, or NMI). + * See the Xtensa processor databook for more details. + */ + +/* Core interrupt numbers mapped to each EXTERNAL BInterrupt pin number: */ +#define XCHAL_EXTINT0_NUM 2 /* (intlevel 1) */ +#define XCHAL_EXTINT1_NUM 6 /* (intlevel 2) */ +#define XCHAL_EXTINT2_NUM 10 /* (intlevel 3) */ +#define XCHAL_EXTINT3_NUM 13 /* (intlevel 4) */ +#define XCHAL_EXTINT4_NUM 16 /* (intlevel 5) */ +#define XCHAL_EXTINT5_NUM 17 /* (intlevel 5) */ +#define XCHAL_EXTINT6_NUM 18 /* (intlevel 5) */ +#define XCHAL_EXTINT7_NUM 20 /* (intlevel 7) */ +/* EXTERNAL BInterrupt pin numbers mapped to each core interrupt number: */ +#define XCHAL_INT2_EXTNUM 0 /* (intlevel 1) */ +#define XCHAL_INT6_EXTNUM 1 /* (intlevel 2) */ +#define XCHAL_INT10_EXTNUM 2 /* (intlevel 3) */ +#define XCHAL_INT13_EXTNUM 3 /* (intlevel 4) */ +#define XCHAL_INT16_EXTNUM 4 /* (intlevel 5) */ +#define XCHAL_INT17_EXTNUM 5 /* (intlevel 5) */ +#define XCHAL_INT18_EXTNUM 6 /* (intlevel 5) */ +#define XCHAL_INT20_EXTNUM 7 /* (intlevel 7) */ + + +/*---------------------------------------------------------------------- + EXCEPTIONS and VECTORS + ----------------------------------------------------------------------*/ + +#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture + number: 1 == XEA1 (old) + 2 == XEA2 (new) + 0 == XEAX (extern) or TX */ +#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */ +#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */ +#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */ +#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */ +#define XCHAL_HAVE_HALT 0 /* halt architecture option */ +#define XCHAL_HAVE_BOOTLOADER 0 /* boot loader (for TX) */ +#define XCHAL_HAVE_MEM_ECC_PARITY 1 /* local memory ECC/parity */ +#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */ +#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */ +#define XCHAL_VECBASE_RESET_VADDR 0xB003A000 /* VECBASE reset value */ +#define XCHAL_VECBASE_RESET_PADDR 0xB003A000 +#define XCHAL_RESET_VECBASE_OVERLAP 0 + +#define XCHAL_RESET_VECTOR0_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR0_PADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR1_VADDR 0xBE800000 +#define XCHAL_RESET_VECTOR1_PADDR 0xBE800000 +#define XCHAL_RESET_VECTOR_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR_PADDR 0xBEFE0000 +#define XCHAL_MEMERROR_VECTOR0_VADDR 0xBEFE0400 +#define XCHAL_MEMERROR_VECTOR0_PADDR 0xBEFE0400 +#define XCHAL_MEMERROR_VECTOR1_VADDR 0xBE800400 +#define XCHAL_MEMERROR_VECTOR1_PADDR 0xBE800400 +#define XCHAL_MEMERROR_VECTOR_VADDR 0xBEFE0400 +#define XCHAL_MEMERROR_VECTOR_PADDR 0xBEFE0400 +#define XCHAL_USER_VECOFS 0x00000340 +#define XCHAL_USER_VECTOR_VADDR 0xB003A340 +#define XCHAL_USER_VECTOR_PADDR 0xB003A340 +#define XCHAL_KERNEL_VECOFS 0x00000300 +#define XCHAL_KERNEL_VECTOR_VADDR 0xB003A300 +#define XCHAL_KERNEL_VECTOR_PADDR 0xB003A300 +#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0 +#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xB003A3C0 +#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0xB003A3C0 +#define XCHAL_WINDOW_OF4_VECOFS 0x00000000 +#define XCHAL_WINDOW_UF4_VECOFS 0x00000040 +#define XCHAL_WINDOW_OF8_VECOFS 0x00000080 +#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0 +#define XCHAL_WINDOW_OF12_VECOFS 0x00000100 +#define XCHAL_WINDOW_UF12_VECOFS 0x00000140 +#define XCHAL_WINDOW_VECTORS_VADDR 0xB003A000 +#define XCHAL_WINDOW_VECTORS_PADDR 0xB003A000 +#define XCHAL_INTLEVEL2_VECOFS 0x00000180 +#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xB003A180 +#define XCHAL_INTLEVEL2_VECTOR_PADDR 0xB003A180 +#define XCHAL_INTLEVEL3_VECOFS 0x000001C0 +#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xB003A1C0 +#define XCHAL_INTLEVEL3_VECTOR_PADDR 0xB003A1C0 +#define XCHAL_INTLEVEL4_VECOFS 0x00000200 +#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xB003A200 +#define XCHAL_INTLEVEL4_VECTOR_PADDR 0xB003A200 +#define XCHAL_INTLEVEL5_VECOFS 0x00000240 +#define XCHAL_INTLEVEL5_VECTOR_VADDR 0xB003A240 +#define XCHAL_INTLEVEL5_VECTOR_PADDR 0xB003A240 +#define XCHAL_INTLEVEL6_VECOFS 0x00000280 +#define XCHAL_INTLEVEL6_VECTOR_VADDR 0xB003A280 +#define XCHAL_INTLEVEL6_VECTOR_PADDR 0xB003A280 +#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS +#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR +#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR +#define XCHAL_NMI_VECOFS 0x000002C0 +#define XCHAL_NMI_VECTOR_VADDR 0xB003A2C0 +#define XCHAL_NMI_VECTOR_PADDR 0xB003A2C0 +#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS +#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR +#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR + + +/*---------------------------------------------------------------------- + DEBUG MODULE + ----------------------------------------------------------------------*/ + +/* Misc */ +#define XCHAL_HAVE_DEBUG_ERI 0 /* ERI to debug module */ +#define XCHAL_HAVE_DEBUG_APB 0 /* APB to debug module */ +#define XCHAL_HAVE_DEBUG_JTAG 1 /* JTAG to debug module */ + +/* On-Chip Debug (OCD) */ +#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */ +#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ +#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ +#define XCHAL_HAVE_OCD_DIR_ARRAY 0 /* faster OCD option (to LX4) */ +#define XCHAL_HAVE_OCD_LS32DDR 1 /* L32DDR/S32DDR (faster OCD) */ + +/* TRAX (in core) */ +#define XCHAL_HAVE_TRAX 0 /* TRAX in debug module */ +#define XCHAL_TRAX_MEM_SIZE 0 /* TRAX memory size in bytes */ +#define XCHAL_TRAX_MEM_SHAREABLE 0 /* start/end regs; ready sig. */ +#define XCHAL_TRAX_ATB_WIDTH 0 /* ATB width (bits), 0=no ATB */ +#define XCHAL_TRAX_TIME_WIDTH 0 /* timestamp bitwidth, 0=none */ + +/* Perf counters */ +#define XCHAL_NUM_PERF_COUNTERS 0 /* performance counters */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* See core-matmap.h header file for more details. */ + +#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */ +#define XCHAL_HAVE_SPANNING_WAY 1 /* one way maps I+D 4GB vaddr */ +#define XCHAL_SPANNING_WAY 0 /* TLB spanning way number */ +#define XCHAL_HAVE_IDENTITY_MAP 1 /* vaddr == paddr always */ +#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */ +#define XCHAL_HAVE_MIMIC_CACHEATTR 1 /* region protection */ +#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */ +#define XCHAL_HAVE_PTP_MMU 0 /* full MMU (with page table + [autorefill] and protection) + usable for an MMU-based OS */ +/* If none of the above last 4 are set, it's a custom TLB configuration. */ + +#define XCHAL_MMU_ASID_BITS 0 /* number of bits in ASIDs */ +#define XCHAL_MMU_RINGS 1 /* number of rings (1..4) */ +#define XCHAL_MMU_RING_BITS 0 /* num of bits in RING field */ + +#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ + + +#endif /* _XTENSA_CORE_CONFIGURATION_H */ diff --git a/src/platform/cannonlake/include/xtensa/config/core-isa.h b/src/platform/cannonlake/include/xtensa/config/core-isa.h new file mode 100644 index 0000000..bfad40c --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/core-isa.h @@ -0,0 +1,557 @@ +/* + * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa + * processor CORE configuration + * + * See <xtensa/config/core.h>, which includes this file, for more details. + */ + +/* Xtensa processor core configuration information. + + Customer ID=10631; Build=0x60f88; Copyright (c) 1999-2016 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_CONFIGURATION_H +#define _XTENSA_CORE_CONFIGURATION_H + + +/**************************************************************************** + Parameters Useful for Any Code, USER or PRIVILEGED + ****************************************************************************/ + +/* + * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is + * configured, and a value of 0 otherwise. These macros are always defined. + */ + + +/*---------------------------------------------------------------------- + ISA + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */ +#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */ +#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */ +#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ +#define XCHAL_MAX_INSTRUCTION_SIZE 8 /* max instr bytes (3..8) */ +#define XCHAL_HAVE_DEBUG 1 /* debug option */ +#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */ +#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */ +#define XCHAL_LOOP_BUFFER_SIZE 64 /* zero-ov. loop instr buffer size */ +#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */ +#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */ +#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */ +#define XCHAL_HAVE_DEPBITS 0 /* DEPBITS instruction */ +#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */ +#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */ +#define XCHAL_HAVE_MUL32 1 /* MULL instruction */ +#define XCHAL_HAVE_MUL32_HIGH 1 /* MULUH/MULSH instructions */ +#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */ +#define XCHAL_HAVE_L32R 1 /* L32R instruction */ +#define XCHAL_HAVE_ABSOLUTE_LITERALS 0 /* non-PC-rel (extended) L32R */ +#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */ +#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */ +#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */ +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */ +#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */ +#define XCHAL_HAVE_ABS 1 /* ABS instruction */ +/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */ +/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */ +#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */ +#define XCHAL_HAVE_S32C1I 1 /* S32C1I instruction */ +#define XCHAL_HAVE_SPECULATION 0 /* speculation */ +#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */ +#define XCHAL_NUM_CONTEXTS 1 /* */ +#define XCHAL_NUM_MISC_REGS 0 /* num of scratch regs (0..4) */ +#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */ +#define XCHAL_HAVE_PRID 1 /* processor ID register */ +#define XCHAL_HAVE_EXTERN_REGS 1 /* WER/RER instructions */ +#define XCHAL_HAVE_MX 0 /* MX core (Tensilica internal) */ +#define XCHAL_HAVE_MP_INTERRUPTS 0 /* interrupt distributor port */ +#define XCHAL_HAVE_MP_RUNSTALL 0 /* core RunStall control port */ +#define XCHAL_HAVE_PSO 0 /* Power Shut-Off */ +#define XCHAL_HAVE_PSO_CDM 0 /* core/debug/mem pwr domains */ +#define XCHAL_HAVE_PSO_FULL_RETENTION 0 /* all regs preserved on PSO */ +#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */ +#define XCHAL_HAVE_BOOLEANS 1 /* boolean registers */ +/* TODO: CP is 1 - need assembler support */ +#define XCHAL_HAVE_CP 0 /* CPENABLE reg (coprocessor) */ +#define XCHAL_CP_MAXCFG 2 /* max allowed cp id plus one */ +#define XCHAL_HAVE_MAC16 0 /* MAC16 package */ + +#define XCHAL_HAVE_FUSION 0 /* Fusion*/ +#define XCHAL_HAVE_FUSION_FP 0 /* Fusion FP option */ +#define XCHAL_HAVE_FUSION_LOW_POWER 0 /* Fusion Low Power option */ +#define XCHAL_HAVE_FUSION_AES 0 /* Fusion BLE/Wifi AES-128 CCM option */ +#define XCHAL_HAVE_FUSION_CONVENC 0 /* Fusion Conv Encode option */ +#define XCHAL_HAVE_FUSION_LFSR_CRC 0 /* Fusion LFSR-CRC option */ +#define XCHAL_HAVE_FUSION_BITOPS 0 /* Fusion Bit Operations Support option */ +#define XCHAL_HAVE_FUSION_AVS 0 /* Fusion AVS option */ +#define XCHAL_HAVE_FUSION_16BIT_BASEBAND 0 /* Fusion 16-bit Baseband option */ +#define XCHAL_HAVE_FUSION_VITERBI 0 /* Fusion Viterbi option */ +#define XCHAL_HAVE_FUSION_SOFTDEMAP 0 /* Fusion Soft Bit Demap option */ +#define XCHAL_HAVE_HIFIPRO 0 /* HiFiPro Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4 0 /* HiFi4 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4_VFPU 0 /* HiFi4 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI3 1 /* HiFi3 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI3_VFPU 0 /* HiFi3 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI2EP 0 /* HiFi2EP */ +#define XCHAL_HAVE_HIFI_MINI 0 + + +#define XCHAL_HAVE_VECTORFPU2005 0 /* vector or user floating-point pkg */ +#define XCHAL_HAVE_USER_DPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_USER_SPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_FP 1 /* single prec floating point */ +#define XCHAL_HAVE_FP_DIV 1 /* FP with DIV instructions */ +#define XCHAL_HAVE_FP_RECIP 1 /* FP with RECIP instructions */ +#define XCHAL_HAVE_FP_SQRT 1 /* FP with SQRT instructions */ +#define XCHAL_HAVE_FP_RSQRT 1 /* FP with RSQRT instructions */ +#define XCHAL_HAVE_DFP 0 /* double precision FP pkg */ +#define XCHAL_HAVE_DFP_DIV 0 /* DFP with DIV instructions */ +#define XCHAL_HAVE_DFP_RECIP 0 /* DFP with RECIP instructions*/ +#define XCHAL_HAVE_DFP_SQRT 0 /* DFP with SQRT instructions */ +#define XCHAL_HAVE_DFP_RSQRT 0 /* DFP with RSQRT instructions*/ +#define XCHAL_HAVE_DFP_ACCEL 0 /* double precision FP acceleration pkg */ +#define XCHAL_HAVE_DFP_accel XCHAL_HAVE_DFP_ACCEL /* for backward compatibility */ + +#define XCHAL_HAVE_DFPU_SINGLE_ONLY 1 /* DFPU Coprocessor, single precision only */ +#define XCHAL_HAVE_DFPU_SINGLE_DOUBLE 0 /* DFPU Coprocessor, single and double precision */ +#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */ +#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */ +#define XCHAL_HAVE_PDX4 0 /* PDX4 */ +#define XCHAL_HAVE_CONNXD2 0 /* ConnX D2 pkg */ +#define XCHAL_HAVE_CONNXD2_DUALLSFLIX 0 /* ConnX D2 & Dual LoadStore Flix */ +#define XCHAL_HAVE_BBE16 0 /* ConnX BBE16 pkg */ +#define XCHAL_HAVE_BBE16_RSQRT 0 /* BBE16 & vector recip sqrt */ +#define XCHAL_HAVE_BBE16_VECDIV 0 /* BBE16 & vector divide */ +#define XCHAL_HAVE_BBE16_DESPREAD 0 /* BBE16 & despread */ +#define XCHAL_HAVE_BBENEP 0 /* ConnX BBENEP pkgs */ +#define XCHAL_HAVE_BSP3 0 /* ConnX BSP3 pkg */ +#define XCHAL_HAVE_BSP3_TRANSPOSE 0 /* BSP3 & transpose32x32 */ +#define XCHAL_HAVE_SSP16 0 /* ConnX SSP16 pkg */ +#define XCHAL_HAVE_SSP16_VITERBI 0 /* SSP16 & viterbi */ +#define XCHAL_HAVE_TURBO16 0 /* ConnX Turbo16 pkg */ +#define XCHAL_HAVE_BBP16 0 /* ConnX BBP16 pkg */ +#define XCHAL_HAVE_FLIX3 0 /* basic 3-way FLIX option */ +#define XCHAL_HAVE_GRIVPEP 0 /* GRIVPEP is General Release of IVPEP */ +#define XCHAL_HAVE_GRIVPEP_HISTOGRAM 0 /* Histogram option on GRIVPEP */ + + +/*---------------------------------------------------------------------- + MISC + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_LOADSTORE_UNITS 1 /* load/store units */ +#define XCHAL_NUM_WRITEBUFFER_ENTRIES 16 /* size of write buffer */ +#define XCHAL_INST_FETCH_WIDTH 8 /* instr-fetch width in bytes */ +#define XCHAL_DATA_WIDTH 8 /* data width in bytes */ +#define XCHAL_DATA_PIPE_DELAY 2 /* d-side pipeline delay + (1 = 5-stage, 2 = 7-stage) */ +#define XCHAL_CLOCK_GATING_GLOBAL 1 /* global clock gating */ +#define XCHAL_CLOCK_GATING_FUNCUNIT 1 /* funct. unit clock gating */ +/* In T1050, applies to selected core load and store instructions (see ISA): */ +#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */ +#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/ +#define XCHAL_UNALIGNED_LOAD_HW 0 /* unaligned loads work in hw */ +#define XCHAL_UNALIGNED_STORE_HW 0 /* unaligned stores work in hw*/ + +#define XCHAL_SW_VERSION 1100003 /* sw version of this header */ + +#define XCHAL_CORE_ID "cavs21_LX6HiFi3_RF3_WB16" /* alphanum core name + (CoreID) set in the Xtensa + Processor Generator */ + +#define XCHAL_BUILD_UNIQUE_ID 0x00060F88 /* 22-bit sw build ID */ + +/* + * These definitions describe the hardware targeted by this software. + */ +#define XCHAL_HW_CONFIGID0 0xC2F3FBFE /* ConfigID hi 32 bits*/ +#define XCHAL_HW_CONFIGID1 0x1CC60F88 /* ConfigID lo 32 bits*/ +#define XCHAL_HW_VERSION_NAME "LX6.0.3" /* full version name */ +#define XCHAL_HW_VERSION_MAJOR 2600 /* major ver# of targeted hw */ +#define XCHAL_HW_VERSION_MINOR 3 /* minor ver# of targeted hw */ +#define XCHAL_HW_VERSION 260003 /* major*100+minor */ +#define XCHAL_HW_REL_LX6 1 +#define XCHAL_HW_REL_LX6_0 1 +#define XCHAL_HW_REL_LX6_0_3 1 +#define XCHAL_HW_CONFIGID_RELIABLE 1 +/* If software targets a *range* of hardware versions, these are the bounds: */ +#define XCHAL_HW_MIN_VERSION_MAJOR 2600 /* major v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION_MINOR 3 /* minor v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION 260003 /* earliest targeted hw */ +#define XCHAL_HW_MAX_VERSION_MAJOR 2600 /* major v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION_MINOR 3 /* minor v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION 260003 /* latest targeted hw */ + + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_ICACHE_LINESIZE 64 /* I-cache line size in bytes */ +#define XCHAL_DCACHE_LINESIZE 64 /* D-cache line size in bytes */ +#define XCHAL_ICACHE_LINEWIDTH 6 /* log2(I line size in bytes) */ +#define XCHAL_DCACHE_LINEWIDTH 6 /* log2(D line size in bytes) */ + +#define XCHAL_ICACHE_SIZE 16384 /* I-cache size in bytes or 0 */ +#define XCHAL_DCACHE_SIZE 49152 /* D-cache size in bytes or 0 */ + +#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */ +#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */ + +#define XCHAL_HAVE_PREFETCH 1 /* PREFCTL register */ +#define XCHAL_HAVE_PREFETCH_L1 1 /* prefetch to L1 dcache */ +#define XCHAL_PREFETCH_CASTOUT_LINES 2 /* dcache pref. castout bufsz */ +#define XCHAL_PREFETCH_ENTRIES 8 /* cache prefetch entries */ +#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */ +#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */ +#define XCHAL_HAVE_ICACHE_TEST 1 /* Icache test instructions */ +#define XCHAL_HAVE_DCACHE_TEST 1 /* Dcache test instructions */ +#define XCHAL_HAVE_ICACHE_DYN_WAYS 1 /* Icache dynamic way support */ +#define XCHAL_HAVE_DCACHE_DYN_WAYS 1 /* Dcache dynamic way support */ + + + + +/**************************************************************************** + Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code + ****************************************************************************/ + + +#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */ +#define XCHAL_HAVE_AXI 0 /* AXI bus */ + +#define XCHAL_HAVE_PIF_WR_RESP 0 /* pif write response */ +#define XCHAL_HAVE_PIF_REQ_ATTR 1 /* pif attribute */ + +/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */ + +/* Number of cache sets in log2(lines per way): */ +#define XCHAL_ICACHE_SETWIDTH 6 +#define XCHAL_DCACHE_SETWIDTH 8 + +/* Cache set associativity (number of ways): */ +#define XCHAL_ICACHE_WAYS 4 +#define XCHAL_DCACHE_WAYS 3 + +/* Cache features: */ +#define XCHAL_ICACHE_LINE_LOCKABLE 1 +#define XCHAL_DCACHE_LINE_LOCKABLE 1 +#define XCHAL_ICACHE_ECC_PARITY XTHAL_MEMEP_ECC +#define XCHAL_DCACHE_ECC_PARITY XTHAL_MEMEP_ECC + +/* Cache access size in bytes (affects operation of SICW instruction): */ +#define XCHAL_ICACHE_ACCESS_SIZE 8 +#define XCHAL_DCACHE_ACCESS_SIZE 8 + +#define XCHAL_DCACHE_BANKS 1 /* number of banks */ + +/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */ +#define XCHAL_CA_BITS 4 + + +/*---------------------------------------------------------------------- + INTERNAL I/D RAM/ROMs and XLMI + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */ +#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */ +#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */ +#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */ +#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/ +#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */ + +#define XCHAL_HAVE_IMEM_LOADSTORE 1 /* can load/store to IROM/IRAM*/ + + +/*---------------------------------------------------------------------- + INTERRUPTS and TIMERS + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */ +#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */ +#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */ +#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */ +#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ +#define XCHAL_NUM_INTERRUPTS 21 /* number of interrupts */ +#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */ +#define XCHAL_NUM_EXTINTERRUPTS 8 /* num of external interrupts */ +#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels + (not including level zero) */ +#define XCHAL_EXCM_LEVEL 5 /* level masked by PS.EXCM */ + /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */ + +/* Masks of interrupts at each interrupt level: */ +#define XCHAL_INTLEVEL1_MASK 0x0000000F +#define XCHAL_INTLEVEL2_MASK 0x000000F0 +#define XCHAL_INTLEVEL3_MASK 0x00000F00 +#define XCHAL_INTLEVEL4_MASK 0x00007000 +#define XCHAL_INTLEVEL5_MASK 0x000F8000 +#define XCHAL_INTLEVEL6_MASK 0x00000000 +#define XCHAL_INTLEVEL7_MASK 0x00100000 + +/* Masks of interrupts at each range 1..n of interrupt levels: */ +#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x0000000F +#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x000000FF +#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x00000FFF +#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x00007FFF +#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x000FFFFF +#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x001FFFFF + +/* Level of each interrupt: */ +#define XCHAL_INT0_LEVEL 1 +#define XCHAL_INT1_LEVEL 1 +#define XCHAL_INT2_LEVEL 1 +#define XCHAL_INT3_LEVEL 1 +#define XCHAL_INT4_LEVEL 2 +#define XCHAL_INT5_LEVEL 2 +#define XCHAL_INT6_LEVEL 2 +#define XCHAL_INT7_LEVEL 2 +#define XCHAL_INT8_LEVEL 3 +#define XCHAL_INT9_LEVEL 3 +#define XCHAL_INT10_LEVEL 3 +#define XCHAL_INT11_LEVEL 3 +#define XCHAL_INT12_LEVEL 4 +#define XCHAL_INT13_LEVEL 4 +#define XCHAL_INT14_LEVEL 4 +#define XCHAL_INT15_LEVEL 5 +#define XCHAL_INT16_LEVEL 5 +#define XCHAL_INT17_LEVEL 5 +#define XCHAL_INT18_LEVEL 5 +#define XCHAL_INT19_LEVEL 5 +#define XCHAL_INT20_LEVEL 7 +#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */ +#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */ +#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with + EXCSAVE/EPS/EPC_n, RFI n) */ + +/* Type of each interrupt: */ +#define XCHAL_INT0_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT1_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT3_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT4_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT5_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT8_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT9_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT10_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT11_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT12_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT13_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT19_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT20_TYPE XTHAL_INTTYPE_NMI + +/* Masks of interrupts for each type of interrupt: */ +#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFE00000 +#define XCHAL_INTTYPE_MASK_SOFTWARE 0x0008D999 +#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000000 +#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x00072444 +#define XCHAL_INTTYPE_MASK_TIMER 0x00000222 +#define XCHAL_INTTYPE_MASK_NMI 0x00100000 +#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000 +#define XCHAL_INTTYPE_MASK_PROFILING 0x00000000 + +/* Interrupt numbers assigned to specific interrupt sources: */ +#define XCHAL_TIMER0_INTERRUPT 1 /* CCOMPARE0 */ +#define XCHAL_TIMER1_INTERRUPT 5 /* CCOMPARE1 */ +#define XCHAL_TIMER2_INTERRUPT 9 /* CCOMPARE2 */ +#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED +#define XCHAL_NMI_INTERRUPT 20 /* non-maskable interrupt */ + +/* Interrupt numbers for levels at which only one interrupt is configured: */ +#define XCHAL_INTLEVEL7_NUM 20 +/* (There are many interrupts each at level(s) 1, 2, 3, 4, 5.) */ + + +/* + * External interrupt mapping. + * These macros describe how Xtensa processor interrupt numbers + * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) + * map to external BInterrupt<n> pins, for those interrupts + * configured as external (level-triggered, edge-triggered, or NMI). + * See the Xtensa processor databook for more details. + */ + +/* Core interrupt numbers mapped to each EXTERNAL BInterrupt pin number: */ +#define XCHAL_EXTINT0_NUM 2 /* (intlevel 1) */ +#define XCHAL_EXTINT1_NUM 6 /* (intlevel 2) */ +#define XCHAL_EXTINT2_NUM 10 /* (intlevel 3) */ +#define XCHAL_EXTINT3_NUM 13 /* (intlevel 4) */ +#define XCHAL_EXTINT4_NUM 16 /* (intlevel 5) */ +#define XCHAL_EXTINT5_NUM 17 /* (intlevel 5) */ +#define XCHAL_EXTINT6_NUM 18 /* (intlevel 5) */ +#define XCHAL_EXTINT7_NUM 20 /* (intlevel 7) */ +/* EXTERNAL BInterrupt pin numbers mapped to each core interrupt number: */ +#define XCHAL_INT2_EXTNUM 0 /* (intlevel 1) */ +#define XCHAL_INT6_EXTNUM 1 /* (intlevel 2) */ +#define XCHAL_INT10_EXTNUM 2 /* (intlevel 3) */ +#define XCHAL_INT13_EXTNUM 3 /* (intlevel 4) */ +#define XCHAL_INT16_EXTNUM 4 /* (intlevel 5) */ +#define XCHAL_INT17_EXTNUM 5 /* (intlevel 5) */ +#define XCHAL_INT18_EXTNUM 6 /* (intlevel 5) */ +#define XCHAL_INT20_EXTNUM 7 /* (intlevel 7) */ + + +/*---------------------------------------------------------------------- + EXCEPTIONS and VECTORS + ----------------------------------------------------------------------*/ + +#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture + number: 1 == XEA1 (old) + 2 == XEA2 (new) + 0 == XEAX (extern) or TX */ +#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */ +#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */ +#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */ +#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */ +#define XCHAL_HAVE_HALT 0 /* halt architecture option */ +#define XCHAL_HAVE_BOOTLOADER 1 /* boot loader (for TX) */ +#define XCHAL_HAVE_MEM_ECC_PARITY 1 /* local memory ECC/parity */ +#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */ +#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */ +#define XCHAL_VECBASE_RESET_VADDR 0xBE040000 /* VECBASE reset value */ +#define XCHAL_VECBASE_RESET_PADDR 0xBE040000 +#define XCHAL_RESET_VECBASE_OVERLAP 0 + +#define XCHAL_RESET_VECTOR0_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR0_PADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR1_VADDR 0xBE800000 +#define XCHAL_RESET_VECTOR1_PADDR 0xBE800000 +#define XCHAL_RESET_VECTOR_VADDR 0xBEFE0000 +#define XCHAL_RESET_VECTOR_PADDR 0xBEFE0000 +#define XCHAL_MEMERROR_VECTOR0_VADDR 0xBEFE0500 +#define XCHAL_MEMERROR_VECTOR0_PADDR 0xBEFE0500 +#define XCHAL_MEMERROR_VECTOR1_VADDR 0xBEFE0500 +#define XCHAL_MEMERROR_VECTOR1_PADDR 0xBEFE0500 +#define XCHAL_MEMERROR_VECTOR_VADDR 0xBEFE0500 +#define XCHAL_MEMERROR_VECTOR_PADDR 0xBEFE0500 +#define XCHAL_USER_VECOFS 0x00000340 +#define XCHAL_USER_VECTOR_VADDR 0xBE040340 +#define XCHAL_USER_VECTOR_PADDR 0xBE040340 +#define XCHAL_KERNEL_VECOFS 0x00000300 +#define XCHAL_KERNEL_VECTOR_VADDR 0xBE040300 +#define XCHAL_KERNEL_VECTOR_PADDR 0xBE040300 +#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0 +#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xBE0403C0 +#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0xBE0403C0 +#define XCHAL_WINDOW_OF4_VECOFS 0x00000000 +#define XCHAL_WINDOW_UF4_VECOFS 0x00000040 +#define XCHAL_WINDOW_OF8_VECOFS 0x00000080 +#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0 +#define XCHAL_WINDOW_OF12_VECOFS 0x00000100 +#define XCHAL_WINDOW_UF12_VECOFS 0x00000140 +#define XCHAL_WINDOW_VECTORS_VADDR 0xBE040400 +#define XCHAL_WINDOW_VECTORS_PADDR 0xBE040400 +#define XCHAL_INTLEVEL2_VECOFS 0x00000180 +#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xBE040180 +#define XCHAL_INTLEVEL2_VECTOR_PADDR 0xBE040180 +#define XCHAL_INTLEVEL3_VECOFS 0x000001C0 +#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xBE0401C0 +#define XCHAL_INTLEVEL3_VECTOR_PADDR 0xBE0401C0 +#define XCHAL_INTLEVEL4_VECOFS 0x00000200 +#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xBE040200 +#define XCHAL_INTLEVEL4_VECTOR_PADDR 0xBE040200 +#define XCHAL_INTLEVEL5_VECOFS 0x00000240 +#define XCHAL_INTLEVEL5_VECTOR_VADDR 0xBE040240 +#define XCHAL_INTLEVEL5_VECTOR_PADDR 0xBE040240 +#define XCHAL_INTLEVEL6_VECOFS 0x00000280 +#define XCHAL_INTLEVEL6_VECTOR_VADDR 0xBE040280 +#define XCHAL_INTLEVEL6_VECTOR_PADDR 0xBE040280 +#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS +#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR +#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR +#define XCHAL_NMI_VECOFS 0x000002C0 +#define XCHAL_NMI_VECTOR_VADDR 0xBE0402C0 +#define XCHAL_NMI_VECTOR_PADDR 0xBE0402C0 +#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS +#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR +#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR + + +/*---------------------------------------------------------------------- + DEBUG MODULE + ----------------------------------------------------------------------*/ + +/* Misc */ +#define XCHAL_HAVE_DEBUG_ERI 0 /* ERI to debug module */ +#define XCHAL_HAVE_DEBUG_APB 0 /* APB to debug module */ +#define XCHAL_HAVE_DEBUG_JTAG 1 /* JTAG to debug module */ + +/* On-Chip Debug (OCD) */ +#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */ +#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ +#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ +#define XCHAL_HAVE_OCD_DIR_ARRAY 0 /* faster OCD option (to LX4) */ +#define XCHAL_HAVE_OCD_LS32DDR 1 /* L32DDR/S32DDR (faster OCD) */ + +/* TRAX (in core) */ +#define XCHAL_HAVE_TRAX 0 /* TRAX in debug module */ +#define XCHAL_TRAX_MEM_SIZE 0 /* TRAX memory size in bytes */ +#define XCHAL_TRAX_MEM_SHAREABLE 0 /* start/end regs; ready sig. */ +#define XCHAL_TRAX_ATB_WIDTH 0 /* ATB width (bits), 0=no ATB */ +#define XCHAL_TRAX_TIME_WIDTH 0 /* timestamp bitwidth, 0=none */ + +/* Perf counters */ +#define XCHAL_NUM_PERF_COUNTERS 0 /* performance counters */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* See core-matmap.h header file for more details. */ + +#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */ +#define XCHAL_HAVE_SPANNING_WAY 1 /* one way maps I+D 4GB vaddr */ +#define XCHAL_SPANNING_WAY 0 /* TLB spanning way number */ +#define XCHAL_HAVE_IDENTITY_MAP 1 /* vaddr == paddr always */ +#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */ +#define XCHAL_HAVE_MIMIC_CACHEATTR 1 /* region protection */ +#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */ +#define XCHAL_HAVE_PTP_MMU 0 /* full MMU (with page table + [autorefill] and protection) + usable for an MMU-based OS */ +/* If none of the above last 4 are set, it's a custom TLB configuration. */ + +#define XCHAL_MMU_ASID_BITS 0 /* number of bits in ASIDs */ +#define XCHAL_MMU_RINGS 1 /* number of rings (1..4) */ +#define XCHAL_MMU_RING_BITS 0 /* num of bits in RING field */ + +#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ + + +#endif /* _XTENSA_CORE_CONFIGURATION_H */ diff --git a/src/platform/cannonlake/include/xtensa/config/core-matmap.h b/src/platform/cannonlake/include/xtensa/config/core-matmap.h new file mode 100644 index 0000000..c4f479a --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/core-matmap.h @@ -0,0 +1,313 @@ +/* + * xtensa/config/core-matmap.h -- Memory access and translation mapping + * parameters (CHAL) of the Xtensa processor core configuration. + * + * If you are using Xtensa Tools, see <xtensa/config/core.h> (which includes + * this file) for more details. + * + * In the Xtensa processor products released to date, all parameters + * defined in this file are derivable (at least in theory) from + * information contained in the core-isa.h header file. + * In particular, the following core configuration parameters are relevant: + * XCHAL_HAVE_CACHEATTR + * XCHAL_HAVE_MIMIC_CACHEATTR + * XCHAL_HAVE_XLT_CACHEATTR + * XCHAL_HAVE_PTP_MMU + * XCHAL_ITLB_ARF_ENTRIES_LOG2 + * XCHAL_DTLB_ARF_ENTRIES_LOG2 + * XCHAL_DCACHE_IS_WRITEBACK + * XCHAL_ICACHE_SIZE (presence of I-cache) + * XCHAL_DCACHE_SIZE (presence of D-cache) + * XCHAL_HW_VERSION_MAJOR + * XCHAL_HW_VERSION_MINOR + */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 1999-2015 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_CORE_MATMAP_H +#define XTENSA_CONFIG_CORE_MATMAP_H + + +/*---------------------------------------------------------------------- + CACHE (MEMORY ACCESS) ATTRIBUTES + ----------------------------------------------------------------------*/ + + +/* Cache Attribute encodings -- lists of access modes for each cache attribute: */ +#define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_CACHED XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION +#define XCHAL_LCA_LIST XTHAL_LAM_CACHED_NOALLOC XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_CACHED XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_ISOLATE XCHAL_SEP \ + XTHAL_LAM_EXCEPTION +#define XCHAL_SCA_LIST XTHAL_SAM_WRITETHRU XCHAL_SEP \ + XTHAL_SAM_WRITETHRU XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_WRITEBACK XCHAL_SEP \ + XTHAL_SAM_WRITEBACK_NOALLOC XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_ISOLATE XCHAL_SEP \ + XTHAL_SAM_EXCEPTION + + +/* + * Specific encoded cache attribute values of general interest. + * If a specific cache mode is not available, the closest available + * one is returned instead (eg. writethru instead of writeback, + * bypass instead of writethru). + */ +#define XCHAL_CA_BYPASS 2 /* cache disabled (bypassed) mode */ +#define XCHAL_CA_BYPASSBUF 6 /* cache disabled (bypassed) bufferable mode */ +#define XCHAL_CA_WRITETHRU 1 /* cache enabled (write-through) mode */ +#define XCHAL_CA_WRITEBACK 4 /* cache enabled (write-back) mode */ +#define XCHAL_HAVE_CA_WRITEBACK_NOALLOC 1 /* write-back no-allocate availability */ +#define XCHAL_CA_WRITEBACK_NOALLOC 5 /* cache enabled (write-back no-allocate) mode */ +#define XCHAL_CA_ILLEGAL 15 /* no access allowed (all cause exceptions) mode */ +#define XCHAL_CA_ISOLATE 14 /* cache isolate (accesses go to cache not memory) mode */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* + * General notes on MMU parameters. + * + * Terminology: + * ASID = address-space ID (acts as an "extension" of virtual addresses) + * VPN = virtual page number + * PPN = physical page number + * CA = encoded cache attribute (access modes) + * TLB = translation look-aside buffer (term is stretched somewhat here) + * I = instruction (fetch accesses) + * D = data (load and store accesses) + * way = each TLB (ITLB and DTLB) consists of a number of "ways" + * that simultaneously match the virtual address of an access; + * a TLB successfully translates a virtual address if exactly + * one way matches the vaddr; if none match, it is a miss; + * if multiple match, one gets a "multihit" exception; + * each way can be independently configured in terms of number of + * entries, page sizes, which fields are writable or constant, etc. + * set = group of contiguous ways with exactly identical parameters + * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE + * from the page table and storing it in one of the auto-refill ways; + * if this PTE load also misses, a miss exception is posted for s/w. + * min-wired = a "min-wired" way can be used to map a single (minimum-sized) + * page arbitrarily under program control; it has a single entry, + * is non-auto-refill (some other way(s) must be auto-refill), + * all its fields (VPN, PPN, ASID, CA) are all writable, and it + * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current + * restriction is that this be the only page size it supports). + * + * TLB way entries are virtually indexed. + * TLB ways that support multiple page sizes: + * - must have all writable VPN and PPN fields; + * - can only use one page size at any given time (eg. setup at startup), + * selected by the respective ITLBCFG or DTLBCFG special register, + * whose bits n*4+3 .. n*4 index the list of page sizes for way n + * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n); + * this list may be sparse for auto-refill ways because auto-refill + * ways have independent lists of supported page sizes sharing a + * common encoding with PTE entries; the encoding is the index into + * this list; unsupported sizes for a given way are zero in the list; + * selecting unsupported sizes results in undefined hardware behaviour; + * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition). + */ + +#define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */ +#define XCHAL_MMU_ASID_KERNEL 0 /* ASID value indicating kernel (ring 0) address space */ +#define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */ +#define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ +#define XCHAL_MMU_MAX_PTE_PAGE_SIZE 29 /* max page size in a PTE structure (log2) */ +#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 29 /* min page size in a PTE structure (log2) */ + + +/*** Instruction TLB: ***/ + +#define XCHAL_ITLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_ITLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_ITLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_ITLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_ITLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_ITLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* ITLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_ITLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_ITLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_ITLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_ITLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of ITLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of ITLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of ITLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_ITLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E7_CA_RESET 0x02 + + +/*** Data TLB: ***/ + +#define XCHAL_DTLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_DTLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_DTLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_DTLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_DTLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_DTLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_DTLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* DTLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_DTLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_DTLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_DTLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_DTLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of DTLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of DTLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of DTLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_DTLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E7_CA_RESET 0x02 + + + + +#endif /*XTENSA_CONFIG_CORE_MATMAP_H*/ diff --git a/src/platform/cannonlake/include/xtensa/config/defs.h b/src/platform/cannonlake/include/xtensa/config/defs.h new file mode 100644 index 0000000..b695e59 --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/defs.h @@ -0,0 +1,38 @@ +/* Definitions for Xtensa instructions, types, and protos. */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 2003-2004 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* NOTE: This file exists only for backward compatibility with T1050 + and earlier Xtensa releases. It includes only a subset of the + available header files. */ + +#ifndef _XTENSA_BASE_HEADER +#define _XTENSA_BASE_HEADER + +#ifdef __XTENSA__ + +#include <xtensa/tie/xt_core.h> +#include <xtensa/tie/xt_misc.h> +#include <xtensa/tie/xt_booleans.h> + +#endif /* __XTENSA__ */ +#endif /* !_XTENSA_BASE_HEADER */ diff --git a/src/platform/cannonlake/include/xtensa/config/specreg.h b/src/platform/cannonlake/include/xtensa/config/specreg.h new file mode 100644 index 0000000..96bfa94 --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/specreg.h @@ -0,0 +1,106 @@ +/* + * Xtensa Special Register symbolic names + */ + +/* $Id: //depot/rel/Eaglenest/Xtensa/SWConfig/hal/specreg.h.tpp#1 $ */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 1998-2002 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef XTENSA_SPECREG_H +#define XTENSA_SPECREG_H + +/* Include these special register bitfield definitions, for historical reasons: */ +#include <xtensa/corebits.h> + + +/* Special registers: */ +#define LBEG 0 +#define LEND 1 +#define LCOUNT 2 +#define SAR 3 +#define BR 4 +#define SCOMPARE1 12 +#define WINDOWBASE 72 +#define WINDOWSTART 73 +#define IBREAKENABLE 96 +#define ATOMCTL 99 +#define DDR 104 +#define IBREAKA_0 128 +#define IBREAKA_1 129 +#define DBREAKA_0 144 +#define DBREAKA_1 145 +#define DBREAKC_0 160 +#define DBREAKC_1 161 +#define EPC_1 177 +#define EPC_2 178 +#define EPC_3 179 +#define EPC_4 180 +#define EPC_5 181 +#define EPC_6 182 +#define EPC_7 183 +#define DEPC 192 +#define EPS_2 194 +#define EPS_3 195 +#define EPS_4 196 +#define EPS_5 197 +#define EPS_6 198 +#define EPS_7 199 +#define EXCSAVE_1 209 +#define EXCSAVE_2 210 +#define EXCSAVE_3 211 +#define EXCSAVE_4 212 +#define EXCSAVE_5 213 +#define EXCSAVE_6 214 +#define EXCSAVE_7 215 +#define CPENABLE 224 +#define INTERRUPT 226 +#define INTENABLE 228 +#define PS 230 +#define VECBASE 231 +#define EXCCAUSE 232 +#define DEBUGCAUSE 233 +#define CCOUNT 234 +#define PRID 235 +#define ICOUNT 236 +#define ICOUNTLEVEL 237 +#define EXCVADDR 238 +#define CCOMPARE_0 240 +#define CCOMPARE_1 241 +#define CCOMPARE_2 242 +#define MISC_REG_0 244 +#define MISC_REG_1 245 + +/* Special cases (bases of special register series): */ +#define IBREAKA 128 +#define DBREAKA 144 +#define DBREAKC 160 +#define EPC 176 +#define EPS 192 +#define EXCSAVE 208 +#define CCOMPARE 240 + +/* Special names for read-only and write-only interrupt registers: */ +#define INTREAD 226 +#define INTSET 226 +#define INTCLEAR 227 + +#endif /* XTENSA_SPECREG_H */ diff --git a/src/platform/cannonlake/include/xtensa/config/system.h b/src/platform/cannonlake/include/xtensa/config/system.h new file mode 100644 index 0000000..aad1d8c --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/system.h @@ -0,0 +1,271 @@ +/* + * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration + * + * NOTE: The location and contents of this file are highly subject to change. + * + * Source for configuration-independent binaries (which link in a + * configuration-specific HAL library) must NEVER include this file. + * The HAL itself has historically included this file in some instances, + * but this is not appropriate either, because the HAL is meant to be + * core-specific but system independent. + */ + +/* Customer ID=4313; Build=0x5483b; Copyright (c) 2000-2010 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_SYSTEM_H +#define XTENSA_CONFIG_SYSTEM_H + +/*#include <xtensa/hal.h>*/ + + + +/*---------------------------------------------------------------------- + CONFIGURED SOFTWARE OPTIONS + ----------------------------------------------------------------------*/ + +#define XSHAL_USE_ABSOLUTE_LITERALS 0 /* (sw-only option, whether software uses absolute literals) */ +#define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals. */ + +#define XSHAL_ABI XTHAL_ABI_CALL0 /* (sw-only option, selected ABI) */ +/* The above maps to one of the following constants: */ +#define XTHAL_ABI_WINDOWED 0 +#define XTHAL_ABI_CALL0 1 +/* Alternatives: */ +/*#define XSHAL_WINDOWED_ABI 1*/ /* set if windowed ABI selected */ +/*#define XSHAL_CALL0_ABI 0*/ /* set if call0 ABI selected */ + +#define XSHAL_CLIB XTHAL_CLIB_NEWLIB /* (sw-only option, selected C library) */ +/* The above maps to one of the following constants: */ +#define XTHAL_CLIB_NEWLIB 0 +#define XTHAL_CLIB_UCLIBC 1 +#define XTHAL_CLIB_XCLIB 2 +/* Alternatives: */ +/*#define XSHAL_NEWLIB 1*/ /* set if newlib C library selected */ +/*#define XSHAL_UCLIBC 0*/ /* set if uCLibC C library selected */ +/*#define XSHAL_XCLIB 0*/ /* set if Xtensa C library selected */ + +#define XSHAL_USE_FLOATING_POINT 1 + +#define XSHAL_FLOATING_POINT_ABI 0 + +/*---------------------------------------------------------------------- + DEVICE ADDRESSES + ----------------------------------------------------------------------*/ + +/* + * Strange place to find these, but the configuration GUI + * allows moving these around to account for various core + * configurations. Specific boards (and their BSP software) + * will have specific meanings for these components. + */ + +/* I/O Block areas: */ +#define XSHAL_IOBLOCK_CACHED_VADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_PADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_SIZE 0x0E000000 + +#define XSHAL_IOBLOCK_BYPASS_VADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_PADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_SIZE 0x0E000000 + +/* System ROM: */ +#define XSHAL_ROM_VADDR 0x50000000 +#define XSHAL_ROM_PADDR 0x50000000 +#define XSHAL_ROM_SIZE 0x01000000 +/* Largest available area (free of vectors): */ +#define XSHAL_ROM_AVAIL_VADDR 0x50000300 +#define XSHAL_ROM_AVAIL_VSIZE 0x00FFFD00 + +/* System RAM: */ +#define XSHAL_RAM_VADDR 0x60000000 +#define XSHAL_RAM_PADDR 0x60000000 +#define XSHAL_RAM_VSIZE 0x04000000 +#define XSHAL_RAM_PSIZE 0x04000000 +#define XSHAL_RAM_SIZE XSHAL_RAM_PSIZE +/* Largest available area (free of vectors): */ +#define XSHAL_RAM_AVAIL_VADDR 0x60000400 +#define XSHAL_RAM_AVAIL_VSIZE 0x03FFFC00 + +/* + * Shadow system RAM (same device as system RAM, at different address). + * (Emulation boards need this for the SONIC Ethernet driver + * when data caches are configured for writeback mode.) + * NOTE: on full MMU configs, this points to the BYPASS virtual address + * of system RAM, ie. is the same as XSHAL_RAM_* except that virtual + * addresses are viewed through the BYPASS static map rather than + * the CACHED static map. + */ +#define XSHAL_RAM_BYPASS_VADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PSIZE 0x04000000 + +/* Alternate system RAM (different device than system RAM): */ +/*#define XSHAL_ALTRAM_[VP]ADDR ...not configured...*/ +/*#define XSHAL_ALTRAM_SIZE ...not configured...*/ + +/* Some available location in which to place devices in a simulation (eg. XTMP): */ +#define XSHAL_SIMIO_CACHED_VADDR 0xC0000000 +#define XSHAL_SIMIO_BYPASS_VADDR 0xC0000000 +#define XSHAL_SIMIO_PADDR 0xC0000000 +#define XSHAL_SIMIO_SIZE 0x20000000 + + +/*---------------------------------------------------------------------- + * For use by reference testbench exit and diagnostic routines. + */ +#define XSHAL_MAGIC_EXIT 0x0 + +/*---------------------------------------------------------------------- + * DEVICE-ADDRESS DEPENDENT... + * + * Values written to CACHEATTR special register (or its equivalent) + * to enable and disable caches in various modes. + *----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------- + BACKWARD COMPATIBILITY ... + ----------------------------------------------------------------------*/ + +/* + * NOTE: the following two macros are DEPRECATED. Use the latter + * board-specific macros instead, which are specially tuned for the + * particular target environments' memory maps. + */ +#define XSHAL_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS /* disable caches in bypass mode */ +#define XSHAL_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT /* default setting to enable caches (no writeback!) */ + +/*---------------------------------------------------------------------- + GENERIC + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains a system (PIF) RAM, + * system (PIF) ROM, local memory, or XLMI. */ + +/* These set any unused 512MB region to cache-BYPASS attribute: */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEBACK 0x22224442 /* enable caches in write-back mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEALLOC 0x22221112 /* enable caches in write-allocate mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITETHRU 0x22221112 /* enable caches in write-through mode */ +#define XSHAL_ALLVALID_CACHEATTR_BYPASS 0x22222222 /* disable caches in bypass mode */ +#define XSHAL_ALLVALID_CACHEATTR_DEFAULT XSHAL_ALLVALID_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set any unused 512MB region to ILLEGAL attribute: */ +#define XSHAL_STRICT_CACHEATTR_WRITEBACK 0xFFFF444F /* enable caches in write-back mode */ +#define XSHAL_STRICT_CACHEATTR_WRITEALLOC 0xFFFF111F /* enable caches in write-allocate mode */ +#define XSHAL_STRICT_CACHEATTR_WRITETHRU 0xFFFF111F /* enable caches in write-through mode */ +#define XSHAL_STRICT_CACHEATTR_BYPASS 0xFFFF222F /* disable caches in bypass mode */ +#define XSHAL_STRICT_CACHEATTR_DEFAULT XSHAL_STRICT_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set the first 512MB, if unused, to ILLEGAL attribute to help catch + * NULL-pointer dereference bugs; all other unused 512MB regions are set + * to cache-BYPASS attribute: */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEBACK 0x2222444F /* enable caches in write-back mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC 0x2222111F /* enable caches in write-allocate mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITETHRU 0x2222111F /* enable caches in write-through mode */ +#define XSHAL_TRAPNULL_CACHEATTR_BYPASS 0x2222222F /* disable caches in bypass mode */ +#define XSHAL_TRAPNULL_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/*---------------------------------------------------------------------- + ISS (Instruction Set Simulator) SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For now, ISS defaults to the TRAPNULL settings: */ +#define XSHAL_ISS_CACHEATTR_WRITEBACK XSHAL_TRAPNULL_CACHEATTR_WRITEBACK +#define XSHAL_ISS_CACHEATTR_WRITEALLOC XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC +#define XSHAL_ISS_CACHEATTR_WRITETHRU XSHAL_TRAPNULL_CACHEATTR_WRITETHRU +#define XSHAL_ISS_CACHEATTR_BYPASS XSHAL_TRAPNULL_CACHEATTR_BYPASS +#define XSHAL_ISS_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK + +#define XSHAL_ISS_PIPE_REGIONS 0 +#define XSHAL_ISS_SDRAM_REGIONS 0 + + +/*---------------------------------------------------------------------- + XT2000 BOARD SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains any system RAM, + * system ROM, local memory, XLMI, or other XT2000 board device or memory. + * Regions containing devices are forced to cache-BYPASS mode regardless + * of whether the macro is _WRITEBACK vs. _BYPASS etc. */ + +/* These set any 512MB region unused on the XT2000 to ILLEGAL attribute: */ +#define XSHAL_XT2000_CACHEATTR_WRITEBACK 0xFF22444F /* enable caches in write-back mode */ +#define XSHAL_XT2000_CACHEATTR_WRITEALLOC 0xFF22111F /* enable caches in write-allocate mode */ +#define XSHAL_XT2000_CACHEATTR_WRITETHRU 0xFF22111F /* enable caches in write-through mode */ +#define XSHAL_XT2000_CACHEATTR_BYPASS 0xFF22222F /* disable caches in bypass mode */ +#define XSHAL_XT2000_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +#define XSHAL_XT2000_PIPE_REGIONS 0x00000000 /* BusInt pipeline regions */ +#define XSHAL_XT2000_SDRAM_REGIONS 0x00000440 /* BusInt SDRAM regions */ + + +/*---------------------------------------------------------------------- + VECTOR INFO AND SIZES + ----------------------------------------------------------------------*/ + +#define XSHAL_VECTORS_PACKED 0 +#define XSHAL_STATIC_VECTOR_SELECT 0 +#define XSHAL_RESET_VECTOR_VADDR 0x50000000 +#define XSHAL_RESET_VECTOR_PADDR 0x50000000 + +/* + * Sizes allocated to vectors by the system (memory map) configuration. + * These sizes are constrained by core configuration (eg. one vector's + * code cannot overflow into another vector) but are dependent on the + * system or board (or LSP) memory map configuration. + * + * Whether or not each vector happens to be in a system ROM is also + * a system configuration matter, sometimes useful, included here also: + */ +#define XSHAL_RESET_VECTOR_SIZE 0x00000300 +#define XSHAL_RESET_VECTOR_ISROM 1 +#define XSHAL_USER_VECTOR_SIZE 0x00000038 +#define XSHAL_USER_VECTOR_ISROM 0 +#define XSHAL_PROGRAMEXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_USEREXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNEL_VECTOR_SIZE 0x00000038 +#define XSHAL_KERNEL_VECTOR_ISROM 0 +#define XSHAL_STACKEDEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNELEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_DOUBLEEXC_VECTOR_SIZE 0x00000040 +#define XSHAL_DOUBLEEXC_VECTOR_ISROM 0 +#define XSHAL_WINDOW_VECTORS_SIZE 0x00000178 +#define XSHAL_WINDOW_VECTORS_ISROM 0 +#define XSHAL_INTLEVEL2_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL2_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL3_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL3_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL4_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL4_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL5_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL5_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL6_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL6_VECTOR_ISROM 0 +#define XSHAL_DEBUG_VECTOR_SIZE XSHAL_INTLEVEL6_VECTOR_SIZE +#define XSHAL_DEBUG_VECTOR_ISROM XSHAL_INTLEVEL6_VECTOR_ISROM +#define XSHAL_NMI_VECTOR_SIZE 0x00000038 +#define XSHAL_NMI_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL7_VECTOR_SIZE XSHAL_NMI_VECTOR_SIZE + + +#endif /*XTENSA_CONFIG_SYSTEM_H*/ diff --git a/src/platform/cannonlake/include/xtensa/config/tie-asm.h b/src/platform/cannonlake/include/xtensa/config/tie-asm.h new file mode 100644 index 0000000..15f6e89 --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/tie-asm.h @@ -0,0 +1,239 @@ +/* + * tie-asm.h -- compile-time HAL assembler definitions dependent on CORE & TIE + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file contains assembly-language definitions (assembly + macros, etc.) for this specific Xtensa processor's TIE extensions + and options. It is customized to this Xtensa processor configuration. + + Copyright (c) 1999-2015 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_ASM_H +#define _XTENSA_CORE_TIE_ASM_H + +/* Selection parameter values for save-area save/restore macros: */ +/* Option vs. TIE: */ +#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ +#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */ +#define XTHAL_SAS_ANYOT 0x0003 /* both of the above */ +/* Whether used automatically by compiler: */ +#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */ +#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */ +#define XTHAL_SAS_ANYCC 0x000C /* both of the above */ +/* ABI handling across function calls: */ +#define XTHAL_SAS_CALR 0x0010 /* caller-saved */ +#define XTHAL_SAS_CALE 0x0020 /* callee-saved */ +#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */ +#define XTHAL_SAS_ANYABI 0x0070 /* all of the above three */ +/* Misc */ +#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */ +#define XTHAL_SAS3(optie,ccuse,abi) ( ((optie) & XTHAL_SAS_ANYOT) \ + | ((ccuse) & XTHAL_SAS_ANYCC) \ + | ((abi) & XTHAL_SAS_ANYABI) ) + + + /* + * Macro to store all non-coprocessor (extra) custom TIE and optional state + * (not including zero-overhead loop registers). + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 4 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters: + * continue If macro invoked as part of a larger store sequence, set to 1 + * if this is not the first in the sequence. Defaults to 0. + * ofs Offset from start of larger sequence (from value of first ptr + * in sequence) at which to store. Defaults to next available space + * (or 0 if <continue> is 0). + * select Select what category(ies) of registers to store, as a bitmask + * (see XTHAL_SAS_xxx constants). Defaults to all registers. + * alloc Select what category(ies) of registers to allocate; if any + * category is selected here that is not in <select>, space for + * the corresponding registers is skipped without doing any store. + */ + .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Optional caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 1016, 4, 4 + rsr.BR \at1 // boolean option + s32i \at1, \ptr, .Lxchal_ofs_+0 + rsr.SCOMPARE1 \at1 // conditional store option + s32i \at1, \ptr, .Lxchal_ofs_+4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 1016, 4, 4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .endif + .endm // xchal_ncp_store + + /* + * Macro to load all non-coprocessor (extra) custom TIE and optional state + * (not including zero-overhead loop registers). + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 4 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters: + * continue If macro invoked as part of a larger load sequence, set to 1 + * if this is not the first in the sequence. Defaults to 0. + * ofs Offset from start of larger sequence (from value of first ptr + * in sequence) at which to load. Defaults to next available space + * (or 0 if <continue> is 0). + * select Select what category(ies) of registers to load, as a bitmask + * (see XTHAL_SAS_xxx constants). Defaults to all registers. + * alloc Select what category(ies) of registers to allocate; if any + * category is selected here that is not in <select>, space for + * the corresponding registers is skipped without doing any load. + */ + .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Optional caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 1016, 4, 4 + l32i \at1, \ptr, .Lxchal_ofs_+0 + wsr.BR \at1 // boolean option + l32i \at1, \ptr, .Lxchal_ofs_+4 + wsr.SCOMPARE1 \at1 // conditional store option + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 1016, 4, 4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 + .endif + .endm // xchal_ncp_load + + +#define XCHAL_NCP_NUM_ATMPS 1 + + /* + * Macro to store the state of TIE coprocessor AudioEngineLX. + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 8 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_CP1_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters are the same as for xchal_ncp_store. + */ +#define xchal_cp_AudioEngineLX_store xchal_cp1_store + .macro xchal_cp1_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Custom caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 0, 8, 8 + rur.AE_OVF_SAR \at1 // ureg 240 + s32i \at1, \ptr, .Lxchal_ofs_+0 + rur.AE_BITHEAD \at1 // ureg 241 + s32i \at1, \ptr, .Lxchal_ofs_+4 + rur.AE_TS_FTS_BU_BP \at1 // ureg 242 + s32i \at1, \ptr, .Lxchal_ofs_+8 + rur.AE_SD_NO \at1 // ureg 243 + s32i \at1, \ptr, .Lxchal_ofs_+12 + ae_sp24x2s.i aep0, \ptr, .Lxchal_ofs_+16 + ae_sp24x2s.i aep1, \ptr, .Lxchal_ofs_+24 + ae_sp24x2s.i aep2, \ptr, .Lxchal_ofs_+32 + ae_sp24x2s.i aep3, \ptr, .Lxchal_ofs_+40 + ae_sp24x2s.i aep4, \ptr, .Lxchal_ofs_+48 + ae_sp24x2s.i aep5, \ptr, .Lxchal_ofs_+56 + addi \ptr, \ptr, 64 + ae_sp24x2s.i aep6, \ptr, .Lxchal_ofs_+0 + ae_sp24x2s.i aep7, \ptr, .Lxchal_ofs_+8 + ae_sq56s.i aeq0, \ptr, .Lxchal_ofs_+16 + ae_sq56s.i aeq1, \ptr, .Lxchal_ofs_+24 + ae_sq56s.i aeq2, \ptr, .Lxchal_ofs_+32 + ae_sq56s.i aeq3, \ptr, .Lxchal_ofs_+40 + .set .Lxchal_pofs_, .Lxchal_pofs_ + 64 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 48 + .elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 0, 8, 8 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 112 + .endif + .endm // xchal_cp1_store + + /* + * Macro to load the state of TIE coprocessor AudioEngineLX. + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 8 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_CP1_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters are the same as for xchal_ncp_load. + */ +#define xchal_cp_AudioEngineLX_load xchal_cp1_load + .macro xchal_cp1_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Custom caller-saved registers not used by default by the compiler: + .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select) + xchal_sa_align \ptr, 0, 0, 8, 8 + l32i \at1, \ptr, .Lxchal_ofs_+0 + wur.AE_OVF_SAR \at1 // ureg 240 + l32i \at1, \ptr, .Lxchal_ofs_+4 + wur.AE_BITHEAD \at1 // ureg 241 + l32i \at1, \ptr, .Lxchal_ofs_+8 + wur.AE_TS_FTS_BU_BP \at1 // ureg 242 + l32i \at1, \ptr, .Lxchal_ofs_+12 + wur.AE_SD_NO \at1 // ureg 243 + ae_lp24x2.i aep0, \ptr, .Lxchal_ofs_+16 + ae_lp24x2.i aep1, \ptr, .Lxchal_ofs_+24 + ae_lp24x2.i aep2, \ptr, .Lxchal_ofs_+32 + ae_lp24x2.i aep3, \ptr, .Lxchal_ofs_+40 + ae_lp24x2.i aep4, \ptr, .Lxchal_ofs_+48 + ae_lp24x2.i aep5, \ptr, .Lxchal_ofs_+56 + addi \ptr, \ptr, 64 + ae_lp24x2.i aep6, \ptr, .Lxchal_ofs_+0 + ae_lp24x2.i aep7, \ptr, .Lxchal_ofs_+8 + addi \ptr, \ptr, 16 + ae_lq56.i aeq0, \ptr, .Lxchal_ofs_+0 + ae_lq56.i aeq1, \ptr, .Lxchal_ofs_+8 + ae_lq56.i aeq2, \ptr, .Lxchal_ofs_+16 + ae_lq56.i aeq3, \ptr, .Lxchal_ofs_+24 + .set .Lxchal_pofs_, .Lxchal_pofs_ + 80 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 32 + .elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 0, 8, 8 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 112 + .endif + .endm // xchal_cp1_load + +#define XCHAL_CP1_NUM_ATMPS 1 +#define XCHAL_SA_NUM_ATMPS 1 + + /* Empty macros for unconfigured coprocessors: */ + .macro xchal_cp0_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp0_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp2_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp2_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp3_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp3_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp4_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp4_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp5_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp5_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp6_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp6_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm + +#endif /*_XTENSA_CORE_TIE_ASM_H*/ diff --git a/src/platform/cannonlake/include/xtensa/config/tie.h b/src/platform/cannonlake/include/xtensa/config/tie.h new file mode 100644 index 0000000..d47e427 --- /dev/null +++ b/src/platform/cannonlake/include/xtensa/config/tie.h @@ -0,0 +1,169 @@ +/* + * tie.h -- compile-time HAL definitions dependent on CORE & TIE configuration + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file describes this specific Xtensa processor's TIE extensions + that extend basic Xtensa core functionality. It is customized to this + Xtensa processor configuration. + + Copyright (c) 1999-2015 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_H +#define _XTENSA_CORE_TIE_H + +#define XCHAL_CP_NUM 1 /* number of coprocessors */ +#define XCHAL_CP_MAX 2 /* max CP ID + 1 (0 if none) */ +#define XCHAL_CP_MASK 0x02 /* bitmask of all CPs by ID */ +#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ + +/* Basic parameters of each coprocessor: */ +#define XCHAL_CP1_NAME "AudioEngineLX" +#define XCHAL_CP1_IDENT AudioEngineLX +#define XCHAL_CP1_SA_SIZE 112 /* size of state save area */ +#define XCHAL_CP1_SA_ALIGN 8 /* min alignment of save area */ +#define XCHAL_CP_ID_AUDIOENGINELX 1 /* coprocessor ID (0..7) */ + +/* Filler info for unassigned coprocessors, to simplify arrays etc: */ +#define XCHAL_CP0_SA_SIZE 0 +#define XCHAL_CP0_SA_ALIGN 1 +#define XCHAL_CP2_SA_SIZE 0 +#define XCHAL_CP2_SA_ALIGN 1 +#define XCHAL_CP3_SA_SIZE 0 +#define XCHAL_CP3_SA_ALIGN 1 +#define XCHAL_CP4_SA_SIZE 0 +#define XCHAL_CP4_SA_ALIGN 1 +#define XCHAL_CP5_SA_SIZE 0 +#define XCHAL_CP5_SA_ALIGN 1 +#define XCHAL_CP6_SA_SIZE 0 +#define XCHAL_CP6_SA_ALIGN 1 +#define XCHAL_CP7_SA_SIZE 0 +#define XCHAL_CP7_SA_ALIGN 1 + +/* Save area for non-coprocessor optional and custom (TIE) state: */ +#define XCHAL_NCP_SA_SIZE 8 +#define XCHAL_NCP_SA_ALIGN 4 + +/* Total save area for optional and custom state (NCP + CPn): */ +#define XCHAL_TOTAL_SA_SIZE 128 /* with 16-byte align padding */ +#define XCHAL_TOTAL_SA_ALIGN 8 /* actual minimum alignment */ + +/* + * Detailed contents of save areas. + * NOTE: caller must define the XCHAL_SA_REG macro (not defined here) + * before expanding the XCHAL_xxx_SA_LIST() macros. + * + * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize, + * dbnum,base,regnum,bitsz,gapsz,reset,x...) + * + * s = passed from XCHAL_*_LIST(s), eg. to select how to expand + * ccused = set if used by compiler without special options or code + * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global) + * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg) + * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg) + * name = lowercase reg name (no quotes) + * galign = group byte alignment (power of 2) (galign >= align) + * align = register byte alignment (power of 2) + * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz) + * (not including any pad bytes required to galign this or next reg) + * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>) + * base = reg shortname w/o index (or sr=special, ur=TIE user reg) + * regnum = reg index in regfile, or special/TIE-user reg number + * bitsz = number of significant bits (regfile width, or ur/sr mask bits) + * gapsz = intervening bits, if bitsz bits not stored contiguously + * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize) + * reset = register reset value (or 0 if undefined at reset) + * x = reserved for future use (0 until then) + * + * To filter out certain registers, e.g. to expand only the non-global + * registers used by the compiler, you can do something like this: + * + * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p) + * #define SELCC0(p...) + * #define SELCC1(abikind,p...) SELAK##abikind(p) + * #define SELAK0(p...) REG(p) + * #define SELAK1(p...) REG(p) + * #define SELAK2(p...) + * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \ + * ...what you want to expand... + */ + +#define XCHAL_NCP_SA_NUM 2 +#define XCHAL_NCP_SA_LIST(s) \ + XCHAL_SA_REG(s,0,0,0,1, br, 4, 4, 4,0x0204, sr,4 , 16,0,0,0) \ + XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) + +#define XCHAL_CP0_SA_NUM 0 +#define XCHAL_CP0_SA_LIST(s) /* empty */ + +#define XCHAL_CP1_SA_NUM 16 +#define XCHAL_CP1_SA_LIST(s) \ + XCHAL_SA_REG(s,0,0,1,0, ae_ovf_sar, 8, 4, 4,0x03F0, ur,240, 7,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0, ae_bithead, 4, 4, 4,0x03F1, ur,241, 32,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0,ae_ts_fts_bu_bp, 4, 4, 4,0x03F2, ur,242, 16,0,0,0) \ + XCHAL_SA_REG(s,0,0,1,0, ae_sd_no, 4, 4, 4,0x03F3, ur,243, 28,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep0, 8, 8, 8,0x0060, aep,0 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep1, 8, 8, 8,0x0061, aep,1 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep2, 8, 8, 8,0x0062, aep,2 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep3, 8, 8, 8,0x0063, aep,3 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep4, 8, 8, 8,0x0064, aep,4 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep5, 8, 8, 8,0x0065, aep,5 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep6, 8, 8, 8,0x0066, aep,6 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aep7, 8, 8, 8,0x0067, aep,7 , 48,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq0, 8, 8, 8,0x0068, aeq,0 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq1, 8, 8, 8,0x0069, aeq,1 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq2, 8, 8, 8,0x006A, aeq,2 , 56,0,0,0) \ + XCHAL_SA_REG(s,0,0,2,0, aeq3, 8, 8, 8,0x006B, aeq,3 , 56,0,0,0) + +#define XCHAL_CP2_SA_NUM 0 +#define XCHAL_CP2_SA_LIST(s) /* empty */ + +#define XCHAL_CP3_SA_NUM 0 +#define XCHAL_CP3_SA_LIST(s) /* empty */ + +#define XCHAL_CP4_SA_NUM 0 +#define XCHAL_CP4_SA_LIST(s) /* empty */ + +#define XCHAL_CP5_SA_NUM 0 +#define XCHAL_CP5_SA_LIST(s) /* empty */ + +#define XCHAL_CP6_SA_NUM 0 +#define XCHAL_CP6_SA_LIST(s) /* empty */ + +#define XCHAL_CP7_SA_NUM 0 +#define XCHAL_CP7_SA_LIST(s) /* empty */ + +/* Byte length of instruction from its first nibble (op0 field), per FLIX. */ +#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8 +/* Byte length of instruction from its first byte, per FLIX. */ +#define XCHAL_BYTE0_FORMAT_LENGTHS \ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,8 + +#endif /*_XTENSA_CORE_TIE_H*/
From: Rander Wang rander.wang@linux.intel.com
Add platform headers for Intel Cannonlake platform.
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- .../cannonlake/include/platform/Makefile.am | 9 + src/platform/cannonlake/include/platform/clk.h | 44 +++ src/platform/cannonlake/include/platform/dma.h | 72 +++++ .../cannonlake/include/platform/interrupt.h | 171 ++++++++++ src/platform/cannonlake/include/platform/mailbox.h | 84 +++++ src/platform/cannonlake/include/platform/memory.h | 348 +++++++++++++++++++++ .../cannonlake/include/platform/platform.h | 142 +++++++++ src/platform/cannonlake/include/platform/shim.h | 274 ++++++++++++++++ src/platform/cannonlake/include/platform/timer.h | 72 +++++ 9 files changed, 1216 insertions(+) create mode 100644 src/platform/cannonlake/include/platform/Makefile.am create mode 100644 src/platform/cannonlake/include/platform/clk.h create mode 100644 src/platform/cannonlake/include/platform/dma.h create mode 100644 src/platform/cannonlake/include/platform/interrupt.h create mode 100644 src/platform/cannonlake/include/platform/mailbox.h create mode 100644 src/platform/cannonlake/include/platform/memory.h create mode 100644 src/platform/cannonlake/include/platform/platform.h create mode 100644 src/platform/cannonlake/include/platform/shim.h create mode 100644 src/platform/cannonlake/include/platform/timer.h
diff --git a/src/platform/cannonlake/include/platform/Makefile.am b/src/platform/cannonlake/include/platform/Makefile.am new file mode 100644 index 0000000..4e4e20d --- /dev/null +++ b/src/platform/cannonlake/include/platform/Makefile.am @@ -0,0 +1,9 @@ +noinst_HEADERS = \ + clk.h \ + dma.h \ + interrupt.h \ + mailbox.h \ + memory.h \ + platform.h \ + shim.h \ + timer.h diff --git a/src/platform/cannonlake/include/platform/clk.h b/src/platform/cannonlake/include/platform/clk.h new file mode 100644 index 0000000..d6ccd6c --- /dev/null +++ b/src/platform/cannonlake/include/platform/clk.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_CLOCK__ +#define __PLATFORM_CLOCK__ + +#define CLK_CPU 0 +#define CLK_SSP 1 + +#define CLK_DEFAULT_CPU_HZ 120000000 +#define CLK_MAX_CPU_HZ 400000000 + +void init_platform_clocks(void); + +#endif diff --git a/src/platform/cannonlake/include/platform/dma.h b/src/platform/cannonlake/include/platform/dma.h new file mode 100644 index 0000000..00dcda8 --- /dev/null +++ b/src/platform/cannonlake/include/platform/dma.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_DMA_H__ +#define __PLATFORM_DMA_H__ + +/* available DMACs */ +#define DMA_GP_LP_DMAC0 0 +#define DMA_GP_LP_DMAC1 1 +#define DMA_GP_HP_DMAC0 2 +#define DMA_GP_HP_DMAC1 3 +#define DMA_HOST_IN_DMAC 4 +#define DMA_HOST_OUT_DMAC 5 +#define DMA_LINK_IN_DMAC 6 +#define DMA_LINK_OUT_DMAC 7 + +/* mappings - TODO improve API to get type */ +#define DMA_ID_DMAC0 DMA_HOST_IN_DMAC +#define DMA_ID_DMAC1 DMA_GP_LP_DMAC0 +#define DMA_ID_DMAC2 DMA_HOST_OUT_DMAC +#define DMA_ID_DMAC3 DMA_GP_HP_DMAC0 +#define DMA_ID_DMAC4 DMA_GP_LP_DMAC1 +#define DMA_ID_DMAC5 DMA_GP_HP_DMAC1 +#define DMA_ID_DMAC6 DMA_LINK_IN_DMAC +#define DMA_ID_DMAC7 DMA_LINK_OUT_DMAC + +/* handshakes */ +#define DMA_HANDSHAKE_DMIC_CH0 0 +#define DMA_HANDSHAKE_DMIC_CH1 1 +#define DMA_HANDSHAKE_SSP0_TX 2 +#define DMA_HANDSHAKE_SSP0_RX 3 +#define DMA_HANDSHAKE_SSP1_TX 4 +#define DMA_HANDSHAKE_SSP1_RX 5 +#define DMA_HANDSHAKE_SSP2_TX 6 +#define DMA_HANDSHAKE_SSP2_RX 7 +#define DMA_HANDSHAKE_SSP3_TX 8 +#define DMA_HANDSHAKE_SSP3_RX 9 +#define DMA_HANDSHAKE_SSP4_TX 10 +#define DMA_HANDSHAKE_SSP4_RX 11 +#define DMA_HANDSHAKE_SSP5_TX 12 +#define DMA_HANDSHAKE_SSP5_RX 13 + +#endif diff --git a/src/platform/cannonlake/include/platform/interrupt.h b/src/platform/cannonlake/include/platform/interrupt.h new file mode 100644 index 0000000..4735ddc --- /dev/null +++ b/src/platform/cannonlake/include/platform/interrupt.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __INCLUDE_PLATFORM_INTERRUPT__ +#define __INCLUDE_PLATFORM_INTERRUPT__ + +#include <stdint.h> +#include <reef/interrupt-map.h> + +#define PLATFORM_IRQ_CHILDREN 32 + +/* IRQ numbers - wrt Tensilica DSP */ +#define IRQ_NUM_SOFTWARE0 0 /* level 1 */ +#define IRQ_NUM_TIMER1 1 /* level 1 */ +#define IRQ_NUM_EXT_LEVEL1 2 /* level 1 */ +#define IRQ_NUM_SOFTWARE2 3 /* level 1 */ +#define IRQ_NUM_SOFTWARE3 4 /* level 2 */ +#define IRQ_NUM_TIMER2 5 /* level 2 */ +#define IRQ_NUM_EXT_LEVEL2 6 /* level 2 */ +#define IRQ_NUM_SOFTWARE4 7 /* level 2 */ +#define IRQ_NUM_SOFTWARE5 8 /* level 3 */ +#define IRQ_NUM_TIMER3 9 /* level 3 */ +#define IRQ_NUM_EXT_LEVEL3 10 /* level 3 */ +#define IRQ_NUM_SOFTWARE6 11 /* level 3 */ +#define IRQ_NUM_SOFTWARE7 12 /* level 4 */ +#define IRQ_NUM_EXT_LEVEL4 13 /* level 4 */ +#define IRQ_NUM_SOFTWARE8 14 /* level 4 */ +#define IRQ_NUM_SOFTWARE9 15 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL5 16 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL6 17 /* level 5 */ +#define IRQ_NUM_EXT_LEVEL7 18 /* level 5 */ +#define IRQ_NUM_SOFTWARE10 19 /* level 5 */ +#define IRQ_NUM_NMI 20 /* level 7 */ + +/* IRQ Level 2 bits */ +#define IRQ_BIT_LVL2_HP_GP_DMA0(x) (x + 24) +#define IRQ_BIT_LVL2_WALL_CLK1 23 +#define IRQ_BIT_LVL2_WALL_CLK0 22 +#define IRQ_BIT_LVL2_L2_MEMERR 21 +#define IRQ_BIT_LVL2_SHA256 16 +#define IRQ_BIT_LVL2_L2_CACHE 15 +#define IRQ_BIT_LVL2_IDC 8 +#define IRQ_BIT_LVL2_HOST_IPC 7 +#define IRQ_BIT_LVL2_CSME_IPC 6 +#define IRQ_BIT_LVL2_PMC_IPC 5 + +/* IRQ Level 3 bits */ +#define IRQ_BIT_LVL3_CODE_LOADER 31 +#define IRQ_BIT_LVL3_HOST_STREAM_OUT(x) (16 + x) +#define IRQ_BIT_LVL3_HOST_STREAM_IN(x) (0 + x) + +/* IRQ Level 4 bits */ +#define IRQ_BIT_LVL4_LINK_STREAM_OUT(x) (16 + x) +#define IRQ_BIT_LVL4_LINK_STREAM_IN(x) (0 + x) + +/* IRQ Level 5 bits */ +#define IRQ_BIT_LVL5_LP_GP_DMA1 15 +#define IRQ_BIT_LVL5_LP_GP_DMA0 16 +#define IRQ_BIT_LVL5_DMIC 6 +#define IRQ_BIT_LVL5_SSP(x) (0 + x) + +/* Level 2 Peripheral IRQ mappings */ +#define IRQ_EXT_HP_GPDMA_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_HP_GP_DMA0(0), 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_IDC_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_IDC, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_IPC_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_HOST_IPC, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_TSTAMP1_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_WALL_CLK1, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_TSTAMP0_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_WALL_CLK0, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_MERR_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_L2_MEMERR, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_L2CACHE_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_L2_CACHE, 2, xcpu, IRQ_NUM_EXT_LEVEL2) +#define IRQ_EXT_SHA256_LVL2(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL2_SHA256, 2, xcpu, IRQ_NUM_EXT_LEVEL2) + +/* Level 3 Peripheral IRQ mappings */ +#define IRQ_EXT_CODE_DMA_LVL3(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL3_CODE_LOADER, 3, xcpu, IRQ_NUM_EXT_LEVEL3) +#define IRQ_EXT_HOST_DMA_IN_LVL3(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL3_HOST_STREAM_IN(channel), 3, xcpu, IRQ_NUM_EXT_LEVEL3) +#define IRQ_EXT_HOST_DMA_OUT_LVL3(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL3_HOST_STREAM_OUT(channel), 3, xcpu, IRQ_NUM_EXT_LEVEL3) + +/* Level 4 Peripheral IRQ mappings */ +#define IRQ_EXT_LINK_DMA_IN_LVL4(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL4_LINK_STREAM_IN(channel), 4, xcpu, IRQ_NUM_EXT_LEVEL4) +#define IRQ_EXT_LINK_DMA_OUT_LVL4(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL4_LINK_STREAM_OUT(channel), 4, xcpu, IRQ_NUM_EXT_LEVEL4) + +/* Level 5 Peripheral IRQ mappings */ +#define IRQ_EXT_LP_GPDMA0_LVL5(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL5_LP_GP_DMA0, 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_LP_GPDMA1_LVL4(xcpu, channel) \ + REEF_IRQ(IRQ_BIT_LVL5_LP_GP_DMA1, 4, xcpu, IRQ_NUM_EXT_LEVEL4) +#define IRQ_EXT_SSP0_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(0), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP1_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(1), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP2_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(2), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_SSP3_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_SSP(3), 5, xcpu, IRQ_NUM_EXT_LEVEL5) +#define IRQ_EXT_DMIC_LVL5(xcpu) \ + REEF_IRQ(IRQ_BIT_LVL5_DMIC, 5, xcpu, IRQ_NUM_EXT_LEVEL5) + + +/* IRQ Masks */ +#define IRQ_MASK_SOFTWARE0 (1 << IRQ_NUM_SOFTWARE0) +#define IRQ_MASK_TIMER1 (1 << IRQ_NUM_TIMER1) +#define IRQ_MASK_EXT_LEVEL1 (1 << IRQ_NUM_EXT_LEVEL1) +#define IRQ_MASK_SOFTWARE1 (1 << IRQ_NUM_SOFTWARE1) +#define IRQ_MASK_SOFTWARE2 (1 << IRQ_NUM_SOFTWARE2) +#define IRQ_MASK_TIMER2 (1 << IRQ_NUM_TIMER2) +#define IRQ_MASK_EXT_LEVEL2 (1 << IRQ_NUM_EXT_LEVEL2) +#define IRQ_MASK_SOFTWARE3 (1 << IRQ_NUM_SOFTWARE3) +#define IRQ_MASK_SOFTWARE4 (1 << IRQ_NUM_SOFTWARE4) +#define IRQ_MASK_TIMER3 (1 << IRQ_NUM_TIMER3) +#define IRQ_MASK_EXT_LEVEL3 (1 << IRQ_NUM_EXT_LEVEL3) +#define IRQ_MASK_SOFTWARE5 (1 << IRQ_NUM_SOFTWARE5) +#define IRQ_MASK_SOFTWARE6 (1 << IRQ_NUM_SOFTWARE6) +#define IRQ_MASK_EXT_LEVEL4 (1 << IRQ_NUM_EXT_LEVEL4) +#define IRQ_MASK_SOFTWARE7 (1 << IRQ_NUM_SOFTWARE7) +#define IRQ_MASK_SOFTWARE8 (1 << IRQ_NUM_SOFTWARE8) +#define IRQ_MASK_EXT_LEVEL5 (1 << IRQ_NUM_EXT_LEVEL5) +#define IRQ_MASK_EXT_LEVEL6 (1 << IRQ_NUM_EXT_LEVEL6) +#define IRQ_MASK_EXT_LEVEL7 (1 << IRQ_NUM_EXT_LEVEL7) +#define IRQ_MASK_SOFTWARE9 (1 << IRQ_NUM_SOFTWARE9) + +void platform_interrupt_init(void); + +struct irq_parent *platform_irq_get_parent(uint32_t irq); +void platform_interrupt_set(int irq); +void platform_interrupt_clear(uint32_t irq, uint32_t mask); +uint32_t platform_interrupt_get_enabled(void); +void platform_interrupt_mask(uint32_t irq, uint32_t mask); +void platform_interrupt_unmask(uint32_t irq, uint32_t mask); + +#endif diff --git a/src/platform/cannonlake/include/platform/mailbox.h b/src/platform/cannonlake/include/platform/mailbox.h new file mode 100644 index 0000000..6724fe5 --- /dev/null +++ b/src/platform/cannonlake/include/platform/mailbox.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __INCLUDE_PLATFORM_MAILBOX__ +#define __INCLUDE_PLATFORM_MAILBOX__ + +#include <platform/memory.h> + + +/* + * The Window Region on Broxton HPSRAM is organised like this :- + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_TRACE_BASE | Trace Buffer W3| SRAM_TRACE_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_DEBUG_BASE | Debug data W2 | SRAM_DEBUG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_INBOX_BASE | Inbox W1 | SRAM_INBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_OUTBOX_BASE | Outbox W0 | SRAM_MAILBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_SW_REG_BASE | SW Registers W0| SRAM_SW_REG_SIZE | + * +---------------------+----------------+-----------------------------------+ + */ + +/* window 3 - trace */ +#define MAILBOX_TRACE_SIZE SRAM_TRACE_SIZE +#define MAILBOX_TRACE_BASE SRAM_TRACE_BASE + +/* window 2 debug and exception */ +#define MAILBOX_DEBUG_SIZE (SRAM_DEBUG_SIZE - MAILBOX_EXCEPTION_SIZE) +#define MAILBOX_DEBUG_BASE SRAM_DEBUG_BASE + +#define MAILBOX_EXCEPTION_SIZE 0x100 +#define MAILBOX_EXCEPTION_BASE \ + (MAILBOX_DEBUG_BASE + MAILBOX_DEBUG_SIZE) + +/* window 1 inbox/downlink and FW registers */ +#define MAILBOX_HOSTBOX_SIZE SRAM_INBOX_SIZE +#define MAILBOX_HOSTBOX_BASE SRAM_INBOX_BASE + + +#define MAILBOX_STREAM_SIZE 0x200 +#define MAILBOX_STREAM_BASE \ + (MAILBOX_BASE + MAILBOX_STREAM_OFFSET) + +/* window 0 */ +#define MAILBOX_DSPBOX_SIZE SRAM_OUTBOX_SIZE +#define MAILBOX_DSPBOX_BASE SRAM_OUTBOX_BASE + +#define MAILBOX_SW_REG_SIZE SRAM_SW_REG_SIZE +#define MAILBOX_SW_REG_BASE SRAM_SW_REG_BASE + +#endif diff --git a/src/platform/cannonlake/include/platform/memory.h b/src/platform/cannonlake/include/platform/memory.h new file mode 100644 index 0000000..06b27f3 --- /dev/null +++ b/src/platform/cannonlake/include/platform/memory.h @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_MEMORY_H__ +#define __PLATFORM_MEMORY_H__ + +#include <config.h> + +/* physical DSP addresses */ + +/* shim */ +#define SHIM_BASE 0x00071F00 +#define SHIM_SIZE 0x00000100 + +/* cmd IO to audio codecs */ +#define CMD_BASE 0x00001100 +#define CMD_SIZE 0x00000010 + +/* resource allocation */ +#define RES_BASE 0x00001110 +#define RES_SIZE 0x00000010 + +/* IPC to the host */ +#define IPC_HOST_BASE 0x00071E00 +#define IPC_HOST_SIZE 0x00000020 + +/* intra DSP IPC */ +#define IPC_DSP_SIZE 0x00000080 +#define IPC_DSP_BASE(x) (0x00001200 + x * IPC_DSP_SIZE) + +/* SRAM window for HOST */ +#define HOST_WIN_SIZE 0x00000008 +#define HOST_WIN_BASE(x) (0x00071A00 + x * HOST_WIN_SIZE) + +/* IRQ controller */ +#define IRQ_BASE 0x00078800 +#define IRQ_SIZE 0x00000200 + +/* time stamping */ +#define TIME_BASE 0x00071800 +#define TIME_SIZE 0x00000200 + +/* M/N dividers */ +#define MN_BASE 0x00078C00 +#define MN_SIZE 0x00000200 + +/* low power DMA position */ +#define LP_GP_DMA_LINK_SIZE 0x00000080 +#define LP_GP_DMA_LINK_BASE(x) (0x00001C00 + x * LP_GP_DMA_LINK_SIZE) + +/* high performance DMA position */ +#define HP_GP_DMA_LINK_SIZE 0x00000800 +#define HP_GP_DMA_LINK_BASE(x) (0x00001D00 + x * HP_GP_DMA_LINK_SIZE) + +/* link DMAC stream */ +#define GTW_LINK_OUT_STREAM_SIZE 0x00000020 +#define GTW_LINK_OUT_STREAM_BASE(x) \ + (0x00072400 + x * GTW_LINK_OUT_STREAM_SIZE) + +#define GTW_LINK_IN_STREAM_SIZE 0x00000020 +#define GTW_LINK_IN_STREAM_BASE(x) \ + (0x00072600 + x * GTW_LINK_IN_STREAM_SIZE) + +/* host DMAC stream */ +#define GTW_HOST_OUT_STREAM_SIZE 0x00000040 +#define GTW_HOST_OUT_STREAM_BASE(x) \ + (0x00072800 + x * GTW_HOST_OUT_STREAM_SIZE) + +#define GTW_HOST_IN_STREAM_SIZE 0x00000040 +#define GTW_HOST_IN_STREAM_BASE(x) \ + (0x00072C00 + x * GTW_HOST_IN_STREAM_SIZE) + +/* code loader */ +#define GTW_CODE_LDR_SIZE 0x00000040 +#define GTW_CODE_LDR_BASE 0x00002BC0 + +/* L2 TLBs */ +#define L2_HP_SRAM_TLB_SIZE 0x00001000 +#define L2_HP_SRAM_TLB_BASE 0x00003000 + +/* DMICs */ +#define DMIC_BASE 0x00004000 +#define DMIC_SIZE 0x00004000 + +/* SSP */ +#define SSP_BASE(x) (0x00077000 + x * SSP_SIZE) +#define SSP_SIZE 0x0000200 + +/* low power DMACs */ +#define LP_GP_DMA_SIZE 0x00001000 +#define LP_GP_DMA_BASE(x) (0x0007C000 + x * LP_GP_DMA_SIZE) + +/* high performance DMACs */ +#define HP_GP_DMA_SIZE 0x00001000 +#define HP_GP_DMA_BASE(x) (0x0000E000 + x * HP_GP_DMA_SIZE) + +/* ROM */ +#define ROM_BASE 0xBEFE0000 +#define ROM_SIZE 0x00002000 + +#define TEXT_BASE 0xb0039000 +#define TEXT_LENGTH 0xB000 +#define DATA_BASE 0xb0044000 +#define DATA_LENGTH 0x4000 + + +/* + * The HP SRAM Region on Cannonlake is organised like this :- + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_SW_REG_BASE | SW Registers W0| SRAM_SW_REG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_OUTBOX_BASE | Outbox W0 | SRAM_MAILBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_INBOX_BASE | Inbox W1 | SRAM_INBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_DEBUG_BASE | Debug data W2 | SRAM_DEBUG_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | SRAM_TRACE_BASE | Trace Buffer W3| SRAM_TRACE_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HP_SRAM_BASE | DMA | HEAP_HP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_SYSTEM_BASE | System Heap | HEAP_SYSTEM_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_RUNTIME_BASE | Runtime Heap | HEAP_RUNTIME_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_BUFFER_BASE | Module Buffers | HEAP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_END | Stack | REEF_STACK_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_BASE | | | + * +---------------------+----------------+-----------------------------------+ + */ + +/* HP SRAM */ +#define HP_SRAM_BASE 0xBE000000 +#define HP_SRAM_SIZE 0x002F0000 + +/* HP SRAM Base */ +#define HP_SRAM_VECBASE_RESET (HP_SRAM_BASE + 0x40000) + +/* Heap section sizes for module pool */ +#define HEAP_RT_COUNT8 0 +#define HEAP_RT_COUNT16 256 +#define HEAP_RT_COUNT32 128 +#define HEAP_RT_COUNT64 64 +#define HEAP_RT_COUNT128 32 +#define HEAP_RT_COUNT256 16 +#define HEAP_RT_COUNT512 8 +#define HEAP_RT_COUNT1024 4 + +/* text and data share the same L2 SRAM on Cannonlake */ +#define REEF_TEXT_START 0xBE040400 +#define REEF_TEXT_START_SIZE 0x40 +#define L2_VECTOR_SIZE 0x1000 + +/* HP SRAM windows */ +/* window 0 */ +#define SRAM_SW_REG_BASE (HP_SRAM_BASE + 0x4000) +#define SRAM_SW_REG_SIZE 0x1000 + +#define SRAM_OUTBOX_BASE (SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE) +#define SRAM_OUTBOX_SIZE 0x1000 + +/* window 1 */ +#define SRAM_INBOX_BASE (SRAM_OUTBOX_BASE + SRAM_OUTBOX_SIZE) +#define SRAM_INBOX_SIZE 0x2000 + +/* window 2 */ +#define SRAM_DEBUG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE) +#define SRAM_DEBUG_SIZE 0x1000 + +/* window 3 */ +#define SRAM_TRACE_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE) +#define SRAM_TRACE_SIZE 0x2000 + +#define HP_SRAM_WIN0_BASE SRAM_SW_REG_BASE +#define HP_SRAM_WIN0_SIZE (SRAM_SW_REG_SIZE + SRAM_OUTBOX_SIZE) +#define HP_SRAM_WIN1_BASE SRAM_INBOX_BASE +#define HP_SRAM_WIN1_SIZE SRAM_INBOX_SIZE +#define HP_SRAM_WIN2_BASE SRAM_DEBUG_BASE +#define HP_SRAM_WIN2_SIZE SRAM_DEBUG_SIZE +#define HP_SRAM_WIN3_BASE SRAM_TRACE_BASE +#define HP_SRAM_WIN3_SIZE SRAM_TRACE_SIZE + +#define HEAP_DMA_BUFFER_BASE (SRAM_TRACE_BASE + SRAM_TRACE_SIZE) +#define HEAP_DMA_BUFFER_SIZE 0x20000 +#define HEAP_DMA_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_DMA_BUFFER_COUNT \ + (HEAP_DMA_BUFFER_SIZE / HEAP_DMA_BUFFER_BLOCK_SIZE) + +#define REEF_TEXT_BASE (REEF_TEXT_START + REEF_TEXT_START_SIZE) +#define REEF_TEXT_SIZE 0x18000 + +/* initialized data */ +#define REEF_DATA_SIZE 0x18000 + +/* bss data */ +#define REEF_BSS_DATA_SIZE 0x8000 + +/* Heap configuration */ +#define HEAP_SYSTEM_BASE (REEF_TEXT_BASE + REEF_TEXT_SIZE + \ + REEF_DATA_SIZE + REEF_BSS_DATA_SIZE) + +#define HEAP_SYSTEM_SIZE 0x8000 + +#define HEAP_RUNTIME_BASE (HEAP_SYSTEM_BASE + HEAP_SYSTEM_SIZE) +#define HEAP_RUNTIME_SIZE \ + (HEAP_RT_COUNT8 * 8 + HEAP_RT_COUNT16 * 16 + \ + HEAP_RT_COUNT32 * 32 + HEAP_RT_COUNT64 * 64 + \ + HEAP_RT_COUNT128 * 128 + HEAP_RT_COUNT256 * 256 + \ + HEAP_RT_COUNT512 * 512 + HEAP_RT_COUNT1024 * 1024) + +/* Stack configuration */ +#define REEF_STACK_SIZE 0x2000 +#define REEF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE) +#define REEF_STACK_END (REEF_STACK_BASE - REEF_STACK_SIZE) + +#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE) +#define HEAP_BUFFER_SIZE \ + (REEF_STACK_END - HEAP_BUFFER_BASE) +#define HEAP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) + +/* + * The LP SRAM Heap and Stack on Cannonlake are organised like this :- + * + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | LP_SRAM_BASE | RO Data | REEF_LP_DATA_SIZE | + * | | Data | | + * | | BSS | | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_SYSTEM_BASE | System Heap | HEAP_LP_SYSTEM_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_RUNTIME_BASE| Runtime Heap | HEAP_LP_RUNTIME_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_LP_BUFFER_BASE | Module Buffers | HEAP_LP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_LP_STACK_END | Stack | REEF_LP_STACK_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_BASE | | | + * +---------------------+----------------+-----------------------------------+ + */ + +/* LP SRAM */ +#define LP_SRAM_BASE 0xBE800000 +#define LP_SRAM_SIZE 0x00020000 + +/* Heap section sizes for module pool */ +#define HEAP_RT_LP_COUNT8 0 +#define HEAP_RT_LP_COUNT16 256 +#define HEAP_RT_LP_COUNT32 128 +#define HEAP_RT_LP_COUNT64 64 +#define HEAP_RT_LP_COUNT128 32 +#define HEAP_RT_LP_COUNT256 16 +#define HEAP_RT_LP_COUNT512 8 +#define HEAP_RT_LP_COUNT1024 4 + +/* Heap configuration */ +#define REEF_LP_DATA_SIZE 0x4000 + +#define HEAP_LP_SYSTEM_BASE (LP_SRAM_BASE + REEF_LP_DATA_SIZE) +#define HEAP_LP_SYSTEM_SIZE 0x1000 + +#define HEAP_LP_RUNTIME_BASE (HEAP_LP_SYSTEM_BASE + HEAP_LP_SYSTEM_SIZE) +#define HEAP_LP_RUNTIME_SIZE \ + (HEAP_RT_LP_COUNT8 * 8 + HEAP_RT_LP_COUNT16 * 16 + \ + HEAP_RT_LP_COUNT32 * 32 + HEAP_RT_LP_COUNT64 * 64 + \ + HEAP_RT_LP_COUNT128 * 128 + HEAP_RT_LP_COUNT256 * 256 + \ + HEAP_RT_LP_COUNT512 * 512 + HEAP_RT_LP_COUNT1024 * 1024) + +#define HEAP_LP_BUFFER_BASE (HEAP_LP_RUNTIME_BASE + HEAP_LP_RUNTIME_SIZE) +#define HEAP_LP_BUFFER_SIZE \ + (LP_SRAM_SIZE - HEAP_LP_RUNTIME_SIZE - REEF_LP_STACK_SIZE - HEAP_LP_SYSTEM_SIZE) + +#define HEAP_LP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_LP_BUFFER_COUNT (HEAP_LP_BUFFER_SIZE / HEAP_LP_BUFFER_BLOCK_SIZE) + + +/* Stack configuration */ +#define REEF_LP_STACK_SIZE 0x1000 +#define REEF_LP_STACK_BASE (LP_SRAM_BASE + LP_SRAM_SIZE) +#define REEF_LP_STACK_END (REEF_LP_STACK_BASE - REEF_LP_STACK_SIZE) + + +/* Vector and literal sizes - not in core-isa.h */ +#define REEF_MEM_VECT_LIT_SIZE 0x8 +#define REEF_MEM_VECT_TEXT_SIZE 0x38 +#define REEF_MEM_VECT_SIZE (REEF_MEM_VECT_TEXT_SIZE + REEF_MEM_VECT_LIT_SIZE) + +#define REEF_MEM_ERROR_TEXT_SIZE 0x180 +#define REEF_MEM_ERROR_LIT_SIZE 0x8 + +#define REEF_MEM_RESET_TEXT_SIZE 0x268 +#define REEF_MEM_RESET_LIT_SIZE 0x8 +#define REEF_MEM_VECBASE_LIT_SIZE 0x178 + +#define REEF_MEM_RO_SIZE 0x8 + +/* boot loadee in IMR */ +#define IMR_BOOT_LDR_TEXT_ENTRY_BASE 0xB0038000 +#define IMR_BOOT_LDR_TEXT_ENTRY_SIZE 0x40 +#define IMR_BOOT_LDR_LIT_BASE (IMR_BOOT_LDR_TEXT_ENTRY_BASE + IMR_BOOT_LDR_TEXT_ENTRY_SIZE) +#define IMR_BOOT_LDR_LIT_SIZE 0x70 +#define IMR_BOOT_LDR_TEXT_BASE (IMR_BOOT_LDR_LIT_BASE + IMR_BOOT_LDR_LIT_SIZE) +#define IMR_BOOT_LDR_TEXT_SIZE 0x1C00 +#define IMR_BOOT_LDR_TEXT1_BASE (IMR_BOOT_LDR_TEXT_BASE + IMR_BOOT_LDR_TEXT_SIZE) +#define IMR_BOOT_LDR_TEXT1_SIZE 0x2000 +#define IMR_BOOT_LDR_DATA_BASE 0xB0002000 +#define IMR_BOOT_LDR_DATA_SIZE 0x1000 +#define IMR_BOOT_LDR_BSS_BASE 0xB0100000 +#define IMR_BOOT_LDR_BSS_SIZE 0x10000 +#define IMR_BOOT_LDR_MANIFEST_BASE 0xB0032000 +#define IMR_BOOT_LDR_MANIFEST_SIZE 0x6000 + +#endif diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h new file mode 100644 index 0000000..00e0069 --- /dev/null +++ b/src/platform/cannonlake/include/platform/platform.h @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_PLATFORM_H__ +#define __PLATFORM_PLATFORM_H__ + +#include <platform/shim.h> +#include <platform/interrupt.h> +#include <uapi/ipc.h> + +struct reef; + +#define PLATFORM_SSP_COUNT 3 + +/* Host page size */ +#define HOST_PAGE_SIZE 4096 +#define PLATFORM_PAGE_TABLE_SIZE 256 + +/* IPC Interrupt */ +#define PLATFORM_IPC_INTERUPT IRQ_EXT_IPC_LVL2(0) + +/* pipeline IRQ */ +#define PLATFORM_SCHEDULE_IRQ IRQ_NUM_SOFTWARE5 + +#define PLATFORM_IRQ_TASK_HIGH IRQ_NUM_SOFTWARE4 +#define PLATFORM_IRQ_TASK_MED IRQ_NUM_SOFTWARE3 +#define PLATFORM_IRQ_TASK_LOW IRQ_NUM_SOFTWARE2 + +#define PLATFORM_SCHEDULE_COST 200 + +/* maximum preload pipeline depth */ +#define MAX_PRELOAD_SIZE 20 + +/* DMA treats PHY addresses as host address unless within DSP region */ +#define PLATFORM_HOST_DMA_MASK 0x00000000 + +/* Platform stream capabilities */ +#define PLATFORM_MAX_CHANNELS 4 +#define PLATFORM_MAX_STREAMS 5 + +/* clock source used by scheduler for deadline calculations */ +#define PLATFORM_SCHED_CLOCK CLK_SSP + +/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */ +#define PLATFORM_DMA_TIMEOUT 1333 + +/* DMA host transfer timeouts in microseconds */ +#define PLATFORM_HOST_DMA_TIMEOUT 50 + +/* WorkQ window size in microseconds */ +#define PLATFORM_WORKQ_WINDOW 2000 + +/* platform WorkQ clock */ +#define PLATFORM_WORKQ_CLOCK CLK_SSP + +/* Host finish work schedule delay in microseconds */ +#define PLATFORM_HOST_FINISH_DELAY 100 + +/* 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 + +/* the interval of DMA trace copying */ +#define DMA_TRACE_PERIOD 500000 + +/* + * the interval of reschedule DMA trace copying in special case like half + * fullness of local DMA trace buffer + */ +#define DMA_TRACE_RESCHEDULE_TIME 5000 + +/* DMAC used for trace DMA */ +#define PLATFORM_TRACE_DMAC DMA_ID_DMAC0 + +/* DSP should be idle in this time frame */ +#define PLATFORM_IDLE_TIME 750000 + +/* Platform defined panic code */ +#define platform_panic(__x) \ + sw_reg_write(SW_REG_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 + +struct timer *platform_timer; + +/* + * APIs declared here are defined for every platform and IPC mechanism. + */ + +int platform_boot_complete(uint32_t boot_message); + +int platform_init(struct reef *reef); + +int platform_ssp_set_mn(uint32_t ssp_port, uint32_t source, uint32_t rate, + uint32_t bclk_fs); + +void platform_ssp_disable_mn(uint32_t ssp_port); + +#endif diff --git a/src/platform/cannonlake/include/platform/shim.h b/src/platform/cannonlake/include/platform/shim.h new file mode 100644 index 0000000..6654335 --- /dev/null +++ b/src/platform/cannonlake/include/platform/shim.h @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_SHIM_H__ +#define __PLATFORM_SHIM_H__ + +#include <platform/memory.h> + +#ifndef ASSEMBLY +#include <stdint.h> +#endif + +/* DSP IPC for Host Registers */ +#define IPC_DIPCTDR 0x00 +#define IPC_DIPCTDA 0x04 +#define IPC_DIPCTDD 0x08 +#define IPC_DIPCIDR 0x10 +#define IPC_DIPCIDA 0x14 +#define IPC_DIPCIDD 0x18 +#define IPC_DIPCCTL 0x28 + + +/* DIPCTDR */ +#define IPC_DIPCTDR_BUSY (1 << 31) +#define IPC_DIPCTDR_MSG_MASK 0x7FFFFFFF + +/* DIPCTDA */ +#define IPC_DIPCTDA_BUSY (1 << 31) +#define IPC_DIPCTDA_MSG_MASK 0x7FFFFFFF + +/* DIPCTE */ +#define IPC_DIPCTE_MSG_MASK 0x3FFFFFFF + +/* DIPCIDA*/ +#define IPC_DIPCIDA_DONE (1 << 31) + +/* DIPCIE */ +#define IPC_DIPCIE_DONE (1 << 31) +#define IPC_DIPCIE_MSG_MASK 0x3FFFFFFF + +/* DIPCCTL */ +#define IPC_DIPCCTL_IPCIDIE (1 << 1) +#define IPC_DIPCCTL_IPCTBIE (1 << 0) + +#define IRQ_CPU_OFFSET 0x40 + +#define REG_IRQ_IL2MSD(xcpu) (0x0 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2MCD(xcpu) (0x4 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2MD(xcpu) (0x8 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL2SD(xcpu) (0xc + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL2MD_ALL 0x03F181F0 + +#define REG_IRQ_IL3MSD(xcpu) (0x10 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3MCD(xcpu) (0x14 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3MD(xcpu) (0x18 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL3SD(xcpu) (0x1c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL3MD_ALL 0x807F81FF + +#define REG_IRQ_IL4MSD(xcpu) (0x20 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4MCD(xcpu) (0x24 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4MD(xcpu) (0x28 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL4SD(xcpu) (0x2c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL4MD_ALL 0x807F81FF + +#define REG_IRQ_IL5MSD(xcpu) (0x30 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5MCD(xcpu) (0x34 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5MD(xcpu) (0x38 + (xcpu * IRQ_CPU_OFFSET)) +#define REG_IRQ_IL5SD(xcpu) (0x3c + (xcpu * IRQ_CPU_OFFSET)) + +/* all mask valid bits */ +#define REG_IRQ_IL5MD_ALL 0xFFFFC0CF + +#define REG_IRQ_IL2RSD 0x100 +#define REG_IRQ_IL3RSD 0x104 +#define REG_IRQ_IL4RSD 0x108 +#define REG_IRQ_IL5RSD 0x10c + +#define REG_IRQ_LVL5_LP_GPDMA0_MASK (0xff << 16) +#define REG_IRQ_LVL5_LP_GPDMA1_MASK (0xff << 24) + +/* DSP Shim Registers */ +#define SHIM_DSPWC 0x20 /* DSP Wall Clock */ +#define SHIM_DSPWCTCS 0x28 /* DSP Wall Clock Timer Control & Status */ +#define SHIM_DSPWCT0C 0x30 /* DSP Wall Clock Timer 0 Compare */ +#define SHIM_DSPWCT1C 0x38 /* DSP Wall Clock Timer 1 Compare */ + +#define SHIM_DSPWCTCS_T1T (0x1 << 5) /* Timer 1 triggered */ +#define SHIM_DSPWCTCS_T0T (0x1 << 4) /* Timer 0 triggered */ +#define SHIM_DSPWCTCS_T1A (0x1 << 1) /* Timer 1 armed */ +#define SHIM_DSPWCTCS_T0A (0x1 << 0) /* Timer 0 armed */ + +#define SHIM_CLKCTL 0x78 +#define SHIM_CLKSTS 0x7C + +#define SHIM_PWRCTL 0x90 +#define SHIM_PWRSTS 0x92 +#define SHIM_PWRCTL_TCPDSP0PG (0x1 << 0) + +/* LP GPDMA Force Dynamic Clock Gating bits, 0--enable */ +#define SHIM_CLKCTL_LPGPDMAFDCGB(x) (0x1 << (26 + x)) +#define SHIM_CLKCTL_TCPLCG(x) (0x1 << (16 + x)) + +/* Core clock PLL divisor */ +#define SHIM_CLKCTL_DPCS_MASK(x) (0x1 << 2) + +/* Prevent Audio PLL Shutdown */ +#define SHIM_CLKCTL_TCPAPLLS (0x1 << 7) + +/* 0--from PLL, 1--from oscillator */ +#define SHIM_CLKCTL_HDCS (0x1 << 4) + +/* Oscillator select */ +#define SHIM_CLKCTL_HDOCS (0x1 << 2) + +/* HP memory clock PLL divisor */ +#define SHIM_CLKCTL_HPMPCS (0x1 << 0) + +#define GPDMA_CLKCTL(x) (0x78404 + x*0x100) +#define GPDMA_FDCGB (0x1 << 0) + +#define L2LMCAP 0x71D00 +#define L2MPAT 0x71D04 + +#define HSPGCTL0 0x71D10 +#define HSRMCTL0 0x71D14 +#define HSPGISTS0 0x71D18 + +#define HSPGCTL1 0x71D20 +#define HSRMCTL1 0x71D24 +#define HSPGISTS1 0x71D28 + +#define LSPGCTL 0x71D50 +#define LSRMCTL 0x71D54 +#define LSPGISTS 0x71D58 + +#define SHIM_L2_MECS (SHIM_BASE + 0xd0) + +#define SHIM_LDOCTL 0xA4 +#define SHIM_HPMEM_POWER_ON (0x3 << 0) +#define SHIM_LPMEM_POWER_BYPASS (0x1 << 0) + +#define DSP_INIT_LPGPDMA(x) (0x71A60 + (2*x)) +#define LPGPDMA_CTLOSEL_FLAG (1 << 15) +#define LPGPDMA_CHOSEL_FLAG (0xFF) + +#define DSP_INIT_IOPO 0x71A68 +#define IOPO_DMIC_FLAG (1 << 0) +#define IOPO_I2S_FLAG (7 << 8) + +#define DSP_INIT_GENO 0x71A6C +#define GENO_MDIVOSEL (1 << 1) +#define GENO_DIOPTOSEL (1 << 2) + +#define DSP_INIT_ALHO 0x71A70 +#define ALHO_ASO_FLAG (1 << 0) +#define ALHO_CSO_FLAG (1 << 1) +#define ALHO_CFO_FLAG (1 << 2) + +/* host windows */ +#define DMWBA(x) (HOST_WIN_BASE(x) + 0x0) +#define DMWLO(x) (HOST_WIN_BASE(x) + 0x4) + +#define DMWBA_ENABLE (1 << 0) +#define DMWBA_READONLY (1 << 1) + +#ifndef ASSEMBLY + +static inline uint16_t shim_read16(uint16_t reg) +{ + return *((volatile uint16_t*)(SHIM_BASE + reg)); +} + +static inline void shim_write16(uint16_t reg, uint16_t val) +{ + *((volatile uint16_t*)(SHIM_BASE + reg)) = val; +} + +static inline uint32_t shim_read(uint32_t reg) +{ + return *((volatile uint32_t*)(SHIM_BASE + reg)); +} + +static inline void shim_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(SHIM_BASE + reg)) = val; +} + +static inline uint64_t shim_read64(uint32_t reg) +{ + return *((volatile uint64_t*)(SHIM_BASE + reg)); +} + +static inline void shim_write64(uint32_t reg, uint64_t val) +{ + *((volatile uint64_t*)(SHIM_BASE + reg)) = val; +} + +static inline uint32_t sw_reg_read(uint32_t reg) +{ + return *((volatile uint32_t*)(SRAM_SW_REG_BASE + reg)); +} + +static inline void sw_reg_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(SRAM_SW_REG_BASE + reg)) = val; +} + +static inline uint32_t mn_reg_read(uint32_t reg) +{ + return *((volatile uint32_t*)(MN_BASE + reg)); +} + +static inline void mn_reg_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(MN_BASE + reg)) = val; +} + +static inline uint32_t irq_read(uint32_t reg) +{ + return *((volatile uint32_t*)(IRQ_BASE + reg)); +} + +static inline void irq_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(IRQ_BASE + reg)) = val; +} + +static inline uint32_t ipc_read(uint32_t reg) +{ + return *((volatile uint32_t*)(IPC_HOST_BASE + reg)); +} + +static inline void ipc_write(uint32_t reg, uint32_t val) +{ + *((volatile uint32_t*)(IPC_HOST_BASE + reg)) = val; +} +#endif + +#endif diff --git a/src/platform/cannonlake/include/platform/timer.h b/src/platform/cannonlake/include/platform/timer.h new file mode 100644 index 0000000..e00746d --- /dev/null +++ b/src/platform/cannonlake/include/platform/timer.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#ifndef __PLATFORM_TIMER_H__ +#define __PLATFORM_TIMER_H__ + +#include <stdint.h> +#include <reef/timer.h> +#include <platform/interrupt.h> + +#define TIMER_COUNT 5 + +/* timer numbers must use associated IRQ number */ +#define TIMER0 IRQ_NUM_TIMER1 +#define TIMER1 IRQ_NUM_TIMER2 +#define TIMER2 IRQ_NUM_TIMER3 +#define TIMER3 IRQ_EXT_TSTAMP0_LVL2(0) +#define TIMER4 IRQ_EXT_TSTAMP1_LVL2(0) + +#define TIMER_AUDIO TIMER3 + +struct comp_dev; +struct sof_ipc_stream_posn; + +int platform_timer_set(struct timer *timer, uint64_t ticks); +void platform_timer_clear(struct timer *timer); +uint64_t platform_timer_get(struct timer *timer); +void platform_timer_start(struct timer *timer); +void platform_timer_stop(struct timer *timer); +int platform_timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg); + +/* get timestamp for host stream DMA position */ +void platform_host_timestamp(struct comp_dev *host, + struct sof_ipc_stream_posn *posn); + +/* get timestamp for DAI stream DMA position */ +void platform_dai_timestamp(struct comp_dev *dai, + struct sof_ipc_stream_posn *posn); + +/* get current wallclock for componnent */ +void platform_dai_wallclock(struct comp_dev *dai, uint64_t *wallclock); +#endif
From: Rander Wang rander.wang@linux.intel.com
Add platform initialisation and drivers for Intel Cannonlake platform.
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/platform/cannonlake/Makefile.am | 35 ++ src/platform/cannonlake/base_module.c | 52 +++ src/platform/cannonlake/boot_ldr.x.in | 431 ++++++++++++++++++++++ src/platform/cannonlake/boot_module.c | 52 +++ src/platform/cannonlake/cannonlake.x.in | 542 ++++++++++++++++++++++++++++ src/platform/cannonlake/clk.c | 206 +++++++++++ src/platform/cannonlake/dai.c | 108 ++++++ src/platform/cannonlake/dma.c | 175 +++++++++ src/platform/cannonlake/include/Makefile.am | 1 + src/platform/cannonlake/interrupt.c | 304 ++++++++++++++++ src/platform/cannonlake/platform.c | 272 ++++++++++++++ src/platform/cannonlake/timer.c | 134 +++++++ 12 files changed, 2312 insertions(+) create mode 100644 src/platform/cannonlake/Makefile.am create mode 100644 src/platform/cannonlake/base_module.c create mode 100644 src/platform/cannonlake/boot_ldr.x.in create mode 100644 src/platform/cannonlake/boot_module.c create mode 100644 src/platform/cannonlake/cannonlake.x.in create mode 100644 src/platform/cannonlake/clk.c create mode 100644 src/platform/cannonlake/dai.c create mode 100644 src/platform/cannonlake/dma.c create mode 100644 src/platform/cannonlake/include/Makefile.am create mode 100644 src/platform/cannonlake/interrupt.c create mode 100644 src/platform/cannonlake/platform.c create mode 100644 src/platform/cannonlake/timer.c
diff --git a/src/platform/cannonlake/Makefile.am b/src/platform/cannonlake/Makefile.am new file mode 100644 index 0000000..9f3d591 --- /dev/null +++ b/src/platform/cannonlake/Makefile.am @@ -0,0 +1,35 @@ +SUBDIRS = include + +noinst_LIBRARIES = libplatform.a + +libplatform_a_SOURCES = \ + platform.c \ + dai.c \ + dma.c \ + clk.c \ + timer.c \ + interrupt.c + +libplatform_a_CFLAGS = \ + $(ARCH_CFLAGS) \ + $(ARCH_INCDIR) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) + +noinst_PROGRAMS = module boot_module + +module_SOURCES = \ + base_module.c + +module_CFLAGS = \ + $(ARCH_INCDIR) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) + +boot_module_SOURCES = \ + boot_module.c + +boot_module_CFLAGS = \ + $(ARCH_INCDIR) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) \ No newline at end of file diff --git a/src/platform/cannonlake/base_module.c b/src/platform/cannonlake/base_module.c new file mode 100644 index 0000000..dd5d719 --- /dev/null +++ b/src/platform/cannonlake/base_module.c @@ -0,0 +1,52 @@ +/* + * 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +#include <uapi/manifest.h> +#include <platform/memory.h> + +/* + * Each module has an entry in the FW manifest header. This is NOT part of + * the SOF executable image but is inserted by object copy as a ELF section + * for parsing by rimage (to genrate the manifest). + */ +struct sof_man_module cnl_manifest = { + .name = "BASEFW", + .uuid = {0x32, 0x8c, 0x39, 0x0e, 0xde, 0x5a, 0x4b, 0xba, + 0x93, 0xb1, 0xc5, 0x04, 0x32, 0x28, 0x0e, 0xe4}, + .entry_point = REEF_TEXT_START, + .type = { + .load_type = SOF_MAN_MOD_TYPE_MODULE, + .domain_ll = 1, + }, + .affinity_mask = 3, +}; + +/* not used, but stops linker complaining */ +int _start; diff --git a/src/platform/cannonlake/boot_ldr.x.in b/src/platform/cannonlake/boot_ldr.x.in new file mode 100644 index 0000000..cc7a2dc --- /dev/null +++ b/src/platform/cannonlake/boot_ldr.x.in @@ -0,0 +1,431 @@ +/* + * Linker Script for Cannonlake Bootloader. + * + * This script is run through the GNU C preprocessor to align the memory + * offsets with headers. + * + * Use spaces for formatting as cpp ignore tab sizes. + */ + +#include <platform/memory.h> +#include <xtensa/config/core-isa-boot.h> + +OUTPUT_ARCH(xtensa) + +MEMORY +{ + boot_entry_text : + org = IMR_BOOT_LDR_TEXT_ENTRY_BASE, + len = IMR_BOOT_LDR_TEXT_ENTRY_SIZE + boot_entry_lit : + org = IMR_BOOT_LDR_LIT_BASE, + len = IMR_BOOT_LDR_LIT_SIZE + reef_text : + org = IMR_BOOT_LDR_TEXT_BASE, + len = IMR_BOOT_LDR_TEXT_SIZE, + vector_base_text : + org = XCHAL_VECBASE_RESET_PADDR, + len = REEF_MEM_VECBASE_LIT_SIZE + vector_int2_lit : + org = XCHAL_INTLEVEL2_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int2_text : + org = XCHAL_INTLEVEL2_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int3_lit : + org = XCHAL_INTLEVEL3_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int3_text : + org = XCHAL_INTLEVEL3_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int4_lit : + org = XCHAL_INTLEVEL4_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int4_text : + org = XCHAL_INTLEVEL4_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int5_lit : + org = XCHAL_INTLEVEL5_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int5_text : + org = XCHAL_INTLEVEL5_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int6_lit : + org = XCHAL_INTLEVEL6_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int6_text : + org = XCHAL_INTLEVEL6_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int7_lit : + org = XCHAL_INTLEVEL7_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int7_text : + org = XCHAL_INTLEVEL7_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_kernel_lit : + org = XCHAL_KERNEL_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_kernel_text : + org = XCHAL_KERNEL_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_user_lit : + org = XCHAL_USER_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_user_text : + org = XCHAL_USER_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_double_lit : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_double_text : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + reef_data : + org = IMR_BOOT_LDR_DATA_BASE, + len = IMR_BOOT_LDR_DATA_SIZE + reef_bss_data : + org = IMR_BOOT_LDR_BSS_BASE, + len = IMR_BOOT_LDR_BSS_SIZE +} + +PHDRS +{ + boot_entry_text_phdr PT_LOAD; + boot_entry_lit_phdr PT_LOAD; + reef_text_phdr PT_LOAD; + vector_base_text_phdr PT_LOAD; + vector_int2_lit_phdr PT_LOAD; + vector_int2_text_phdr PT_LOAD; + vector_int3_lit_phdr PT_LOAD; + vector_int3_text_phdr PT_LOAD; + vector_int4_lit_phdr PT_LOAD; + vector_int4_text_phdr PT_LOAD; + vector_int5_lit_phdr PT_LOAD; + vector_int5_text_phdr PT_LOAD; + vector_int6_lit_phdr PT_LOAD; + vector_int6_text_phdr PT_LOAD; + vector_int7_lit_phdr PT_LOAD; + vector_int7_text_phdr PT_LOAD; + vector_kernel_lit_phdr PT_LOAD; + vector_kernel_text_phdr PT_LOAD; + vector_user_lit_phdr PT_LOAD; + vector_user_text_phdr PT_LOAD; + vector_double_lit_phdr PT_LOAD; + vector_double_text_phdr PT_LOAD; + reef_data_phdr PT_LOAD; + reef_bss_data_phdr PT_LOAD; +} + +/* Default entry point: */ +ENTRY(boot_entry) +EXTERN(reset_vector) + +SECTIONS +{ + .boot_entry.text : ALIGN(4) + { + _boot_entry_text_start = ABSOLUTE(.); + KEEP (*(.boot_entry.text)) + _boot_entry_text_end = ABSOLUTE(.); + } >boot_entry_text :boot_entry_text_phdr + + .boot_entry.literal : ALIGN(4) + { + _boot_entry_literal_start = ABSOLUTE(.); + *(.boot_entry.literal) + *(.literal .literal.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + _boot_entry_literal_end = ABSOLUTE(.); + } >boot_entry_lit :boot_entry_lit_phdr + + .text : ALIGN(4) + { + _stext = .; + _text_start = ABSOLUTE(.); + *(.entry.text) + *(.init.literal) + KEEP(*(.init)) + *( .text .text.*) + *(.fini.literal) + KEEP(*(.fini)) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + } >reef_text :reef_text_phdr + + .WindowVectors.text : ALIGN(4) + { + _WindowVectors_text_start = ABSOLUTE(.); + KEEP (*(.WindowVectors.text)) + _WindowVectors_text_end = ABSOLUTE(.); + } >vector_base_text :vector_base_text_phdr + + .Level2InterruptVector.literal : ALIGN(4) + { + _Level2InterruptVector_literal_start = ABSOLUTE(.); + *(.Level2InterruptVector.literal) + _Level2InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int2_lit :vector_int2_lit_phdr + + .Level2InterruptVector.text : ALIGN(4) + { + _Level2InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level2InterruptVector.text)) + _Level2InterruptVector_text_end = ABSOLUTE(.); + } >vector_int2_text :vector_int2_text_phdr + + .Level3InterruptVector.literal : ALIGN(4) + { + _Level3InterruptVector_literal_start = ABSOLUTE(.); + *(.Level3InterruptVector.literal) + _Level3InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int3_lit :vector_int3_lit_phdr + + .Level3InterruptVector.text : ALIGN(4) + { + _Level3InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level3InterruptVector.text)) + _Level3InterruptVector_text_end = ABSOLUTE(.); + } >vector_int3_text :vector_int3_text_phdr + + .Level4InterruptVector.literal : ALIGN(4) + { + _Level4InterruptVector_literal_start = ABSOLUTE(.); + *(.Level4InterruptVector.literal) + _Level4InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int4_lit :vector_int4_lit_phdr + + .Level4InterruptVector.text : ALIGN(4) + { + _Level4InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level4InterruptVector.text)) + _Level4InterruptVector_text_end = ABSOLUTE(.); + } >vector_int4_text :vector_int4_text_phdr + + .Level5InterruptVector.literal : ALIGN(4) + { + _Level5InterruptVector_literal_start = ABSOLUTE(.); + *(.Level5InterruptVector.literal) + _Level5InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int5_lit :vector_int5_lit_phdr + + .Level5InterruptVector.text : ALIGN(4) + { + _Level5InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level5InterruptVector.text)) + _Level5InterruptVector_text_end = ABSOLUTE(.); + } >vector_int5_text :vector_int5_text_phdr + + .DebugExceptionVector.literal : ALIGN(4) + { + _DebugExceptionVector_literal_start = ABSOLUTE(.); + *(.DebugExceptionVector.literal) + _DebugExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int6_lit :vector_int6_lit_phdr + + .DebugExceptionVector.text : ALIGN(4) + { + _DebugExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DebugExceptionVector.text)) + _DebugExceptionVector_text_end = ABSOLUTE(.); + } >vector_int6_text :vector_int6_text_phdr + + .NMIExceptionVector.literal : ALIGN(4) + { + _NMIExceptionVector_literal_start = ABSOLUTE(.); + *(.NMIExceptionVector.literal) + _NMIExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int7_lit :vector_int7_lit_phdr + + .NMIExceptionVector.text : ALIGN(4) + { + _NMIExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.NMIExceptionVector.text)) + _NMIExceptionVector_text_end = ABSOLUTE(.); + } >vector_int7_text :vector_int7_text_phdr + + .KernelExceptionVector.literal : ALIGN(4) + { + _KernelExceptionVector_literal_start = ABSOLUTE(.); + *(.KernelExceptionVector.literal) + _KernelExceptionVector_literal_end = ABSOLUTE(.); + } >vector_kernel_lit :vector_kernel_lit_phdr + + .KernelExceptionVector.text : ALIGN(4) + { + _KernelExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.KernelExceptionVector.text)) + _KernelExceptionVector_text_end = ABSOLUTE(.); + } >vector_kernel_text :vector_kernel_text_phdr + + .UserExceptionVector.literal : ALIGN(4) + { + _UserExceptionVector_literal_start = ABSOLUTE(.); + *(.UserExceptionVector.literal) + _UserExceptionVector_literal_end = ABSOLUTE(.); + } >vector_user_lit :vector_user_lit_phdr + + .UserExceptionVector.text : ALIGN(4) + { + _UserExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.UserExceptionVector.text)) + _UserExceptionVector_text_end = ABSOLUTE(.); + } >vector_user_text :vector_user_text_phdr + + .DoubleExceptionVector.literal : ALIGN(4) + { + _DoubleExceptionVector_literal_start = ABSOLUTE(.); + *(.DoubleExceptionVector.literal) + _DoubleExceptionVector_literal_end = ABSOLUTE(.); + } >vector_double_lit :vector_double_lit_phdr + + .DoubleExceptionVector.text : ALIGN(4) + { + _DoubleExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DoubleExceptionVector.text)) + _DoubleExceptionVector_text_end = ABSOLUTE(.); + } >vector_double_text :vector_double_text_phdr + + .rodata : ALIGN(4) + { + _rodata_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); + KEEP (*(.xt_except_table)) + KEEP (*(.gcc_except_table)) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + KEEP (*(.eh_frame)) + /* C++ constructor and destructor tables, properly ordered: */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + . = ALIGN(4); /* this table MUST be 4-byte aligned */ + _bss_table_start = ABSOLUTE(.); + LONG(_bss_start) + LONG(_bss_end) + _bss_table_end = ABSOLUTE(.); + _rodata_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .data : ALIGN(4) + { + _data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + KEEP(*(.gnu.linkonce.d.*personality*)) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + KEEP(*(.jcr)) + _data_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .lit4 : ALIGN(4) + { + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + } >reef_bss_data :reef_bss_data_phdr + + _man = 0x1234567; + + PROVIDE(_memmap_vecbase_reset = HP_SRAM_VECBASE_RESET); + + _memmap_cacheattr_wbna_trapnull = 0x25222222; + PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull); + + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + .xt.insn 0 : + { + KEEP (*(.xt.insn)) + KEEP (*(.gnu.linkonce.x.*)) + } + .xt.prop 0 : + { + KEEP (*(.xt.prop)) + KEEP (*(.xt.prop.*)) + KEEP (*(.gnu.linkonce.prop.*)) + } + .xt.lit 0 : + { + KEEP (*(.xt.lit)) + KEEP (*(.xt.lit.*)) + KEEP (*(.gnu.linkonce.p.*)) + } + .xt.profile_range 0 : + { + KEEP (*(.xt.profile_range)) + KEEP (*(.gnu.linkonce.profile_range.*)) + } + .xt.profile_ranges 0 : + { + KEEP (*(.xt.profile_ranges)) + KEEP (*(.gnu.linkonce.xt.profile_ranges.*)) + } + .xt.profile_files 0 : + { + KEEP (*(.xt.profile_files)) + KEEP (*(.gnu.linkonce.xt.profile_files.*)) + } +} diff --git a/src/platform/cannonlake/boot_module.c b/src/platform/cannonlake/boot_module.c new file mode 100644 index 0000000..7d965f5 --- /dev/null +++ b/src/platform/cannonlake/boot_module.c @@ -0,0 +1,52 @@ +/* + * 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +#include <uapi/manifest.h> +#include <platform/memory.h> + +/* + * Each module has an entry in the FW manifest header. This is NOT part of + * the SOF executable image but is inserted by object copy as a ELF section + * for parsing by rimage (to genrate the manifest). + */ +struct sof_man_module cnl_bootldr_manifest = { + .name = "BRNGUP", + .uuid = {0xf3, 0xe4, 0x79, 0x2b, 0x75, 0x46, 0x49, 0xf6, + 0x89, 0xdf, 0x3b, 0xc1, 0x94, 0xa9, 0x1a, 0xeb}, + .entry_point = IMR_BOOT_LDR_TEXT_ENTRY_BASE, + .type = { + .load_type = SOF_MAN_MOD_TYPE_MODULE, + .domain_ll = 1, + }, + .affinity_mask = 3, +}; + +/* not used, but stops linker complaining */ +int _start; diff --git a/src/platform/cannonlake/cannonlake.x.in b/src/platform/cannonlake/cannonlake.x.in new file mode 100644 index 0000000..9ca28f0 --- /dev/null +++ b/src/platform/cannonlake/cannonlake.x.in @@ -0,0 +1,542 @@ +/* + * Linker Script for Apololake. + * + * This script is run through the GNU C preprocessor to align the memory + * offsets with headers. + * + * Use spaces for formatting as cpp ignore tab sizes. + */ + +#include <platform/memory.h> +#include <xtensa/config/core-isa.h> + +OUTPUT_ARCH(xtensa) + +MEMORY +{ + vector_reset_text : + org = XCHAL_RESET_VECTOR0_PADDR, + len = REEF_MEM_RESET_TEXT_SIZE + vector_reset_lit : + org = XCHAL_RESET_VECTOR0_PADDR + REEF_MEM_RESET_TEXT_SIZE, + len = REEF_MEM_RESET_LIT_SIZE + vector_memory_lit : + org = XCHAL_MEMERROR_VECTOR_PADDR + REEF_MEM_ERROR_LIT_SIZE, + len = REEF_MEM_ERROR_LIT_SIZE + vector_memory_text : + org = XCHAL_MEMERROR_VECTOR_PADDR, + len = REEF_MEM_ERROR_TEXT_SIZE + vector_base_text : + org = XCHAL_VECBASE_RESET_PADDR, + len = REEF_MEM_VECBASE_LIT_SIZE + vector_int2_lit : + org = XCHAL_INTLEVEL2_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int2_text : + org = XCHAL_INTLEVEL2_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int3_lit : + org = XCHAL_INTLEVEL3_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int3_text : + org = XCHAL_INTLEVEL3_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int4_lit : + org = XCHAL_INTLEVEL4_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int4_text : + org = XCHAL_INTLEVEL4_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int5_lit : + org = XCHAL_INTLEVEL5_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int5_text : + org = XCHAL_INTLEVEL5_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int6_lit : + org = XCHAL_INTLEVEL6_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int6_text : + org = XCHAL_INTLEVEL6_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int7_lit : + org = XCHAL_INTLEVEL7_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int7_text : + org = XCHAL_INTLEVEL7_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_kernel_lit : + org = XCHAL_KERNEL_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_kernel_text : + org = XCHAL_KERNEL_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_user_lit : + org = XCHAL_USER_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_user_text : + org = XCHAL_USER_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_double_lit : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_double_text : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + reef_text_start : + org = REEF_TEXT_START, + len = REEF_TEXT_START_SIZE, + reef_text : + org = REEF_TEXT_BASE, + len = REEF_TEXT_SIZE, + reef_data : + org = REEF_TEXT_BASE + REEF_TEXT_SIZE, + len = REEF_DATA_SIZE + reef_bss_data : + org = REEF_TEXT_BASE + REEF_TEXT_SIZE + REEF_DATA_SIZE, + len = REEF_BSS_DATA_SIZE + system_heap : + org = HEAP_SYSTEM_BASE, + len = HEAP_SYSTEM_SIZE + runtime_heap : + org = HEAP_RUNTIME_BASE, + len = HEAP_RUNTIME_SIZE + buffer_heap : + org = HEAP_BUFFER_BASE, + len = HEAP_BUFFER_SIZE + reef_stack : + org = REEF_STACK_END, + len = REEF_STACK_BASE - REEF_STACK_END +} + +PHDRS +{ + vector_reset_text_phdr PT_LOAD; + vector_reset_lit_phdr PT_LOAD; + vector_memory_lit_phdr PT_LOAD; + vector_memory_text_phdr PT_LOAD; + vector_base_text_phdr PT_LOAD; + vector_int2_lit_phdr PT_LOAD; + vector_int2_text_phdr PT_LOAD; + vector_int3_lit_phdr PT_LOAD; + vector_int3_text_phdr PT_LOAD; + vector_int4_lit_phdr PT_LOAD; + vector_int4_text_phdr PT_LOAD; + vector_int5_lit_phdr PT_LOAD; + vector_int5_text_phdr PT_LOAD; + vector_int6_lit_phdr PT_LOAD; + vector_int6_text_phdr PT_LOAD; + vector_int7_lit_phdr PT_LOAD; + vector_int7_text_phdr PT_LOAD; + vector_kernel_lit_phdr PT_LOAD; + vector_kernel_text_phdr PT_LOAD; + vector_user_lit_phdr PT_LOAD; + vector_user_text_phdr PT_LOAD; + vector_double_lit_phdr PT_LOAD; + vector_double_text_phdr PT_LOAD; + reef_text_start_phdr PT_LOAD; + reef_text_phdr PT_LOAD; + reef_data_phdr PT_LOAD; + reef_bss_data_phdr PT_LOAD; + system_heap_phdr PT_LOAD; + runtime_heap_phdr PT_LOAD; + buffer_heap_phdr PT_LOAD; + reef_stack_phdr PT_LOAD; +} + +/* Default entry point: */ +ENTRY(_MainEntry) +_rom_store_table = 0; + +/* ABI0 does not use Window base */ +PROVIDE(_memmap_vecbase_reset = XCHAL_VECBASE_RESET_PADDR); + +/* Various memory-map dependent cache attribute settings: */ +_memmap_cacheattr_wb_base = 0x44024000; +_memmap_cacheattr_wt_base = 0x11021000; +_memmap_cacheattr_bp_base = 0x22022000; +_memmap_cacheattr_unused_mask = 0x00F00FFF; +_memmap_cacheattr_wb_trapnull = 0x4422422F; +_memmap_cacheattr_wba_trapnull = 0x4422422F; +_memmap_cacheattr_wbna_trapnull = 0x25222222; +_memmap_cacheattr_wt_trapnull = 0x1122122F; +_memmap_cacheattr_bp_trapnull = 0x2222222F; +_memmap_cacheattr_wb_strict = 0x44F24FFF; +_memmap_cacheattr_wt_strict = 0x11F21FFF; +_memmap_cacheattr_bp_strict = 0x22F22FFF; +_memmap_cacheattr_wb_allvalid = 0x44224222; +_memmap_cacheattr_wt_allvalid = 0x11221222; +_memmap_cacheattr_bp_allvalid = 0x22222222; +PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull); + +SECTIONS +{ + .ResetVector.text : ALIGN(4) + { + _ResetVector_text_start = ABSOLUTE(.); + KEEP (*(.ResetVector.text)) + _ResetVector_text_end = ABSOLUTE(.); + } >vector_reset_text :vector_reset_text_phdr + + .ResetVector.literal : ALIGN(4) + { + _ResetVector_literal_start = ABSOLUTE(.); + *(.ResetVector.literal) + _ResetVector_literal_end = ABSOLUTE(.); + } >vector_reset_lit :vector_reset_lit_phdr + + .MemoryExceptionVector.literal : ALIGN(4) + { + _MemoryExceptionVector_literal_start = ABSOLUTE(.); + KEEP (*(.MemoryExceptionVector.literal)) + _MemoryExceptionVector_literal_end = ABSOLUTE(.); + } >vector_memory_lit :vector_memory_lit_phdr + + .MemoryExceptionVector.text : ALIGN(4) + { + _MemoryExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.MemoryExceptionVector.text)) + _MemoryExceptionVector_text_end = ABSOLUTE(.); + } >vector_memory_text :vector_memory_text_phdr + + .WindowVectors.text : ALIGN(4) + { + _WindowVectors_text_start = ABSOLUTE(.); + KEEP (*(.WindowVectors.text)) + _WindowVectors_text_end = ABSOLUTE(.); + } >vector_base_text :vector_base_text_phdr + + .Level2InterruptVector.literal : ALIGN(4) + { + _Level2InterruptVector_literal_start = ABSOLUTE(.); + *(.Level2InterruptVector.literal) + _Level2InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int2_lit :vector_int2_lit_phdr + + .Level2InterruptVector.text : ALIGN(4) + { + _Level2InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level2InterruptVector.text)) + _Level2InterruptVector_text_end = ABSOLUTE(.); + } >vector_int2_text :vector_int2_text_phdr + + .Level3InterruptVector.literal : ALIGN(4) + { + _Level3InterruptVector_literal_start = ABSOLUTE(.); + *(.Level3InterruptVector.literal) + _Level3InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int3_lit :vector_int3_lit_phdr + + .Level3InterruptVector.text : ALIGN(4) + { + _Level3InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level3InterruptVector.text)) + _Level3InterruptVector_text_end = ABSOLUTE(.); + } >vector_int3_text :vector_int3_text_phdr + + .Level4InterruptVector.literal : ALIGN(4) + { + _Level4InterruptVector_literal_start = ABSOLUTE(.); + *(.Level4InterruptVector.literal) + _Level4InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int4_lit :vector_int4_lit_phdr + + .Level4InterruptVector.text : ALIGN(4) + { + _Level4InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level4InterruptVector.text)) + _Level4InterruptVector_text_end = ABSOLUTE(.); + } >vector_int4_text :vector_int4_text_phdr + + .Level5InterruptVector.literal : ALIGN(4) + { + _Level5InterruptVector_literal_start = ABSOLUTE(.); + *(.Level5InterruptVector.literal) + _Level5InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int5_lit :vector_int5_lit_phdr + + .Level5InterruptVector.text : ALIGN(4) + { + _Level5InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level5InterruptVector.text)) + _Level5InterruptVector_text_end = ABSOLUTE(.); + } >vector_int5_text :vector_int5_text_phdr + + .DebugExceptionVector.literal : ALIGN(4) + { + _DebugExceptionVector_literal_start = ABSOLUTE(.); + *(.DebugExceptionVector.literal) + _DebugExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int6_lit :vector_int6_lit_phdr + + .DebugExceptionVector.text : ALIGN(4) + { + _DebugExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DebugExceptionVector.text)) + _DebugExceptionVector_text_end = ABSOLUTE(.); + } >vector_int6_text :vector_int6_text_phdr + + .NMIExceptionVector.literal : ALIGN(4) + { + _NMIExceptionVector_literal_start = ABSOLUTE(.); + *(.NMIExceptionVector.literal) + _NMIExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int7_lit :vector_int7_lit_phdr + + .NMIExceptionVector.text : ALIGN(4) + { + _NMIExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.NMIExceptionVector.text)) + _NMIExceptionVector_text_end = ABSOLUTE(.); + } >vector_int7_text :vector_int7_text_phdr + + .KernelExceptionVector.literal : ALIGN(4) + { + _KernelExceptionVector_literal_start = ABSOLUTE(.); + *(.KernelExceptionVector.literal) + _KernelExceptionVector_literal_end = ABSOLUTE(.); + } >vector_kernel_lit :vector_kernel_lit_phdr + + .KernelExceptionVector.text : ALIGN(4) + { + _KernelExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.KernelExceptionVector.text)) + _KernelExceptionVector_text_end = ABSOLUTE(.); + } >vector_kernel_text :vector_kernel_text_phdr + + .UserExceptionVector.literal : ALIGN(4) + { + _UserExceptionVector_literal_start = ABSOLUTE(.); + *(.UserExceptionVector.literal) + _UserExceptionVector_literal_end = ABSOLUTE(.); + } >vector_user_lit :vector_user_lit_phdr + + .UserExceptionVector.text : ALIGN(4) + { + _UserExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.UserExceptionVector.text)) + _UserExceptionVector_text_end = ABSOLUTE(.); + } >vector_user_text :vector_user_text_phdr + + .DoubleExceptionVector.literal : ALIGN(4) + { + _DoubleExceptionVector_literal_start = ABSOLUTE(.); + *(.DoubleExceptionVector.literal) + _DoubleExceptionVector_literal_end = ABSOLUTE(.); + } >vector_double_lit :vector_double_lit_phdr + + .DoubleExceptionVector.text : ALIGN(4) + { + _DoubleExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DoubleExceptionVector.text)) + _DoubleExceptionVector_text_end = ABSOLUTE(.); + } >vector_double_text :vector_double_text_phdr + + .MainEntry.text : ALIGN(4) + { + _MainEntry_text_start = ABSOLUTE(.); + KEEP (*(.MainEntry.text)) + _MainEntry_text_end = ABSOLUTE(.); + } >reef_text_start :reef_text_start_phdr + + .text : ALIGN(4) + { + _stext = .; + _text_start = ABSOLUTE(.); + *(.entry.text) + *(.init.literal) + KEEP(*(.init)) + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.fini.literal) + KEEP(*(.fini)) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + } >reef_text :reef_text_phdr + + .rodata : ALIGN(4) + { + _rodata_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); + KEEP (*(.xt_except_table)) + KEEP (*(.gcc_except_table)) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + KEEP (*(.eh_frame)) + /* C++ constructor and destructor tables, properly ordered: */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + . = ALIGN(4); /* this table MUST be 4-byte aligned */ + _bss_table_start = ABSOLUTE(.); + LONG(_bss_start) + LONG(_bss_end) + _bss_table_end = ABSOLUTE(.); + _rodata_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .data : ALIGN(4) + { + _data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + KEEP(*(.gnu.linkonce.d.*personality*)) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + KEEP(*(.jcr)) + _data_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .lit4 : ALIGN(4) + { + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + } >reef_data :reef_data_phdr + + .bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + } >reef_bss_data :reef_bss_data_phdr + + /* stack */ + _end = REEF_STACK_END; + PROVIDE(end = REEF_STACK_END); + _stack_sentry = REEF_STACK_END; + __stack = REEF_STACK_BASE; + + /* System Heap */ + _system_heap = HEAP_SYSTEM_BASE; + + + /* module heap */ + _module_heap = HEAP_RUNTIME_BASE; + + /* buffer heap */ + _buffer_heap = HEAP_BUFFER_BASE; + _buffer_heap_end = _stack_sentry; + + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + .xt.insn 0 : + { + KEEP (*(.xt.insn)) + KEEP (*(.gnu.linkonce.x.*)) + } + .xt.prop 0 : + { + KEEP (*(.xt.prop)) + KEEP (*(.xt.prop.*)) + KEEP (*(.gnu.linkonce.prop.*)) + } + .xt.lit 0 : + { + KEEP (*(.xt.lit)) + KEEP (*(.xt.lit.*)) + KEEP (*(.gnu.linkonce.p.*)) + } + .xt.profile_range 0 : + { + KEEP (*(.xt.profile_range)) + KEEP (*(.gnu.linkonce.profile_range.*)) + } + .xt.profile_ranges 0 : + { + KEEP (*(.xt.profile_ranges)) + KEEP (*(.gnu.linkonce.xt.profile_ranges.*)) + } + .xt.profile_files 0 : + { + KEEP (*(.xt.profile_files)) + KEEP (*(.gnu.linkonce.xt.profile_files.*)) + } + + .system_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_SYSTEM_SIZE; + _system_heap_end = ABSOLUTE(.); + } >system_heap :system_heap_phdr + + .runtime_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _runtime_heap_start = ABSOLUTE(.); + . = . + HEAP_RUNTIME_SIZE; + _runtime_heap_end = ABSOLUTE(.); + } >runtime_heap :runtime_heap_phdr + + .buffer_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_BUFFER_SIZE; + _system_heap_end = ABSOLUTE(.); + } >buffer_heap :buffer_heap_phdr + + .reef_stack (NOLOAD) : ALIGN(8) + { + . = ALIGN (4096); + _reef_stack_start = ABSOLUTE(.); + . = . + REEF_STACK_SIZE; + _reef_stack_end = ABSOLUTE(.); + } >reef_stack :reef_stack_phdr +} diff --git a/src/platform/cannonlake/clk.c b/src/platform/cannonlake/clk.c new file mode 100644 index 0000000..bcce20d --- /dev/null +++ b/src/platform/cannonlake/clk.c @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <reef/clock.h> +#include <reef/io.h> +#include <reef/reef.h> +#include <reef/list.h> +#include <reef/alloc.h> +#include <reef/notifier.h> +#include <reef/lock.h> +#include <platform/clk.h> +#include <platform/shim.h> +#include <platform/timer.h> +#include <config.h> +#include <stdint.h> +#include <limits.h> + +#define NUM_CLOCKS 2 + +struct clk_data { + uint32_t freq; + uint32_t ticks_per_usec; + spinlock_t lock; +}; + +struct clk_pdata { + struct clk_data clk[NUM_CLOCKS]; +}; + +struct freq_table { + uint32_t freq; + uint32_t ticks_per_usec; + uint32_t enc; +}; + +static struct clk_pdata *clk_pdata; + +/* increasing frequency order */ +static const struct freq_table cpu_freq[] = { + {120000000, 120, 0x0}, + {400000000, 400, 0x4}, +}; + +static const struct freq_table ssp_freq[] = { + {19200000, 19,}, + {25000000, 25,}, /* default */ +}; + +#define CPU_DEFAULT_IDX 2 +#define SSP_DEFAULT_IDX 1 + +static inline uint32_t get_freq(const struct freq_table *table, int size, + unsigned int hz) +{ + uint32_t i; + + /* find lowest available frequency that is >= requested hz */ + for (i = 0; i < size; i++) { + if (hz <= table[i].freq) + return i; + } + + /* not found, so return max frequency */ + return size - 1; +} + +void clock_enable(int clock) +{ + switch (clock) { + case CLK_CPU: + break; + case CLK_SSP: + default: + break; + } +} + +void clock_disable(int clock) +{ + switch (clock) { + case CLK_CPU: + break; + case CLK_SSP: + default: + break; + } +} + +uint32_t clock_set_freq(int clock, uint32_t hz) +{ + struct clock_notify_data notify_data; + uint32_t idx; + uint32_t flags; + + notify_data.old_freq = clk_pdata->clk[clock].freq; + notify_data.old_ticks_per_usec = clk_pdata->clk[clock].ticks_per_usec; + + /* atomic context for chaning clocks */ + spin_lock_irq(&clk_pdata->clk[clock].lock, flags); + + switch (clock) { + case CLK_CPU: + /* get nearest frequency that is >= requested Hz */ + idx = get_freq(cpu_freq, ARRAY_SIZE(cpu_freq), hz); + notify_data.freq = cpu_freq[idx].freq; + + /* tell anyone interested we are about to change CPU freq */ + notifier_event(NOTIFIER_ID_CPU_FREQ, CLOCK_NOTIFY_PRE, + ¬ify_data); + + /* set CPU frequency request for CCU */ + io_reg_update_bits(SHIM_BASE + SHIM_CLKCTL, + SHIM_CLKCTL_DPCS_MASK(0), cpu_freq[idx].enc); + + /* tell anyone interested we have now changed CPU freq */ + notifier_event(NOTIFIER_ID_CPU_FREQ, CLOCK_NOTIFY_POST, + ¬ify_data); + break; + case CLK_SSP: + default: + break; + } + + spin_unlock_irq(&clk_pdata->clk[clock].lock, flags); + return clk_pdata->clk[clock].freq; +} + +uint32_t clock_get_freq(int clock) +{ + return clk_pdata->clk[clock].freq; +} + +uint64_t clock_us_to_ticks(int clock, uint64_t us) +{ + return clk_pdata->clk[clock].ticks_per_usec * us; +} + +uint64_t clock_time_elapsed(int clock, uint64_t previous, uint64_t *current) +{ + uint64_t _current; + + // TODO: change timer APIs to clk APIs ?? + switch (clock) { + case CLK_CPU: + _current = arch_timer_get_system(NULL); + break; + case CLK_SSP: + _current = platform_timer_get(platform_timer); + break; + default: + return 0; + } + + *current = _current; + if (_current >= previous) + return (_current - previous) / + clk_pdata->clk[clock].ticks_per_usec; + else + return (_current + (ULONG_LONG_MAX - previous)) / + clk_pdata->clk[clock].ticks_per_usec; +} + +void init_platform_clocks(void) +{ + clk_pdata = rmalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*clk_pdata)); + + spinlock_init(&clk_pdata->clk[0].lock); + spinlock_init(&clk_pdata->clk[1].lock); + + /* set defaults */ + clk_pdata->clk[CLK_CPU].freq = cpu_freq[CPU_DEFAULT_IDX].freq; + clk_pdata->clk[CLK_CPU].ticks_per_usec = + cpu_freq[CPU_DEFAULT_IDX].ticks_per_usec; + clk_pdata->clk[CLK_SSP].freq = ssp_freq[SSP_DEFAULT_IDX].freq; + clk_pdata->clk[CLK_SSP].ticks_per_usec = + ssp_freq[SSP_DEFAULT_IDX].ticks_per_usec; +} diff --git a/src/platform/cannonlake/dai.c b/src/platform/cannonlake/dai.c new file mode 100644 index 0000000..1ca5c29 --- /dev/null +++ b/src/platform/cannonlake/dai.c @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <reef/reef.h> +#include <reef/dai.h> +#include <reef/ssp.h> +#include <reef/stream.h> +#include <reef/audio/component.h> +#include <platform/memory.h> +#include <platform/interrupt.h> +#include <platform/dma.h> +#include <stdint.h> +#include <string.h> +#include <config.h> + +static struct dai ssp[] = { +{ + .type = SOF_DAI_INTEL_SSP, + .index = 0, + .plat_data = { + .base = SSP_BASE(0), + .irq = IRQ_EXT_SSP0_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(0) + SSDR, + .handshake = DMA_HANDSHAKE_SSP0_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(0) + SSDR, + .handshake = DMA_HANDSHAKE_SSP0_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 1, + .plat_data = { + .base = SSP_BASE(1), + .irq = IRQ_EXT_SSP1_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(1) + SSDR, + .handshake = DMA_HANDSHAKE_SSP1_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(1) + SSDR, + .handshake = DMA_HANDSHAKE_SSP1_RX, + } + }, + .ops = &ssp_ops, +}, +{ + .type = SOF_DAI_INTEL_SSP, + .index = 2, + .plat_data = { + .base = SSP_BASE(2), + .irq = IRQ_EXT_SSP2_LVL5(0), + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SSP_BASE(2) + SSDR, + .handshake = DMA_HANDSHAKE_SSP2_TX, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SSP_BASE(2) + SSDR, + .handshake = DMA_HANDSHAKE_SSP2_RX, + } + }, + .ops = &ssp_ops, +},}; + +struct dai *dai_get(uint32_t type, uint32_t index) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ssp); i++) { + if (ssp[i].type == type && ssp[i].index == index) + return &ssp[i]; + } + + return NULL; +} diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c new file mode 100644 index 0000000..45bdee3 --- /dev/null +++ b/src/platform/cannonlake/dma.c @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <reef/dma.h> +#include <reef/dw-dma.h> +#include <platform/memory.h> +#include <platform/interrupt.h> +#include <platform/dma.h> +#include <stdint.h> +#include <string.h> + +static struct dw_drv_plat_data dmac0 = { + .chan[0] = { + .class = 6, + .weight = 0, + }, + .chan[1] = { + .class = 6, + .weight = 0, + }, + .chan[2] = { + .class = 6, + .weight = 0, + }, + .chan[3] = { + .class = 6, + .weight = 0, + }, + .chan[4] = { + .class = 6, + .weight = 0, + }, + .chan[5] = { + .class = 6, + .weight = 0, + }, + .chan[6] = { + .class = 6, + .weight = 0, + }, + .chan[7] = { + .class = 6, + .weight = 0, + }, +}; + +static struct dw_drv_plat_data dmac1 = { + .chan[0] = { + .class = 7, + .weight = 0, + }, + .chan[1] = { + .class = 7, + .weight = 0, + }, + .chan[2] = { + .class = 7, + .weight = 0, + }, + .chan[3] = { + .class = 7, + .weight = 0, + }, + .chan[4] = { + .class = 7, + .weight = 0, + }, + .chan[5] = { + .class = 7, + .weight = 0, + }, + .chan[6] = { + .class = 7, + .weight = 0, + }, + .chan[7] = { + .class = 7, + .weight = 0, + }, +}; + +static struct dma dma[] = { +{ /* Low Power GP DMAC 0 */ + .plat_data = { + .id = DMA_GP_LP_DMAC0, + .base = LP_GP_DMA_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0), + .drv_plat_data = &dmac0, + }, + .ops = &dw_dma_ops, +}, +{ /* Low Power GP DMAC 1 */ + .plat_data = { + .id = DMA_GP_LP_DMAC1, + .base = LP_GP_DMA_BASE(1), + .channels = 8, + .irq = IRQ_EXT_LP_GPDMA1_LVL4(0, 0), + .drv_plat_data = &dmac1, + }, + .ops = &dw_dma_ops, +}, +{ /* Host In DMAC */ + .plat_data = { + .id = DMA_HOST_IN_DMAC, + .base = GTW_HOST_IN_STREAM_BASE(0), + .channels = 7, + .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0), + }, +}, +{ /* Host out DMAC */ + .plat_data = { + .id = DMA_HOST_OUT_DMAC, + .base = GTW_HOST_OUT_STREAM_BASE(0), + .channels = 6, + .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0), + }, +}, +{ /* Link In DMAC */ + .plat_data = { + .id = DMA_LINK_IN_DMAC, + .base = GTW_LINK_IN_STREAM_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0), + }, +}, +{ /* Link out DMAC */ + .plat_data = { + .id = DMA_LINK_OUT_DMAC, + .base = GTW_LINK_OUT_STREAM_BASE(0), + .channels = 8, + .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0), + }, +},}; + +struct dma *dma_get(int dmac_id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + if (dma[i].plat_data.id == dmac_id) + return &dma[i]; + } + + return NULL; +} diff --git a/src/platform/cannonlake/include/Makefile.am b/src/platform/cannonlake/include/Makefile.am new file mode 100644 index 0000000..19f40eb --- /dev/null +++ b/src/platform/cannonlake/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = platform xtensa diff --git a/src/platform/cannonlake/interrupt.c b/src/platform/cannonlake/interrupt.c new file mode 100644 index 0000000..3268362 --- /dev/null +++ b/src/platform/cannonlake/interrupt.c @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2017, 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: Keyon Jie yang.jie@linux.intel.com + * Liam Girdwood liam.r.girdwood@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <reef/reef.h> +#include <reef/interrupt.h> +#include <reef/interrupt-map.h> +#include <arch/interrupt.h> +#include <platform/interrupt.h> +#include <platform/shim.h> +#include <stdint.h> +#include <stdlib.h> + +static void parent_level2_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL2); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL2SD(0)); + irq_write(REG_IRQ_IL2MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL2MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL2); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL2); +} + +static void parent_level3_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL3); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL3SD(0)); + irq_write(REG_IRQ_IL3MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL3MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL3); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL3); +} + +static void parent_level4_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL4); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL4SD(0)); + irq_write(REG_IRQ_IL4MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL4MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL4); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL4); +} + +static void parent_level5_handler(void *data) +{ + struct irq_parent *parent = (struct irq_parent *)data; + struct irq_child * child = NULL; + uint32_t status; + uint32_t i = 0; + + /* mask the parent IRQ */ + arch_interrupt_disable_mask(1 << IRQ_NUM_EXT_LEVEL5); + + /* mask all child interrupts */ + status = irq_read(REG_IRQ_IL5SD(0)); + irq_write(REG_IRQ_IL5MSD(0), status); + + /* handle each child */ + while (status) { + + /* any IRQ for this child bit ? */ + if ((status & 0x1) == 0) + goto next; + + /* get child if any and run handler */ + child = parent->child[i]; + if (child && child->handler) { + child->handler(child->handler_arg); + + /* unmask this bit i interrupt */ + irq_write(REG_IRQ_IL5MCD(0), 0x1 << i); + } else { + /* nobody cared ? */ + trace_irq_error("nbc"); + } + +next: + status >>= 1; + i++; + } + + /* clear parent and unmask */ + arch_interrupt_clear(IRQ_NUM_EXT_LEVEL5); + arch_interrupt_enable_mask(1 << IRQ_NUM_EXT_LEVEL5); +} + +/* DSP internal interrupts */ +static struct irq_parent dsp_irq[4] = { + {IRQ_NUM_EXT_LEVEL2, parent_level2_handler, }, + {IRQ_NUM_EXT_LEVEL3, parent_level3_handler, }, + {IRQ_NUM_EXT_LEVEL4, parent_level4_handler, }, + {IRQ_NUM_EXT_LEVEL5, parent_level5_handler, }, +}; + +struct irq_parent *platform_irq_get_parent(uint32_t irq) +{ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL2: + return &dsp_irq[0]; + case IRQ_NUM_EXT_LEVEL3: + return &dsp_irq[1]; + case IRQ_NUM_EXT_LEVEL4: + return &dsp_irq[2]; + case IRQ_NUM_EXT_LEVEL5: + return &dsp_irq[3]; + default: + return NULL; + } +} + +uint32_t platform_interrupt_get_enabled(void) +{ + return 0; +} + +void platform_interrupt_mask(uint32_t irq, uint32_t mask) +{ + /* mask external interrupt bit */ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL5: + irq_write(REG_IRQ_IL5MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL4: + irq_write(REG_IRQ_IL4MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL3: + irq_write(REG_IRQ_IL3MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL2: + irq_write(REG_IRQ_IL2MSD(0), 1 << REEF_IRQ_BIT(irq)); + break; + default: + break; + } + +} + +void platform_interrupt_unmask(uint32_t irq, uint32_t mask) +{ + /* unmask external interrupt bit */ + switch (REEF_IRQ_NUMBER(irq)) { + case IRQ_NUM_EXT_LEVEL5: + irq_write(REG_IRQ_IL5MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL4: + irq_write(REG_IRQ_IL4MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL3: + irq_write(REG_IRQ_IL3MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + case IRQ_NUM_EXT_LEVEL2: + irq_write(REG_IRQ_IL2MCD(0), 1 << REEF_IRQ_BIT(irq)); + break; + default: + break; + } + +} + +void platform_interrupt_clear(uint32_t irq, uint32_t mask) +{ +} + +void platform_interrupt_init(void) +{ + int i; + + /* mask all external IRQs by default */ + irq_write(REG_IRQ_IL2MSD(0), REG_IRQ_IL2MD_ALL); + irq_write(REG_IRQ_IL3MSD(0), REG_IRQ_IL3MD_ALL); + irq_write(REG_IRQ_IL4MSD(0), REG_IRQ_IL4MD_ALL); + irq_write(REG_IRQ_IL5MSD(0), REG_IRQ_IL5MD_ALL); + + for (i = 0; i < ARRAY_SIZE(dsp_irq); i++) { + spinlock_init(&dsp_irq[i].lock); + } +} diff --git a/src/platform/cannonlake/platform.c b/src/platform/cannonlake/platform.c new file mode 100644 index 0000000..729364f --- /dev/null +++ b/src/platform/cannonlake/platform.c @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <platform/memory.h> +#include <platform/mailbox.h> +#include <platform/shim.h> +#include <platform/dma.h> +#include <platform/clk.h> +#include <platform/timer.h> +#include <platform/interrupt.h> +#include <uapi/ipc.h> +#include <reef/mailbox.h> +#include <reef/dai.h> +#include <reef/dma.h> +#include <reef/reef.h> +#include <reef/work.h> +#include <reef/clock.h> +#include <reef/ipc.h> +#include <reef/agent.h> +#include <reef/io.h> +#include <reef/trace.h> +#include <reef/audio/component.h> +#include <config.h> +#include <string.h> +#include <version.h> + +static const struct sof_ipc_fw_ready ready = { + .hdr = { + .cmd = SOF_IPC_FW_READY, + .size = sizeof(struct sof_ipc_fw_ready), + }, + .version = { + .build = REEF_BUILD, + .minor = REEF_MINOR, + .major = REEF_MAJOR, + .date = __DATE__, + .time = __TIME__, + .tag = REEF_TAG, + }, +}; + +#define SRAM_WINDOW_HOST_OFFSET(x) (0x80000 + x * 0x20000) + +#define NUM_CNL_WINDOWS 5 + +static const struct sof_ipc_window sram_window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window) + + sizeof(struct sof_ipc_window_elem) * NUM_CNL_WINDOWS, + .type = SOF_IPC_EXT_WINDOW, + }, + .num_windows = NUM_CNL_WINDOWS, + .window[0] = { + .type = SOF_IPC_REGION_REGS, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_SW_REG_SIZE, + .offset = 0, + }, + .window[1] = { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_SW_REG_SIZE, + }, + .window[2] = { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 1, /* map to host window 1 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = 0, + }, + .window[3] = { + .type = SOF_IPC_REGION_DEBUG, + .id = 2, /* map to host window 2 */ + .flags = 0, // TODO: set later + .size = SRAM_DEBUG_SIZE, + .offset = 0, + }, + .window[4] = { + .type = SOF_IPC_REGION_TRACE, + .id = 3, /* map to host window 3 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = 0, + }, + +}; + +static struct work_queue_timesource platform_generic_queue = { + .timer = { + .id = TIMER3, /* external timer */ + .irq = IRQ_EXT_TSTAMP0_LVL2(0), + }, + .clk = CLK_CPU, + .notifier = NOTIFIER_ID_CPU_FREQ, + .timer_set = platform_timer_set, + .timer_clear = platform_timer_clear, + .timer_get = platform_timer_get, +}; + +struct timer *platform_timer = &platform_generic_queue.timer; + +int platform_boot_complete(uint32_t boot_message) +{ + mailbox_dspbox_write(0, &ready, sizeof(ready)); + mailbox_dspbox_write(sizeof(ready), &sram_window, + sram_window.ext_hdr.hdr.size); + + /* boot now complete so we can relax the CPU */ + clock_set_freq(CLK_CPU, CLK_DEFAULT_CPU_HZ); + + /* tell host we are ready */ + ipc_write(IPC_DIPCIDD, SRAM_WINDOW_HOST_OFFSET(0) >> 12); + ipc_write(IPC_DIPCIDR, 0x80000000 | SOF_IPC_FW_READY); + + return 0; +} + +static void platform_memory_windows_init(void) +{ + /* window0, for fw status & outbox/uplink mbox */ + io_reg_write(DMWLO(0), HP_SRAM_WIN0_SIZE | 0x7); + io_reg_write(DMWBA(0), HP_SRAM_WIN0_BASE + | DMWBA_READONLY | DMWBA_ENABLE); + + /* window1, for inbox/downlink mbox */ + io_reg_write(DMWLO(1), HP_SRAM_WIN1_SIZE | 0x7); + io_reg_write(DMWBA(1), HP_SRAM_WIN1_BASE + | DMWBA_ENABLE); + + /* window2, for debug */ + io_reg_write(DMWLO(2), HP_SRAM_WIN2_SIZE | 0x7); + io_reg_write(DMWBA(2), HP_SRAM_WIN2_BASE + | DMWBA_READONLY | DMWBA_ENABLE); + + /* window3, for trace */ + io_reg_write(DMWLO(3), HP_SRAM_WIN3_SIZE | 0x7); + io_reg_write(DMWBA(3), HP_SRAM_WIN3_BASE + | DMWBA_READONLY | DMWBA_ENABLE); +} + +/* init HW */ +static void platform_init_hw(void) +{ + io_reg_write(DSP_INIT_GENO, + GENO_MDIVOSEL | GENO_DIOPTOSEL); + + io_reg_write(DSP_INIT_IOPO, + IOPO_DMIC_FLAG |IOPO_I2S_FLAG); + + io_reg_write(DSP_INIT_ALHO, + ALHO_ASO_FLAG | ALHO_CSO_FLAG | ALHO_CFO_FLAG); + + io_reg_write(DSP_INIT_LPGPDMA(0), + LPGPDMA_CHOSEL_FLAG | LPGPDMA_CTLOSEL_FLAG); + io_reg_write(DSP_INIT_LPGPDMA(1), + LPGPDMA_CHOSEL_FLAG | LPGPDMA_CTLOSEL_FLAG); +} + +static struct timer platform_ext_timer = { + .id = TIMER3, + .irq = IRQ_EXT_TSTAMP0_LVL2(0), +}; + +int platform_init(struct reef *reef) +{ + struct dma *dmac0; + struct dma *dmac1; + struct dai *ssp; + int i; + + trace_point(TRACE_BOOT_PLATFORM_ENTRY); + platform_init_hw(); + + platform_interrupt_init(); + + trace_point(TRACE_BOOT_PLATFORM_MBOX); + platform_memory_windows_init(); + + trace_point(TRACE_BOOT_PLATFORM_SHIM); + + /* init work queues and clocks */ + trace_point(TRACE_BOOT_PLATFORM_TIMER); + platform_timer_start(&platform_ext_timer); + + trace_point(TRACE_BOOT_PLATFORM_CLOCK); + init_platform_clocks(); + + trace_point(TRACE_BOOT_SYS_WORK); + init_system_workq(&platform_generic_queue); + + /* init the system agent */ + sa_init(reef); + + /* Set CPU to default frequency for booting */ + trace_point(TRACE_BOOT_SYS_CPU_FREQ); + clock_set_freq(CLK_CPU, CLK_MAX_CPU_HZ); + + /* set SSP clock to 25M */ + trace_point(TRACE_BOOT_PLATFORM_SSP_FREQ); + clock_set_freq(CLK_SSP, 25000000); + + /* initialise the host IPC mechanisms */ + trace_point(TRACE_BOOT_PLATFORM_IPC); + ipc_init(reef); + + /* prevent Core0 clock gating. */ + shim_write(SHIM_CLKCTL, shim_read(SHIM_CLKCTL) | + SHIM_CLKCTL_TCPLCG(0)); + + /* prevent LP GPDMA 0&1 clock gating */ + io_reg_write(GPDMA_CLKCTL(0), GPDMA_FDCGB); + io_reg_write(GPDMA_CLKCTL(1), GPDMA_FDCGB); + + /* prevent DSP Common power gating */ + shim_write16(SHIM_PWRCTL, SHIM_PWRCTL_TCPDSP0PG); + + /* init DMACs */ + trace_point(TRACE_BOOT_PLATFORM_DMA); + dmac0 = dma_get(DMA_GP_LP_DMAC0); + if (dmac0 == NULL) + return -ENODEV; + dma_probe(dmac0); + + dmac1 = dma_get(DMA_GP_LP_DMAC1); + if (dmac1 == NULL) + return -ENODEV; + dma_probe(dmac1); + + /* init SSP ports */ + trace_point(TRACE_BOOT_PLATFORM_SSP); + for(i = 0; i < PLATFORM_SSP_COUNT; i++) { + ssp = dai_get(SOF_DAI_INTEL_SSP, i); + if (ssp == NULL) + return -ENODEV; + dai_probe(ssp); + } + + return 0; +} diff --git a/src/platform/cannonlake/timer.c b/src/platform/cannonlake/timer.c new file mode 100644 index 0000000..d2ee870 --- /dev/null +++ b/src/platform/cannonlake/timer.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + * Rander Wang rander.wang@intel.com + */ + +#include <platform/timer.h> +#include <platform/shim.h> +#include <reef/debug.h> +#include <reef/audio/component.h> +#include <stdint.h> + +void platform_timer_start(struct timer *timer) +{ + /* run timer */ + shim_write64(SHIM_DSPWCT0C, 0); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0A); +} + +void platform_timer_stop(struct timer *timer) +{ + /* stop timer */ + shim_write64(SHIM_DSPWCT0C, 0); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) & ~SHIM_DSPWCTCS_T0A); +} + +int platform_timer_set(struct timer *timer, uint64_t ticks) +{ + /* a tick value of 0 will not generate an IRQ */ + if (ticks == 0) + ticks = 1; + + /* set new value and run */ + shim_write64(SHIM_DSPWCT0C, ticks); + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0A); + + return 0; +} + +void platform_timer_clear(struct timer *timer) +{ + /* write 1 to clear the timer interrupt */ + shim_write(SHIM_DSPWCTCS, + shim_read(SHIM_DSPWCTCS) | SHIM_DSPWCTCS_T0T); +} + +uint64_t platform_timer_get(struct timer *timer) +{ +// return arch_timer_get_system(timer); + return (uint64_t)shim_read64(SHIM_DSPWC); +} + +/* get timestamp for host stream DMA position */ +void platform_host_timestamp(struct comp_dev *host, + struct sof_ipc_stream_posn *posn) +{ + int err; + + /* get host postion */ + err = comp_position(host, posn); + if (err == 0) + posn->flags |= SOF_TIME_HOST_VALID; +} + +/* get timestamp for DAI stream DMA position */ +void platform_dai_timestamp(struct comp_dev *dai, + struct sof_ipc_stream_posn *posn) +{ + int err; + + /* get DAI postion */ + err = comp_position(dai, posn); + if (err == 0) + posn->flags |= SOF_TIME_DAI_VALID; + + /* get SSP wallclock - DAI sets this to stream start value */ + posn->wallclock = shim_read64(SHIM_DSPWC) - posn->wallclock; + posn->flags |= SOF_TIME_WALL_VALID; +} + +/* get current wallclock for componnent */ +void platform_dai_wallclock(struct comp_dev *dai, uint64_t *wallclock) +{ + *wallclock = shim_read64(SHIM_DSPWC); +} + +int platform_timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg) +{ + return interrupt_register(timer->irq, handler, arg); +} + +int timer_register(struct timer *timer, void(*handler)(void *arg), void *arg) +{ + switch (timer->id) { + case TIMER0: + case TIMER1: + case TIMER2: + return arch_timer_register(timer, handler, arg); + case TIMER3: + return platform_timer_register(timer, handler, arg); + default: + return -EINVAL; + } +}
From: Rander Wang rander.wang@linux.intel.com
Add a support for a secondary boot loader than cant be used to bootstrap multiple firmware modules.
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/arch/xtensa/boot_entry.S | 98 ++++++++++++++++++++ src/arch/xtensa/boot_loader.c | 206 +++++++++++++++++++++++++++++++++++++++++ src/arch/xtensa/crt1-boards.S | 16 ++++ src/arch/xtensa/main-entry.S | 57 ++++++++++++ src/arch/xtensa/reset-vector.S | 16 +++- 5 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 src/arch/xtensa/boot_entry.S create mode 100644 src/arch/xtensa/boot_loader.c create mode 100644 src/arch/xtensa/main-entry.S
diff --git a/src/arch/xtensa/boot_entry.S b/src/arch/xtensa/boot_entry.S new file mode 100644 index 0000000..cf793f5 --- /dev/null +++ b/src/arch/xtensa/boot_entry.S @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +/* + * Entry point from ROM - assumes :- + * + * 1) C runtime environment is initalised by ROM. + * 2) Stack is in first HPSRAM bank. + */ + +#include <config.h> +#include <platform/shim.h> +#include <xtensa/corebits.h> +#include <xtensa/config/core-isa-boot.h> + + .type boot_pri_core, @function + .type boot_sec_core, @function + + .begin literal_prefix .boot_entry + .section .boot_entry.text, "ax" + + .align 4 + .global boot_entry + +boot_entry: + entry a1, 48 + j boot_init + + .align 4 + .literal_position +l2_mecs: + .word SHIM_L2_MECS + +boot_init: + .align 4 +#if defined(CONFIG_CANNONLAKE) + /* reset memory hole */ + l32r a3, l2_mecs + movi a5, 0 + s32i a5, a3, 0 +#endif + +#if (XCHAL_DCACHE_IS_COHERENT || XCHAL_LOOP_BUFFER_SIZE) && \ + XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RE_2012_0 + /* Enable zero-overhead loop instr buffer, + and snoop responses, if configured. */ + movi a3, (MEMCTL_SNOOP_EN | MEMCTL_L0IBUF_EN) + rsr a2, MEMCTL + or a2, a2, a3 + wsr a2, MEMCTL +#endif + + /* determine core we are running on */ + rsr a2, PRID + beqz a2, 1f + + /* we are seconadry core, so boot it */ + call8 boot_sec_core + j dead + +1: + /* we are primary core so boot it */ + call8 boot_pri_core + +dead: + /* should never get here - we are dead */ + j dead + + .size boot_entry, . - boot_entry + + .end literal_prefix diff --git a/src/arch/xtensa/boot_loader.c b/src/arch/xtensa/boot_loader.c new file mode 100644 index 0000000..5c5939c --- /dev/null +++ b/src/arch/xtensa/boot_loader.c @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2016, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + */ + +#include <arch/cache.h> +#include <arch/wait.h> +#include <reef/trace.h> +#include <reef/io.h> +#include <uapi/manifest.h> +#include <platform/memory.h> + +/* entry point to main firmware */ +extern void _ResetVector(void); + +void boot_pri_core(void); +void boot_sec_core(void); + +#if defined(CONFIG_CANNONLAKE) + +/* memcopy used by boot loader */ +static inline void bmemcpy(void *dest, void *src, size_t bytes) +{ + uint32_t *d = dest; + uint32_t *s = src; + int i; + + for (i = 0; i < (bytes >> 2); i++) + d[i] = s[i]; + + dcache_writeback_region(dest, bytes); +} + +/* bzero used by bootloader */ +static inline void bbzero(void *dest, size_t bytes) +{ + uint32_t *d = dest; + int i; + + for (i = 0; i < (bytes >> 2); i++) + d[i] = 0; + + dcache_writeback_region(dest, bytes); +} + +static void parse_module(struct sof_man_fw_header *hdr, + struct sof_man_module *mod) +{ + int i; + uint32_t bias; + + /* each module has 3 segments */ + for (i = 0; i < 3; i++) { + + switch (mod->segment[i].flags.r.type) { + case SOF_MAN_SEGMENT_TEXT: + case SOF_MAN_SEGMENT_DATA: + bias = (mod->segment[i].file_offset - + SOF_MAN_ELF_TEXT_OFFSET); + + /* copy from IMR to SRAM */ + bmemcpy((void *)mod->segment[i].v_base_addr, + (void *)((int)hdr + bias), + mod->segment[i].flags.r.length * HOST_PAGE_SIZE); + break; + case SOF_MAN_SEGMENT_BSS: + /* copy from IMR to SRAM */ + bbzero((void*)mod->segment[i].v_base_addr, + mod->segment[i].flags.r.length * HOST_PAGE_SIZE); + break; + default: + /* ignore */ + break; + } + } +} + +/* parse FW manifest and copy modules */ +static void parse_manifest(void) +{ + struct sof_man_fw_desc *desc = + (struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE; + struct sof_man_fw_header *hdr = &desc->header; + struct sof_man_module *mod; + int i; + + /* copy module to SRAM - skip bootloader module */ + for (i = 1; i < hdr->num_module_entries; i++) { + + mod = sof_man_get_module(desc, i); + parse_module(hdr, mod); + } +} +#endif + +/* power on HPSRAM */ +static int32_t hp_sram_init(void) +{ + int delay_count = 256, timeout = 256; + uint32_t status; + + shim_write(SHIM_LDOCTL, SHIM_HPMEM_POWER_ON); + + /* add some delay before touch power register */ + idelay(delay_count); + + /* now all the memory bank has been powered up */ + io_reg_write(HSPGCTL0, 0); + io_reg_write(HSRMCTL0, 0); + io_reg_write(HSPGCTL1, 0); + io_reg_write(HSRMCTL1, 0); + + /* query the power status of first part of HP memory */ + /* to check whether it has been powered up. A few */ + /* cycles are needed for it to be powered up */ + status = io_reg_read(HSPGISTS0); + while (status) { + idelay(delay_count); + + status = io_reg_read(HSPGISTS0); + if (timeout-- < 0) { + return -EIO; + } + } + + /* query the power status of second part of HP memory */ + /* and do as above code */ + timeout = 256; + status = io_reg_read(HSPGISTS1); + while (status) { + idelay(delay_count); + + status = io_reg_read(HSPGISTS1); + if (timeout-- < 0) { + return -EIO; + } + } + + /* add some delay before touch power register */ + idelay(delay_count); + shim_write(SHIM_LDOCTL, SHIM_LPMEM_POWER_BYPASS); + + return 0; +} + +/* boot secondary core - i.e core ID > 0 */ +void boot_sec_core(void) +{ + /* TODO: prepare C stack for this core */ + while (1); + + /* now call SOF entry */ + _ResetVector(); +} + +/* boot primary core - i.e. core ID == 0 */ +void boot_pri_core(void) +{ + int32_t result; + + /* TODO: platform trace should write to HW IPC regs on CNL */ + platform_trace_point(TRACE_BOOT_LDR_ENTRY); + + /* init the HPSRAM */ + platform_trace_point(TRACE_BOOT_LDR_HPSRAM); + result = hp_sram_init(); + if (result < 0) { + platform_panic(PANIC_MEM); + return; + } + +#if defined(CONFIG_CANNONLAKE) + /* parse manifest and copy modules */ + platform_trace_point(TRACE_BOOT_LDR_MANIFEST); + parse_manifest(); +#endif + + /* now call SOF entry */ + platform_trace_point(TRACE_BOOT_LDR_JUMP); + _ResetVector(); +} diff --git a/src/arch/xtensa/crt1-boards.S b/src/arch/xtensa/crt1-boards.S index 5d9b842..ff24bfd 100644 --- a/src/arch/xtensa/crt1-boards.S +++ b/src/arch/xtensa/crt1-boards.S @@ -120,6 +120,22 @@ _start: #include "reset-unneeded.S" #endif
+#if XCHAL_HAVE_BOOTLOADER + .weak _Level2FromVector + .weak _Level3FromVector + .weak _Level4FromVector + .weak _Level5FromVector + + movi a4, _Level2FromVector + wsr a4, EXCSAVE+2 + movi a4, _Level3FromVector + wsr a4, EXCSAVE+3 + movi a4, _Level4FromVector + wsr a4, EXCSAVE+4 + movi a4, _Level5FromVector + wsr a4, EXCSAVE+5 +#endif + // Initialize the stack pointer. // See the "ABI and Software Conventions" chapter in the // Xtensa ISA Reference manual for details. diff --git a/src/arch/xtensa/main-entry.S b/src/arch/xtensa/main-entry.S new file mode 100644 index 0000000..27a18b4 --- /dev/null +++ b/src/arch/xtensa/main-entry.S @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2017, 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: Rander Wang rander.wang@intel.com + */ + +/* + * Entry point from boot loader. + * Fix link address of this entry to REEF_TEXT_START so that + * it is easy for boot loader to jump to the baseFW becasue + * the boot loader and baseFW are in different elf file. + */ + + +// Exports +.global _MainEntry + + +/**************************************************************************/ + + .begin literal_prefix .MainEntry + .section .MainEntry.text, "ax" + + .align 4 + .global _MainEntry + +_MainEntry: + + call0 _start + + .size _MainEntry, . - _MainEntry + + .end literal_prefix diff --git a/src/arch/xtensa/reset-vector.S b/src/arch/xtensa/reset-vector.S index be2eb7a..f491b33 100644 --- a/src/arch/xtensa/reset-vector.S +++ b/src/arch/xtensa/reset-vector.S @@ -35,6 +35,10 @@ #include "xtos-internal.h" #include <config.h>
+#if XCHAL_HAVE_BOOTLOADER +#include <platform/memory.h> +#endif + // The following reset vector avoids initializing certain registers already // initialized by processor reset. But it does initialize some of them // anyway, for minimal support of warm restart (restarting in software by @@ -290,6 +294,7 @@ _ResetHandler: s32i a0, a2, 0 // clear sync variable .Ldonesync: #endif + #if XCHAL_HAVE_EXTERN_REGS && XCHAL_HAVE_MP_RUNSTALL /* On core 0, this releases other cores. On other cores this has no effect, because runstall control is unconnected. */ @@ -375,7 +380,6 @@ _ResetHandler: movi a2, _memmap_cacheattr_reset /* note: absolute symbol, not a ptr */ cacheattr_set /* set CACHEATTR from a2 (clobbers a3-a8) */ #endif - /* Now that caches are initialized, cache coherency can be enabled. */ #if XCHAL_DCACHE_IS_COHERENT # if XCHAL_HAVE_EXTERN_REGS && XCHAL_HAVE_MX && (XCHAL_HW_MIN_VERSION < XTENSA_HWVERSION_RE_2012_0) @@ -574,7 +578,15 @@ unpackdone: * needed (with -mlongcalls) which it doesn't with j or jx. * Note: This needs to be call0 regardless of the selected ABI. */ - call0 _start // jump to _start (in crt1-*.S) + +#if XCHAL_HAVE_BOOTLOADER + /*ToDo refine the _start*/ + movi a0, REEF_TEXT_START + callx0 a0 +#else + call0 _start // jump to _start (in crt1-*.S) +#endif + /* does not return */
#else /* XCHAL_HAVE_HALT */
This one does not apply for me?
Using index info to reconstruct a base tree... error: patch failed: src/arch/xtensa/crt1-boards.S:120 error: src/arch/xtensa/crt1-boards.S: patch does not apply
On 01/23/2018 10:40 AM, Liam Girdwood wrote:
From: Rander Wang rander.wang@linux.intel.com
Add a support for a secondary boot loader than cant be used to bootstrap multiple firmware modules.
Signed-off-by: Rander Wang rander.wang@linux.intel.com
src/arch/xtensa/boot_entry.S | 98 ++++++++++++++++++++ src/arch/xtensa/boot_loader.c | 206 +++++++++++++++++++++++++++++++++++++++++ src/arch/xtensa/crt1-boards.S | 16 ++++ src/arch/xtensa/main-entry.S | 57 ++++++++++++ src/arch/xtensa/reset-vector.S | 16 +++- 5 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 src/arch/xtensa/boot_entry.S create mode 100644 src/arch/xtensa/boot_loader.c create mode 100644 src/arch/xtensa/main-entry.S
[...]
diff --git a/src/arch/xtensa/crt1-boards.S b/src/arch/xtensa/crt1-boards.S index 5d9b842..ff24bfd 100644 --- a/src/arch/xtensa/crt1-boards.S +++ b/src/arch/xtensa/crt1-boards.S @@ -120,6 +120,22 @@ _start: #include "reset-unneeded.S" #endif
Maybe because the code is different initially, something looks missing...
#if XTOS_RESET_UNNEEDED && !XCHAL_HAVE_HALT #include "reset-unneeded.S" #endif
On Tue, 2018-01-23 at 13:16 -0600, Pierre-Louis Bossart wrote:
This one does not apply for me?
Using index info to reconstruct a base tree... error: patch failed: src/arch/xtensa/crt1-boards.S:120 error: src/arch/xtensa/crt1-boards.S: patch does not apply
On 01/23/2018 10:40 AM, Liam Girdwood wrote:
From: Rander Wang rander.wang@linux.intel.com
Add a support for a secondary boot loader than cant be used to bootstrap multiple firmware modules.
Signed-off-by: Rander Wang rander.wang@linux.intel.com
src/arch/xtensa/boot_entry.S | 98 ++++++++++++++++++++ src/arch/xtensa/boot_loader.c | 206 +++++++++++++++++++++++++++++++++++++++++ src/arch/xtensa/crt1-boards.S | 16 ++++ src/arch/xtensa/main-entry.S | 57 ++++++++++++ src/arch/xtensa/reset-vector.S | 16 +++- 5 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 src/arch/xtensa/boot_entry.S create mode 100644 src/arch/xtensa/boot_loader.c create mode 100644 src/arch/xtensa/main-entry.S
[...]
diff --git a/src/arch/xtensa/crt1-boards.S b/src/arch/xtensa/crt1- boards.S index 5d9b842..ff24bfd 100644 --- a/src/arch/xtensa/crt1-boards.S +++ b/src/arch/xtensa/crt1-boards.S @@ -120,6 +120,22 @@ _start: #include "reset-unneeded.S" #endif
Maybe because the code is different initially, something looks missing...
#if XTOS_RESET_UNNEEDED && !XCHAL_HAVE_HALT #include "reset-unneeded.S" #endif
I suspect I've sent the pre-merge version after running cleanpatch....but I've pushed the post merge version.
Liam
From: Rander Wang rander.wang@linux.intel.com
Support IPC on Intel Cannonlake platform.
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/ipc/Makefile.am | 8 ++ src/ipc/cnl-ipc.c | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 src/ipc/cnl-ipc.c
diff --git a/src/ipc/Makefile.am b/src/ipc/Makefile.am index 8438b70..bd83f60 100644 --- a/src/ipc/Makefile.am +++ b/src/ipc/Makefile.am @@ -42,6 +42,14 @@ libipc_a_SOURCES = \ dma-copy.c endif
+if BUILD_CANNONLAKE +libipc_a_SOURCES = \ + ipc.c \ + intel-ipc.c \ + cnl-ipc.c \ + dma-copy.c +endif + libipc_a_CFLAGS = \ $(ARCH_CFLAGS) \ $(ARCH_INCDIR) \ diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c new file mode 100644 index 0000000..cd5e825 --- /dev/null +++ b/src/ipc/cnl-ipc.c @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2017, 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: Liam Girdwood liam.r.girdwood@linux.intel.com + * Keyon Jie yang.jie@linux.intel.com + Rander Wang rander.wang@intel.com + */ + +#include <reef/debug.h> +#include <reef/timer.h> +#include <reef/interrupt.h> +#include <reef/ipc.h> +#include <reef/mailbox.h> +#include <reef/reef.h> +#include <reef/stream.h> +#include <reef/dai.h> +#include <reef/dma.h> +#include <reef/alloc.h> +#include <reef/wait.h> +#include <reef/trace.h> +#include <reef/ssp.h> +#include <platform/interrupt.h> +#include <platform/mailbox.h> +#include <platform/shim.h> +#include <platform/dma.h> +#include <platform/platform.h> +#include <reef/audio/component.h> +#include <reef/audio/pipeline.h> +#include <uapi/ipc.h> +#include <reef/intel-ipc.h> + +extern struct ipc *_ipc; + +/* test code to check working IRQ */ +static void irq_handler(void *arg) +{ + uint32_t dipctdr; + uint32_t dipcida; + uint32_t msg = 0; + + trace_ipc("IRQ"); + + dipctdr = ipc_read(IPC_DIPCTDR); + dipcida = ipc_read(IPC_DIPCIDA); + + /* new message from host */ + if (dipctdr & IPC_DIPCTDR_BUSY) { + trace_ipc("Nms"); + + /* mask Busy interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE); + + msg = dipctdr & IPC_DIPCTDR_MSG_MASK; + + /* TODO: place message in Q and process later */ + /* It's not Q ATM, may overwrite */ + if (_ipc->host_pending) + trace_ipc_error("Pen"); + _ipc->host_msg = msg; + _ipc->host_pending = 1; + } + + /* reply message(done) from host */ + if (dipcida & IPC_DIPCIDA_DONE) { + trace_ipc("Rpy"); + /* mask Done interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCIDIE); + + /* clear DONE bit - tell host we have completed the operation */ + ipc_write(IPC_DIPCIDA, ipc_read(IPC_DIPCIDA) |IPC_DIPCIDA_DONE); + + /* unmask Done interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) | IPC_DIPCCTL_IPCIDIE); + } + +} + +void ipc_platform_do_cmd(struct ipc *ipc) +{ + struct intel_ipc_data *iipc = ipc_get_drvdata(ipc); + struct sof_ipc_reply reply; + int32_t err; + + trace_ipc("Cmd"); + + /* perform command and return any error */ + err = ipc_cmd(); + if (err > 0) { + goto done; /* reply created and copied by cmd() */ + } else if (err < 0) { + /* send std error reply */ + reply.error = err; + } else if (err == 0) { + /* send std reply */ + reply.error = 0; + } + + /* send std error/ok reply */ + reply.hdr.cmd = SOF_IPC_GLB_REPLY; + reply.hdr.size = sizeof(reply); + mailbox_hostbox_write(0, &reply, sizeof(reply)); + +done: + ipc->host_pending = 0; + + /* write 1 to clear busy, and trigger interrupt to host*/ + ipc_write(IPC_DIPCTDR, ipc_read(IPC_DIPCTDR) |IPC_DIPCTDR_BUSY); + ipc_write(IPC_DIPCTDA, ipc_read(IPC_DIPCTDA) |IPC_DIPCTDA_BUSY ); + + /* unmask Busy interrupt */ + ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) | IPC_DIPCCTL_IPCTBIE); + + // TODO: signal audio work to enter D3 in normal context + /* are we about to enter D3 ? */ + if (iipc->pm_prepare_D3) { + while (1) + wait_for_interrupt(0); + } + + tracev_ipc("CmD"); +} + +void ipc_platform_send_msg(struct ipc *ipc) +{ + struct ipc_msg *msg; + uint32_t flags; + + spin_lock_irq(&ipc->lock, flags); + + /* any messages to send ? */ + if (list_is_empty(&ipc->msg_list)) { + ipc->dsp_pending = 0; + goto out; + } + + /* now send the message */ + msg = list_first_item(&ipc->msg_list, struct ipc_msg, list); + mailbox_dspbox_write(0, msg->tx_data, msg->tx_size); + list_item_del(&msg->list); + ipc->dsp_msg = msg; + tracev_ipc("Msg"); + + /* now interrupt host to tell it we have message sent */ + ipc_write(IPC_DIPCIDD, 0); + ipc_write(IPC_DIPCIDR, 0x80000000 | msg->header); + +out: + spin_unlock_irq(&ipc->lock, flags); +} + +int platform_ipc_init(struct ipc *ipc) +{ + struct intel_ipc_data *iipc; + int i; + + _ipc = ipc; + + /* init ipc data */ + iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data)); + ipc_set_drvdata(_ipc, iipc); + _ipc->dsp_msg = NULL; + list_init(&ipc->empty_list); + list_init(&ipc->msg_list); + spinlock_init(&ipc->lock); + for (i = 0; i < MSG_QUEUE_SIZE; i++) + list_item_prepend(&ipc->message[i].list, &ipc->empty_list); + + /* allocate page table buffer */ + iipc->page_table = rballoc(RZONE_SYS, RFLAGS_NONE, + HOST_PAGE_SIZE); + if (iipc->page_table) + bzero(iipc->page_table, HOST_PAGE_SIZE); + + /* dma */ + iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0); + + /* PM */ + iipc->pm_prepare_D3 = 0; + + /* configure interrupt */ + interrupt_register(PLATFORM_IPC_INTERUPT, irq_handler, NULL); + interrupt_enable(PLATFORM_IPC_INTERUPT); + + /* enable IPC interrupts from host */ + ipc_write(IPC_DIPCCTL, IPC_DIPCCTL_IPCIDIE | IPC_DIPCCTL_IPCTBIE); + + return 0; +}
Build the Intel Cannonklake platform.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- configure.ac | 27 ++++++++++++ src/arch/xtensa/Makefile.am | 91 +++++++++++++++++++++++++++++++++++++--- src/arch/xtensa/hal/Makefile.am | 34 +++++++++++++++ src/arch/xtensa/xtos/Makefile.am | 6 +++ src/platform/Makefile.am | 4 ++ 5 files changed, 156 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac index 744d815..d37fc67 100644 --- a/configure.ac +++ b/configure.ac @@ -157,6 +157,23 @@ case "$with_platform" in AC_DEFINE([CONFIG_BROADWELL], [1], [Configure for Broadwell]) AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table]) ;; + cannonlake*) + + PLATFORM_LDSCRIPT="cannonlake.x" + AC_SUBST(PLATFORM_LDSCRIPT) + + PLATFORM="cannonlake" + AC_SUBST(PLATFORM) + + FW_NAME="cnl" + AC_SUBST(FW_NAME) + + XTENSA_CORE="hifi4_std" + AC_SUBST(XTENSA_CORE) + + AC_DEFINE([CONFIG_CANNONLAKE], [1], [Configure for Cannonlake]) + AC_DEFINE([CONFIG_IRQ_MAP], [1], [Configure IRQ maps]) + ;; *) AC_MSG_ERROR([Host platform not specified]) ;; @@ -167,6 +184,8 @@ AM_CONDITIONAL(BUILD_CHERRYTRAIL, test "$FW_NAME" = "cht") AM_CONDITIONAL(BUILD_HASWELL, test "$FW_NAME" = "hsw") AM_CONDITIONAL(BUILD_BROADWELL, test "$FW_NAME" = "bdw") AM_CONDITIONAL(BUILD_APOLLOLAKE, test "$FW_NAME" = "apl") +AM_CONDITIONAL(BUILD_CANNONLAKE, test "$FW_NAME" = "cnl") +AM_CONDITIONAL(BUILD_BOOTLOADER, test "$FW_NAME" = "cnl") AM_CONDITIONAL(BUILD_MODULE, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
# DSP core support (Optional) @@ -193,6 +212,9 @@ AS_IF([test "x$enable_dma_trace" != "xno"], [
AM_CONDITIONAL(BUILD_DMA_TRACE, test "x$enable_dma_trace" != "xno")
+PLATFORM_BOOT_LDR_LDSCRIPT="boot_ldr.x" +AC_SUBST(PLATFORM_BOOT_LDR_LDSCRIPT) + # Test after CFLAGS set othewise test of cross compiler fails. AM_PROG_AS AM_PROG_AR @@ -246,6 +268,11 @@ AC_CONFIG_FILES([ src/platform/haswell/include/platform/Makefile src/platform/haswell/include/xtensa/Makefile src/platform/haswell/include/xtensa/config/Makefile + src/platform/cannonlake/Makefile + src/platform/cannonlake/include/Makefile + src/platform/cannonlake/include/platform/Makefile + src/platform/cannonlake/include/xtensa/Makefile + src/platform/cannonlake/include/xtensa/config/Makefile ]) AC_OUTPUT
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index 32e4aa5..b055a82 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -35,6 +35,11 @@ reef_SOURCES = \ timer.c \ task.c
+if BUILD_CANNONLAKE +reef_SOURCES += \ + main-entry.S +endif + reef_CFLAGS = \ $(ARCH_INCDIR) \ $(ARCH_CFLAGS) \ @@ -69,17 +74,91 @@ reef_LDFLAGS = \ $(ARCH_LDFLAGS) -Wl,-Map=reef-$(FW_NAME).map \ -T ../../platform/$(PLATFORM)/$(PLATFORM_LDSCRIPT)
-bin-local: reef - $(OBJCOPY) -O binary reef reef-$(FW_NAME).bin - $(OBJDUMP) -S reef > reef-$(FW_NAME).lst - $(OBJDUMP) -D reef > reef-$(FW_NAME).dis - rimage -i reef -o reef-$(FW_NAME).ri -m $(FW_NAME) +RIMAGE_FLAGS = reef-$(FW_NAME) +RIMAGE_BOOT_FLAGS = +BIN_FLAGS = reef + +if BUILD_BOOTLOADER + +noinst_PROGRAMS += \ + boot_ldr + +LINK_BOOT_LDR_SCRIPT = ../../platform/$(PLATFORM)/$(PLATFORM_BOOT_LDR_LDSCRIPT) +BUILT_SOURCES += $(LINK_BOOT_LDR_SCRIPT) +CLEANFILES += $(LINK_BOOT_LDR_SCRIPT) + +nodist_boot_ldr_SOURCES = $(LINK_BOOT_LDR_SCRIPT).in +$(LINK_BOOT_LDR_SCRIPT): Makefile $(LINK_BOOT_LDR_SCRIPT).in $(LINK_DEPS) + cat $(LINK_BOOT_LDR_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(REEF_INCDIR) - >$@ + +boot_ldr_SOURCES = \ + boot_entry.S \ + _vectors.S \ + boot_loader.c + +boot_ldr_CFLAGS = \ + $(ARCH_INCDIR) \ + $(ARCH_CFLAGS) \ + $(REEF_INCDIR) \ + $(PLATFORM_INCDIR) + +boot_ldr_CCASFLAGS = \ + $(ARCH_INCDIR) \ + $(ASFLAGS) \ + $(ARCH_ASFLAGS) \ + $(PLATFORM_INCDIR) + +boot_ldr_LDADD = \ + hal/libhal.a \ + libreset.a \ + xtos/libxtos.a \ + xtos/libxlevel2.a \ + xtos/libxlevel3.a \ + xtos/libxlevel4.a \ + xtos/libxlevel5.a \ + -lgcc + +boot_ldr_LDFLAGS = \ + $(ARCH_LDFLAGS) \ + -T ../../platform/$(PLATFORM)/$(PLATFORM_BOOT_LDR_LDSCRIPT) + +boot_ldr-local: + cp boot_ldr boot_ldr-$(FW_NAME) + $(OBJCOPY) -O binary ../../platform/$(PLATFORM)/boot_module mod-boot-$(FW_NAME).bin + $(OBJCOPY) --add-section .module=mod-boot-$(FW_NAME).bin \ + --set-section-flags .module=load,readonly boot_ldr-$(FW_NAME) + $(OBJCOPY) -O binary boot_ldr boot_ldr-$(FW_NAME).bin + $(OBJDUMP) -h -D boot_ldr > boot_ldr-$(FW_NAME).map + $(OBJDUMP) -S boot_ldr > boot_ldr-$(FW_NAME).lst + $(OBJDUMP) -D boot_ldr > boot_ldr-$(FW_NAME).dis + +RIMAGE_BOOT_FLAGS += boot_ldr-$(FW_NAME) +BIN_FLAGS +=boot_ldr-local +endif + +if BUILD_MODULE +MODULE_COPY=$(OBJCOPY) -O binary ../../platform/$(PLATFORM)/module mod-$(FW_NAME).bin +MODULE_INSERT=$(OBJCOPY) --add-section .module=mod-$(FW_NAME).bin \ + --set-section-flags .module=load,readonly reef-$(FW_NAME) +else +MODULE_COPY= +MODULE_INSERT= +endif + +bin-local: $(BIN_FLAGS) + cp reef reef-$(FW_NAME) + $(MODULE_COPY) + $(MODULE_INSERT) + $(OBJDUMP) -S reef-$(FW_NAME) > reef-$(FW_NAME).lst + $(OBJDUMP) -D reef-$(FW_NAME) > reef-$(FW_NAME).dis + rimage -o reef-$(FW_NAME).ri -m $(FW_NAME) $(RIMAGE_BOOT_FLAGS) $(RIMAGE_FLAGS)
vminstall-local: scp -P 5555 reef-*.ri root@localhost:/lib/firmware/intel/
clean-local: - rm -f reef-*.bin + rm -fr mod-* + rm -fr *.bin rm -fr *.lst rm -fr *.map rm -fr *.dis diff --git a/src/arch/xtensa/hal/Makefile.am b/src/arch/xtensa/hal/Makefile.am index 247473e..d9c3a55 100644 --- a/src/arch/xtensa/hal/Makefile.am +++ b/src/arch/xtensa/hal/Makefile.am @@ -41,6 +41,31 @@ STATE_DEFS = \ -D__SPLIT__get_cpenable \ -D__SPLIT__set_cpenable
+STATE_DEFS_CNL = \ + -D__SPLIT__extra_size \ + -D__SPLIT__extra_align \ + -D__SPLIT__cpregs_size \ + -D__SPLIT__cpregs_align \ + -D__SPLIT__cp_names \ + -D__SPLIT__all_extra_size \ + -D__SPLIT__all_extra_align \ + -D__SPLIT__num_coprocessors \ + -D__SPLIT__cp_num \ + -D__SPLIT__cp_max \ + -D__SPLIT__cp_mask \ + -D__SPLIT__cp_id_mappings \ + -D__SPLIT__cp_mask_mappings \ + -D__SPLIT__init_mem_extra \ + -D__SPLIT__init_mem_cp \ + -D__SPLIT__save_extra \ + -D__SPLIT__restore_extra \ + -D__SPLIT__cpregs_save_fn \ + -D__SPLIT__cpregs_restore_fn \ + -D__SPLIT__validate_cp \ + -D__SPLIT__invalidate_cp \ + -D__SPLIT__get_cpenable \ + -D__SPLIT__set_cpenable + DISASS_DEFS = \ -D__SPLIT__op0_format_lengths \ -D__SPLIT__byte0_format_lengths \ @@ -161,6 +186,15 @@ PLATFORM_DEFS = \ $(CACHE_DEFS) endif
+if BUILD_CANNONLAKE +PLATFORM_DEFS = \ + $(STATE_DEFS_CNL) \ + $(DISASS_DEFS) \ + $(MISC_DEFS) \ + $(INTERRUPTS_DEFS) \ + $(CACHE_DEFS) +endif + noinst_LIBRARIES = libhal.a
libhal_a_SOURCES = \ diff --git a/src/arch/xtensa/xtos/Makefile.am b/src/arch/xtensa/xtos/Makefile.am index 9fff986..2e855e7 100644 --- a/src/arch/xtensa/xtos/Makefile.am +++ b/src/arch/xtensa/xtos/Makefile.am @@ -45,6 +45,12 @@ if BUILD_HASWELL PLATFORM_DEFS = $(VECTOR_DEFS) endif
+if BUILD_CANNONLAKE +PLATFORM_DEFS = $(VECTOR_DEFS) +noinst_LIBRARIES += libxlevel6.a +VECTOR_DEFS += -D__SPLIT__level6 +endif + LEVEL_SRC = \ int-handler.S \ int-vector.S \ diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am index 79446d0..93742b0 100644 --- a/src/platform/Makefile.am +++ b/src/platform/Makefile.am @@ -17,3 +17,7 @@ endif if BUILD_BROADWELL SUBDIRS = haswell endif + +if BUILD_CANNONLAKE +SUBDIRS = cannonlake +endif
participants (2)
-
Liam Girdwood
-
Pierre-Louis Bossart