Moved to dev/bi.

This commit is contained in:
ragge 1999-08-04 19:09:46 +00:00
parent eadf853bb8
commit fe04287ec0
6 changed files with 0 additions and 1040 deletions

View File

@ -1,151 +0,0 @@
/* $NetBSD: bi.c,v 1.11 1999/02/02 18:37:22 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* 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 at Ludd, University of
* Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* VAXBI specific routines.
*/
/*
* TODO
* handle BIbus errors more gracefully.
*/
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <machine/mtpr.h>
#include <machine/nexus.h>
#include <machine/cpu.h>
#include <arch/vax/bi/bireg.h>
#include <arch/vax/bi/bivar.h>
static int bi_match __P((struct device *, struct cfdata *, void *));
static void bi_attach __P((struct device *, struct device *, void*));
static int bi_print __P((void *, const char *));
struct cfattach bi_ca = {
sizeof(struct bi_softc), bi_match, bi_attach
};
struct bi_list bi_list[] = {
{BIDT_MS820, 1, "ms820"},
{BIDT_DRB32, 0, "drb32"},
{BIDT_DWBUA, 0, "dwbua"},
{BIDT_KLESI, 0, "klesi"},
{BIDT_KA820, 1, "ka820"},
{BIDT_DB88, 0, "db88"},
{BIDT_CIBCA, 0, "cibca"},
{BIDT_DMB32, 0, "dmb32"},
{BIDT_CIBCI, 0, "cibci"},
{BIDT_KA800, 0, "ka800"},
{BIDT_KDB50, 0, "kdb50"},
{BIDT_DWMBA, 0, "dwmba"},
{BIDT_KFBTA, 0, "kfbta"},
{BIDT_DEBNK, 0, "debnk"},
{BIDT_DEBNA, 0, "debna"},
{0,0,0}
};
int
bi_print(aux, name)
void *aux;
const char *name;
{
struct bi_attach_args *ba = aux;
struct bi_list *bl;
for (bl = &bi_list[0]; bl->bl_nr; bl++)
if (bl->bl_nr == ba->ba_node->biic.bi_dtype)
break;
if (name) {
if (bl->bl_nr == 0)
printf("unknown device 0x%x",
ba->ba_node->biic.bi_dtype);
else
printf(bl->bl_name);
printf(" at %s", name);
}
printf(" node %d", ba->ba_nodenr);
#ifdef DEBUG
if (ba->ba_node->biic.bi_sadr && ba->ba_node->biic.bi_eadr)
printf(" [sadr %lx eadr %lx]", ba->ba_node->biic.bi_sadr,
ba->ba_node->biic.bi_eadr);
#endif
return bl->bl_havedriver ? UNCONF : UNSUPP;
}
int
bi_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
{
struct bp_conf *bp = aux;
if (strcmp(bp->type, "bi"))
return 0;
return 1;
}
void
bi_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct bp_conf *bp = aux;
struct bi_softc *bi = (void *)self;
struct bi_node *binode;
struct bi_attach_args ba;
int nodenr;
printf("\n");
bi->bi_base = (struct bi_node *)bp->bp_addr;
ba.ba_intcpu = 1 << mastercpu;
#define NODEPGS (sizeof(struct bi_node) / VAX_NBPG)
for (nodenr = 0; nodenr < NNODEBI; nodenr++) {
binode = (struct bi_node *)vax_map_physmem(
(paddr_t)(bi->bi_base + nodenr), NODEPGS);
if (badaddr((caddr_t)binode, 4)) {
vax_unmap_physmem((vaddr_t)binode, NODEPGS);
} else {
ba.ba_node = binode;
ba.ba_nodenr = nodenr;
ba.ba_busnr = 0; /* XXX */
config_found(self, &ba, bi_print);
}
}
}

View File

