these are going to be made machine-independent
This commit is contained in:
parent
17f70e1910
commit
1ebd4658b5
|
@ -1,249 +0,0 @@
|
|||
/* $NetBSD: if_le.c,v 1.9 1995/11/25 01:31:09 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Ralph Campbell and Rick Macklem.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)if_le.c 8.2 (Berkeley) 11/16/93
|
||||
*/
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#endif
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/rpb.h>
|
||||
|
||||
#include <alpha/tc/tc.h>
|
||||
#include <alpha/tc/asic.h>
|
||||
#include <alpha/tc/if_levar.h>
|
||||
#include <dev/ic/am7990reg.h>
|
||||
#define LE_NEED_BUF_CONTIG
|
||||
#define LE_NEED_BUF_GAP2
|
||||
#define LE_NEED_BUF_GAP16
|
||||
#include <dev/ic/am7990var.h>
|
||||
|
||||
/* access LANCE registers */
|
||||
void lewritereg();
|
||||
#define LERDWR(cntl, src, dst) { (dst) = (src); wbflush(); }
|
||||
#define LEWREG(src, dst) lewritereg(&(dst), (src))
|
||||
|
||||
#define LE_OFFSET_RAM 0x0
|
||||
#define LE_OFFSET_LANCE 0x100000
|
||||
#define LE_OFFSET_ROM 0x1c0000
|
||||
|
||||
extern caddr_t le_iomem;
|
||||
|
||||
#define LE_SOFTC(unit) lecd.cd_devs[unit]
|
||||
#define LE_DELAY(x) DELAY(x)
|
||||
|
||||
int lematch __P((struct device *, void *, void *));
|
||||
void leattach __P((struct device *, struct device *, void *));
|
||||
int leintr __P((void *));
|
||||
|
||||
struct cfdriver lecd = {
|
||||
NULL, "le", lematch, leattach, DV_IFNET, sizeof (struct le_softc)
|
||||
};
|
||||
|
||||
integrate void
|
||||
lewrcsr(sc, port, val)
|
||||
struct le_softc *sc;
|
||||
u_int16_t port, val;
|
||||
{
|
||||
struct lereg1 *ler1 = sc->sc_r1;
|
||||
|
||||
LEWREG(port, ler1->ler1_rap);
|
||||
LERDWR(port, val, ler1->ler1_rdp);
|
||||
}
|
||||
|
||||
integrate u_int16_t
|
||||
lerdcsr(sc, port)
|
||||
struct le_softc *sc;
|
||||
u_int16_t port;
|
||||
{
|
||||
struct lereg1 *ler1 = sc->sc_r1;
|
||||
u_int16_t val;
|
||||
|
||||
LEWREG(port, ler1->ler1_rap);
|
||||
LERDWR(0, ler1->ler1_rdp, val);
|
||||
return (val);
|
||||
}
|
||||
|
||||
int
|
||||
lematch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
{
|
||||
struct cfdata *cf = match;
|
||||
struct confargs *ca = aux;
|
||||
#ifdef notdef /* XXX */
|
||||
struct tc_cfloc *tc_locp;
|
||||
struct asic_cfloc *asic_locp;
|
||||
#endif
|
||||
|
||||
#ifdef notdef /* XXX */
|
||||
tclocp = (struct tc_cfloc *)cf->cf_loc;
|
||||
#endif
|
||||
|
||||
/* XXX CHECK BUS */
|
||||
/* make sure that we're looking for this type of device. */
|
||||
#ifdef notdef
|
||||
if (!BUS_MATCHNAME(ca, "PMAD-BA "))
|
||||
#endif
|
||||
if (!BUS_MATCHNAME(ca, "lance"))
|
||||
return (0);
|
||||
|
||||
#ifdef notdef /* XXX */
|
||||
/* make sure the unit matches the cfdata */
|
||||
if ((cf->cf_unit != tap->ta_unit &&
|
||||
tap->ta_unit != TA_ANYUNIT) ||
|
||||
(tclocp->cf_slot != tap->ta_slot &&
|
||||
tclocp->cf_slot != TC_SLOT_WILD) ||
|
||||
(tclocp->cf_offset != tap->ta_offset &&
|
||||
tclocp->cf_offset != TC_OFFSET_WILD))
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
leattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
register struct le_softc *sc = (void *)self;
|
||||
struct confargs *ca = aux;
|
||||
u_char *cp;
|
||||
int i;
|
||||
|
||||
if (sc->sc_dev.dv_unit == 0 && (hwrpb->rpb_type == ST_DEC_3000_300 ||
|
||||
hwrpb->rpb_type == ST_DEC_3000_500)) {
|
||||
/* It's on the system ASIC */
|
||||
volatile u_int *ldp;
|
||||
|
||||
sc->sc_r1 = (struct lereg1 *)BUS_CVTADDR(ca);
|
||||
sc->sc_r1 = TC_DENSE_TO_SPARSE(sc->sc_r1);
|
||||
sc->sc_mem = (void *)le_iomem;
|
||||
/* XXX */ cp = (u_char *)ASIC_SYS_ETHER_ADDRESS(asic_base);
|
||||
|
||||
sc->sc_copytodesc = copytobuf_gap2;
|
||||
sc->sc_copyfromdesc = copyfrombuf_gap2;
|
||||
sc->sc_copytobuf = copytobuf_gap16;
|
||||
sc->sc_copyfrombuf = copyfrombuf_gap16;
|
||||
sc->sc_zerobuf = zerobuf_gap16;
|
||||
|
||||
/*
|
||||
* And enable Lance dma through the asic.
|
||||
*/
|
||||
ldp = (volatile u_int *)ASIC_REG_LANCE_DMAPTR(asic_base);
|
||||
*ldp = (((u_int64_t)le_iomem << 3) & ~(u_int64_t)0x1f) |
|
||||
(((u_int64_t)le_iomem >> 29) & 0x1f);
|
||||
*(volatile u_int *)ASIC_REG_CSR(asic_base) |=
|
||||
ASIC_CSR_DMAEN_LANCE;
|
||||
wbflush();
|
||||
} else {
|
||||
/* It's on the turbochannel proper */
|
||||
sc->sc_r1 = (struct lereg1 *)
|
||||
(BUS_CVTADDR(ca) + LE_OFFSET_LANCE);
|
||||
sc->sc_mem = (void *)
|
||||
(BUS_CVTADDR(ca) + LE_OFFSET_RAM);
|
||||
cp = (u_char *)(BUS_CVTADDR(ca) + LE_OFFSET_ROM + 2);
|
||||
|
||||
sc->sc_copytodesc = copytobuf_contig;
|
||||
sc->sc_copyfromdesc = copyfrombuf_contig;
|
||||
sc->sc_copytobuf = copytobuf_contig;
|
||||
sc->sc_copyfrombuf = copyfrombuf_contig;
|
||||
sc->sc_zerobuf = zerobuf_contig;
|
||||
}
|
||||
|
||||
sc->sc_conf3 = 0;
|
||||
sc->sc_addr = 0;
|
||||
sc->sc_memsize = 65536;
|
||||
|
||||
/*
|
||||
* Get the ethernet address out of rom
|
||||
*/
|
||||
for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) {
|
||||
sc->sc_arpcom.ac_enaddr[i] = *cp;
|
||||
cp += 4;
|
||||
}
|
||||
|
||||
sc->sc_arpcom.ac_if.if_name = lecd.cd_name;
|
||||
leconfig(sc);
|
||||
|
||||
BUS_INTR_ESTABLISH(ca, leintr, sc);
|
||||
/* XXX YEECH!!! */
|
||||
*(volatile u_int *)ASIC_REG_IMSK(asic_base) |= ASIC_INTR_LANCE;
|
||||
wbflush();
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a lance register port, reading it back to ensure success. This seems
|
||||
* to be necessary during initialization, since the chip appears to be a bit
|
||||
* pokey sometimes.
|
||||
*/
|
||||
void
|
||||
lewritereg(regptr, val)
|
||||
register volatile u_short *regptr;
|
||||
register u_short val;
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
while (*regptr != val) {
|
||||
*regptr = val;
|
||||
wbflush();
|
||||
if (++i > 10000) {
|
||||
printf("le: Reg did not settle (to x%x): x%x\n", val,
|
||||
*regptr);
|
||||
return;
|
||||
}
|
||||
DELAY(100);
|
||||
}
|
||||
}
|
||||
|
||||
#include <dev/ic/am7990.c>
|
|
@ -1,96 +0,0 @@
|
|||
/* $NetBSD: if_levar.h,v 1.1 1995/06/28 01:48:26 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Ralph Campbell and Rick Macklem.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)if_lereg.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/* Local Area Network Controller for Ethernet (LANCE) registers */
|
||||
struct lereg1 {
|
||||
volatile u_int16_t ler1_rdp; /* data port */
|
||||
int16_t pad0;
|
||||
int32_t pad1;
|
||||
volatile u_int16_t ler1_rap; /* register select port */
|
||||
int16_t pad2;
|
||||
int32_t pad3;
|
||||
};
|
||||
|
||||
/*
|
||||
* Ethernet software status per interface.
|
||||
*
|
||||
* Each interface is referenced by a network interface structure,
|
||||
* arpcom.ac_if, which the routing code uses to locate the interface.
|
||||
* This structure contains the output queue for the interface, its address, ...
|
||||
*/
|
||||
struct le_softc {
|
||||
struct device sc_dev; /* base structure */
|
||||
struct arpcom sc_arpcom; /* Ethernet common part */
|
||||
|
||||
void (*sc_copytodesc) /* Copy to descriptor */
|
||||
__P((struct le_softc *, void *, int, int));
|
||||
void (*sc_copyfromdesc) /* Copy from descriptor */
|
||||
__P((struct le_softc *, void *, int, int));
|
||||
|
||||
void (*sc_copytobuf) /* Copy to buffer */
|
||||
__P((struct le_softc *, void *, int, int));
|
||||
void (*sc_copyfrombuf) /* Copy from buffer */
|
||||
__P((struct le_softc *, void *, int, int));
|
||||
void (*sc_zerobuf) /* and Zero bytes in buffer */
|
||||
__P((struct le_softc *, int, int));
|
||||
|
||||
u_int16_t sc_conf3; /* CSR3 value */
|
||||
|
||||
void *sc_mem; /* base addr of RAM -- CPU's view */
|
||||
u_long sc_addr; /* base addr of RAM -- LANCE's view */
|
||||
u_long sc_memsize; /* size of RAM */
|
||||
|
||||
int sc_nrbuf; /* number of receive buffers */
|
||||
int sc_ntbuf; /* number of transmit buffers */
|
||||
int sc_last_rd;
|
||||
int sc_first_td, sc_last_td, sc_no_td;
|
||||
|
||||
int sc_initaddr;
|
||||
int sc_rmdaddr;
|
||||
int sc_tmdaddr;
|
||||
int sc_rbufaddr;
|
||||
int sc_tbufaddr;
|
||||
|
||||
#ifdef LEDEBUG
|
||||
int sc_debug;
|
||||
#endif
|
||||
|
||||
struct lereg1 *sc_r1; /* LANCE registers */
|
||||
};
|
|
@ -1,272 +0,0 @@
|
|||
/* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/rpb.h>
|
||||
|
||||
#include <alpha/tc/tc.h>
|
||||
|
||||
struct tc_softc {
|
||||
struct device sc_dv;
|
||||
struct abus sc_bus;
|
||||
struct tc_cpu_desc *sc_desc;
|
||||
};
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
int tcmatch(struct device *, void *, void *);
|
||||
void tcattach(struct device *, struct device *, void *);
|
||||
int tcprint(void *, char *);
|
||||
struct cfdriver tccd =
|
||||
{ NULL, "tc", tcmatch, tcattach, DV_DULL, sizeof (struct tc_softc) };
|
||||
|
||||
void tc_intr_establish __P((struct confargs *, int (*)(void *), void *));
|
||||
void tc_intr_disestablish __P((struct confargs *));
|
||||
caddr_t tc_cvtaddr __P((struct confargs *));
|
||||
int tc_matchname __P((struct confargs *, char *));
|
||||
|
||||
extern int cputype;
|
||||
|
||||
#ifdef DEC_3000_300
|
||||
extern struct tc_cpu_desc dec_3000_300_cpu;
|
||||
#endif
|
||||
#ifdef DEC_3000_500
|
||||
extern struct tc_cpu_desc dec_3000_500_cpu;
|
||||
#endif
|
||||
|
||||
struct tc_cpu_desc *tc_cpu_devs[] = {
|
||||
NULL, /* Unused */
|
||||
NULL, /* ST_ADU */
|
||||
NULL, /* ST_DEC_4000 */
|
||||
NULL, /* ST_DEC_7000 */
|
||||
#ifdef DEC_3000_500
|
||||
&dec_3000_500_cpu, /* ST_DEC_3000_500 */
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
NULL, /* Unused */
|
||||
NULL, /* ST_DEC_2000_300 */
|
||||
#ifdef DEC_3000_300
|
||||
&dec_3000_300_cpu, /* ST_DEC_3000_300 */
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
};
|
||||
int ntc_cpu_devs = sizeof tc_cpu_devs / sizeof tc_cpu_devs[0];
|
||||
|
||||
int
|
||||
tcmatch(parent, cfdata, aux)
|
||||
struct device *parent;
|
||||
void *cfdata;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = cfdata;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* Make sure that we're looking for a TC. */
|
||||
if (strcmp(ca->ca_name, tccd.cd_name) != 0)
|
||||
return (0);
|
||||
|
||||
/* Make sure that unit exists. */
|
||||
if (cf->cf_unit != 0 ||
|
||||
cputype > ntc_cpu_devs || tc_cpu_devs[cputype] == NULL)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
tcattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct tc_softc *sc = (struct tc_softc *)self;
|
||||
struct confargs *nca;
|
||||
char namebuf[TC_ROM_LLEN+1];
|
||||
int i;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* keep our CPU description handy */
|
||||
sc->sc_desc = tc_cpu_devs[cputype];
|
||||
|
||||
/* set up interrupt handlers */
|
||||
(*sc->sc_desc->tc_intr_setup)();
|
||||
set_iointr(sc->sc_desc->tc_iointr);
|
||||
|
||||
sc->sc_bus.ab_dv = (struct device *)sc;
|
||||
sc->sc_bus.ab_type = BUS_TC;
|
||||
sc->sc_bus.ab_intr_establish = tc_intr_establish;
|
||||
sc->sc_bus.ab_intr_disestablish = tc_intr_disestablish;
|
||||
sc->sc_bus.ab_cvtaddr = tc_cvtaddr;
|
||||
sc->sc_bus.ab_matchname = tc_matchname;
|
||||
|
||||
/* Try to configure each CPU-internal device */
|
||||
for (i = 0; i < sc->sc_desc->tcd_ndevs; i++) {
|
||||
nca = &sc->sc_desc->tcd_devs[i];
|
||||
nca->ca_bus = &sc->sc_bus;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (nca->ca_slot > sc->sc_desc->tcd_nslots)
|
||||
panic("tcattach: dev slot > number of slots for %s",
|
||||
nca->ca_name);
|
||||
#endif
|
||||
|
||||
if (tc_checkdevmem(nca) == 0)
|
||||
continue;
|
||||
|
||||
/* If no name, we have to see what might be there. */
|
||||
if (nca->ca_name == NULL) {
|
||||
if (tc_checkslot(nca, namebuf) == 0)
|
||||
continue;
|
||||
nca->ca_name = namebuf;
|
||||
}
|
||||
|
||||
/* Tell the autoconfig machinery we've found the hardware. */
|
||||
config_found(self, nca, tcprint);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
tcprint(aux, pnp)
|
||||
void *aux;
|
||||
char *pnp;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
if (pnp)
|
||||
printf("%s at %s", ca->ca_name, pnp);
|
||||
printf(" slot %ld offset 0x%lx", ca->ca_slot, ca->ca_offset);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
caddr_t
|
||||
tc_cvtaddr(ca)
|
||||
struct confargs *ca;
|
||||
{
|
||||
struct tc_softc *sc = tccd.cd_devs[0];
|
||||
|
||||
return (sc->sc_desc->tcd_slots[ca->ca_slot].tsd_dense + ca->ca_offset);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
tc_intr_establish(ca, handler, val)
|
||||
struct confargs *ca;
|
||||
intr_handler_t handler;
|
||||
void *val;
|
||||
{
|
||||
struct tc_softc *sc = tccd.cd_devs[0];
|
||||
|
||||
(*sc->sc_desc->tc_intr_establish)(ca, handler, val);
|
||||
}
|
||||
|
||||
void
|
||||
tc_intr_disestablish(ca)
|
||||
struct confargs *ca;
|
||||
{
|
||||
struct tc_softc *sc = tccd.cd_devs[0];
|
||||
|
||||
(*sc->sc_desc->tc_intr_disestablish)(ca);
|
||||
}
|
||||
|
||||
int
|
||||
tc_matchname(ca, name)
|
||||
struct confargs *ca;
|
||||
char *name;
|
||||
{
|
||||
|
||||
return (bcmp(name, ca->ca_name, TC_ROM_LLEN) == 0);
|
||||
}
|
||||
|
||||
int
|
||||
tc_checkdevmem(ca)
|
||||
struct confargs *ca;
|
||||
{
|
||||
u_int32_t *datap;
|
||||
|
||||
datap = (u_int32_t *)BUS_CVTADDR(ca);
|
||||
|
||||
/* Return non-zero if memory was there (i.e. address wasn't bad). */
|
||||
return (!badaddr(datap, sizeof (u_int32_t)));
|
||||
}
|
||||
|
||||
u_int64_t tc_slot_romoffs[] = { TC_SLOT_ROM, TC_SLOT_PROTOROM };
|
||||
int ntc_slot_romoffs = sizeof tc_slot_romoffs / sizeof tc_slot_romoffs[0];
|
||||
|
||||
int
|
||||
tc_checkslot(ca, namep)
|
||||
struct confargs *ca;
|
||||
char *namep;
|
||||
{
|
||||
struct tc_rommap *romp;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < ntc_slot_romoffs; i++) {
|
||||
romp = (struct tc_rommap *)
|
||||
(BUS_CVTADDR(ca) + tc_slot_romoffs[i]);
|
||||
|
||||
switch (romp->tcr_width.v) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (romp->tcr_stride.v != 4)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
if (romp->tcr_test[j+0*romp->tcr_stride.v] != 0x55 ||
|
||||
romp->tcr_test[j+1*romp->tcr_stride.v] != 0x00 ||
|
||||
romp->tcr_test[j+2*romp->tcr_stride.v] != 0xaa ||
|
||||
romp->tcr_test[j+3*romp->tcr_stride.v] != 0xff)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < TC_ROM_LLEN; j++)
|
||||
namep[j] = romp->tcr_modname[j].v;
|
||||
namep[TC_ROM_LLEN] = '\0';
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
tc_intrnull(val)
|
||||
void *val;
|
||||
{
|
||||
|
||||
panic("uncaught TC intr for slot %ld\n", (long)val);
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/* $NetBSD: tc.h,v 1.1 1995/02/13 23:09:07 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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];
|
||||
};
|
||||
|
||||
/* The contents of a cfdata->cf_loc for a TurboChannel device */
|
||||
struct tc_cfloc {
|
||||
int cf_slot; /* Slot number */
|
||||
int cf_offset; /* XXX? Offset into slot. */
|
||||
int cf_vec;
|
||||
int cf_ipl;
|
||||
};
|
||||
|
||||
#define TC_SLOT_WILD -1 /* wildcarded slot */
|
||||
#define TC_OFFSET_WILD -1 /* wildcarded offset */
|
||||
#define TC_VEC_WILD -1 /* wildcarded vec */
|
||||
#define TC_IPL_WILD -1 /* wildcarded ipl */
|
||||
|
||||
struct tc_slot_desc {
|
||||
caddr_t tsd_dense;
|
||||
};
|
||||
|
||||
struct tc_cpu_desc {
|
||||
struct tc_slot_desc *tcd_slots;
|
||||
long tcd_nslots;
|
||||
struct confargs *tcd_devs;
|
||||
long tcd_ndevs;
|
||||
void (*tc_intr_setup) __P((void));
|
||||
void (*tc_intr_establish)
|
||||
__P((struct confargs *, intr_handler_t, void *));
|
||||
void (*tc_intr_disestablish) __P((struct confargs *));
|
||||
void (*tc_iointr) __P((void *, int));
|
||||
};
|
||||
|
||||
int tc_intrnull __P((void *));
|
Loading…
Reference in New Issue