From 2e2f669176f43d9981a709a66bcdf1c6f36bad49 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Tue, 19 Jun 2018 17:30:16 +0200 Subject: [PATCH] platform: extract number of available cores Extracts number of available cores to platform/platcfg.h. This header is asm friendly and can be easily used in xtos. Signed-off-by: Tomasz Lauda --- .../apollolake/include/platform/Makefile.am | 1 + .../apollolake/include/platform/platcfg.h | 2 ++ .../apollolake/include/platform/platform.h | 2 -- src/platform/apollolake/interrupt.c | 3 +- .../baytrail/include/platform/Makefile.am | 1 + .../baytrail/include/platform/platcfg.h | 36 +++++++++++++++++++ .../cannonlake/include/platform/Makefile.am | 1 + .../cannonlake/include/platform/platcfg.h | 2 ++ .../cannonlake/include/platform/platform.h | 2 -- src/platform/cannonlake/interrupt.c | 3 +- .../haswell/include/platform/Makefile.am | 1 + .../haswell/include/platform/platcfg.h | 36 +++++++++++++++++++ 12 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 src/platform/baytrail/include/platform/platcfg.h create mode 100644 src/platform/haswell/include/platform/platcfg.h diff --git a/src/platform/apollolake/include/platform/Makefile.am b/src/platform/apollolake/include/platform/Makefile.am index af8ef7807..051a51ccf 100644 --- a/src/platform/apollolake/include/platform/Makefile.am +++ b/src/platform/apollolake/include/platform/Makefile.am @@ -4,6 +4,7 @@ noinst_HEADERS = \ interrupt.h \ mailbox.h \ memory.h \ + platcfg.h \ platform.h \ pm_runtime.h \ shim.h \ diff --git a/src/platform/apollolake/include/platform/platcfg.h b/src/platform/apollolake/include/platform/platcfg.h index 0875db333..c0f1dfe16 100644 --- a/src/platform/apollolake/include/platform/platcfg.h +++ b/src/platform/apollolake/include/platform/platcfg.h @@ -35,4 +35,6 @@ #define PLATFORM_DISABLE_L2CACHE_AT_BOOT 1 +#define PLATFORM_CORE_COUNT 2 + #endif diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h index 39f85498b..51e12f49d 100644 --- a/src/platform/apollolake/include/platform/platform.h +++ b/src/platform/apollolake/include/platform/platform.h @@ -41,8 +41,6 @@ struct sof; -#define MAX_CORE_COUNT 2 - /* Host page size */ #define HOST_PAGE_SIZE 4096 #define PLATFORM_PAGE_TABLE_SIZE 256 diff --git a/src/platform/apollolake/interrupt.c b/src/platform/apollolake/interrupt.c index 7d4d3640a..d18373c2d 100644 --- a/src/platform/apollolake/interrupt.c +++ b/src/platform/apollolake/interrupt.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,7 @@ static void irq_lvl2_level5_handler(void *data) } /* DSP internal interrupts */ -static struct irq_desc dsp_irq[MAX_CORE_COUNT][4] = { +static struct irq_desc dsp_irq[PLATFORM_CORE_COUNT][4] = { {{IRQ_NUM_EXT_LEVEL2, irq_lvl2_level2_handler, }, {IRQ_NUM_EXT_LEVEL3, irq_lvl2_level3_handler, }, {IRQ_NUM_EXT_LEVEL4, irq_lvl2_level4_handler, }, diff --git a/src/platform/baytrail/include/platform/Makefile.am b/src/platform/baytrail/include/platform/Makefile.am index 48a7f5bb0..5a6c224a6 100644 --- a/src/platform/baytrail/include/platform/Makefile.am +++ b/src/platform/baytrail/include/platform/Makefile.am @@ -4,6 +4,7 @@ noinst_HEADERS = \ interrupt.h \ mailbox.h \ memory.h \ + platcfg.h \ platform.h \ pm_runtime.h \ pmc.h \ diff --git a/src/platform/baytrail/include/platform/platcfg.h b/src/platform/baytrail/include/platform/platcfg.h new file mode 100644 index 000000000..431277d70 --- /dev/null +++ b/src/platform/baytrail/include/platform/platcfg.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Marcin Maka + */ + +#ifndef __PLATFORM_PLATCFG_H__ +#define __PLATFORM_PLATCFG_H__ + +#define PLATFORM_CORE_COUNT 1 + +#endif diff --git a/src/platform/cannonlake/include/platform/Makefile.am b/src/platform/cannonlake/include/platform/Makefile.am index af8ef7807..051a51ccf 100644 --- a/src/platform/cannonlake/include/platform/Makefile.am +++ b/src/platform/cannonlake/include/platform/Makefile.am @@ -4,6 +4,7 @@ noinst_HEADERS = \ interrupt.h \ mailbox.h \ memory.h \ + platcfg.h \ platform.h \ pm_runtime.h \ shim.h \ diff --git a/src/platform/cannonlake/include/platform/platcfg.h b/src/platform/cannonlake/include/platform/platcfg.h index f51ee4f40..cf95c2934 100644 --- a/src/platform/cannonlake/include/platform/platcfg.h +++ b/src/platform/cannonlake/include/platform/platcfg.h @@ -33,4 +33,6 @@ #define PLATFORM_RESET_MHE_AT_BOOT 1 +#define PLATFORM_CORE_COUNT 4 + #endif diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h index b3e5f7404..1904bd5dc 100644 --- a/src/platform/cannonlake/include/platform/platform.h +++ b/src/platform/cannonlake/include/platform/platform.h @@ -47,8 +47,6 @@ struct sof; #define PLATFORM_SSP_COUNT 3 #define MAX_GPDMA_COUNT 2 -#define MAX_CORE_COUNT 4 - /* Host page size */ #define HOST_PAGE_SIZE 4096 #define PLATFORM_PAGE_TABLE_SIZE 256 diff --git a/src/platform/cannonlake/interrupt.c b/src/platform/cannonlake/interrupt.c index 949b923e2..6f5ef17e8 100644 --- a/src/platform/cannonlake/interrupt.c +++ b/src/platform/cannonlake/interrupt.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,7 @@ static void irq_lvl2_level5_handler(void *data) } /* DSP internal interrupts */ -static struct irq_desc dsp_irq[MAX_CORE_COUNT][4] = { +static struct irq_desc dsp_irq[PLATFORM_CORE_COUNT][4] = { {{IRQ_NUM_EXT_LEVEL2, irq_lvl2_level2_handler, }, {IRQ_NUM_EXT_LEVEL3, irq_lvl2_level3_handler, }, {IRQ_NUM_EXT_LEVEL4, irq_lvl2_level4_handler, }, diff --git a/src/platform/haswell/include/platform/Makefile.am b/src/platform/haswell/include/platform/Makefile.am index af8ef7807..051a51ccf 100644 --- a/src/platform/haswell/include/platform/Makefile.am +++ b/src/platform/haswell/include/platform/Makefile.am @@ -4,6 +4,7 @@ noinst_HEADERS = \ interrupt.h \ mailbox.h \ memory.h \ + platcfg.h \ platform.h \ pm_runtime.h \ shim.h \ diff --git a/src/platform/haswell/include/platform/platcfg.h b/src/platform/haswell/include/platform/platcfg.h new file mode 100644 index 000000000..431277d70 --- /dev/null +++ b/src/platform/haswell/include/platform/platcfg.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Marcin Maka + */ + +#ifndef __PLATFORM_PLATCFG_H__ +#define __PLATFORM_PLATCFG_H__ + +#define PLATFORM_CORE_COUNT 1 + +#endif