@ -1,252 +0,0 @@
/* $NetBSD: bireg.h,v 1.4 1998/10/18 18:47:18 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* 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.
*
* @(#)bireg.h 7.3 (Berkeley) 6/28/90
*/
/*
* VAXBI node definitions.
*/
/*
* BI node addresses
*/
#define BI_NODE(node) (0x2000 * (node))
#define BI_BASE(bi,nod) ((0x20000000 + (bi) * 0x2000000) + BI_NODE(nod))
#define MAXNBI 16 /* Spec says there can be 16 anyway */
#define NNODEBI 16 /* 16 nodes per BI */
#define BI_PROBE 0x80000 /* CPU on 8200, NBIA on 8800 */
/*
* BI nodes all start with BI interface registers (those on the BIIC chip).
* These are followed with interface-specific registers.
*
* NB: This structure does NOT include the four GPRs (not anymore!)
*/
struct biiregs {
u_short bi_dtype; /* device type */
u_short bi_revs; /* revisions */
u_long bi_csr; /* control and status register */
u_long bi_ber; /* bus error register */
u_long bi_eintrcsr; /* error interrupt control register */
u_long bi_intrdes; /* interrupt destination register */
/* the rest are not required for all nodes */
u_long bi_ipintrmsk; /* IP interrupt mask register */
u_long bi_fipsdes; /* Force-Bit IPINTR/STOP destination reg */
u_long bi_ipintrsrc; /* IPINTR source register */
u_long bi_sadr; /* starting address register */
u_long bi_eadr; /* ending address register */
u_long bi_bcicsr; /* BCI control and status register */
u_long bi_wstat; /* write status register */
u_long bi_fipscmd; /* Force-Bit IPINTR/STOP command reg */
u_long bi_xxx1[3]; /* unused */
u_long bi_uintrcsr; /* user interface interrupt control reg */
u_long bi_xxx2[43]; /* unused */
/* although these are on the BIIC, their interpretation varies */
/* u_long bi_gpr[4]; */ /* general purpose registers */
};
/*
* A generic BI node.
*/
struct bi_node {
struct biiregs biic; /* interface */
u_long bi_xxx[1988]; /* pad to 8K */
};
/*
* A cpu node.
*/
struct bi_cpu {
struct biiregs biic; /* interface chip */
u_long bi_gpr[4]; /* gprs (unused) */
u_long bi_sosr; /* slave only status register */
u_long bi_xxx[63]; /* pad */
u_long bi_rxcd; /* receive console data register */
};
/* device types */
#define BIDT_MS820 0x0001 /* MS820 memory board */
#define BIDT_DRB32 0x0101 /* DRB32 (MFA) Supercomputer gateway */
#define BIDT_DWBUA 0x0102 /* DWBUA Unibus adapter */
#define BIDT_KLESI 0x0103 /* KLESI-B (DWBLA) adapter */
#define BIDT_HSB70 0x4104 /* HSB70 */
#define BIDT_KA820 0x0105 /* KA820 cpu */
#define BIDT_DB88 0x0106 /* DB88 (NBI) adapter */
#define BIDT_DWMBA 0x2107 /* XMI-BI (XBI) adapter */
#define BIDT_DWMBB 0x0107 /* XMI-BI (XBI) adapter */
#define BIDT_CIBCA 0x0108 /* Computer Interconnect adapter */
#define BIDT_DMB32 0x0109 /* DMB32 (COMB) adapter */
#define BIDT_BAA 0x010a /* BAA */
#define BIDT_CIBCI 0x010b /* Computer Interconnect adapter (old) */
#define BIDT_DEBNT 0x410b /* (AIE_TK70) Ethernet+TK50/TBK70 */
#define BIDT_KA800 0x010c /* KA800 (ACP) slave processor */
#define BIDT_KFBTA 0x410d /* RD/RX disk controller */
#define BIDT_KDB50 0x010e /* KDB50 (BDA) disk controller */
#define BIDT_DEBNK 0x410e /* (AIE_TK) BI Ethernet (Lance) + TK50 */
#define BIDT_DEBNA 0x410f /* (AIE) BI Ethernet (Lance) adapter */
#define BIDT_DEBNI 0x0118 /* (XNA) BI Ethernet adapter */
/* bits in bi_csr */
#define BICSR_IREV(x) ((u_char)((x) >> 24)) /* VAXBI interface rev */
#define BICSR_TYPE(x) ((u_char)((x) >> 16)) /* BIIC type */
#define BICSR_HES 0x8000 /* hard error summary */
#define BICSR_SES 0x4000 /* soft error summary */
#define BICSR_INIT 0x2000 /* initialise node */
#define BICSR_BROKE 0x1000 /* broke */
#define BICSR_STS 0x0800 /* self test status */
#define BICSR_NRST 0x0400 /* node reset */
#define BICSR_UWP 0x0100 /* unlock write pending */
#define BICSR_HEIE 0x0080 /* hard error interrupt enable */
#define BICSR_SEIE 0x0040 /* soft error interrupt enable */
#define BICSR_ARB_MASK 0x0030 /* mask to get arbitration codes */
#define BICSR_ARB_NONE 0x0030 /* no arbitration */
#define BICSR_ARB_LOG 0x0020 /* low priority */
#define BICSR_ARB_HIGH 0x0010 /* high priority */
#define BICSR_ARB_RR 0x0000 /* round robin */
#define BICSR_NODEMASK 0x000f /* node ID */
#define BICSR_BITS \
"\20\20HES\17SES\16INIT\15BROKE\14STS\13NRST\11UWP\10HEIE\7SEIE"
/* bits in bi_ber */
#define BIBER_MBZ 0x8000fff0
#define BIBER_NMR 0x40000000 /* no ack to multi-responder command */
#define BIBER_MTCE 0x20000000 /* master transmit check error */
#define BIBER_CTE 0x10000000 /* control transmit error */
#define BIBER_MPE 0x08000000 /* master parity error */
#define BIBER_ISE 0x04000000 /* interlock sequence error */
#define BIBER_TDF 0x02000000 /* transmitter during fault */
#define BIBER_IVE 0x01000000 /* ident vector error */
#define BIBER_CPE 0x00800000 /* command parity error */
#define BIBER_SPE 0x00400000 /* slave parity error */
#define BIBER_RDS 0x00200000 /* read data substitute */
#define BIBER_RTO 0x00100000 /* retry timeout */
#define BIBER_STO 0x00080000 /* stall timeout */
#define BIBER_BTO 0x00040000 /* bus timeout */
#define BIBER_NEX 0x00020000 /* nonexistent address */
#define BIBER_ICE 0x00010000 /* illegal confirmation error */
#define BIBER_UPEN 0x00000008 /* user parity enable */
#define BIBER_IPE 0x00000004 /* ID parity error */
#define BIBER_CRD 0x00000002 /* corrected read data */
#define BIBER_NPE 0x00000001 /* null bus parity error */
#define BIBER_HARD 0x4fff0000
#define BIBER_BITS \
"\20\37NMR\36MTCE\35CTE\34MPE\33ISE\32TDF\31IVE\30CPE\
\27SPE\26RDS\25RTO\24STO\23BTO\22NEX\21ICE\4UPEN\3IPE\2CRD\1NPE"
/* bits in bi_eintrcsr */
#define BIEIC_INTRAB 0x01000000 /* interrupt abort */
#define BIEIC_INTRC 0x00800000 /* interrupt complete */
#define BIEIC_INTRSENT 0x00200000 /* interrupt command sent */
#define BIEIC_INTRFORCE 0x00100000 /* interrupt force */
#define BIEIC_LEVELMASK 0x000f0000 /* mask for interrupt levels */
#define BIEIC_IPL17 0x00080000 /* ipl 0x17 */
#define BIEIC_IPL16 0x00040000 /* ipl 0x16 */
#define BIEIC_IPL15 0x00020000 /* ipl 0x15 */
#define BIEIC_IPL14 0x00010000 /* ipl 0x14 */
#define BIEIC_VECMASK 0x00003ffc /* vector mask for error intr */
/* bits in bi_intrdes */
#define BIDEST_MASK 0x0000ffff /* one bit per node to be intr'ed */
/* bits in bi_ipintrmsk */
#define BIIPINTR_MASK 0xffff0000 /* one per node to allow to ipintr */
/* bits in bi_fipsdes */
#define BIFIPSD_MASK 0x0000ffff
/* bits in bi_ipintrsrc */
#define BIIPSRC_MASK 0xffff0000
/* sadr and eadr are simple addresses */
/* bits in bi_bcicsr */
#define BCI_BURSTEN 0x00020000 /* burst mode enable */
#define BCI_IPSTOP_FRC 0x00010000 /* ipintr/stop force */
#define BCI_MCASTEN 0x00008000 /* multicast space enable */
#define BCI_BCASTEN 0x00004000 /* broadcast enable */
#define BCI_STOPEN 0x00002000 /* stop enable */
#define BCI_RSRVDEN 0x00001000 /* reserved enable */
#define BCI_IDENTEN 0x00000800 /* ident enable */
#define BCI_INVALEN 0x00000400 /* inval enable */
#define BCI_WINVEN 0x00000200 /* write invalidate enable */
#define BCI_UINTEN 0x00000100 /* user interface csr space enable */
#define BCI_BIICEN 0x00000080 /* BIIC csr space enable */
#define BCI_INTEN 0x00000040 /* interrupt enable */
#define BCI_IPINTEN 0x00000020 /* ipintr enable */
#define BCI_PIPEEN 0x00000010 /* pipeline NXT enable */
#define BCI_RTOEVEN 0x00000008 /* read timeout EV enable */
#define BCI_BITS \
"\20\22BURSTEN\21IPSTOP_FRC\20MCASTEN\
\17BCASTEN\16STOPEN\15RSRVDEN\14IDENTEN\13INVALEN\12WINVEN\11UINTEN\
\10BIICEN\7INTEN\6IPINTEN\5PIPEEN\4RTOEVEN"
/* bits in bi_wstat */
#define BIW_GPR3 0x80000000 /* gpr 3 was written */
#define BIW_GPR2 0x40000000 /* gpr 2 was written */
#define BIW_GPR1 0x20000000 /* gpr 1 was written */
#define BIW_GPR0 0x10000000 /* gpr 0 was written */
/* bits in force-bit ipintr/stop command register */
#define BIFIPSC_CMDMASK 0x0000f000 /* command */
#define BIFIPSC_MIDEN 0x00000800 /* master ID enable */
/* bits in bi_uintcsr */
#define BIUI_INTAB 0xf0000000 /* interrupt abort level */
#define BIUI_INTC 0x0f000000 /* interrupt complete bits */
#define BIUI_SENT 0x00f00000 /* interrupt sent bits */
#define BIUI_FORCE 0x000f0000 /* force interrupt level */
#define BIUI_EVECEN 0x00008000 /* external vector enable */
#define BIUI_VEC 0x00003ffc /* interrupt vector */
/* tell if a bi device is a slave (hence has SOSR) */
#define BIDT_ISSLAVE(x) (((x) & 0x7f00) == 0)
/* bits in bi_sosr */
#define BISOSR_MEMSIZE 0x1ffc0000 /* memory size */
#define BISOSR_BROKE 0x00001000 /* broke */
/* bits in bi_rxcd */
#define BIRXCD_BUSY2 0x80000000 /* busy 2 */
#define BIRXCD_NODE2 0x0f000000 /* node id 2 */
#define BIRXCD_CHAR2 0x00ff0000 /* character 2 */
#define BIRXCD_BUSY1 0x00008000 /* busy 1 */
#define BIRXCD_NODE1 0x00000f00 /* node id 1 */
#define BIRXCD_CHAR1 0x000000ff /* character 1 */

