Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga Changes to ACA500 support:
details: https://anonhg.NetBSD.org/src/rev/1492ed47f2db
branches: trunk
changeset: 792139:1492ed47f2db
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Sun Dec 22 23:02:38 2013 +0000
description:
Changes to ACA500 support:
- Add support for second (aux) CF slot.
- Rework wdc attachment to be more sane.
- Add support for clockport on ACA500.
- Fix style where appropriate.
diffstat:
sys/arch/amiga/clockport/files.clockport | 6 +-
sys/arch/amiga/clockport/gencp_acafh.c | 98 ++++++++++++++++++
sys/arch/amiga/conf/GENERIC.in | 8 +-
sys/arch/amiga/dev/acafh.c | 11 +-
sys/arch/amiga/dev/acafhreg.h | 3 +-
sys/arch/amiga/dev/acafhvar.h | 4 +-
sys/arch/amiga/dev/wdc_acafh.c | 168 +++++++++++++++++++-----------
7 files changed, 228 insertions(+), 70 deletions(-)
diffs (truncated from 465 to 300 lines):
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/clockport/files.clockport
--- a/sys/arch/amiga/clockport/files.clockport Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/clockport/files.clockport Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.clockport,v 1.4 2012/11/08 18:30:21 rkujawa Exp $
+# $NetBSD: files.clockport,v 1.5 2013/12/22 23:02:38 rkujawa Exp $
define clockportbus {}
@@ -18,6 +18,10 @@
attach gencp at xsurfbus with gencp_xsurf
file arch/amiga/clockport/gencp_xsurf.c gencp_xsurf needs-flag
+# ACA500 clockport
+attach gencp at acafhbus with gencp_acafh
+file arch/amiga/clockport/gencp_acafh.c gencp_acafh needs-flag
+
# more zbus clockports should be added, like:
# Highway clockport
# attach gencp at highwaybus with gencp_highway
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/clockport/gencp_acafh.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/clockport/gencp_acafh.c Sun Dec 22 23:02:38 2013 +0000
@@ -0,0 +1,98 @@
+/* $NetBSD: gencp_acafh.c,v 1.1 2013/12/22 23:02:38 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2013 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.
+ */
+
+/* Clockport on ACA500. */
+
+#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/acafhvar.h>
+#include <amiga/dev/zbusvar.h>
+
+#include <amiga/clockport/clockportvar.h>
+
+static int gencp_acafh_match(device_t, cfdata_t, void *);
+static void gencp_acafh_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(gencp_acafh, sizeof(struct gencp_softc),
+ gencp_acafh_match, gencp_acafh_attach, NULL, NULL);
+
+static int
+gencp_acafh_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct acafhbus_attach_args *aaa_aa;
+ static int attach_count = 0;
+
+ aaa_aa = aux;
+
+ if (strcmp(aaa_aa->aaa_name, "gencp_acafh") != 0)
+ return 0;
+
+ if (attach_count >= 1)
+ return 0;
+
+ attach_count++;
+
+ return 1;
+}
+
+static void
+gencp_acafh_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 acafhbus_attach_args *aaa_aa;
+
+ aaa_aa = aux;
+ sc = device_private(self);
+ sc->sc_dev = self;
+ sc->cpb_aa = &cpb_aa;
+
+ /* Set the address and bus access methods. */
+ cpb_bst.base = (bus_addr_t) __UNVOLATILE(ztwomap(aaa_aa->aaa_pbase));
+ cpb_bst.absm = &amiga_bus_stride_4;
+
+ sc->cpb_aa->cp_iot = &cpb_bst;
+
+ gencp_attach(sc);
+}
+
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.121 2013/12/22 02:21:51 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.122 2013/12/22 23:02:38 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -52,7 +52,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.121 $"
+#ident "GENERIC-$Revision: 1.122 $"
m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
makeoptions COPTS="-Os"
@@ -462,6 +462,7 @@
ne* at xsurfbus? # NE2000 chip on X-Surf
gencp* at xsurfbus? # clockports on X-Surf
wdc* at xsurfbus? # IDE on X-Surf
+
clockport* at gencp?
# Arcnet
@@ -517,7 +518,8 @@
#acafh0 at mainbus0 # Individual Computers ACA500
#options ACA500_SUPPORT
-#wdc* at acafhbus?
+#wdc* at acafhbus? # CF slots on ACA500
+#gencp* at acafhbus? # clockport on ACA500
wdc0 at mainbus0 # A4000 & A1200 IDE bus
wdc* at zbus0 # Buddha / Catweasel
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/dev/acafh.c
--- a/sys/arch/amiga/dev/acafh.c Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/dev/acafh.c Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acafh.c,v 1.1 2013/12/22 02:21:51 rkujawa Exp $ */
+/* $NetBSD: acafh.c,v 1.2 2013/12/22 23:02:38 rkujawa Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acafh.c,v 1.1 2013/12/22 02:21:51 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acafh.c,v 1.2 2013/12/22 23:02:38 rkujawa Exp $");
/*
* Individual Computers ACA500 driver.
@@ -78,6 +78,7 @@
vaddr_t aca_vbase;
int i;
struct acafhbus_attach_args aaa_wdc;
+ struct acafhbus_attach_args aaa_cp;
sc = device_private(self);
sc->sc_dev = self;
@@ -127,9 +128,13 @@
}
aprint_normal("\n");
- aaa_wdc.aaa_base = (bus_addr_t) 0xDA0000 + 2;
+ aaa_wdc.aaa_pbase = (bus_addr_t) GAYLE_IDE_BASE + 2;
strcpy(aaa_wdc.aaa_name, "wdc_acafh");
config_found_ia(sc->sc_dev, "acafhbus", &aaa_wdc, acafh_print);
+
+ aaa_cp.aaa_pbase = (bus_addr_t) ACAFH_CLOCKPORT_BASE;
+ strcpy(aaa_cp.aaa_name, "gencp_acafh");
+ config_found_ia(sc->sc_dev, "acafhbus", &aaa_cp, acafh_print);
}
uint8_t
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/dev/acafhreg.h
--- a/sys/arch/amiga/dev/acafhreg.h Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/dev/acafhreg.h Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acafhreg.h,v 1.1 2013/12/22 02:21:51 rkujawa Exp $ */
+/* $NetBSD: acafhreg.h,v 1.2 2013/12/22 23:02:38 rkujawa Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
#ifndef _AMIGA_ACAFHREG_H_
#define GAYLE_IDE_BASE 0xDA0000 /* ACA500 has Gayle-compatible IDE */
+#define ACAFH_CLOCKPORT_BASE 0xD80001
#define ACAFH_MSB_SHIFT 0xF
#define ACAFH_MSB_MASK 0x8000
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/dev/acafhvar.h
--- a/sys/arch/amiga/dev/acafhvar.h Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/dev/acafhvar.h Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acafhvar.h,v 1.1 2013/12/22 02:21:51 rkujawa Exp $ */
+/* $NetBSD: acafhvar.h,v 1.2 2013/12/22 23:02:38 rkujawa Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
struct acafhbus_attach_args {
char aaa_name[32];
- bus_addr_t aaa_base;
+ bus_addr_t aaa_pbase; /* physical base address */
};
uint8_t acafh_cf_intr_status(struct acafh_softc *, uint8_t);
diff -r df53a9bb28ba -r 1492ed47f2db sys/arch/amiga/dev/wdc_acafh.c
--- a/sys/arch/amiga/dev/wdc_acafh.c Sun Dec 22 18:30:21 2013 +0000
+++ b/sys/arch/amiga/dev/wdc_acafh.c Sun Dec 22 23:02:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_acafh.c,v 1.1 2013/12/22 02:21:51 rkujawa Exp $ */
+/* $NetBSD: wdc_acafh.c,v 1.2 2013/12/22 23:02:38 rkujawa Exp $ */
/*-
* Copyright (c) 2000, 2003, 2013 The NetBSD Foundation, Inc.
@@ -32,8 +32,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * ACA500 CF (IDE) controller driver.
+ *
+ * The hardware emulates original A600/A1200 Gayle interface. However, it has
+ * two channels, second channel placed instead of ctl registers (so software
+ * reset of the bus is not possible, duh). There are no slave devices.
+ */
+
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_acafh.c,v 1.1 2013/12/22 02:21:51 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_acafh.c,v 1.2 2013/12/22 23:02:38 rkujawa Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -52,26 +60,39 @@
#include <amiga/amiga/gayle.h>
#include <amiga/dev/zbusvar.h>
#include <amiga/dev/acafhvar.h>
+#include <amiga/dev/acafhreg.h>
#include <dev/ata/atavar.h>
#include <dev/ic/wdcvar.h>
-struct wdc_acafh_softc {
- struct wdc_softc sc_wdcdev;
- struct ata_channel *sc_chanlist[1];
- struct ata_channel sc_channel;
- struct ata_queue sc_chqueue;
- struct wdc_regs sc_wdc_regs;
- struct isr sc_isr;
- volatile u_char *sc_intreg;
- struct bus_space_tag cmd_iot;
- struct bus_space_tag ctl_iot;
- struct acafh_softc *aca_sc;
+#define WDC_ACAFH_SLOTS 2
+
+struct wdc_acafh_slot {
+ struct ata_channel channel;
+ struct ata_queue chqueue;
+ struct wdc_regs wdr;
};
-int wdc_acafh_match(device_t, cfdata_t, void *);
-void wdc_acafh_attach(device_t, device_t, void *);
-int wdc_acafh_intr(void *);
+struct wdc_acafh_softc {
+ device_t sc_dev;
+
+ struct wdc_softc sc_wdcdev;
+ struct ata_channel *sc_chanlist[WDC_ACAFH_SLOTS];
+ struct wdc_acafh_slot sc_slots[WDC_ACAFH_SLOTS];
+
+ struct isr sc_isr;
Home |
Main Index |
Thread Index |
Old Index