Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga - Split X-Surf driver from if_ne_zbus, rework...
details: https://anonhg.NetBSD.org/src/rev/acaf3eb9d66c
branches: trunk
changeset: 779279:acaf3eb9d66c
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Tue May 15 17:35:43 2012 +0000
description:
- Split X-Surf driver from if_ne_zbus, rework, add support for clockports present on X-Surf boards.
- Add gencp(4), a driver for generic clockports (it just needs a base address).
Approved by phx.
diffstat:
sys/arch/amiga/clockport/clockportvar.h | 18 ++-
sys/arch/amiga/clockport/files.clockport | 31 ++++-
sys/arch/amiga/clockport/gencp.c | 61 ++++++++++
sys/arch/amiga/clockport/gencp_xsurf.c | 99 +++++++++++++++++
sys/arch/amiga/conf/GENERIC.in | 15 +-
sys/arch/amiga/conf/files.amiga | 13 +-
sys/arch/amiga/dev/if_ne_xsurf.c | 175 +++++++++++++++++++++++++++++++
sys/arch/amiga/dev/if_ne_zbus.c | 19 +---
sys/arch/amiga/dev/xsurf.c | 156 +++++++++++++++++++++++++++
sys/arch/amiga/dev/xsurfvar.h | 44 +++++++
10 files changed, 597 insertions(+), 34 deletions(-)
diffs (truncated from 786 to 300 lines):
diff -r f277275f79a4 -r acaf3eb9d66c sys/arch/amiga/clockport/clockportvar.h
--- a/sys/arch/amiga/clockport/clockportvar.h Tue May 15 17:30:04 2012 +0000
+++ b/sys/arch/amiga/clockport/clockportvar.h Tue May 15 17:35:43 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clockportvar.h,v 1.1 2012/04/17 09:59:03 rkujawa Exp $ */
+/* $NetBSD: clockportvar.h,v 1.2 2012/05/15 17:35:43 rkujawa Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,10 +31,18 @@
#include <sys/types.h>
-struct clockportbus_softc {
+struct gencp_softc {
+ device_t sc_dev;
+
struct clockportbus_attach_args *cpb_aa;
};
+struct clockportbus_softc {
+
+ struct clockportbus_attach_args *cpb_aa;
+};
+
+/* Struct passed down to clockportbus. */
struct clockportbus_attach_args {
bus_space_tag_t cp_iot;
@@ -42,6 +50,10 @@
void *(*cp_intr_establish)(int (*)(void *), void *);
};
+/*
+ * Struct passed down to devices attached to clockportbus, currently
+ * has the same data as above.
+ */
struct clockport_attach_args {
bus_space_tag_t cp_iot;
@@ -51,3 +63,5 @@
void *clockport_generic_intr_establish(int (*)(void *), void *);
+void gencp_attach(struct gencp_softc *gsc);
+
diff -r f277275f79a4 -r acaf3eb9d66c sys/arch/amiga/clockport/files.clockport
--- a/sys/arch/amiga/clockport/files.clockport Tue May 15 17:30:04 2012 +0000
+++ b/sys/arch/amiga/clockport/files.clockport Tue May 15 17:35:43 2012 +0000
@@ -1,26 +1,41 @@
-# $NetBSD: files.clockport,v 1.1 2012/04/17 09:59:03 rkujawa Exp $
+# $NetBSD: files.clockport,v 1.2 2012/05/15 17:35:43 rkujawa Exp $
define clockportbus {}
-define clockport_common
-file arch/amiga/clockport/clockport_common.c clockport_generic
+define clockport_common {}
+file arch/amiga/clockport/clockport_common.c clockport_common
+
+# Generic clockport (can be attached on top of Zorro boards)
+device gencp: clockportbus, clockport_common
+file arch/amiga/clockport/gencp.c gencp needs-flag
# A1200 clockport
device a1k2cp: clockportbus, clockport_common
attach a1k2cp at mainbus
file arch/amiga/clockport/a1k2cp.c a1k2cp
+# X-Surf clockports
+attach gencp at xsurfbus with gencp_xsurf
+file arch/amiga/clockport/gencp_xsurf.c gencp_xsurf needs-flag
+
+# more zbus clockports should be added, like:
+# Highway clockport
+# attach gencp at highwaybus with gencp_highway
+# file arch/amiga/clockport/gencp_highway.c
+#
+# also for clockports like the second one on A604:
+# device obio at mainbus {[address = -1]}
+# attach gencp at obio with gencp_obio
+# file arch/amiga/clockport/gencp_obio.c
+#
+# etc.
+
device clockport {}
attach clockport at clockportbus
file arch/amiga/clockport/clockport.c clockport
# Individual Computers SilverSurfer serial
-#device com
attach com at clockport with com_ss
file arch/amiga/clockport/com_ss.c
-# TODO: We should support for generic clockports, like:
-# device obio at mainbus {[address = -1]}
-# device gencp
-# attach gencp at obio
diff -r f277275f79a4 -r acaf3eb9d66c sys/arch/amiga/clockport/gencp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/clockport/gencp.c Tue May 15 17:35:43 2012 +0000
@@ -0,0 +1,61 @@
+/* $NetBSD: gencp.c,v 1.1 2012/05/15 17:35:43 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+/* Totally generic clockport, not much to do here... */
+
+#include <sys/cdefs.h>
+
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kmem.h>
+
+#include <machine/cpu.h>
+
+#include <amiga/amiga/device.h>
+
+#include <amiga/dev/zbusvar.h>
+
+#include <amiga/clockport/clockportvar.h>
+
+void
+gencp_attach(struct gencp_softc *gsc)
+{
+ aprint_normal(": generic clockport pa 0x%x\n",
+ (bus_addr_t) kvtop((void*) gsc->cpb_aa->cp_iot->base));
+
+ gsc->cpb_aa->cp_intr_establish = clockport_generic_intr_establish;
+
+ config_found(gsc->sc_dev, gsc->cpb_aa, 0);
+}
+
diff -r f277275f79a4 -r acaf3eb9d66c sys/arch/amiga/clockport/gencp_xsurf.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/clockport/gencp_xsurf.c Tue May 15 17:35:43 2012 +0000
@@ -0,0 +1,99 @@
+/* $NetBSD: gencp_xsurf.c,v 1.1 2012/05/15 17:35:43 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+/* Clockports on top of X-Surf. */
+
+#include <sys/cdefs.h>
+
+#include <sys/systm.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kmem.h>
+
+#include <machine/cpu.h>
+
+#include <amiga/amiga/device.h>
+
+#include <amiga/dev/zbusvar.h>
+#include <amiga/dev/xsurfvar.h>
+
+#include <amiga/clockport/clockportvar.h>
+
+static int gencp_xsurf_match(struct device *pdp, struct cfdata *cfp, void *aux);
+static void gencp_xsurf_attach(device_t parent, device_t self, void *aux);
+
+CFATTACH_DECL_NEW(gencp_xsurf, sizeof(struct gencp_softc),
+ gencp_xsurf_match, gencp_xsurf_attach, NULL, NULL);
+
+static int
+gencp_xsurf_match(struct device *pdp, struct cfdata *cfp, void *aux)
+{
+ struct xsurfbus_attach_args *xsb_aa;
+ static int attach_count = 0;
+
+ xsb_aa = (struct xsurfbus_attach_args *) aux;
+
+ if (strcmp(xsb_aa->xaa_name, "gencp_xsurf") != 0)
+ return 0;
+
+ /* No X-Surf with more than 2 clockports exists. */
+ if (attach_count >= 2)
+ return 0;
+
+ attach_count++;
+
+ return 1;
+}
+
+static void
+gencp_xsurf_attach(device_t parent, device_t self, void *aux)
+{
+ struct gencp_softc *sc;
+ struct bus_space_tag cpb_bst;
+ struct clockportbus_attach_args cpb_aa;
+ struct xsurfbus_attach_args *xsb_aa;
+
+ xsb_aa = (struct xsurfbus_attach_args *) aux;
+ sc = device_private(self);
+ sc->sc_dev = self;
+ sc->cpb_aa = &cpb_aa;
+
+ /* Set the address and bus access methods. */
+ cpb_bst.base = xsb_aa->xaa_base;
+ cpb_bst.absm = &amiga_bus_stride_4;
+
+ sc->cpb_aa->cp_iot = &cpb_bst;
+
+ gencp_attach(sc);
+}
+
diff -r f277275f79a4 -r acaf3eb9d66c sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in Tue May 15 17:30:04 2012 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in Tue May 15 17:35:43 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.98 2012/04/17 09:59:03 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.99 2012/05/15 17:35:44 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -52,7 +52,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.98 $"
+#ident "GENERIC-$Revision: 1.99 $"
m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
makeoptions COPTS="-Os"
@@ -416,8 +416,8 @@
aucc* at mainbus0 # Amiga CC audio
audio* at aucc?
-#a1k2cp0 at mainbus0 # A1200 on-board clockport
-#clockport* at a1k2cp0
+a1k2cp0 at mainbus0 # A1200 on-board clockport
+clockport* at a1k2cp0
#com* at clockport? # Individual Computers SilverSurfer
')m4_dnl
@@ -456,11 +456,16 @@
# Ethernet cards:
le* at zbus0 # A2065, Ameristar, Ariadne
Home |
Main Index |
Thread Index |
Old Index