summaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-07-17 19:15:52 -0600
committerTom Rini <trini@konsulko.com>2025-08-11 15:11:19 -0600
commit493c3da3ac530229ca4c4caadd5df041f6c25eb2 (patch)
tree77f1064c23f9a7ad194bade1533a0efbfdd0d84a /arch/sandbox
parent26f857f1e37ccb7dfb93d55650ce35b179ed220f (diff)
sandbox: Add more dummy functions to mimic other architectures
This adds more common functions found on other architectures that will allow for more compile-testing of drivers. These are either dummy functions as we do not need them or mappings to existing functions, similar to how other architectures handle it. Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/include/asm/dma-mapping.h27
-rw-r--r--arch/sandbox/include/asm/io.h13
-rw-r--r--arch/sandbox/include/asm/processor.h3
3 files changed, 42 insertions, 1 deletions
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..72953828f96 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -12,6 +12,9 @@ static inline void sync(void)
{
}
+#define mb() sync()
+#define dmb() sync()
+
enum sandboxio_size_t {
SB_SIZE_8,
SB_SIZE_16,
@@ -53,6 +56,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