summaryrefslogtreecommitdiff
path: root/sys/arch/sgi
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-03-30 20:14:41 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-03-30 20:14:41 +0000
commit4da26b55cbe8cf129b37638e6b39d6a74aa763c2 (patch)
treef2cfbf86ebadab2d5bbd4080d521ca208e3fee0b /sys/arch/sgi
parent48df6ce4c0798cc1d04adf27a5fb3236f0a07bd0 (diff)
Implement bus_space_*8 and bus_space_vaddr.
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r--sys/arch/sgi/include/bus.h39
-rw-r--r--sys/arch/sgi/localbus/macebus.c34
-rw-r--r--sys/arch/sgi/localbus/macebus.h16
3 files changed, 47 insertions, 42 deletions
diff --git a/sys/arch/sgi/include/bus.h b/sys/arch/sgi/include/bus.h
index 1a47d7e57f5..cc6b1abe01b 100644
--- a/sys/arch/sgi/include/bus.h
+++ b/sys/arch/sgi/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.8 2008/02/20 19:13:38 miod Exp $ */
+/* $OpenBSD: bus.h,v 1.9 2008/03/30 20:14:38 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
@@ -72,6 +72,7 @@ struct mips_bus_space {
bus_size_t);
int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t,
bus_size_t, bus_size_t, bus_space_handle_t *);
+ void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t);
};
#define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o))
@@ -89,6 +90,8 @@ struct mips_bus_space {
#define bus_space_subregion(t, h, o, s, p) \
(*(t)->_space_subregion)((t), (h), (o), (s), (p))
+#define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h))
+
/* Helper function in pmap.c */
int bus_mem_add_mapping(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
@@ -106,8 +109,7 @@ CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_read_multi(1,8)
bus_space_read_multi(2,16)
bus_space_read_multi(4,32)
-
-#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!!
+bus_space_read_multi(8,64)
/*----------------------------------------------------------------------------*/
#define bus_space_read_region(n,m) \
@@ -122,8 +124,7 @@ CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_read_region(1,8)
bus_space_read_region(2,16)
bus_space_read_region(4,32)
-
-#define bus_space_read_region_8 !!! bus_space_read_region_8 not implemented !!!
+bus_space_read_region(8,64)
/*----------------------------------------------------------------------------*/
#define bus_space_write_multi(n,m) \
@@ -139,8 +140,7 @@ CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_write_multi(1,8)
bus_space_write_multi(2,16)
bus_space_write_multi(4,32)
-
-#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!!
+bus_space_write_multi(8,64)
/*----------------------------------------------------------------------------*/
#define bus_space_write_region(n,m) \
@@ -157,9 +157,7 @@ CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_write_region(1,8)
bus_space_write_region(2,16)
bus_space_write_region(4,32)
-
-#define bus_space_write_region_8 \
- !!! bus_space_write_region_8 not implemented !!!
+bus_space_write_region(8,64)
/*----------------------------------------------------------------------------*/
#define bus_space_set_region(n,m) \
@@ -176,6 +174,7 @@ CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_set_region(1,8)
bus_space_set_region(2,16)
bus_space_set_region(4,32)
+bus_space_set_region(8,64)
/*----------------------------------------------------------------------------*/
#define bus_space_read_raw_multi(n,m,l) \
@@ -189,9 +188,7 @@ CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
bus_space_read_raw_multi(2,16,1)
bus_space_read_raw_multi(4,32,2)
-
-#define bus_space_read_raw_multi_8 \
- !!! bus_space_read_raw_multi_8 not implemented !!!
+bus_space_read_raw_multi(8,64,3)
/*----------------------------------------------------------------------------*/
#define bus_space_write_raw_multi(n,m,l) \
@@ -205,9 +202,7 @@ CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\
bus_space_write_raw_multi(2,16,1)
bus_space_write_raw_multi(4,32,2)
-
-#define bus_space_write_raw_multi_8 \
- !!! bus_space_write_raw_multi_8 not implemented !!!
+bus_space_write_raw_multi(8,64,3)
/*----------------------------------------------------------------------------*/
static __inline void
@@ -244,8 +239,16 @@ bus_space_copy_4(void *v, bus_space_handle_t h1, bus_size_t o1,
*d++ = *s++;
}
-#define bus_space_copy_8 \
- !!! bus_space_write_raw_multi_8 not implemented !!!
+static __inline void
+bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1,
+ bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
+{
+ int64_t *s = (int64_t *)(h1 + o1);
+ int64_t *d = (int64_t *)(h2 + o2);
+
+ while (c--)
+ *d++ = *s++;
+}
/*----------------------------------------------------------------------------*/
/*
diff --git a/sys/arch/sgi/localbus/macebus.c b/sys/arch/sgi/localbus/macebus.c
index f5cd3ab5c3a..96d6f504833 100644
--- a/sys/arch/sgi/localbus/macebus.c
+++ b/sys/arch/sgi/localbus/macebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macebus.c,v 1.34 2008/02/20 18:46:20 miod Exp $ */
+/* $OpenBSD: macebus.c,v 1.35 2008/03/30 20:14:40 miod Exp $ */
/*
* Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se)
@@ -66,6 +66,22 @@ void macebus_do_pending_int(int);
intrmask_t macebus_iointr(intrmask_t, struct trap_frame *);
intrmask_t macebus_aux(intrmask_t, struct trap_frame *);
+u_int8_t mace_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int16_t mace_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int32_t mace_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int64_t mace_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+void mace_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t);
+void mace_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
+void mace_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void mace_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
+
+int mace_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *);
+void mace_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+int mace_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *);
+
+void *mace_space_vaddr(bus_space_tag_t, bus_space_handle_t);
+
bus_addr_t macebus_pa_to_device(paddr_t);
paddr_t macebus_device_to_pa(bus_addr_t);
@@ -89,6 +105,7 @@ bus_space_t macebus_tag = {
mace_read_4, mace_write_4,
mace_read_8, mace_write_8,
mace_space_map, mace_space_unmap, mace_space_region,
+ mace_space_vaddr
};
bus_space_t crimebus_tag = {
@@ -101,6 +118,7 @@ bus_space_t crimebus_tag = {
mace_read_4, mace_write_4,
mace_read_8, mace_write_8,
mace_space_map, mace_space_unmap, mace_space_region,
+ mace_space_vaddr
};
bus_space_handle_t crime_h;
@@ -270,11 +288,7 @@ mace_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
u_int64_t
mace_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
-#ifdef __LP64__
return *(volatile u_int64_t *)(h + o);
-#else
- return lp32_read8((u_int64_t *)(h + o));
-#endif
}
void
@@ -298,11 +312,7 @@ mace_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int32_t v)
void
mace_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v)
{
-#ifdef __LP64__
*(volatile u_int64_t *)(h + o) = v;
-#else
- lp32_write8((u_int64_t *)(h + o), v);
-#endif
}
extern int extent_malloc_flags;
@@ -385,6 +395,12 @@ mace_space_region(bus_space_tag_t t, bus_space_handle_t bsh,
return (0);
}
+void *
+mace_space_vaddr(bus_space_tag_t t, bus_space_handle_t h)
+{
+ return (void *)h;
+}
+
/*
* Macebus bus_dma helpers.
* Mace accesses memory contiguously at 0x40000000 onwards.
diff --git a/sys/arch/sgi/localbus/macebus.h b/sys/arch/sgi/localbus/macebus.h
index f66e3bfdad4..5ae13d282cd 100644
--- a/sys/arch/sgi/localbus/macebus.h
+++ b/sys/arch/sgi/localbus/macebus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: macebus.h,v 1.11 2008/02/20 18:46:20 miod Exp $ */
+/* $OpenBSD: macebus.h,v 1.12 2008/03/30 20:14:40 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.com).
@@ -122,20 +122,6 @@
extern bus_space_t macebus_tag;
extern struct machine_bus_dma_tag mace_bus_dma_tag;
-u_int8_t mace_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-u_int16_t mace_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-u_int32_t mace_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-u_int64_t mace_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-
-void mace_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t);
-void mace_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
-void mace_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
-void mace_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
-
-int mace_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void mace_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-int mace_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *);
-
void *macebus_intr_establish(void *, u_long, int, int, int (*)(void *),
void *, char *);
void macebus_intr_disestablish(void *, void *);