summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:44:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:44:47 +0000
commit6afe9ee8d22a269ef23333736e730b3fae966922 (patch)
treed6016955c8217dc52e98356fc9aadeca908e6072 /sys
parent7d28578e9adbc29d49b78131d52565281c81de43 (diff)
from netbsd:
Use machine-independent TurboChannel include files from dev/tc. Add machine-dependent TC definitions in pmax/include/tc_machdep.h.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/pmax/include/tc_machdep.h84
-rw-r--r--sys/arch/pmax/tc/if_le.c48
-rw-r--r--sys/arch/pmax/tc/tc.h57
3 files changed, 109 insertions, 80 deletions
diff --git a/sys/arch/pmax/include/tc_machdep.h b/sys/arch/pmax/include/tc_machdep.h
new file mode 100644
index 00000000000..7768aebd269
--- /dev/null
+++ b/sys/arch/pmax/include/tc_machdep.h
@@ -0,0 +1,84 @@
+/* $NetBSD: tc_machdep.h,v 1.1 1995/12/28 08:42:17 jonathan Exp $ */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Jonathan Stone, Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Machine-specific definitions for TurboChannel support.
+ *
+ * This file must typedef the following types:
+ *
+ * tc_addr_t TurboChannel bus address
+ * tc_offset_t TurboChannel bus address difference (offset)
+ *
+ * This file must prototype or define the following functions
+ * or macros (one or more of which may be no-ops):
+ *
+ * tc_mb() read/write memory barrier (any CPU<->memory
+ * reads/writes before must complete before any
+ * CPU<->memory reads/writes after).
+ * tc_wmb() write memory barrier (any CPU<->memory writes
+ * before must complete before any CPU<->memory
+ * writes after).
+ * tc_syncbus() sync TC bus; make sure CPU writes are
+ * propagated across the TurboChannel bus.
+ * tc_badaddr() return non-zero if the given address is invalid.
+ * TC_DENSE_TO_SPARSE()
+ * convert the given physical address in
+ * TurboChannel dense space to the corresponding
+ * address in TurboChannel sparse space.
+ * TC_PHYS_TO_UNCACHED()
+ * convert the given system memory physical address
+ * to the physical address of the corresponding
+ * region that is not cached.
+ */
+
+#ifndef __MACHINE_TC_MACHDEP_H__
+#define __MACHINE_TC_MACHDEP_H__
+
+typedef int32_t tc_addr_t;
+typedef int32_t tc_offset_t;
+
+#define tc_mb() wbflush()
+#define tc_wmb() wbflush()
+
+/*
+ * XXX how to do this on a DECstation ?
+ */
+#define tc_syncbus() wbflush();
+
+#define tc_badaddr(tcaddr) \
+ badaddr((void *)(tcaddr), sizeof (u_int32_t))
+
+
+#define TC_DENSE_TO_SPARSE(addr) \
+ (addr)
+
+#define TC_PHYS_TO_UNCACHED(addr) \
+ (addr)
+
+#endif /* __MACHINE_TC_MACHDEP_H__*/
diff --git a/sys/arch/pmax/tc/if_le.c b/sys/arch/pmax/tc/if_le.c
index c0fbf21090c..31390a02b18 100644
--- a/sys/arch/pmax/tc/if_le.c
+++ b/sys/arch/pmax/tc/if_le.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.5 1995/12/22 12:52:09 jonathan Exp $ */
+/* $NetBSD: if_le.c,v 1.7 1995/12/28 08:42:15 jonathan Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@@ -57,41 +57,26 @@
#include <machine/autoconf.h>
+#include <dev/tc/tcvar.h>
+#include <dev/tc/ioasicvar.h>
+#include <dev/tc/if_levar.h>
+
#ifdef pmax
-typedef u_int32_t word_t;
#define wbflush() MachEmptyWriteBuffer()
/* These should be in a header file, but where? */
-int pmax_boardtype; /* Mother board type */
-/*extern u_long le_iomem;*/
extern u_long asic_base;
-
-/* does this machine have an ASIC? */
-#define SYSTEM_HAS_ASIC() \
- (pmax_boardtype == DS_MAXINE || pmax_boardtype == DS_3MIN || \
- pmax_boardtype == DS_3MAXPLUS)
+extern struct cfdriver mainbuscd; /* XXX really 3100/5100 b'board */
#include <pmax/pmax/kn01.h>
#include <machine/machConst.h>
-#include <pmax/pmax/pmaxtype.h>
-#include <pmax/tc/tc.h>
#include <pmax/pmax/asic.h>
-#include <pmax/tc/if_levar.h>
-#else /* Alpha */
-
-typedef u_int64 word_t;
-#define SYSTEM_HAS_ASIC() \
- (hwrpb->rpb_type == ST_DEC_3000_300 || hwrpb->rpb_type == ST_DEC_3000_500)
+#else /* Alpha */
#include <machine/rpb.h>
-#include <alpha/tc/tc.h>
-#include <alpha/tc/asic.h>
-#include <alpha/tc/if_levar.h>
-
#endif /* Alpha */
-
#include <dev/ic/am7990reg.h>
#define LE_NEED_BUF_CONTIG
#define LE_NEED_BUF_GAP2
@@ -193,10 +178,10 @@ leattach(parent, self, aux)
u_char *cp; /* pointer to MAC address */
int i;
- if (sc->sc_dev.dv_unit == 0 && SYSTEM_HAS_ASIC()) {
- /* It's on the system ASIC */
+ if (parent->dv_cfdata->cf_driver == &ioasiccd) {
+ /* It's on the system IOCTL ASIC */
volatile u_int *ldp;
- word_t dma_mask;
+ tc_addr_t dma_mask;
sc->sc_r1 = (struct lereg1 *)
MACH_PHYS_TO_UNCACHED(BUS_CVTADDR(ca));
@@ -216,11 +201,11 @@ leattach(parent, self, aux)
* And enable Lance dma through the asic.
*/
ldp = (volatile u_int *) (ASIC_REG_LANCE_DMAPTR(asic_base));
- dma_mask = ((word_t)le_iomem << 3);
+ dma_mask = ((tc_addr_t)le_iomem << 3);
#ifdef alpha
/* Set upper 64 bits of DMA mask */
- dma_mask = (dma_mask & ~(word_t)0x1f) |
- (((word_t)le_iomem >> 29) & 0x1f);
+ dma_mask = (dma_mask & ~(tc_addr_t)0x1f) |
+ (((tc_addr_t)le_iomem >> 29) & 0x1f);
#endif /*alpha*/
*ldp = dma_mask;
*(volatile u_int *)ASIC_REG_CSR(asic_base) |=
@@ -228,7 +213,7 @@ leattach(parent, self, aux)
wbflush();
}
#ifdef pmax
- else if (sc->sc_dev.dv_unit == 0 && (pmax_boardtype == DS_PMAX)) {
+ else if (parent->dv_cfdata->cf_driver == &mainbuscd) {
/* It's on the baseboard, attached directly to mainbus. */
sc->sc_r1 = (struct lereg1 *)BUS_CVTADDR(ca);
@@ -242,7 +227,8 @@ leattach(parent, self, aux)
sc->sc_zerobuf = zerobuf_gap2;
}
#endif
- else {
+ else
+ if (parent->dv_cfdata->cf_driver == &tccd) {
/* It's on the turbochannel proper, or on KN02 baseboard. */
sc->sc_r1 = (struct lereg1 *)
(BUS_CVTADDR(ca) + LE_OFFSET_LANCE);
@@ -275,7 +261,7 @@ leattach(parent, self, aux)
BUS_INTR_ESTABLISH(ca, leintr, sc);
- if (SYSTEM_HAS_ASIC()) {
+ if (parent->dv_cfdata->cf_driver == &ioasiccd) {
/* XXX YEECH!!! */
*(volatile u_int *)ASIC_REG_IMSK(asic_base) |= ASIC_INTR_LANCE;
wbflush();
diff --git a/sys/arch/pmax/tc/tc.h b/sys/arch/pmax/tc/tc.h
index 5e65c408af5..793bd8dc26c 100644
--- a/sys/arch/pmax/tc/tc.h
+++ b/sys/arch/pmax/tc/tc.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tc.h,v 1.1 1995/08/07 07:07:50 jonathan Exp $ */
+/* $NetBSD: tc.h,v 1.2 1995/12/28 08:42:16 jonathan Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -31,58 +31,17 @@
* TurboChannel-specific functions and structures.
*/
-/*
- * A junk address to read from, to make sure writes are complete. See
- * System Programmer's Manual, section 9.3 (p. 9-4), and sacrifice a
- * chicken.
- */
-#define MAGIC_READ do { \
- extern u_int32_t no_optimize; \
- no_optimize = *(u_int32_t *)phystok0seg(0x00000001f0080220); \
-} while (0);
-
-#define TC_SPACE_IND 0xffffffffe0000003
-#define TC_SPACE_DENSE 0x0000000000000000
-#define TC_SPACE_DENSE_OFFSET 0x0000000007fffffc
-#define TC_SPACE_SPARSE 0x0000000010000000
-#define TC_SPACE_SPARSE_OFFSET 0x000000000ffffff8
-
-#define TC_DENSE_TO_SPARSE(addr) \
- ((void *) \
- (((u_int64_t)addr & TC_SPACE_IND) | \
- TC_SPACE_SPARSE | \
- (((u_int64_t)addr & TC_SPACE_DENSE_OFFSET) << 1)))
-
-#define TC_SPARSE_TO_DENSE(addr) \
- ((void *) \
- (((u_int64_t)addr & TC_SPACE_IND) | \
- TC_SPACE_DENSE | \
- (((u_int64_t)addr & TC_SPACE_SPARSE_OFFSET) >> 1)))
-
-
-#define TC_ROM_LLEN 8
-#define TC_ROM_SLEN 4
-#define TC_ROM_TEST_SIZE 16
-
#define TC_SLOT_ROM 0x000003e0
#define TC_SLOT_PROTOROM 0x003c03e0
-typedef struct tc_padchar {
- u_int8_t v;
- u_int8_t pad[3];
-} tc_padchar_t;
+#include <machine/tc_machdep.h>
+#include <dev/tc/tcreg.h>
-struct tc_rommap {
- tc_padchar_t tcr_width;
- tc_padchar_t tcr_stride;
- tc_padchar_t tcr_rsize;
- tc_padchar_t tcr_ssize;
- u_int8_t tcr_test[TC_ROM_TEST_SIZE];
- tc_padchar_t tcr_rev[TC_ROM_LLEN];
- tc_padchar_t tcr_vendname[TC_ROM_LLEN];
- tc_padchar_t tcr_modname[TC_ROM_LLEN];
- tc_padchar_t tcr_firmtype[TC_ROM_SLEN];
-};
+
+/*
+ * Obsolete (pre-NetBSD/1.1-style) tc bus descriptor
+ * and device-attach arguments.
+ */
/* The contents of a cfdata->cf_loc for a TurboChannel device */
struct tc_cfloc {