Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/arch/xtensa/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ nodist_sof_SOURCES = $(LINK_SCRIPT).in
BUILT_SOURCES = $(LINK_SCRIPT)
CLEANFILES = $(LINK_SCRIPT)
$(LINK_SCRIPT): Makefile $(LINK_SCRIPT).in $(LINK_DEPS)
cat $(LINK_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(SOF_INCDIR) - >$@
cat $(LINK_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(SOF_INCDIR) $(ARCH_INCDIR) - >$@

noinst_LIBRARIES = \
libreset.a
Expand Down Expand Up @@ -144,7 +144,7 @@ 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) $(SOF_INCDIR) - >$@
cat $(LINK_BOOT_LDR_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(SOF_INCDIR) $(ARCH_INCDIR) - >$@

boot_ldr_SOURCES = \
boot_entry.S \
Expand Down
3 changes: 2 additions & 1 deletion src/arch/xtensa/smp/include/arch/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
noinst_HEADERS = \
alloc.h \
idc.h
idc.h \
memory.h
48 changes: 48 additions & 0 deletions src/arch/xtensa/smp/include/arch/memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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: Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

/**
* \file arch/xtensa/smp/include/arch/memory.h
* \brief Xtensa SMP memory header file
* \authors Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

#ifndef __ARCH_MEMORY_H__
#define __ARCH_MEMORY_H__

#include <platform/platcfg.h>

/** \brief Stack size. */
#define ARCH_STACK_SIZE 0x1000

/** \brief Stack total size. */
#define ARCH_STACK_TOTAL_SIZE (PLATFORM_CORE_COUNT * ARCH_STACK_SIZE)

#endif
21 changes: 2 additions & 19 deletions src/arch/xtensa/smp/xtos/crt1-boards.S
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <xtensa/coreasm.h>
#include "xtos-internal.h"
#include <config.h>
#include <arch/memory.h>


// Exports
Expand Down Expand Up @@ -64,24 +65,6 @@
#endif

/**************************************************************************/
.macro generate_stack_for_idle core_id
.if GREATERTHAN(PLATFORM_CORE_COUNT, \core_id)
.section .bss, "aw"
.align XTOS_IDLE_STACK_SIZE
.if EQUAL(0, \core_id)
.global _stack_start
_stack_start:
.endif
.global _stack_start&core_id
_stack_start&core_id:
.space XTOS_IDLE_STACK_SIZE
.endif
.endm

generate_stack_for_idle 0
generate_stack_for_idle 1
generate_stack_for_idle 2
generate_stack_for_idle 3

.text
.align 4
Expand Down Expand Up @@ -248,7 +231,7 @@ xtos_per_core_init_interrupt_mask:

// Assign stack ptr before PS is initialized to avoid any debugger
// side effects and prevent from double exception.
xtos_stack_addr_percore_basic sp, a3, _stack_start, XTOS_IDLE_STACK_SIZE
xtos_stack_addr_percore_basic sp, a3, _stack_sentry, ARCH_STACK_SIZE

/*
* Now that sp (a1) is set, we can set PS as per the application
Expand Down
1 change: 0 additions & 1 deletion src/arch/xtensa/smp/xtos/xtos-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ extern void xtos_unhandled_interrupt();
#define EQUAL(a, b) ((1 << (a)) & (1 << (b)))

#define XTOS_INT_STACK_SIZE 4096
#define XTOS_IDLE_STACK_SIZE 4096

// sizeof(xtos_enabled)
#define XTOS_ENABLED_SIZE_PER_CORE (4)
Expand Down
3 changes: 2 additions & 1 deletion src/arch/xtensa/up/include/arch/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
noinst_HEADERS = \
idc.h
idc.h \
memory.h
46 changes: 46 additions & 0 deletions src/arch/xtensa/up/include/arch/memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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: Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

/**
* \file arch/xtensa/up/include/arch/memory.h
* \brief Xtensa UP memory header file
* \authors Tomasz Lauda <tomasz.lauda@linux.intel.com>
*/

#ifndef __ARCH_MEMORY_H__
#define __ARCH_MEMORY_H__

/** \brief Stack size. */
#define ARCH_STACK_SIZE 0x1000

/** \brief Stack total size. */
#define ARCH_STACK_TOTAL_SIZE ARCH_STACK_SIZE

#endif
7 changes: 4 additions & 3 deletions src/include/sof/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include <sof/sof.h>
#include <sof/mailbox.h>
#include <sof/cpu.h>
#include <uapi/ipc.h>
#include <platform/platform.h>
#include <stdint.h>
Expand Down Expand Up @@ -131,10 +132,10 @@
static inline uint32_t dump_stack(uint32_t p, void *addr, size_t offset,
size_t limit)
{
extern void *__stack;
extern void *_stack_sentry;
void *stack_bottom = (void *)&__stack - sizeof(void *);
void *stack_limit = (void *)&_stack_sentry;
void *stack_limit = (void *)&_stack_sentry +
(cpu_get_id() * SOF_STACK_SIZE);
void *stack_bottom = stack_limit + SOF_STACK_SIZE - sizeof(void *);
void *stack_top = arch_get_stack_ptr() + offset;
size_t size = stack_bottom - stack_top;

Expand Down
1 change: 1 addition & 0 deletions src/library/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#endif

#define HEAP_BUFFER_SIZE (1024 * 128)
#define SOF_STACK_SIZE 0x1000

#if 0
/* physical DSP addresses */
Expand Down
2 changes: 1 addition & 1 deletion src/platform/apollolake/apollolake.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
6 changes: 4 additions & 2 deletions src/platform/apollolake/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define __PLATFORM_MEMORY_H__

#include <config.h>
#include <arch/memory.h>

/* physical DSP addresses */

Expand Down Expand Up @@ -264,9 +265,10 @@
#define SOF_BSS_DATA_SIZE 0x9000

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
#define SOF_STACK_SIZE ARCH_STACK_SIZE
#define SOF_STACK_TOTAL_SIZE ARCH_STACK_TOTAL_SIZE
#define SOF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_TOTAL_SIZE)

/*
* The LP SRAM Heap and Stack on Apollolake are organised like this :-
Expand Down
2 changes: 1 addition & 1 deletion src/platform/baytrail/baytrail.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
10 changes: 6 additions & 4 deletions src/platform/baytrail/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define __PLATFORM_MEMORY_H__

#include <config.h>
#include <arch/memory.h>

/* physical DSP addresses */

Expand Down Expand Up @@ -128,7 +129,7 @@

#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE)
#define HEAP_BUFFER_SIZE \
(DRAM0_SIZE - HEAP_RUNTIME_SIZE - SOF_STACK_SIZE -\
(DRAM0_SIZE - HEAP_RUNTIME_SIZE - SOF_STACK_TOTAL_SIZE -\
HEAP_SYSTEM_SIZE - SOF_DATA_SIZE)

#define HEAP_BUFFER_BLOCK_SIZE 0x180
Expand All @@ -139,9 +140,10 @@
#define PLATFORM_HEAP_BUFFER 1

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
#define SOF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_SIZE)
#define SOF_STACK_SIZE ARCH_STACK_SIZE
#define SOF_STACK_TOTAL_SIZE ARCH_STACK_TOTAL_SIZE
#define SOF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_TOTAL_SIZE)

/* Vector and literal sizes - not in core-isa.h */
#define SOF_MEM_VECT_LIT_SIZE 0x4
Expand Down
2 changes: 1 addition & 1 deletion src/platform/cannonlake/cannonlake.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
8 changes: 5 additions & 3 deletions src/platform/cannonlake/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define __PLATFORM_MEMORY_H__

#include <config.h>
#include <arch/memory.h>

/* physical DSP addresses */

Expand Down Expand Up @@ -270,9 +271,10 @@
HEAP_RT_COUNT1024 * 1024)

/* Stack configuration */
#define SOF_STACK_SIZE 0x2000
#define SOF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_SIZE)
#define SOF_STACK_SIZE ARCH_STACK_SIZE
#define SOF_STACK_TOTAL_SIZE ARCH_STACK_TOTAL_SIZE
#define SOF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_TOTAL_SIZE)

#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE)
#define HEAP_BUFFER_SIZE \
Expand Down
2 changes: 1 addition & 1 deletion src/platform/haswell/broadwell.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
2 changes: 1 addition & 1 deletion src/platform/haswell/haswell.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
10 changes: 6 additions & 4 deletions src/platform/haswell/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define __PLATFORM_MEMORY_H__

#include <config.h>
#include <arch/memory.h>

/* physical DSP addresses */

Expand Down Expand Up @@ -123,7 +124,7 @@

#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE)
#define HEAP_BUFFER_SIZE \
(DRAM0_SIZE - HEAP_RUNTIME_SIZE - SOF_STACK_SIZE -\
(DRAM0_SIZE - HEAP_RUNTIME_SIZE - SOF_STACK_TOTAL_SIZE -\
HEAP_SYSTEM_SIZE - SOF_DATA_SIZE - MAILBOX_SIZE)

#define HEAP_BUFFER_BLOCK_SIZE 0x180
Expand All @@ -134,9 +135,10 @@
#define PLATFORM_HEAP_BUFFER 1

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
#define SOF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_SIZE)
#define SOF_STACK_SIZE ARCH_STACK_SIZE
#define SOF_STACK_TOTAL_SIZE ARCH_STACK_TOTAL_SIZE
#define SOF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_TOTAL_SIZE)

#define MAILBOX_BASE (SOF_STACK_END - MAILBOX_SIZE)

Expand Down
2 changes: 1 addition & 1 deletion src/platform/icelake/icelake.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ SECTIONS
{
. = ALIGN (4096);
_sof_stack_start = ABSOLUTE(.);
. = . + SOF_STACK_SIZE;
. = . + SOF_STACK_TOTAL_SIZE;
_sof_stack_end = ABSOLUTE(.);
} >sof_stack :sof_stack_phdr

Expand Down
8 changes: 5 additions & 3 deletions src/platform/icelake/include/platform/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define __PLATFORM_MEMORY_H__

#include <config.h>
#include <arch/memory.h>

/* physical DSP addresses */

Expand Down Expand Up @@ -270,9 +271,10 @@
HEAP_RT_COUNT1024 * 1024)

/* Stack configuration */
#define SOF_STACK_SIZE 0x2000
#define SOF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_SIZE)
#define SOF_STACK_SIZE ARCH_STACK_SIZE
#define SOF_STACK_TOTAL_SIZE ARCH_STACK_TOTAL_SIZE
#define SOF_STACK_BASE (HP_SRAM_BASE + HP_SRAM_SIZE)
#define SOF_STACK_END (SOF_STACK_BASE - SOF_STACK_TOTAL_SIZE)

#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE)
#define HEAP_BUFFER_SIZE \
Expand Down
Loading