summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/pci/pcs_bus_io_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/alpha/pci/pcs_bus_io_common.c')
-rw-r--r--sys/arch/alpha/pci/pcs_bus_io_common.c83
1 files changed, 82 insertions, 1 deletions
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)