Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by flxd in ticke...
details: https://anonhg.NetBSD.org/src/rev/623607beb406
branches: netbsd-8
changeset: 434047:623607beb406
user: snj <snj%NetBSD.org@localhost>
date: Sat Jul 01 08:39:21 2017 +0000
description:
Pull up following revision(s) (requested by flxd in ticket #65):
share/man/man4/tc.4: revision 1.7
sys/arch/alpha/tc/tcasic.c: revision 1.46
sys/arch/pmax/tc/tcbus.c: revision 1.33
sys/arch/vax/conf/files.vax: revision 1.121
sys/arch/vax/vsa/tc_vsbus.c: revision 1.8, 1.9
sys/dev/tc/tc.c: revision 1.55
sys/dev/tc/tcvar.h: revision 1.27
Make VAXstation 4000 TURBOchannel adaptor work.
PIO and IRQ tested on VS4000/60 and /96 with TC-USB (slhci) and PMAD-AA (le).
DMA is untested.
vax needs space to be mapped out, so memory space is pre-mapped for TC option
drivers not bus_space'ified yet, also providing custom bus_space methods for
this kludge.
--
whitespace
--
Add vax.
diffstat:
share/man/man4/tc.4 | 11 +-
sys/arch/alpha/tc/tcasic.c | 6 +-
sys/arch/pmax/tc/tcbus.c | 6 +-
sys/arch/vax/conf/files.vax | 6 +-
sys/arch/vax/vsa/tc_vsbus.c | 431 ++++++++++++++++++++++++++++++++++++-------
sys/dev/tc/tc.c | 20 +-
sys/dev/tc/tcvar.h | 4 +-
7 files changed, 388 insertions(+), 96 deletions(-)
diffs (truncated from 679 to 300 lines):
diff -r 5b9a36c24054 -r 623607beb406 share/man/man4/tc.4
--- a/share/man/man4/tc.4 Fri Jun 30 07:00:24 2017 +0000
+++ b/share/man/man4/tc.4 Sat Jul 01 08:39:21 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: tc.4,v 1.6 2016/12/26 16:03:50 wiz Exp $
+.\" $NetBSD: tc.4,v 1.6.6.1 2017/07/01 08:39:21 snj Exp $
.\"
.\" Copyright (c) 1996, 1997 Jonathan Stone.
.\" All rights reserved.
@@ -28,7 +28,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd December 26, 2016
+.Dd June 23, 2017
.Dt TC 4
.Os
.Sh NAME
@@ -39,12 +39,15 @@
.Cd "tc* at tcasic?"
.Ss pmax
.Cd "tc* at mainbus0"
+.Ss vax
+.Cd "tc0 at vsbus0"
.Sh DESCRIPTION
The
.Nm
driver provides machine-independent support for the DEC TURBOchannel
-expansion bus found on all DEC 5000-series machines with MIPS and DEC
-3000-series with Alpha processors.
+expansion bus found on all DEC 5000-series machines with MIPS, DEC
+3000-series with Alpha processors and VAXstation 4000 machines with the
+optional TURBOchannel adaptor.
.Pp
Your system may support additional
.Tn TURBOchannel
diff -r 5b9a36c24054 -r 623607beb406 sys/arch/alpha/tc/tcasic.c
--- a/sys/arch/alpha/tc/tcasic.c Fri Jun 30 07:00:24 2017 +0000
+++ b/sys/arch/alpha/tc/tcasic.c Sat Jul 01 08:39:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcasic.c,v 1.45 2016/12/12 17:03:40 flxd Exp $ */
+/* $NetBSD: tcasic.c,v 1.45.8.1 2017/07/01 08:39:21 snj Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.45 2016/12/12 17:03:40 flxd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.45.8.1 2017/07/01 08:39:21 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -222,7 +222,7 @@
char tcname[TC_ROM_LLEN];
int i;
- if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0))
+ if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname, NULL) == 0))
return (EINVAL);
for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
diff -r 5b9a36c24054 -r 623607beb406 sys/arch/pmax/tc/tcbus.c
--- a/sys/arch/pmax/tc/tcbus.c Fri Jun 30 07:00:24 2017 +0000
+++ b/sys/arch/pmax/tc/tcbus.c Sat Jul 01 08:39:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcbus.c,v 1.32 2016/12/12 17:03:41 flxd Exp $ */
+/* $NetBSD: tcbus.c,v 1.32.8.1 2017/07/01 08:39:21 snj Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.32 2016/12/12 17:03:41 flxd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.32.8.1 2017/07/01 08:39:21 snj Exp $");
#define _PMAX_BUS_DMA_PRIVATE
/*
@@ -221,7 +221,7 @@
int i;
tcaddr = promcall(callv->_slot_address, slotno);
- if (tc_badaddr(tcaddr) || tc_checkslot(tcaddr, tcname) == 0)
+ if (tc_badaddr(tcaddr) || tc_checkslot(tcaddr, tcname, NULL) == 0)
panic("TC console designated by PROM does not exist!?");
for (i = 0; i < __arraycount(cnboards); i++) {
diff -r 5b9a36c24054 -r 623607beb406 sys/arch/vax/conf/files.vax
--- a/sys/arch/vax/conf/files.vax Fri Jun 30 07:00:24 2017 +0000
+++ b/sys/arch/vax/conf/files.vax Sat Jul 01 08:39:21 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.vax,v 1.120 2015/07/05 03:06:27 matt Exp $
+# $NetBSD: files.vax,v 1.120.10.1 2017/07/01 08:39:21 snj Exp $
#
# new style config file for vax architecture
#
@@ -110,8 +110,8 @@
# TurboCHANNEL bus support and device drivers
include "dev/tc/files.tc"
-attach tc at vsbus with tcbus
-file arch/vax/vsa/tc_vsbus.c tcbus
+attach tc at vsbus with tc_vsbus
+file arch/vax/vsa/tc_vsbus.c tc_vsbus
attach uba at mainbus with uba_mainbus
file arch/vax/uba/uba_mainbus.c uba_mainbus
diff -r 5b9a36c24054 -r 623607beb406 sys/arch/vax/vsa/tc_vsbus.c
--- a/sys/arch/vax/vsa/tc_vsbus.c Fri Jun 30 07:00:24 2017 +0000
+++ b/sys/arch/vax/vsa/tc_vsbus.c Sat Jul 01 08:39:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_vsbus.c,v 1.7 2011/06/05 16:12:50 christos Exp $ */
+/* $NetBSD: tc_vsbus.c,v 1.7.46.1 2017/07/01 08:39:21 snj Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -28,120 +28,407 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: tc_vsbus.c,v 1.7.46.1 2017/07/01 08:39:21 snj Exp $");
+
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/device.h>
+#include <machine/cpu.h>
#include <machine/pte.h>
#include <machine/scb.h>
+#include <machine/sid.h>
#include <machine/vsbus.h>
+
#include <dev/tc/tcvar.h>
-static int tcbus_match(device_t, cfdata_t, void *);
-static void tcbus_attach(device_t, device_t, void *);
+#define NSLOTS 1
-struct tcbus_softc {
+struct tc_vsbus_softc {
struct tc_softc sc_tc;
- struct tc_slotdesc sc_slots[1];
+ struct tc_slotdesc sc_slots[NSLOTS];
struct vax_bus_dma_tag sc_dmatag;
struct vax_sgmap sc_sgmap;
struct evcnt sc_ev;
- bus_space_handle_t sc_memh;
+ int (*sc_intr_func)(void *);
+ void *sc_intr_arg;
+ bus_space_tag_t sc_bst;
+ bus_space_handle_t sc_bsh_csr;
+ int sc_cvec;
+};
+
+static int tc_vsbus_match(device_t, cfdata_t, void *);
+static void tc_vsbus_attach(device_t, device_t, void *);
+
+static int tc_vsbus_dma_init(device_t);
+static bus_dma_tag_t tc_vsbus_get_dma_tag(int);
+
+static void tc_vsbus_intr(void *);
+static void tc_vsbus_intr_establish(device_t, void *, int, int (*)(void *),
+ void *);
+static void tc_vsbus_intr_disestablish(device_t, void *);
+static const struct evcnt *tc_vsbus_intr_evcnt(device_t, void *);
+
+static int vax_tc_bus_space_map(void *, bus_addr_t, bus_size_t, int,
+ bus_space_handle_t *, int);
+static int vax_tc_bus_space_subregion(void *, bus_space_handle_t, bus_size_t,
+ bus_size_t, bus_space_handle_t *);
+static void vax_tc_bus_space_unmap(void *, bus_space_handle_t, bus_size_t, int);
+static int vax_tc_bus_space_alloc(void *, bus_addr_t, bus_addr_t, bus_size_t,
+ bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
+static void vax_tc_bus_space_free(void *, bus_space_handle_t, bus_size_t);
+static paddr_t vax_tc_bus_space_mmap(void *, bus_addr_t, off_t, int, int);
+
+CFATTACH_DECL_NEW(tc_vsbus, sizeof(struct tc_vsbus_softc),
+ tc_vsbus_match, tc_vsbus_attach, 0, 0);
+
+static bus_dma_tag_t tc_vsbus_dmat;
+
+struct vax_bus_space vax_tc_bus_space = {
+ NULL,
+ vax_tc_bus_space_map,
+ vax_tc_bus_space_unmap,
+ vax_tc_bus_space_subregion,
+ vax_tc_bus_space_alloc,
+ vax_tc_bus_space_free,
+ vax_tc_bus_space_mmap,
};
-static bus_dma_tag_t tcbus_dmat;
+/*
+ * taken from KA46 System Board Specification, KA46-0-DBF, Rev. X.02,
+ * 10 October 1990
+ */
+#define KA46_BWF0 0x20080014
+#define KA46_BWF0_ADP __BIT(31)
+#define KA46_BWF0_SZ 4
+
+/*
+ * taken from KA49 Processor Module Specification V 1.1, 20 August 1992
+ */
+#define KA49_CFG 0x25800000
+#define KA49_CFG_BA __BIT(0)
+#define KA49_CFG_SZ 2
-CFATTACH_DECL_NEW(tcbus, sizeof(struct tcbus_softc),
- tcbus_match, tcbus_attach, 0, 0);
+/*
+ * taken from Pmariah TURBOchannel Adapter Specification, 29 November 1991
+ */
+#define KA4x_TCA_BASE 0x30000000
+#define KA4x_TCA_DIAG_TRIG (KA4x_TCA_BASE + 0x4000000)
+#define KA4x_TCA_MAP_CHK_SEQ (KA4x_TCA_BASE + 0x4800000)
+#define KA4x_TCA_FIFO_DIAG (KA4x_TCA_BASE + 0x5000000)
+#define KA4x_TCA_SGMAP (KA4x_TCA_BASE + 0x5800000)
+#define KA4x_TCA_DIAG_ROM (KA4x_TCA_BASE + 0x6000000)
+#define KA4x_TCA_CSR (KA4x_TCA_BASE + 0x6800000)
+#define KA4x_TCA_CSR_BLK_SZ __BITS(0, 2) /* 0x00007 RW */
+#define KA4x_TCA_CSR_SPARE __BIT(3) /* 0x00008 RW */
+#define KA4x_TCA_CSR_BAD_PAR __BITS(4, 7) /* 0x000f0 RW */
+#define KA4x_TCA_CSR_RST_TC __BIT(8) /* 0x00100 RW */
+#define KA4x_TCA_CSR_EN_MAP __BIT(9) /* 0x00200 RW */
+#define KA4x_TCA_CSR_INVAL_REF __BIT(10) /* 0x00400 RW1C */
+#define KA4x_TCA_CSR_TC_TMO __BIT(11) /* 0x00800 RW */
+#define KA4x_TCA_CSR_EN_TC_IRQ __BIT(12) /* 0x01000 RW */
+#define KA4x_TCA_CSR_TC_IRQ __BIT(13) /* 0x02000 R */
+#define KA4x_TCA_CSR_ERR __BIT(14) /* 0x04000 RW1C */
+#define KA4x_TCA_CSR_ALT_CYC_ST __BIT(15) /* 0x08000 RW */
+#define KA4x_TCA_CSR_EN_PAR __BIT(16) /* 0x10000 RW */
+#define KA4x_TCA_CSR_FIFO_EMPTY __BIT(17) /* 0x20000 R */
+#define KA4x_TCA_CSR_SZ 4
-static bus_dma_tag_t
-tcbus_get_dma_tag(int slotno)
+static int
+tc_vsbus_match(device_t parent, cfdata_t cfdata, void *aux)
{
- return tcbus_dmat;
+ struct vsbus_attach_args * const va = aux;
+ uint32_t *csr;
+ bus_space_tag_t bst = va->va_memt;
+ bus_space_handle_t bsh;
+ int found, rc;
+
+ if (va->va_paddr != KA4x_TCA_CSR)
+ return 0;
+
+ /* Bus adaptor present? */
+ switch (vax_boardtype) {
+ case VAX_BTYP_46:
+ if (bus_space_map(bst, KA46_BWF0, KA46_BWF0_SZ, 0, &bsh))
+ return 0;
+ found = ((bus_space_read_4(bst, bsh, 0) & KA46_BWF0_ADP) != 0);
+ bus_space_unmap(bst, bsh, KA46_BWF0_SZ);
+ /*
+ * On VS4000/60, although interrupting on a real vector, fool
+ * vsbus interrupt, as no interrupt bit will be set in
+ * vsbus_softc's sc_intreq for TC adaptor.
+ */
+ rc = 20;
+ break;
+ case VAX_BTYP_49:
+ if (bus_space_map(bst, KA49_CFG, KA49_CFG_SZ, 0, &bsh))
+ return 0;
+ found = ((bus_space_read_2(bst, bsh, 0) & KA49_CFG_BA) != 0);
+ bus_space_unmap(bst, bsh, KA49_CFG_SZ);
+ rc = 10;
+ break;
+ default:
+ return 0;
+ }
+ if (!found)
+ return 0;
+
+ /* XXX Assume a found bus adaptor is the TC bus adaptor. */
+
+ /* Force interrupt. */
+ csr = (uint32_t *)va->va_addr;
+ *csr |= KA4x_TCA_CSR_TC_TMO;
+ DELAY(10000);
+ *csr &= ~KA4x_TCA_CSR_TC_TMO;
+ DELAY(10000);
+
+ return rc;
}
+#define INIT_SLOTSZ 1
+
static void
-tcbus_intr_establish(device_t dv, void *cookie, int level,
- int (*func)(void *), void *arg)
+tc_vsbus_attach(device_t parent, device_t self, void *aux)
{
Home |
Main Index |
Thread Index |
Old Index