summaryrefslogtreecommitdiffstats
path: root/sys/arch/sparc/include
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-03-30 20:30:20 +0000
committermiod <miod@openbsd.org>2015-03-30 20:30:20 +0000
commit3b395b5772ca2783f5951e526fbc3bba3e36f8cd (patch)
tree4b44a2c0aa150415e83855fc8e75f74b4ee2f95b /sys/arch/sparc/include
parentsync (diff)
downloadwireguard-openbsd-3b395b5772ca2783f5951e526fbc3bba3e36f8cd.tar.xz
wireguard-openbsd-3b395b5772ca2783f5951e526fbc3bba3e36f8cd.zip
Add a bus_dma_tag_t for DVMA usage, suitable for use for devices not sitting
behind a sun4m iommu. Move the existing dvma routines from vm_machdep.c to this new dvma.c; this allows for a few declarations to be removed from public headers. Extend the device attachment arguments (struct confargs) to pass a bus_dma_tag_t. mainbus receives the dvma bus_dma_tag_t, and devices pass the tag unchanged to their children, except for iommu(4) which replaces it with its own. Change the few sun4m-only drivers to pick the bus_dma_tag_t from confargs rather than assume iommu; this allows qlw(4) to attach and work on sun4c. ok kettenis@
Diffstat (limited to 'sys/arch/sparc/include')
-rw-r--r--sys/arch/sparc/include/autoconf.h32
-rw-r--r--sys/arch/sparc/include/bus.h21
-rw-r--r--sys/arch/sparc/include/param.h5
-rw-r--r--sys/arch/sparc/include/vmparam.h6
4 files changed, 29 insertions, 35 deletions
diff --git a/sys/arch/sparc/include/autoconf.h b/sys/arch/sparc/include/autoconf.h
index f3b3088d138..ab1cc549ad8 100644
--- a/sys/arch/sparc/include/autoconf.h
+++ b/sys/arch/sparc/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.18 2010/06/29 21:28:08 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.19 2015/03/30 20:30:22 miod Exp $ */
/* $NetBSD: autoconf.h,v 1.20 1997/05/24 20:03:03 pk Exp $ */
/*
@@ -95,12 +95,25 @@ struct rom_range { /* Only used on v3 PROMs */
u_int32_t size; /* Size in bytes of this range */
};
+/*
+ * mapiodev maps an I/O device to a virtual address, returning the address.
+ * mapdev does the real work: you can supply a special virtual address and
+ * it will use that instead of creating one, but you must only do this if
+ * you get it from ../sparc/vaddrs.h.
+ */
+void *mapdev(struct rom_reg *pa, int va, int offset, int size);
+#define mapiodev(pa, offset, size) \
+ mapdev(pa, 0, offset, size)
+
+#include <machine/bus.h>
struct confargs {
- int ca_bustype;
- struct romaux ca_ra;
- int ca_slot;
- int ca_offset;
+ int ca_bustype;
+ struct romaux ca_ra;
+ int ca_slot;
+ int ca_offset;
+
+ bus_dma_tag_t ca_dmat;
};
#define BUS_MAIN 0
#define BUS_OBIO 1
@@ -120,15 +133,6 @@ struct confargs {
#define BUS_FGA_A32D32 15
/*
- * mapiodev maps an I/O device to a virtual address, returning the address.
- * mapdev does the real work: you can supply a special virtual address and
- * it will use that instead of creating one, but you must only do this if
- * you get it from ../sparc/vaddrs.h.
- */
-void *mapdev(struct rom_reg *pa, int va, int offset, int size);
-#define mapiodev(pa, offset, size) \
- mapdev(pa, 0, offset, size)
-/*
* REG2PHYS is provided for drivers with a `d_mmap' function.
*/
#define REG2PHYS(rr, offset) \
diff --git a/sys/arch/sparc/include/bus.h b/sys/arch/sparc/include/bus.h
index ec723213110..962be540393 100644
--- a/sys/arch/sparc/include/bus.h
+++ b/sys/arch/sparc/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.13 2011/09/27 20:47:30 miod Exp $ */
+/* $OpenBSD: bus.h,v 1.14 2015/03/30 20:30:22 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
*
@@ -39,19 +39,17 @@
#ifndef _MACHINE_BUS_H_
#define _MACHINE_BUS_H_
-#include <machine/autoconf.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pmap.h>
-
-typedef u_long bus_space_handle_t;
-
+typedef u_long bus_space_handle_t;
/*
* bus_space_tag_t are pointer to *modified* rom_reg structures.
* rr_iospace is used to also carry bus endianness information.
*/
-typedef struct rom_reg *bus_space_tag_t;
+typedef struct rom_reg *bus_space_tag_t;
+typedef struct sparc_bus_dma_tag *bus_dma_tag_t;
+typedef struct sparc_bus_dmamap *bus_dmamap_t;
+
+#include <machine/autoconf.h>
+#include <uvm/uvm_extern.h>
#define TAG_LITTLE_ENDIAN 0x80000000
@@ -526,9 +524,6 @@ struct uio;
#define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */
#define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */
-typedef struct sparc_bus_dma_tag *bus_dma_tag_t;
-typedef struct sparc_bus_dmamap *bus_dmamap_t;
-
/*
* bus_dma_segment_t
*
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 7c8abf3a9ff..532961f5906 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.50 2015/03/18 20:56:40 miod Exp $ */
+/* $OpenBSD: param.h,v 1.51 2015/03/30 20:30:22 miod Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -112,10 +112,9 @@
#define NKMEMPAGES_MAX_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
#ifndef _LOCORE
-extern vaddr_t dvma_base;
-extern vaddr_t dvma_end;
extern struct extent *dvmamap_extent;
+extern void dvma_init(void);
extern caddr_t kdvma_mapin(caddr_t, int, int);
extern caddr_t dvma_malloc_space(size_t, void *, int, int);
extern void dvma_free(caddr_t, size_t, void *);
diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h
index b7356412985..139e61a0dcc 100644
--- a/sys/arch/sparc/include/vmparam.h
+++ b/sys/arch/sparc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.44 2015/03/27 20:25:39 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.45 2015/03/30 20:30:22 miod Exp $ */
/* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */
/*
@@ -129,11 +129,7 @@ extern vsize_t vm_kernel_space_size;
#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
#if defined (_KERNEL)
-struct vm_map;
-#define dvma_mapin(map,va,len,canwait) dvma_mapin_space(map,va,len,canwait,0)
-vaddr_t dvma_mapin_space(struct vm_map *, vaddr_t, int, int, int);
void dvma_mapout(vaddr_t, vaddr_t, int);
-
#endif
#endif /* _MACHINE_VMPARAM_H_ */