View File

@ -1,60 +0,0 @@
/* $NetBSD: bivar.h,v 1.2 1998/10/18 18:47:18 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* 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 at Ludd, University of
* Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* per-BI-adapter state.
*/
struct bi_softc {
struct device bi_dev;
struct bi_node *bi_base;
};
/*
* Struct used for autoconfiguration; attaching of BI nodes.
*/
struct bi_attach_args {
struct bi_node *ba_node;
int ba_busnr;
int ba_nodenr;
int ba_intcpu; /* Mask of which cpus to interrupt */
};
/*
* BI node list.
*/
struct bi_list {
u_short bl_nr; /* Unit ID# */
u_short bl_havedriver; /* Have device driver */
char *bl_name; /* DEC name */
};

View File

@ -1,314 +0,0 @@
/* $NetBSD: kdb.c,v 1.15 1999/03/24 05:51:16 mrg Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* 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 at Ludd, University of
* Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* KDB50 disk device driver
*/
/*
* TODO
* Implement node reset routine.
* Nices hardware error handling.
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <machine/sid.h>
#include <machine/pte.h>
#include <machine/pcb.h>
#include <machine/trap.h>
#include <machine/scb.h>
#include <vax/bi/bireg.h>
#include <vax/bi/bivar.h>
#include <vax/bi/kdbreg.h>
#include <vax/mscp/mscp.h>
#include <vax/mscp/mscpvar.h>
#include <vax/mscp/mscpreg.h>
#include "locators.h"
#define b_forw b_hash.le_next
/*
* Software status, per controller.
*/
struct kdb_softc {
struct device sc_dev; /* Autoconfig info */
struct ivec_dsp sc_ivec; /* Interrupt vector handler */
struct mscp_pack sc_kdb; /* Struct for kdb communication */
struct mscp_softc *sc_softc; /* MSCP info (per mscpvar.h) */
struct kdb_regs *sc_kr; /* KDB controller registers */
struct mscp *sc_mscp; /* Keep pointer to active mscp */
};
int kdbmatch __P((struct device *, struct cfdata *, void *));
void kdbattach __P((struct device *, struct device *, void *));
void kdbreset __P((int));
void kdbintr __P((int));
void kdbctlrdone __P((struct device *, int));
int kdbprint __P((void *, const char *));
void kdbsaerror __P((struct device *, int));
int kdbgo __P((struct device *, struct buf *));
struct cfattach kdb_ca = {
sizeof(struct kdb_softc), kdbmatch, kdbattach
};
extern struct cfdriver kdb_cd;
/*
* More driver definitions, for generic MSCP code.
*/
struct mscp_ctlr kdb_mscp_ctlr = {
kdbctlrdone,
kdbgo,
kdbsaerror,
};
int
kdbprint(aux, name)
void *aux;
const char *name;
{
if (name)
printf("%s: mscpbus", name);
return UNCONF;
}
/*
* Poke at a supposed KDB to see if it is there.
*/
int
kdbmatch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct bi_attach_args *ba = aux;
if (ba->ba_node->biic.bi_dtype != BIDT_KDB50)
return 0;
if (cf->cf_loc[BICF_NODE] != BICF_NODE_DEFAULT &&
cf->cf_loc[BICF_NODE] != ba->ba_nodenr)
return 0;
return 1;
}
void
kdbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct kdb_softc *sc = (void *)self;
struct bi_attach_args *ba = aux;
struct mscp_attach_args ma;
extern struct ivec_dsp idsptch;
volatile int i = 10000;
printf("\n");
bcopy(&idsptch, &sc->sc_ivec, sizeof(struct ivec_dsp));
scb->scb_nexvec[1][ba->ba_nodenr] = &sc->sc_ivec;
sc->sc_ivec.hoppaddr = kdbintr;
sc->sc_ivec.pushlarg = self->dv_unit;
sc->sc_kr = (void *)ba->ba_node;
bzero(&sc->sc_kdb, sizeof (struct mscp_pack));
ma.ma_mc = &kdb_mscp_ctlr;
ma.ma_type = MSCPBUS_DISK|MSCPBUS_KDB;
ma.ma_uuda = (struct mscp_pack *)kvtophys(&sc->sc_kdb);
ma.ma_uda = &sc->sc_kdb;
ma.ma_ip = &sc->sc_kr->kdb_ip;
ma.ma_sa = &sc->sc_kr->kdb_sa;
ma.ma_sw = &sc->sc_kr->kdb_sw;
ma.ma_softc = &sc->sc_softc;
ma.ma_ivec = (int)&scb->scb_nexvec[1][ba->ba_nodenr] - (int)scb;
ma.ma_ctlrnr = ba->ba_nodenr;
sc->sc_kr->kdb_bi.bi_csr |= BICSR_NRST;
while (i--) /* Need delay??? */
;
sc->sc_kr->kdb_bi.bi_intrdes = ba->ba_intcpu;
sc->sc_kr->kdb_bi.bi_bcicsr |= BCI_STOPEN | BCI_IDENTEN | BCI_UINTEN |
BCI_INTEN;
sc->sc_kr->kdb_bi.bi_uintrcsr = ma.ma_ivec;
config_found(&sc->sc_dev, &ma, kdbprint);
}
int
kdbgo(usc, bp)
struct device *usc;
struct buf *bp;
{
struct kdb_softc *sc = (void *)usc;
struct mscp_softc *mi = sc->sc_softc;
struct mscp *mp = (void *)bp->b_actb;
struct pcb *pcb;
pt_entry_t *pte;
int npf, o, i;
unsigned info = 0;
caddr_t addr;
o = (int)bp->b_un.b_addr & VAX_PGOFSET;
npf = vax_btoc(bp->b_bcount + o) + 1;
addr = bp->b_un.b_addr;
/*
* Get a pointer to the pte pointing out the first virtual address.
* Use different ways in kernel and user space.
*/
if ((bp->b_flags & B_PHYS) == 0) {
pte = kvtopte(addr);
} else {
pcb = &bp->b_proc->p_addr->u_pcb;
pte = uvtopte(addr, pcb);
}
/*
* When we are doing DMA to user space, be sure that all pages
* we want to transfer to is mapped. WHY DO WE NEED THIS???
* SHOULDN'T THEY ALWAYS BE MAPPED WHEN DOING THIS???
*/
for (i = 0; i < (npf - 1); i++) {
if ((pte + i)->pg_pfn == 0) {
int rv;
rv = uvm_fault(&bp->b_proc->p_vmspace->vm_map,
(unsigned)addr + i * VAX_NBPG, 0,
VM_PROT_READ|VM_PROT_WRITE);
if (rv)
panic("KDB DMA to nonexistent page, %d", rv);
}
}
/*
* pte's for userspace isn't necessary positioned
* in consecutive physical pages. We check if they
* are, otherwise we need to copy the pte's to a
* physically contigouos page area.
* XXX some copying here may be unneccessary. Subject to fix.
*/
if (bp->b_flags & B_PHYS) {
int i = kvtophys(pte);
unsigned k;
if (trunc_page(i) != trunc_page(kvtophys(pte) + npf * 4)) {
info = (unsigned)malloc(2 * VAX_NBPG, M_DEVBUF, M_WAITOK);
k = (info + VAX_PGOFSET) & ~VAX_PGOFSET;
bcopy(pte, (void *)k, VAX_NBPG);
i = kvtophys(k);
}
mp->mscp_seq.seq_mapbase = i;
} else
mp->mscp_seq.seq_mapbase = (unsigned)pte;
mscp_dgo(mi, KDB_MAP | o, info, bp);
return 1;
}
void
kdbsaerror(usc, doreset)
struct device *usc;
int doreset;
{
struct kdb_softc *sc = (void *)usc;
register int code = sc->sc_kr->kdb_sa;
if ((code & MP_ERR) == 0)
return;
printf("%s: controller error, sa=0x%x\n", sc->sc_dev.dv_xname, code);
/* What to do now??? */
}
/*
* Interrupt routine. Depending on the state of the controller,
* continue initialisation, or acknowledge command and response
* interrupts, and process responses.
*/
void
kdbintr(ctlr)
int ctlr;
{
struct kdb_softc *sc = kdb_cd.cd_devs[ctlr];
if (sc->sc_kr->kdb_sa & MP_ERR) { /* ctlr fatal error */
kdbsaerror(&sc->sc_dev, 1);
return;
}
mscp_intr(sc->sc_softc);
}
#ifdef notyet
/*
* The KDB50 has been reset. Reinitialise the controller
* and requeue outstanding I/O.
*/
void
kdbreset(ctlr)
int ctlr;
{
register struct kdb_softc *sc;
sc = kdb_cd.cd_devs[ctlr];
printf(" kdb%d", ctlr);
/* reset queues and requeue pending transfers */
mscp_requeue(sc->sc_softc);
/*
* If it fails to initialise we will notice later and
* try again (and again...). Do not call kdbstart()
* here; it will be done after the controller finishes
* initialisation.
*/
if (kdbinit(sc))
printf(" (hung)");
}
#endif
void
kdbctlrdone(usc, info)
struct device *usc;
int info;
{
if (info)
free((void *)info, VAX_NBPG * 2);
}

