summaryrefslogtreecommitdiff
path: root/arch/sandbox/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/include/asm')
-rw-r--r--arch/sandbox/include/asm/atomic.h15
-rw-r--r--arch/sandbox/include/asm/dma-mapping.h27
-rw-r--r--arch/sandbox/include/asm/io.h14
-rw-r--r--arch/sandbox/include/asm/processor.h3
-rw-r--r--arch/sandbox/include/asm/system.h3
5 files changed, 59 insertions, 3 deletions
diff --git a/arch/sandbox/include/asm/atomic.h b/arch/sandbox/include/asm/atomic.h
new file mode 100644
index 00000000000..2fe49f52f34
--- /dev/null
+++ b/arch/sandbox/include/asm/atomic.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Based on arch/riscv/include/asm/atomic.h which is:
+ * Copyright 2023 SiFive, Inc.
+ */
+
+#ifndef __SANDBOX_ATOMIC_H
+#define __SANDBOX_ATOMIC_H
+
+/* use the generic asm/atomic.h until we define a better one */
+
+#include <asm/system.h>
+#include <asm-generic/atomic.h>
+
+#endif
diff --git a/arch/sandbox/include/asm/dma-mapping.h b/arch/sandbox/include/asm/dma-mapping.h
index 853b0877b33..410760c2231 100644
--- a/arch/sandbox/include/asm/dma-mapping.h
+++ b/arch/sandbox/include/asm/dma-mapping.h
@@ -1 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copied from arch/arm/include/asm/dma-mapping.h which is:
+ *
+ * (C) Copyright 2007
+ * Stelian Pop <stelian@popies.net>
+ * Lead Tech Design <www.leadtechdesign.com>
+ */
+
+#ifndef __ASM_SANDBOX_DMA_MAPPING_H
+#define __ASM_SANDBOX_DMA_MAPPING_H
+
+#include <asm/cache.h>
+#include <linux/types.h>
+#include <malloc.h>
+
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
+{
+ *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, ROUND(len, ARCH_DMA_MINALIGN));
+ return (void *)*handle;
+}
+
+static inline void dma_free_coherent(void *addr)
+{
+ free(addr);
+}
+
+#endif
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 11ed89e0071..cd3f5d6fd40 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -12,6 +12,10 @@ static inline void sync(void)
{
}
+#define mb() sync()
+#define dmb() sync()
+#define wmb() sync()
+
enum sandboxio_size_t {
SB_SIZE_8,
SB_SIZE_16,
@@ -53,6 +57,16 @@ void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size);
#define writeq(v, addr) sandbox_write((void *)addr, v, SB_SIZE_64)
#endif
+#define readb_relaxed readb
+#define readw_relaxed readw
+#define readl_relaxed readl
+#define readq_relaxed readq
+
+#define writeb_relaxed writeb
+#define writew_relaxed writew
+#define writel_relaxed writel
+#define writeq_relaxed writeq
+
/*
* Clear and set bits in one shot. These macros can be used to clear and
* set multiple bits in a register using a single call. These macros can
diff --git a/arch/sandbox/include/asm/processor.h b/arch/sandbox/include/asm/processor.h
index 8dced6006bd..6521274efb0 100644
--- a/arch/sandbox/include/asm/processor.h
+++ b/arch/sandbox/include/asm/processor.h
@@ -6,6 +6,7 @@
#ifndef _ASM_PROCESSOR_H
#define _ASM_PROCESSOR_H
-/* This file is required for PCI */
+/* Assorted dummy functions */
+#define cpu_relax()
#endif
diff --git a/arch/sandbox/include/asm/system.h b/arch/sandbox/include/asm/system.h
index 7933b6292e2..73f34683b27 100644
--- a/arch/sandbox/include/asm/system.h
+++ b/arch/sandbox/include/asm/system.h
@@ -7,10 +7,9 @@
#define __ASM_SANDBOX_SYSTEM_H
/* Define this as nops for sandbox architecture */
-#define local_irq_save(x)
+#define local_irq_save(x) do { (x) = 0; } while (0)
#define local_irq_enable()
#define local_irq_disable()
-#define local_save_flags(x)
#define local_irq_restore(x)
#endif