summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-12-25 20:52:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-12-25 20:52:58 +0000
commite119c0361672dad51ececf74e902e9e746c3669a (patch)
tree6ddd510faf43f7243c75d021b9dd9c4f012a5e0f
parent222509b17017cbb2e2ec27cefb44daac5f9c70ca (diff)
Implement bus_space_vaddr().
-rw-r--r--sys/arch/landisk/dev/obio.c13
-rw-r--r--sys/arch/landisk/landisk/shpcic_machdep.c6
-rw-r--r--sys/arch/sh/dev/shpcic.c8
-rw-r--r--sys/arch/sh/dev/shpcicvar.h3
-rw-r--r--sys/arch/vax/include/bus.h14
-rw-r--r--sys/arch/vax/vax/bus_mem.c71
6 files changed, 71 insertions, 44 deletions
diff --git a/sys/arch/landisk/dev/obio.c b/sys/arch/landisk/dev/obio.c
index 34e1bc9929c..7eed273ffc0 100644
--- a/sys/arch/landisk/dev/obio.c
+++ b/sys/arch/landisk/dev/obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: obio.c,v 1.6 2008/06/26 05:42:11 ray Exp $ */
+/* $OpenBSD: obio.c,v 1.7 2009/12/25 20:52:55 miod Exp $ */
/* $NetBSD: obio.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@@ -219,6 +219,7 @@ int obio_iomem_alloc(void *v, bus_addr_t rstart, bus_addr_t rend,
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
bus_addr_t *bpap, bus_space_handle_t *bshp);
void obio_iomem_free(void *v, bus_space_handle_t bsh, bus_size_t size);
+void *obio_iomem_vaddr(void *v, bus_space_handle_t bsh);
int obio_iomem_add_mapping(bus_addr_t, bus_size_t, int,
bus_space_handle_t *);
@@ -355,6 +356,12 @@ obio_iomem_free(void *v, bus_space_handle_t bsh, bus_size_t size)
obio_iomem_unmap(v, bsh, size);
}
+void *
+obio_iomem_vaddr(void *v, bus_space_handle_t bsh)
+{
+ return ((void *)bsh);
+}
+
/*
* on-board I/O bus space read/write
*/
@@ -437,6 +444,8 @@ struct _bus_space obio_bus_io =
.bs_alloc = obio_iomem_alloc,
.bs_free = obio_iomem_free,
+ .bs_vaddr = obio_iomem_vaddr,
+
.bs_r_1 = obio_iomem_read_1,
.bs_r_2 = obio_iomem_read_2,
.bs_r_4 = obio_iomem_read_4,
@@ -497,6 +506,8 @@ struct _bus_space obio_bus_mem =
.bs_alloc = obio_iomem_alloc,
.bs_free = obio_iomem_free,
+ .bs_vaddr = obio_iomem_vaddr,
+
.bs_r_1 = obio_iomem_read_1,
.bs_r_2 = obio_iomem_read_2,
.bs_r_4 = obio_iomem_read_4,
diff --git a/sys/arch/landisk/landisk/shpcic_machdep.c b/sys/arch/landisk/landisk/shpcic_machdep.c
index 6093abf6b03..60d82d12eff 100644
--- a/sys/arch/landisk/landisk/shpcic_machdep.c
+++ b/sys/arch/landisk/landisk/shpcic_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shpcic_machdep.c,v 1.3 2006/10/19 03:39:54 drahn Exp $ */
+/* $OpenBSD: shpcic_machdep.c,v 1.4 2009/12/25 20:52:57 miod Exp $ */
/* $NetBSD: shpcic_machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*
@@ -188,6 +188,8 @@ struct _bus_space landisk_pci_bus_io =
.bs_alloc = shpcic_iomem_alloc,
.bs_free = shpcic_iomem_free,
+ .bs_vaddr = shpcic_iomem_vaddr,
+
.bs_r_1 = shpcic_io_read_1,
.bs_r_2 = shpcic_io_read_2,
.bs_r_4 = shpcic_io_read_4,
@@ -248,6 +250,8 @@ struct _bus_space landisk_pci_bus_mem =
.bs_alloc = shpcic_iomem_alloc,
.bs_free = shpcic_iomem_free,
+ .bs_vaddr = shpcic_iomem_vaddr,
+
.bs_r_1 = shpcic_mem_read_1,
.bs_r_2 = shpcic_mem_read_2,
.bs_r_4 = shpcic_mem_read_4,
diff --git a/sys/arch/sh/dev/shpcic.c b/sys/arch/sh/dev/shpcic.c
index ffb92394fc7..93e46f21191 100644
--- a/sys/arch/sh/dev/shpcic.c
+++ b/sys/arch/sh/dev/shpcic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shpcic.c,v 1.9 2009/07/26 18:56:42 miod Exp $ */
+/* $OpenBSD: shpcic.c,v 1.10 2009/12/25 20:52:57 miod Exp $ */
/* $NetBSD: shpcic.c,v 1.10 2005/12/24 20:07:32 perry Exp $ */
/*
@@ -381,6 +381,12 @@ shpcic_iomem_free(void *v, bus_space_handle_t bsh, bus_size_t size)
/* Nothing to do */
}
+void *
+shpcic_iomem_vaddr(void *v, bus_space_handle_t bsh)
+{
+ return ((void *)bsh);
+}
+
/*
* shpcic bus space io/mem read/write
*/
diff --git a/sys/arch/sh/dev/shpcicvar.h b/sys/arch/sh/dev/shpcicvar.h
index 45f001d5f5d..a260c3d89e5 100644
--- a/sys/arch/sh/dev/shpcicvar.h
+++ b/sys/arch/sh/dev/shpcicvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: shpcicvar.h,v 1.3 2006/10/19 03:36:38 drahn Exp $ */
+/* $OpenBSD: shpcicvar.h,v 1.4 2009/12/25 20:52:57 miod Exp $ */
/* $NetBSD: shpcicvar.h,v 1.6 2005/12/11 12:18:58 christos Exp $ */
/*-
@@ -80,6 +80,7 @@ int shpcic_iomem_alloc(void *v, bus_addr_t rstart, bus_addr_t rend,
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
bus_addr_t *bpap, bus_space_handle_t *bshp);
void shpcic_iomem_free(void *v, bus_space_handle_t bsh, bus_size_t size);
+void *shpcic_iomem_vaddr(void *v, bus_space_handle_t bsh);
/* read single */
uint8_t shpcic_io_read_1(void *v, bus_space_handle_t bsh, bus_size_t offset);
diff --git a/sys/arch/vax/include/bus.h b/sys/arch/vax/include/bus.h
index 51bdffb1e17..bb349715186 100644
--- a/sys/arch/vax/include/bus.h
+++ b/sys/arch/vax/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.12 2009/04/20 00:42:06 oga Exp $ */
+/* $OpenBSD: bus.h,v 1.13 2009/12/25 20:52:57 miod Exp $ */
/* $NetBSD: bus.h,v 1.14 2000/06/26 04:56:13 simonb Exp $ */
/*-
@@ -95,6 +95,9 @@ struct vax_bus_space {
bus_addr_t *, bus_space_handle_t *);
void (*vbs_free)(void *, bus_space_handle_t,
bus_size_t);
+
+ /* get kernel virtual address */
+ void * (*vbs_vaddr)(void *, bus_space_handle_t);
};
/*
@@ -160,6 +163,15 @@ struct vax_bus_space {
(*(t)->vbs_free)((t)->vbs_cookie, (h), (s))
/*
+ * void *bus_space_vaddr(bus_space_tag_t t, bus_space_handle_t h);
+ *
+ * Get kernel virtual address.
+ */
+
+#define bus_space_vaddr(t, h) \
+ (*(t)->vbs_vaddr)((t)->vbs_cookie, (h))
+
+/*
* u_intN_t bus_space_read_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset);
*
diff --git a/sys/arch/vax/vax/bus_mem.c b/sys/arch/vax/vax/bus_mem.c
index 064ed8b080d..fcb6c0047d6 100644
--- a/sys/arch/vax/vax/bus_mem.c
+++ b/sys/arch/vax/vax/bus_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_mem.c,v 1.5 2009/07/26 18:48:55 miod Exp $ */
+/* $OpenBSD: bus_mem.c,v 1.6 2009/12/25 20:52:57 miod Exp $ */
/* $NetBSD: bus_mem.c,v 1.8 2000/06/29 07:14:23 mrg Exp $ */
/*
* Copyright (c) 1998 Matt Thomas
@@ -46,14 +46,19 @@
#include <machine/bus.h>
#include <machine/intr.h>
-static int
-vax_mem_bus_space_map(
- void *t,
- bus_addr_t pa,
- bus_size_t size,
- int flags,
- bus_space_handle_t *bshp,
- int f2)
+int vax_mem_bus_space_map(void *, bus_addr_t, bus_size_t, int,
+ bus_space_handle_t *, int);
+void vax_mem_bus_space_unmap(void *, bus_space_handle_t, bus_size_t, int);
+int vax_mem_bus_space_subregion(void *, bus_space_handle_t, bus_size_t,
+ bus_size_t, bus_space_handle_t *);
+int vax_mem_bus_space_alloc(void *, bus_addr_t, bus_addr_t, bus_size_t,
+ bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
+void vax_mem_bus_space_free(void *, bus_space_handle_t, bus_size_t);
+void *vax_mem_bus_space_vaddr(void *, bus_space_handle_t);
+
+int
+vax_mem_bus_space_map(void *t, bus_addr_t pa, bus_size_t size, int flags,
+ bus_space_handle_t *bshp, int f2)
{
vaddr_t va;
@@ -69,24 +74,16 @@ vax_mem_bus_space_map(
return 0;
}
-static int
-vax_mem_bus_space_subregion(
- void *t,
- bus_space_handle_t h,
- bus_size_t o,
- bus_size_t s,
- bus_space_handle_t *hp)
+int
+vax_mem_bus_space_subregion(void *t, bus_space_handle_t h, bus_size_t o,
+ bus_size_t s, bus_space_handle_t *hp)
{
*hp = h + o;
return (0);
}
-static void
-vax_mem_bus_space_unmap(
- void *t,
- bus_space_handle_t h,
- bus_size_t size,
- int f)
+void
+vax_mem_bus_space_unmap(void *t, bus_space_handle_t h, bus_size_t size, int f)
{
u_long va = trunc_page(h);
u_long endva = round_page(h + size);
@@ -98,29 +95,24 @@ vax_mem_bus_space_unmap(
uvm_km_free(kernel_map, va, endva - va);
}
-static int
-vax_mem_bus_space_alloc(
- void *t,
- bus_addr_t rs,
- bus_addr_t re,
- bus_size_t s,
- bus_size_t a,
- bus_size_t b,
- int f,
- bus_addr_t *ap,
- bus_space_handle_t *hp)
+int
+vax_mem_bus_space_alloc(void *t, bus_addr_t rs, bus_addr_t re, bus_size_t s,
+ bus_size_t a, bus_size_t b, int f, bus_addr_t *ap, bus_space_handle_t *hp)
{
panic("vax_mem_bus_alloc not implemented");
}
-static void
-vax_mem_bus_space_free(
- void *t,
- bus_space_handle_t h,
- bus_size_t s)
+void
+vax_mem_bus_space_free(void *t, bus_space_handle_t h, bus_size_t s)
{
panic("vax_mem_bus_free not implemented");
}
+
+void *
+vax_mem_bus_space_vaddr(void *t, bus_space_handle_t h)
+{
+ return ((void *)h);
+}
struct vax_bus_space vax_mem_bus_space = {
NULL,
@@ -128,5 +120,6 @@ struct vax_bus_space vax_mem_bus_space = {
vax_mem_bus_space_unmap,
vax_mem_bus_space_subregion,
vax_mem_bus_space_alloc,
- vax_mem_bus_space_free
+ vax_mem_bus_space_free,
+ vax_mem_bus_space_vaddr
};