diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-30 08:44:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-30 08:44:47 +0000 |
commit | 6afe9ee8d22a269ef23333736e730b3fae966922 (patch) | |
tree | d6016955c8217dc52e98356fc9aadeca908e6072 /sys/arch/pmax/tc | |
parent | 7d28578e9adbc29d49b78131d52565281c81de43 (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/arch/pmax/tc')
-rw-r--r-- | sys/arch/pmax/tc/if_le.c | 48 | ||||
-rw-r--r-- | sys/arch/pmax/tc/tc.h | 57 |
2 files changed, 25 insertions, 80 deletions
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 { |