Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc/powerpc New generic powerpc bus_space frame...
details: https://anonhg.NetBSD.org/src/rev/3b28518fe041
branches: trunk
changeset: 544243:3b28518fe041
user: matt <matt%NetBSD.org@localhost>
date: Sat Mar 15 08:03:19 2003 +0000
description:
New generic powerpc bus_space framework.
diffstat:
sys/arch/powerpc/powerpc/bus_space.c | 654 ++++++++++++++++++++++++++++
sys/arch/powerpc/powerpc/pio_subr.S | 793 +++++++++++++++++++++++++++++++++++
2 files changed, 1447 insertions(+), 0 deletions(-)
diffs (truncated from 1455 to 300 lines):
diff -r 1c1783583f2e -r 3b28518fe041 sys/arch/powerpc/powerpc/bus_space.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/powerpc/bus_space.c Sat Mar 15 08:03:19 2003 +0000
@@ -0,0 +1,654 @@
+/* $NetBSD: bus_space.c,v 1.1 2003/03/15 08:03:19 matt Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/endian.h>
+#include <sys/extent.h>
+#include <sys/malloc.h>
+
+#include <uvm/uvm_extern.h>
+
+#define _POWERPC_BUS_SPACE_PRIVATE
+#include <machine/bus.h>
+
+#ifdef PPC_OEA
+#include <powerpc/oea/bat.h>
+#include <powerpc/oea/pte.h>
+#endif
+
+/* read_N */
+u_int8_t bsr1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int16_t bsr2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int32_t bsr4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int64_t bsr8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+/* write_N */
+void bsw1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t);
+void bsw2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
+void bsw4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void bsw8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
+
+static const struct powerpc_bus_space_scalar scalar_ops = {
+ bsr1, bsr2, bsr4, bsr8,
+ bsw1, bsw2, bsw4, bsw8
+};
+
+/* read_N byte reverse */
+u_int16_t bsr2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int32_t bsr4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int64_t bsr8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+/* write_N byte reverse */
+void bsw2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
+void bsw4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void bsw8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
+
+static const struct powerpc_bus_space_scalar scalar_rb_ops = {
+ bsr1, bsr2rb, bsr4rb, bsr8rb,
+ bsw1, bsw2rb, bsw4rb, bsw8rb
+};
+
+/* read_multi_N */
+void bsrm1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *,
+ size_t);
+void bsrm2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrm4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrm8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+/* write_multi_N */
+void bswm1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int8_t *, size_t);
+void bswm2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswm4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswm8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group multi_ops = {
+ bsrm1, bsrm2, bsrm4, bsrm8,
+ bswm1, bswm2, bswm4, bswm8
+};
+
+/* read_multi_N byte reversed */
+void bsrm2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrm4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrm8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+/* write_multi_N byte reversed */
+void bswm2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswm4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswm8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group multi_rb_ops = {
+ bsrm1, bsrm2rb, bsrm4rb, bsrm8rb,
+ bswm1, bswm2rb, bswm4rb, bswm8rb
+};
+
+/* read_region_N */
+void bsrr1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *,
+ size_t);
+void bsrr2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrr4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrr8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+/* write_region_N */
+void bswr1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int8_t *, size_t);
+void bswr2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswr4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswr8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group region_ops = {
+ bsrr1, bsrr2, bsrr4, bsrr8,
+ bswr1, bswr2, bswr4, bswr8
+};
+
+void bsrr2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrr4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrr8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+void bswr2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswr4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswr8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group region_rb_ops = {
+ bsrr1, bsrr2rb, bsrr4rb, bsrr8rb,
+ bswr1, bswr2rb, bswr4rb, bswr8rb
+};
+
+/* set_region_n */
+void bssr1(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t,
+ size_t);
+void bssr2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t,
+ size_t);
+void bssr4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t,
+ size_t);
+void bssr8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t,
+ size_t);
+
+static const struct powerpc_bus_space_set set_ops = {
+ bssr1, bssr2, bssr4, bssr8,
+};
+
+void bssr2rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t,
+ size_t);
+void bssr4rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t,
+ size_t);
+void bssr8rb(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t,
+ size_t);
+
+static const struct powerpc_bus_space_set set_rb_ops = {
+ bssr1, bssr2rb, bssr4rb, bssr8rb,
+};
+
+/* copy_region_N */
+void bscr1(bus_space_tag_t, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, size_t);
+void bscr2(bus_space_tag_t, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, size_t);
+void bscr4(bus_space_tag_t, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, size_t);
+void bscr8(bus_space_tag_t, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, size_t);
+
+static const struct powerpc_bus_space_copy copy_ops = {
+ bscr1, bscr2, bscr4, bscr8
+};
+
+/*
+ * Strided versions
+ */
+/* read_N */
+u_int8_t bsr1_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int16_t bsr2_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int32_t bsr4_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int64_t bsr8_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+/* write_N */
+void bsw1_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t);
+void bsw2_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
+void bsw4_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void bsw8_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
+
+static const struct powerpc_bus_space_scalar scalar_strided_ops = {
+ bsr1_s, bsr2_s, bsr4_s, bsr8_s,
+ bsw1_s, bsw2_s, bsw4_s, bsw8_s
+};
+
+/* read_N */
+u_int16_t bsr2rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int32_t bsr4rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+u_int64_t bsr8rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+/* write_N */
+void bsw2rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
+void bsw4rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+void bsw8rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
+
+static const struct powerpc_bus_space_scalar scalar_rb_strided_ops = {
+ bsr1_s, bsr2rb_s, bsr4rb_s, bsr8rb_s,
+ bsw1_s, bsw2rb_s, bsw4rb_s, bsw8rb_s
+};
+
+/* read_multi_N */
+void bsrm1_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *,
+ size_t);
+void bsrm2_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrm4_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrm8_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+/* write_multi_N */
+void bswm1_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int8_t *, size_t);
+void bswm2_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswm4_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswm8_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group multi_strided_ops = {
+ bsrm1_s, bsrm2_s, bsrm4_s, bsrm8_s,
+ bswm1_s, bswm2_s, bswm4_s, bswm8_s
+};
+
+/* read_multi_N */
+void bsrm2rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *,
+ size_t);
+void bsrm4rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *,
+ size_t);
+void bsrm8rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t *,
+ size_t);
+
+/* write_multi_N */
+void bswm2rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, size_t);
+void bswm4rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int32_t *, size_t);
+void bswm8rb_s(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+ const u_int64_t *, size_t);
+
+static const struct powerpc_bus_space_group multi_rb_strided_ops = {
+ bsrm1_s, bsrm2rb_s, bsrm4rb_s, bsrm8rb_s,
Home |
Main Index |
Thread Index |
Old Index