]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sandbox: Add more dummy functions to mimic other architectures
authorTom Rini <trini@konsulko.com>
Fri, 18 Jul 2025 01:15:52 +0000 (19:15 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 11 Aug 2025 21:11:19 +0000 (15:11 -0600)
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>
arch/sandbox/include/asm/dma-mapping.h
arch/sandbox/include/asm/io.h
arch/sandbox/include/asm/processor.h
drivers/i3c/master/dw-i3c-master.c

index 853b0877b33de4ba31081d52cc29c184b3f8160b..410760c2231a379131c211cbbc77dcd80f43f4f4 100644 (file)
@@ -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
index 11ed89e007103f59c98f50f1cee1342891cd5c99..72953828f96a545423f3d639e532209020f5daa1 100644 (file)
@@ -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
index 8dced6006bd0a36b790e92a3d62a5cc3c0514761..6521274efb01e01b16404440c666a1f759334ae0 100644 (file)
@@ -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
index d96eb9b134e9f4a97f7b7aecad710df35a20ed2c..0c4af7e528a16142bba64e49a4823382fde905b5 100644 (file)
 #include <linux/iopoll.h>
 #include <linux/i3c/master.h>
 
-#ifdef CONFIG_SANDBOX
-#define cpu_relax() do {} while (0)
-#endif
-
 static u8 even_parity(u8 p)
 {
        p ^= p >> 4;