summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/include/bus.h76
-rw-r--r--sys/arch/alpha/pci/pcs_bus_io_common.c83
-rw-r--r--sys/arch/alpha/pci/pcs_bus_mem_common.c83
-rw-r--r--sys/arch/alpha/tc/tc_bus_mem.c80
4 files changed, 291 insertions, 31 deletions
diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h
index 01a2cb5a259..1a5189833ab 100644
--- a/sys/arch/alpha/include/bus.h
+++ b/sys/arch/alpha/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.6 1997/03/21 00:16:32 niklas Exp $ */
+/* $OpenBSD: bus.h,v 1.7 1997/04/02 22:08:07 niklas Exp $ */
/* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */
/*
@@ -155,6 +155,24 @@ struct alpha_bus_space {
bus_space_handle_t, bus_size_t, bus_size_t));
void (*abs_c_8) __P((void *, bus_space_handle_t, bus_size_t,
bus_space_handle_t, bus_size_t, bus_size_t));
+
+ /* OpenBSD extensions follows */
+
+ /* read multiple raw */
+ void (*abs_rrm_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+ void (*abs_rrm_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+ void (*abs_rrm_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+
+ /* write multiple raw */
+ void (*abs_wrm_2) __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
+ void (*abs_wrm_4) __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
+ void (*abs_wrm_8) __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
};
@@ -168,11 +186,14 @@ struct alpha_bus_space {
(*(t)->__abs_opname(r,sz))((t)->abs_cookie, h, o)
#define __abs_ws(sz, t, h, o, v) \
(*(t)->__abs_opname(w,sz))((t)->abs_cookie, h, o, v)
-#ifndef DEBUG
#define __abs_nonsingle(type, sz, t, h, o, a, c) \
(*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, a, c)
+#ifndef DEBUG
+#define __abs_aligned_nonsingle(type, sz, t, h, o, a, c) \
+ __abs_nonsingle((type), (sz), (t), (h), (o), (a), (c))
+
#else
-#define __abs_nonsingle(type, sz, t, h, o, a, c) \
+#define __abs_aligend_nonsingle(type, sz, t, h, o, a, c) \
do { \
if (((unsigned long)a & (sz - 1)) != 0) \
panic("bus non-single %d-byte unaligned (to %p) at %s:%d", \
@@ -185,7 +206,6 @@ struct alpha_bus_space {
#define __abs_copy(sz, t, h1, o1, h2, o2, cnt) \
(*(t)->__abs_opname(c,sz))((t)->abs_cookie, h1, o1, h2, o2, cnt)
-
/*
* Mapping and unmapping operations.
*/
@@ -232,11 +252,11 @@ struct alpha_bus_space {
#define bus_space_read_multi_1(t, h, o, a, c) \
__abs_nonsingle(rm,1,(t),(h),(o),(a),(c))
#define bus_space_read_multi_2(t, h, o, a, c) \
- __abs_nonsingle(rm,2,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rm,2,(t),(h),(o),(a),(c))
#define bus_space_read_multi_4(t, h, o, a, c) \
- __abs_nonsingle(rm,4,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rm,4,(t),(h),(o),(a),(c))
#define bus_space_read_multi_8(t, h, o, a, c) \
- __abs_nonsingle(rm,8,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rm,8,(t),(h),(o),(a),(c))
/*
@@ -250,12 +270,12 @@ struct alpha_bus_space {
* possible byte-swapping should be done by these functions.
*/
-#define bus_space_read_raw_multi_2(t, h, o, a, c) \
- bus_space_read_multi_2((t), (h), (o), (u_int16_t *)(a), (c) >> 1)
-#define bus_space_read_raw_multi_4(t, h, o, a, c) \
- bus_space_read_multi_4((t), (h), (o), (u_int32_t *)(a), (c) >> 2)
-#define bus_space_read_raw_multi_8(t, h, o, a, c) \
- bus_space_read_multi_8((t), (h), (o), (u_int64_t *)(a), (c) >> 4)
+#define bus_space_read_raw_multi_2(t, h, o, a, c) \
+ __abs_nonsingle(rrm,2,(t),(h),(o),(a),(c))
+#define bus_space_read_raw_multi_4(t, h, o, a, c) \
+ __abs_nonsingle(rrm,4,(t),(h),(o),(a),(c))
+#define bus_space_read_raw_multi_8(t, h, o, a, c) \
+ __abs_nonsingle(rrm,8,(t),(h),(o),(a),(c))
/*
* Bus read region operations.
@@ -263,11 +283,11 @@ struct alpha_bus_space {
#define bus_space_read_region_1(t, h, o, a, c) \
__abs_nonsingle(rr,1,(t),(h),(o),(a),(c))
#define bus_space_read_region_2(t, h, o, a, c) \
- __abs_nonsingle(rr,2,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rr,2,(t),(h),(o),(a),(c))
#define bus_space_read_region_4(t, h, o, a, c) \
- __abs_nonsingle(rr,4,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rr,4,(t),(h),(o),(a),(c))
#define bus_space_read_region_8(t, h, o, a, c) \
- __abs_nonsingle(rr,8,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(rr,8,(t),(h),(o),(a),(c))
/*
@@ -285,11 +305,11 @@ struct alpha_bus_space {
#define bus_space_write_multi_1(t, h, o, a, c) \
__abs_nonsingle(wm,1,(t),(h),(o),(a),(c))
#define bus_space_write_multi_2(t, h, o, a, c) \
- __abs_nonsingle(wm,2,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wm,2,(t),(h),(o),(a),(c))
#define bus_space_write_multi_4(t, h, o, a, c) \
- __abs_nonsingle(wm,4,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wm,4,(t),(h),(o),(a),(c))
#define bus_space_write_multi_8(t, h, o, a, c) \
- __abs_nonsingle(wm,8,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wm,8,(t),(h),(o),(a),(c))
/*
* void bus_space_write_raw_multi_N __P((bus_space_tag_t tag,
@@ -302,12 +322,12 @@ struct alpha_bus_space {
* possible byte-swapping should be done by these functions.
*/
-#define bus_space_write_raw_multi_2(t, h, o, a, c) \
- bus_space_write_multi_2((t), (h), (o), (u_int16_t *)(a), (c) >> 1)
-#define bus_space_write_raw_multi_4(t, h, o, a, c) \
- bus_space_write_multi_4((t), (h), (o), (u_int32_t *)(a), (c) >> 2)
-#define bus_space_write_raw_multi_8(t, h, o, a, c) \
- bus_space_write_multi_8((t), (h), (o), (u_int64_t *)(a), (c) >> 4)
+#define bus_space_write_raw_multi_2(t, h, o, a, c) \
+ __abs_nonsingle(wrm,2,(t),(h),(o),(a),(c))
+#define bus_space_write_raw_multi_4(t, h, o, a, c) \
+ __abs_nonsingle(wrm,4,(t),(h),(o),(a),(c))
+#define bus_space_write_raw_multi_8(t, h, o, a, c) \
+ __abs_nonsingle(wrm,8,(t),(h),(o),(a),(c))
/*
* Bus write region operations.
@@ -315,11 +335,11 @@ struct alpha_bus_space {
#define bus_space_write_region_1(t, h, o, a, c) \
__abs_nonsingle(wr,1,(t),(h),(o),(a),(c))
#define bus_space_write_region_2(t, h, o, a, c) \
- __abs_nonsingle(wr,2,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wr,2,(t),(h),(o),(a),(c))
#define bus_space_write_region_4(t, h, o, a, c) \
- __abs_nonsingle(wr,4,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wr,4,(t),(h),(o),(a),(c))
#define bus_space_write_region_8(t, h, o, a, c) \
- __abs_nonsingle(wr,8,(t),(h),(o),(a),(c))
+ __abs_aligned_nonsingle(wr,8,(t),(h),(o),(a),(c))
/*
diff --git a/sys/arch/alpha/pci/pcs_bus_io_common.c b/sys/arch/alpha/pci/pcs_bus_io_common.c
index 89cc1418cd1..f393cd2e7ef 100644
--- a/sys/arch/alpha/pci/pcs_bus_io_common.c
+++ b/sys/arch/alpha/pci/pcs_bus_io_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcs_bus_io_common.c,v 1.5 1997/01/24 19:57:55 niklas Exp $ */
+/* $OpenBSD: pcs_bus_io_common.c,v 1.6 1997/04/02 22:08:09 niklas Exp $ */
/* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */
/*
@@ -151,6 +151,25 @@ void __C(CHIP,_io_copy_4) __P((void *, bus_space_handle_t,
void __C(CHIP,_io_copy_8) __P((void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+/* read multiple raw */
+void __C(CHIP,_io_read_raw_multi_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+void __C(CHIP,_io_read_raw_multi_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+void __C(CHIP,_io_read_raw_multi_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+
+/* write multiple raw */
+void __C(CHIP,_io_write_raw_multi_2) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+void __C(CHIP,_io_write_raw_multi_4) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+void __C(CHIP,_io_write_raw_multi_8) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+
static long
__C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
@@ -223,6 +242,16 @@ static struct alpha_bus_space __C(CHIP,_io_space) = {
__C(CHIP,_io_copy_2),
__C(CHIP,_io_copy_4),
__C(CHIP,_io_copy_8),
+
+ /* read multiple raw */
+ __C(CHIP,_io_read_raw_multi_2),
+ __C(CHIP,_io_read_raw_multi_4),
+ __C(CHIP,_io_read_raw_multi_8),
+
+ /* write multiple raw*/
+ __C(CHIP,_io_write_raw_multi_2),
+ __C(CHIP,_io_write_raw_multi_4),
+ __C(CHIP,_io_write_raw_multi_8),
};
bus_space_tag_t
@@ -716,3 +745,55 @@ CHIP_io_copy_N(1)
CHIP_io_copy_N(2)
CHIP_io_copy_N(4)
CHIP_io_copy_N(8)
+
+#define CHIP_io_read_raw_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_io_read_raw_multi_),BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ __C(CHIP,_io_barrier)(v, h, o, BYTES, BUS_BARRIER_READ); \
+ temp = __C(__C(CHIP,_io_read_),BYTES)(v, h, o); \
+ for (i = 0; i < BYTES; i++) { \
+ *a++ = temp & 0xff; \
+ temp >>= 8; \
+ } \
+ c -= BYTES; \
+ } \
+}
+CHIP_io_read_raw_multi_N(2,u_int16_t)
+CHIP_io_read_raw_multi_N(4,u_int32_t)
+CHIP_io_read_raw_multi_N(8,u_int64_t)
+
+#define CHIP_io_write_raw_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_io_write_raw_multi_),BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ const u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ temp = 0; \
+ for (i = BYTES - 1; i >= 0; i--) { \
+ temp <<= 8; \
+ temp |= *(a + i); \
+ } \
+ __C(__C(CHIP,_io_write_),BYTES)(v, h, o, temp); \
+ __C(CHIP,_io_barrier)(v, h, o, BYTES, BUS_BARRIER_WRITE); \
+ c -= BYTES; \
+ a += BYTES; \
+ } \
+}
+CHIP_io_write_raw_multi_N(2,u_int16_t)
+CHIP_io_write_raw_multi_N(4,u_int32_t)
+CHIP_io_write_raw_multi_N(8,u_int64_t)
diff --git a/sys/arch/alpha/pci/pcs_bus_mem_common.c b/sys/arch/alpha/pci/pcs_bus_mem_common.c
index 44d0c90cf2f..0cd2f784206 100644
--- a/sys/arch/alpha/pci/pcs_bus_mem_common.c
+++ b/sys/arch/alpha/pci/pcs_bus_mem_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcs_bus_mem_common.c,v 1.5 1997/01/24 19:57:56 niklas Exp $ */
+/* $OpenBSD: pcs_bus_mem_common.c,v 1.6 1997/04/02 22:08:09 niklas Exp $ */
/* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */
/*
@@ -152,6 +152,25 @@ void __C(CHIP,_mem_copy_4) __P((void *, bus_space_handle_t,
void __C(CHIP,_mem_copy_8) __P((void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+/* read multiple raw */
+void __C(CHIP,_mem_read_raw_multi_2) __P((void *,
+ bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
+void __C(CHIP,_mem_read_raw_multi_4) __P((void *,
+ bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
+void __C(CHIP,_mem_read_raw_multi_8) __P((void *,
+ bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
+
+/* write multiple raw */
+void __C(CHIP,_mem_write_raw_multi_2) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+void __C(CHIP,_mem_write_raw_multi_4) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+void __C(CHIP,_mem_write_raw_multi_8) __P((void *,
+ bus_space_handle_t, bus_size_t, const u_int8_t *,
+ bus_size_t));
+
static long
__C(CHIP,_dmem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
static long
@@ -226,6 +245,16 @@ static struct alpha_bus_space __C(CHIP,_mem_space) = {
__C(CHIP,_mem_copy_2),
__C(CHIP,_mem_copy_4),
__C(CHIP,_mem_copy_8),
+
+ /* read multiple raw */
+ __C(CHIP,_mem_read_raw_multi_2),
+ __C(CHIP,_mem_read_raw_multi_4),
+ __C(CHIP,_mem_read_raw_multi_8),
+
+ /* write multiple raw*/
+ __C(CHIP,_mem_write_raw_multi_2),
+ __C(CHIP,_mem_write_raw_multi_4),
+ __C(CHIP,_mem_write_raw_multi_8),
};
bus_space_tag_t
@@ -983,3 +1012,55 @@ CHIP_mem_copy_N(1)
CHIP_mem_copy_N(2)
CHIP_mem_copy_N(4)
CHIP_mem_copy_N(8)
+
+#define CHIP_mem_read_raw_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_mem_read_raw_multi_),BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ __C(CHIP,_mem_barrier)(v, h, o, BYTES, BUS_BARRIER_READ); \
+ temp = __C(__C(CHIP,_mem_read_),BYTES)(v, h, o); \
+ for (i = 0; i < BYTES; i++) { \
+ *a++ = temp & 0xff; \
+ temp >>= 8; \
+ } \
+ c -= BYTES; \
+ } \
+}
+CHIP_mem_read_raw_multi_N(2,u_int16_t)
+CHIP_mem_read_raw_multi_N(4,u_int32_t)
+CHIP_mem_read_raw_multi_N(8,u_int64_t)
+
+#define CHIP_mem_write_raw_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_mem_write_raw_multi_),BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ const u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ temp = 0; \
+ for (i = BYTES - 1; i >= 0; i--) { \
+ temp <<= 8; \
+ temp |= *(a + i); \
+ } \
+ __C(__C(CHIP,_mem_write_),BYTES)(v, h, o, temp); \
+ __C(CHIP,_mem_barrier)(v, h, o, BYTES, BUS_BARRIER_WRITE); \
+ c -= BYTES; \
+ a += BYTES; \
+ } \
+}
+CHIP_mem_write_raw_multi_N(2,u_int16_t)
+CHIP_mem_write_raw_multi_N(4,u_int32_t)
+CHIP_mem_write_raw_multi_N(8,u_int64_t)
diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c
index 4d901513410..79740b2dc08 100644
--- a/sys/arch/alpha/tc/tc_bus_mem.c
+++ b/sys/arch/alpha/tc/tc_bus_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tc_bus_mem.c,v 1.6 1997/01/24 19:58:19 niklas Exp $ */
+/* $OpenBSD: tc_bus_mem.c,v 1.7 1997/04/02 22:08:10 niklas Exp $ */
/* $NetBSD: tc_bus_mem.c,v 1.13 1996/12/02 22:19:34 cgd Exp $ */
/*
@@ -145,6 +145,22 @@ void tc_mem_copy_4 __P((void *, bus_space_handle_t,
void tc_mem_copy_8 __P((void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+/* read multiple raw */
+void tc_mem_read_raw_multi_2 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+void tc_mem_read_raw_multi_4 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+void tc_mem_read_raw_multi_8 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t *, bus_size_t));
+
+/* write multiple raw */
+void tc_mem_write_raw_multi_2 __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
+void tc_mem_write_raw_multi_4 __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
+void tc_mem_write_raw_multi_8 __P((void *, bus_space_handle_t,
+ bus_size_t, const u_int8_t *, bus_size_t));
+
static struct alpha_bus_space tc_mem_space = {
/* cookie */
NULL,
@@ -214,6 +230,16 @@ static struct alpha_bus_space tc_mem_space = {
tc_mem_copy_2,
tc_mem_copy_4,
tc_mem_copy_8,
+
+ /* write multiple raw */
+ tc_mem_read_raw_multi_2,
+ tc_mem_read_raw_multi_4,
+ tc_mem_read_raw_multi_8,
+
+ /* write multiple raw*/
+ tc_mem_write_raw_multi_2,
+ tc_mem_write_raw_multi_4,
+ tc_mem_write_raw_multi_8,
};
bus_space_tag_t
@@ -612,3 +638,55 @@ tc_mem_copy_N(1)
tc_mem_copy_N(2)
tc_mem_copy_N(4)
tc_mem_copy_N(8)
+
+#define tc_mem_read_raw_multi_N(BYTES,TYPE) \
+void \
+__C(tc_mem_read_raw_multi_,BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ tc_mem_barrier(v, h, o, BYTES, BUS_BARRIER_READ); \
+ temp = __C(tc_mem_read_,BYTES)(v, h, o); \
+ for (i = 0; i < BYTES; i++) { \
+ *a++ = temp & 0xff; \
+ temp >>= 8; \
+ } \
+ c -= BYTES; \
+ } \
+}
+tc_mem_read_raw_multi_N(2,u_int16_t)
+tc_mem_read_raw_multi_N(4,u_int32_t)
+tc_mem_read_raw_multi_N(8,u_int64_t)
+
+#define tc_mem_write_raw_multi_N(BYTES,TYPE) \
+void \
+__C(tc_mem_write_raw_multi_,BYTES)(v, h, o, a, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ const u_int8_t *a; \
+{ \
+ TYPE temp; \
+ int i; \
+ \
+ while (c > 0) { \
+ temp = 0; \
+ for (i = BYTES - 1; i >= 0; i--) { \
+ temp <<= 8; \
+ temp |= *(a + i); \
+ } \
+ __C(tc_mem_write_,BYTES)(v, h, o, temp); \
+ tc_mem_barrier(v, h, o, BYTES, BUS_BARRIER_WRITE); \
+ c -= BYTES; \
+ a += BYTES; \
+ } \
+}
+tc_mem_write_raw_multi_N(2,u_int16_t)
+tc_mem_write_raw_multi_N(4,u_int32_t)
+tc_mem_write_raw_multi_N(8,u_int64_t)