[Sound-open-firmware] [PATCH 06/10] platform: extract number of available cores
Liam Girdwood
liam.r.girdwood at linux.intel.com
Thu Jun 21 12:12:04 CEST 2018
From: Tomasz Lauda <tomasz.lauda at linux.intel.com>
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 <tomasz.lauda at linux.intel.com>
---
.../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 af8ef78..051a51c 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 0875db3..c0f1dfe 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 39f8549..51e12f4 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 7d4d364..d18373c 100644
--- a/src/platform/apollolake/interrupt.c
+++ b/src/platform/apollolake/interrupt.c
@@ -36,6 +36,7 @@
#include <arch/cpu.h>
#include <arch/interrupt.h>
#include <platform/interrupt.h>
+#include <platform/platcfg.h>
#include <platform/shim.h>
#include <stdint.h>
#include <stdlib.h>
@@ -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 48a7f5b..5a6c224 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 0000000..431277d
--- /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 <marcin.maka at linux.intel.com>
+ */
+
+#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 af8ef78..051a51c 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 f51ee4f..cf95c29 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 b3e5f74..1904bd5 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 949b923..6f5ef17 100644
--- a/src/platform/cannonlake/interrupt.c
+++ b/src/platform/cannonlake/interrupt.c
@@ -36,6 +36,7 @@
#include <arch/interrupt.h>
#include <arch/cpu.h>
#include <platform/interrupt.h>
+#include <platform/platcfg.h>
#include <platform/shim.h>
#include <stdint.h>
#include <stdlib.h>
@@ -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 af8ef78..051a51c 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 0000000..431277d
--- /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 <marcin.maka at linux.intel.com>
+ */
+
+#ifndef __PLATFORM_PLATCFG_H__
+#define __PLATFORM_PLATCFG_H__
+
+#define PLATFORM_CORE_COUNT 1
+
+#endif
--
2.17.0
More information about the Sound-open-firmware
mailing list