View File

@ -1,64 +0,0 @@
/* $NetBSD: kdbreg.h,v 1.1 1996/07/19 14:26:56 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* 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.
*
* @(#)kdbreg.h 7.3 (Berkeley) 6/28/90
*/
/*
* The KDB50 registers are embedded inside the bi interface
* general-purpose registers.
*/
struct kdb_regs {
struct biiregs kdb_bi;
short kdb_xxx; /* first half of GPR 0 unused */
short kdb_ip; /* initialisation and polling */
short kdb_sa; /* status & address (r/o half) */
short kdb_sw; /* status & address (w/o half) */
};
#define KDBSR_BITS \
"\20\20ERR\17STEP4\16STEP3\15STEP2\14STEP1\13oldNV\12oldQB\11DI\10IE\1GO"
/*
* Asserting KDB_MAP in values placed in mscp_seq.seq_buffer tells
* the KDB to use mscp_seq.seq_mapbase as a set of PTEs and seq_buffer
* as an offset value. Hence we need no mappings; the KDB50 reads
* the hardware page tables directly. (Without KDB_MAP, seq_bufer
* represents the physical memory address instead, and seq_mapbase is
* unused.)
*/
#define KDB_MAP 0x80000000
#define KDB_PHYS 0 /* pseudo flag */

