[Sound-open-firmware] [PATCH 2/3] sof: solve circular dependencies, move rmemcpy/arch_memcpy definitions
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Tue Apr 3 15:57:17 CEST 2018
The preprocessor doesn't seem to care about circular dependencies,
the compiler does. So before we replace multi-line macros with
static inlines, move rmemcpy/arch_memcpy to a reef/string.h and
arch/string.h header file.
This is mostly useful for the mailbox functions, which depend on rmemcpy
but are also called from arch/reef.h dump/panic utilities
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
src/arch/xtensa/include/arch/reef.h | 5 ----
src/arch/xtensa/include/arch/string.h | 40 +++++++++++++++++++++++++++++
src/include/reef/mailbox.h | 1 +
src/include/reef/string.h | 47 +++++++++++++++++++++++++++++++++++
4 files changed, 88 insertions(+), 5 deletions(-)
create mode 100644 src/arch/xtensa/include/arch/string.h
create mode 100644 src/include/reef/string.h
diff --git a/src/arch/xtensa/include/arch/reef.h b/src/arch/xtensa/include/arch/reef.h
index 592221e..7f9b7db 100644
--- a/src/arch/xtensa/include/arch/reef.h
+++ b/src/arch/xtensa/include/arch/reef.h
@@ -40,11 +40,6 @@
/* architecture specific stack frames to dump */
#define ARCH_STACK_DUMP_FRAMES 32
-void *xthal_memcpy(void *dst, const void *src, size_t len);
-
-#define arch_memcpy(dest, src, size) \
- xthal_memcpy(dest, src, size)
-
static inline void *arch_get_stack_ptr(void)
{
void *ptr;
diff --git a/src/arch/xtensa/include/arch/string.h b/src/arch/xtensa/include/arch/string.h
new file mode 100644
index 0000000..73f78bc
--- /dev/null
+++ b/src/arch/xtensa/include/arch/string.h
@@ -0,0 +1,40 @@
+/*
+ * 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 at linux.intel.com>
+ *
+ */
+
+#ifndef __INCLUDE_ARCH_STRING_REEF__
+#define __INCLUDE_ARCH_STRING_REEF__
+
+void *xthal_memcpy(void *dst, const void *src, size_t len);
+
+#define arch_memcpy(dest, src, size) \
+ xthal_memcpy(dest, src, size)
+
+#endif
diff --git a/src/include/reef/mailbox.h b/src/include/reef/mailbox.h
index f134548..cedfbb7 100644
--- a/src/include/reef/mailbox.h
+++ b/src/include/reef/mailbox.h
@@ -34,6 +34,7 @@
#include <platform/mailbox.h>
#include <arch/cache.h>
#include <stdint.h>
+#include <reef/string.h>
/* 4k should be enough for everyone ..... */
#define IPC_MAX_MAILBOX_BYTES 0x1000
diff --git a/src/include/reef/string.h b/src/include/reef/string.h
new file mode 100644
index 0000000..42f47c9
--- /dev/null
+++ b/src/include/reef/string.h
@@ -0,0 +1,47 @@
+/*
+ * 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 at linux.intel.com>
+ */
+
+#ifndef __INCLUDE_STRING_REEF__
+#define __INCLUDE_STRING_REEF__
+
+#include <arch/string.h>
+
+/* C memcpy for arch that don't have arch_memcpy() */
+void cmemcpy(void *dest, void *src, size_t size);
+
+#if defined(arch_memcpy)
+#define rmemcpy(dest, src, size) \
+ arch_memcpy(dest, src, size)
+#else
+#define rmemcpy(dest, src, size) \
+ cmemcpy(dest, src, size)
+#endif
+
+#endif
--
2.14.1
More information about the Sound-open-firmware
mailing list