View File

@ -1,199 +0,0 @@
/* $NetBSD: uba_bi.c,v 1.3 1999/01/19 21:04:48 ragge Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* 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 at Ludd, University of
* Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* DWBUA BI-Unibus adapter
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <machine/sid.h>
#include <machine/pte.h>
#include <machine/pcb.h>
#include <machine/trap.h>
#include <machine/scb.h>
#include <vax/bi/bireg.h>
#include <vax/bi/bivar.h>
#include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h>
#include "locators.h"
#define BUA(uba) ((struct dwbua_regs *)(uba))
static int uba_bi_match __P((struct device *, struct cfdata *, void *));
static void uba_bi_attach __P((struct device *, struct device *, void *));
static void bua_init __P((struct uba_softc *));
static void bua_purge __P((struct uba_softc *, int));
/* bua_csr */
#define BUACSR_ERR 0x80000000 /* composite error */
#define BUACSR_BIF 0x10000000 /* BI failure */
#define BUACSR_SSYNTO 0x08000000 /* slave sync timeout */
#define BUACSR_UIE 0x04000000 /* unibus interlock error */
#define BUACSR_IVMR 0x02000000 /* invalid map register */
#define BUACSR_BADBDP 0x01000000 /* bad BDP select */
#define BUACSR_BUAEIE 0x00100000 /* bua error interrupt enable (?) */
#define BUACSR_UPI 0x00020000 /* unibus power init */
#define BUACSR_UREGDUMP 0x00010000 /* microdiag register dump */
#define BUACSR_IERRNO 0x000000ff /* mask for internal errror number */
/* bua_offset */
#define BUAOFFSET_MASK 0x00003e00 /* hence max offset = 15872 */
/* bua_dpr */
#define BUADPR_DPSEL 0x00e00000 /* data path select (?) */
#define BUADPR_PURGE 0x00000001 /* purge bdp */
/* bua_map -- in particular, those bits that are not in DW780s & DW750s */
#define BUAMR_IOADR 0x40000000 /* I/O address space */
#define BUAMR_LAE 0x04000000 /* longword access enable */
static int allocvec;
struct cfattach uba_bi_ca = {
sizeof(struct uba_softc), uba_bi_match, uba_bi_attach,
};
struct dwbua_regs {
struct biiregs bn_biic; /* interface */
int pad1[396];
int bn_csr;
int bn_vor; /* Vector offset from SCB */
int bn_fubar; /* Failed Unibus address register */
int bn_bifar; /* BI failed address register */
int bn_mdiag[5]; /* microdiag regs for BDP */
int pad2[3];
int bn_dpcsr[6]; /* Data path control and status register */
int pad3[38];
struct pte bn_map[UBAPAGES]; /* Unibus map registers */
int pad4[UBAIOPAGES];
};
/*
* Poke at a supposed DWBUA to see if it is there.
*/
static int
uba_bi_match(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct bi_attach_args *ba = aux;
if ((ba->ba_node->biic.bi_dtype != BIDT_DWBUA) &&
(ba->ba_node->biic.bi_dtype != BIDT_KLESI))
return 0;
if (cf->cf_loc[BICF_NODE] != BICF_NODE_DEFAULT &&
cf->cf_loc[BICF_NODE] != ba->ba_nodenr)
return 0;
return 1;
}
void
uba_bi_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct uba_softc *sc = (void *)self;
struct bi_attach_args *ba = aux;
volatile int timo;
if (ba->ba_node->biic.bi_dtype == BIDT_DWBUA)
printf(": DWBUA\n");
else
printf(": KLESI-B\n");
/*
* Fill in bus specific data.
*/
sc->uh_uba = (void *)ba->ba_node;
sc->uh_nbdp = NBDPBUA;
/* sc->uh_nr is 0; uninteresting here */
/* sc->uh_afterscan; not used */
/* sc->uh_errchk; not used */
/* sc->uh_beforescan */
sc->uh_ubapurge = bua_purge;
sc->uh_ubainit = bua_init;
/* sc->uh_type not used */
sc->uh_memsize = UBAPAGES;
sc->uh_mr = BUA(sc->uh_uba)->bn_map;
#ifdef notdef
/* Can we get separate interrupts? */
scb->scb_nexvec[1][ba->ba_nodenr] = &sc->sc_ivec;
#endif
BUA(sc->uh_uba)->bn_biic.bi_csr |= BICSR_ARB_NONE;
BUA(sc->uh_uba)->bn_biic.bi_csr |= BICSR_STS | BICSR_INIT;
DELAY(1000);
timo = 1000;
while (BUA(sc->uh_uba)->bn_biic.bi_csr & BICSR_BROKE)
if (timo == 0) {
printf("%s: BROKE bit set\n", self->dv_xname);
return;
}
BUA(sc->uh_uba)->bn_biic.bi_intrdes = ba->ba_intcpu;
BUA(sc->uh_uba)->bn_biic.bi_csr =
(BUA(sc->uh_uba)->bn_biic.bi_csr&~BICSR_ARB_MASK) | BICSR_ARB_HIGH;
BUA(sc->uh_uba)->bn_vor = VAX_NBPG + (VAX_NBPG * allocvec++);
uba_attach(sc, BUA(sc->uh_uba)->bn_biic.bi_sadr + UBAPAGES * VAX_NBPG);
}
void
bua_init(sc)
struct uba_softc *sc;
{
BUA(sc->uh_uba)->bn_csr |= BUACSR_UPI;
DELAY(500000);
};
void
bua_purge(sc, bdp)
struct uba_softc *sc;
int bdp;
{
BUA(sc->uh_uba)->bn_dpcsr[bdp] |= BUADPR_PURGE;
}