Rework pmax turbochannel config, as suggested by Jason Thorpe.

Also make TC framebuffer-console search table-driven.

Does not yet include "tcasic" layer; there's no such hardware on DECstations
and nothing for a tcasic layer to do.
This commit is contained in:
jonathan 1998-04-19 07:59:13 +00:00
parent e487483678
commit 9caaf18836
6 changed files with 529 additions and 460 deletions

View File

@ -1,93 +0,0 @@
/* $NetBSD: ds-asic-conf.c,v 1.6 1996/05/29 06:29:05 mhitch Exp $ */
/*
* Copyright (c) 1995 Jonathan Stone
* All rights reserved.
*
* DECstation IO ASIC subslot configuration
*/
#if 0
struct asic_slot {
struct confargs as_ca;
u_int as_bits;
intr_handler_t as_handler;
void *as_val;
};
#endif
/* Initial handler must be asic_intrnull or the ASIC newconf code panics */
struct asic_slot kn03_asic_slots[] =
{
/* name slot offset addr intpri */
{ { "lance", 0, (u_int) (3 * 0x40000), 0,KN03_LANCE_SLOT },
KN03_INTR_LANCE, asic_intrnull, (void*) KN03_LANCE_SLOT, },
{ { "scc", 1, (u_int) (4 * 0x40000), 0, KN03_SCC0_SLOT },
KN03_INTR_SCC_0, asic_intrnull, (void *)KN03_SCC0_SLOT, },
{ { "scc", 2, (u_int) (6 * 0x40000), 0, KN03_SCC1_SLOT },
KN03_INTR_SCC_1, asic_intrnull, (void *)KN03_SCC1_SLOT, },
{ { "mc146818", 3, (u_int) (8* 0x40000), 0 /*XXX*/, 0 /*XXX*/},
0, asic_intrnull, (void *)(long) 16 /*XXX*/, },
{ { "asc", 4, (u_int) (12* 0x40000), 0, KN03_SCSI_SLOT, },
0, asic_intrnull, (void *)KN03_SCSI_SLOT, },
{ { NULL, 0, 0, 0 }, 0, NULL, NULL }
};
struct asic_slot xine_asic_slots[] =
{
{ { "lance", 0, (u_int) (3 * 0x40000), 0, XINE_LANCE_SLOT },
XINE_INTR_LANCE, asic_intrnull, (void*) XINE_LANCE_SLOT, },
{ { "scc", 1, (u_int) (4 * 0x40000), 0, XINE_SCC0_SLOT },
XINE_INTR_SCC_0, asic_intrnull, (void *) XINE_SCC0_SLOT, },
{ { "mc146818", 2, (u_int) (8* 0x40000), 0, 0},
0, asic_intrnull, (void *)(long) 16 /*XXX*/, },
{ { "isdn", 3, (u_int) (9 * 0x40000), 0, XINE_ISDN_SLOT },
0, asic_intrnull, (void *)(long) XINE_ISDN_SLOT, },
{ { "dtop", 4, (u_int) (10* 0x40000), 0, XINE_DTOP_SLOT },
0, asic_intrnull, (void *)(long) XINE_DTOP_SLOT, },
{ { "fdc", 5, (u_int) (11* 0x40000), 0, XINE_FLOPPY_SLOT },
0, asic_intrnull, (void *) (long)XINE_FLOPPY_SLOT, },
{ { "asc", 6, (u_int) (12* 0x40000), 0, XINE_SCSI_SLOT },
0 /*XINE_INTR_SCSI*/, asic_intrnull, (void*)XINE_SCSI_SLOT, },
#if 0
{ { "frc", 3, (u_int) (15* 0x40000), 0, XINE_SLOT_FRC },
0, asic_intrnull, (void *)(long) XINE_SLOT_FRC, },
#endif
{ { NULL, 0, 0, }, 0, NULL, NULL }
};
/*
* The 3MAX (KN02) doesn't even have an asic but for now,
* configure its system slot as if it did.
* Instead there's a 4 Mbyte "system" slot with eight 512 Kbyte subslots
* for system devices:
* 0=ROM, 1=(reserved), 2=CHKSYN, 3=ERRADDR, 4=DZ, 5=CLOCK, 6=CSR, 7=ROM1
* These are mapped onto slot numbers as
* tc0=1, tc1=1, tc2=2, unsed=3, unused=4, scsi=5, ether=6, dc=7
*/
struct asic_slot kn02_asic_slots[] = {
/* name slot offset addr intpri */
{ { "dc", 0, (u_int) (4 * 0x80000), 0, 7 },
KN03_INTR_SCC_0, asic_intrnull, (void *) 7, },
{ { "mc146818", 0, (u_int) (5 * 0x80000), 0, 0 },
0, asic_intrnull, (void *) 16 /*XXX*/, },
{ { NULL, 0, 0 }, 0, NULL, NULL }
};

View File

@ -0,0 +1,84 @@
/* $NetBSD: tc_3max.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone. 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 by Jonathan Stone for
* the NetBSD Project.
* 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.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_3max.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ ");
#include <sys/types.h>
#include <sys/device.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#include <machine/sysconf.h>
#include <pmax/pmax/kn02.h>
/* 3MAX (kn02) turbochannel slots */
/* slot addreseses */
struct tc_slotdesc tc_kn02_slots [8] = {
{ TC_KV(KN02_PHYS_TC_0_START), TC_C(0)}, /* tc option slot 0 */
{ TC_KV(KN02_PHYS_TC_1_START), TC_C(1), }, /* tc option slot 1 */
{ TC_KV(KN02_PHYS_TC_2_START), TC_C(2), }, /* tc option slot 2 */
{ TC_KV(KN02_PHYS_TC_3_START), TC_C(3), }, /* - reserved */
{ TC_KV(KN02_PHYS_TC_4_START), TC_C(4), }, /* - reserved */
{ TC_KV(KN02_PHYS_TC_5_START), TC_C(5), }, /* SCSI on b`board */
{ TC_KV(KN02_PHYS_TC_6_START), TC_C(6), }, /* b'board Ether */
{ TC_KV(KN02_PHYS_TC_7_START), TC_C(7), } /* system CSR, etc. */
};
int tc_kn02_nslots =
sizeof(tc_kn02_slots) / sizeof(tc_kn02_slots[0]);
#define KN02_ROM_NAME KN02_ASIC_NAME
#define TC_KN02_DEV_IOASIC -1
#define TC_KN02_DEV_ETHER 6
#define TC_KN02_DEV_SCSI 5
const struct tc_builtin tc_kn02_builtins[] = {
{ KN02_ROM_NAME,7, 0x0, TC_C(TC_KN02_DEV_IOASIC) /* TC_C(7)*/ },
{ TC_ETHER, 6, 0x0, TC_C(TC_KN02_DEV_ETHER) /* TC_C(6)*/ },
{ TC_SCSI, 5, 0x0, TC_C(TC_KN02_DEV_SCSI) /* TC_C(5)*/ }
};
struct tcbus_attach_args kn02_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_25_MHZ,
8, tc_kn02_slots,
3, tc_kn02_builtins, /*XXX*/
0 /*tc_ds_ioasic_intr_establish*/,
0 /*tc_ds_ioasic_intr_disestablish*/
};

View File

@ -0,0 +1,100 @@
/* $NetBSD: tc_3maxplus.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone. 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 by Jonathan Stone for
* the NetBSD Project.
* 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.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_3maxplus.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ ");
#include <sys/types.h>
#include <sys/device.h>
#include <dev/cons.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/pmax/kn03.h>
int tcbus_match_3maxplus(struct device *, struct cfdata *, void *);
void tcbus_attach_3maxplus(struct device *, struct device *, void *);
/*
* The only builtin Turbochannel device on the kn03 (and kmin)
* is the IOCTL asic, which is mapped into TC slot 3.
*/
const struct tc_builtin tc_kn03_builtins[] = {
{ "IOCTL ", 3, 0x0, TC_C(3), /*TC_C(3)*/ }
};
/* 3MAXPLUS TC slot addresses */
static struct tc_slotdesc tc_kn03_slots [4] = {
{ TC_KV(KN03_PHYS_TC_0_START), TC_C(0) }, /* 0 - tc option slot 0 */
{ TC_KV(KN03_PHYS_TC_1_START), TC_C(1) }, /* 1 - tc option slot 1 */
{ TC_KV(KN03_PHYS_TC_2_START), TC_C(2) }, /* 2 - tc option slot 2 */
{ TC_KV(KN03_PHYS_TC_3_START), TC_C(3) } /* 3 - IOasic on b'board */
};
int tc_kn03_nslots =
sizeof(tc_kn03_slots) / sizeof(tc_kn03_slots[0]);
/*
* 3MAXPLUS turbochannel autoconfiguration table
*/
struct tcbus_attach_args kn03_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_25_MHZ,
KN03_TC_NSLOTS, tc_kn03_slots,
1, tc_kn03_builtins,
0, /*,tc_ds_ioasic_intr_establish, */
0 /* tc_ds_ioasic_intr_disestablish */
};
int
tcbus_match_3maxplus(parent, cfdata, aux)
struct device *parent;
struct cfdata *cfdata;
void *aux;
{
return (systype == DS_3MAXPLUS);
}
void
tcbus_attach_3maxplus(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
{
}

View File

@ -0,0 +1,76 @@
/* $NetBSD: tc_3min.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone. 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 by Jonathan Stone for
* the NetBSD Project.
* 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.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_3min.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ ");
#include <sys/types.h>
#include <sys/device.h>
#include <dev/cons.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#include <pmax/pmax/kmin.h>
int tcbus_match_3min(struct device *, void *, void *);
void tcbus_attach_3min(struct device *, struct device *, void *);
/* 3MIN slot addreseses */
static struct tc_slotdesc tc_kmin_slots [] = {
{ TC_KV(KMIN_PHYS_TC_0_START), TC_C(0) }, /* 0 - tc option slot 0 */
{ TC_KV(KMIN_PHYS_TC_1_START), TC_C(1) }, /* 1 - tc option slot 1 */
{ TC_KV(KMIN_PHYS_TC_2_START), TC_C(2) }, /* 2 - tc option slot 2 */
{ TC_KV(KMIN_PHYS_TC_3_START), TC_C(3) } /* 3 - IO asic on b'board */
};
/*
* The only builtin Turbochannel device on the kn03 (and kmin)
* is the IOCTL asic, which is mapped into TC slot 3.
*/
const struct tc_builtin tc_kn02ba_builtins[] = {
{ "IOCTL ", 3, 0x0, TC_C(3), /*TC_C(3)*/ }
};
int tc_kmin_nslots =
sizeof(tc_kmin_slots) / sizeof(tc_kmin_slots[0]);
/* 3MIN turbochannel autoconfiguration table */
struct tcbus_attach_args kmin_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_12_5_MHZ,
KMIN_TC_NSLOTS, tc_kmin_slots,
1, tc_kn02ba_builtins, /*XXX*/
0 /*tc_ds_ioasic_intr_establish*/ ,
0 /**tc_ds_ioasic_intr_disestablish*/,
};

View File

@ -0,0 +1,78 @@
/* $NetBSD: tc_maxine.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone. 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 by Jonathan Stone for
* the NetBSD Project.
* 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.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_maxine.c,v 1.1 1998/04/19 07:59:13 jonathan Exp $ ");
#include <sys/types.h>
#include <sys/device.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#include <machine/sysconf.h>
#include <pmax/pmax/maxine.h>
/*
* The builtin Turbonchannel devices on the MAXINE
* is the IOCTL asic, which is mapped into TC slot 3, and the PMAG-DV
* xcfb framebuffer, which is built into the baseboard.
*/
const struct tc_builtin tc_xine_builtins[] = {
{ "IOCTL ", 3, 0x0, TC_C(3), /*TC_C(3)*/ },
{ "PMAG-DV ", 2, 0x0, TC_C(2), /*TC_C(4)*/ }
};
/* MAXINE slot addreseses */
static struct tc_slotdesc tc_xine_slots [4] = {
{ TC_KV(XINE_PHYS_TC_0_START), TC_C(0) }, /* 0 - tc option slot 0 */
{ TC_KV(XINE_PHYS_TC_1_START), TC_C(1) }, /* 1 - tc option slot 1 */
/*{ TC_KV(-1), TC_C(-1) },*/ /* physical space for ``slot 2'' is reserved */
{ TC_KV(XINE_PHYS_CFB_START), TC_C(2) }, /* 2 - fb on b'board */
{ TC_KV(XINE_PHYS_TC_3_START), TC_C(3) } /* 3 - IOasic on b'board */
};
int tc_xine_nslots =
sizeof(tc_xine_slots) / sizeof(tc_xine_slots[0]);
struct tcbus_attach_args xine_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_12_5_MHZ, /* TC bus speed */
XINE_TC_NSLOTS, tc_xine_slots,
2, tc_xine_builtins,
0 /*tc_ds_ioasic_intr_establish*/,
0 /*tc_ds_ioasic_intr_disestablish*/
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc_subr.c,v 1.18 1998/03/30 04:45:50 mrg Exp $ */
/* $NetBSD: tc_subr.c,v 1.19 1998/04/19 07:59:13 jonathan Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
@ -14,49 +14,31 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_subr.c,v 1.18 1998/03/30 04:45:50 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: tc_subr.c,v 1.19 1998/04/19 07:59:13 jonathan Exp $");
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h> /* printf() */
#include <sys/device.h>
#include <dev/cons.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#include <machine/sysconf.h>
extern int pmax_boardtype;
#include <pmax/pmax/pmaxtype.h>
#ifndef NULL
#define NULL 0
#endif
/* Return the appropriate tcbus_attach_args for a given cputype */
extern struct tcbus_attach_args * cpu_tcdesc __P ((int systype));
/* Definition of the driver for autoconfig. */
int tcmatch(struct device *, void *, void *);
void tcattach(struct device *, struct device *, void *);
int tcprint(void *, const char *);
void tc_ds_intr_establish __P((struct device *, void *, tc_intrlevel_t,
intr_handler_t handler, intr_arg_t arg));
void tc_intr_disestablish __P((struct device *dev, void *cookie));
caddr_t tc_cvtaddr __P((struct confargs *));
extern int systype;
extern int tc_findconsole __P((int prom_slot));
/* Forward declarations */
static int tc_consprobeslot __P((tc_addr_t slotaddr));
/*
* TurboChannel autoconfiguration declarations and tables for DECstations.
*/
#include <pmax/pmax/pmaxtype.h>
#include <pmax/pmax/asic.h>
#include <pmax/pmax/kn03.h>
#include <pmax/pmax/kn02.h>
#include <pmax/pmax/kmin.h>
#include <pmax/pmax/maxine.h>
#include <pmax/pmax/turbochannel.h>
@ -67,261 +49,139 @@ static int tc_consprobeslot __P((tc_addr_t slotaddr));
#include <pmax/dev/sfbvar.h>
#include <pmax/dev/xcfbvar.h>
/*
* Which system models were configured?
*/
#include "opt_dec_3max.h"
#include "opt_dec_3min.h"
#include "opt_dec_3maxplus.h"
#include "opt_dec_maxine.h"
/* Which TC framebuffers have drivers, for configuring a console device. */
/*
* Which TC framebuffers were drivers configured for?
* Used for configuring a console device.
*/
#include "cfb.h"
#include "mfb.h"
#include "sfb.h"
#ifdef notyet
#include "px.h"
#include "pxg.h"
#endif
/*#include <pmax/pmax/nameglue.h>*/
#define KV(x) ((tc_addr_t)MIPS_PHYS_TO_KSEG1(x))
/*
* Tables for table-driven TC and console configuration.
*/
struct fbinfo;
struct tcfbsw {
const char fbsw_name[8];
int (*fbsw_initfn) __P((struct fbinfo*, char*, int, int));
};
#define tcfbsw_entry(tcname, initfn) { tcname, initfn }
const struct tcfbsw tcfbsw[] = {
#if NMFB > 0
tcfbsw_entry("PMAG_AA ", mfbinit),
#endif
#if NSFB > 0
tcfbsw_entry("PMAGB-BA", sfbinit),
#endif
#if NCFB > 0
tcfbsw_entry("PMAG-BA ", cfbinit),
#endif
};
const int ntcfbsw = sizeof(tcfbsw) / sizeof(tcfbsw[0]);
/*
* Find a tc graphcis console device.
*/
extern int tc_findconsole __P((int prom_slot));
/*
* Local forward declarations
*/
extern struct tcbus_attach_args * cpu_tcdesc __P ((int systype));
static int tc_consprobeslot __P((tc_addr_t slotaddr));
/*
* DECstation tc implementations dont' have a tcasic to handle interrupts,
* and the mapping to CPU interrupt lines is model-dpeendent.
* We have to pass TC interrupt establish/disestablish requests up to
* motherboard-specific code.
*/
void tc_ds_intr_establish __P((struct device *, void *, tc_intrlevel_t,
intr_handler_t handler, intr_arg_t arg));
void tc_ds_intr_disestablish __P((struct device *dev, void *cookie));
void tc_ds_ioasic_intr_setup __P((void));
void tc_ds_ioasic_intr_establish __P((struct device *dev, void *cookie,
tc_intrlevel_t level,
intr_handler_t handler,
void *arg));
void tc_ds_ioasic_intr_disestablish __P((struct device *, void *));
void tc_ds_ioasic_iointr __P((void *, int));
int tc_ds_ioasic_getdev __P((struct confargs *));
/* XXX*/
/* should be handled elsewhere? */
typedef void (*tc_enable_t) __P ((u_int slotno, intr_handler_t,
void *intr_arg, int on));
typedef int (*tc_handler_t) __P((void *intr_arg));
extern void (*tc_enable_interrupt) __P ((u_int slotno, tc_handler_t,
void *intr_arg, int on));
extern void dec_3maxplus_enable_intr __P((u_int slot, tc_handler_t,
void *intr_arg, int on));
extern void dec_3max_enable_intr __P ((u_int slot, tc_handler_t,
void *intr_arg, int on));
extern void dec_3min_enable_intr __P ((u_int slot, tc_handler_t,
void *intr_arg, int on));
extern void dec_maxine_enable_intr __P ((u_int slot, tc_handler_t,
void *intr_arg, int on));
/*
* Configuration tables for the four models of
* Decstation that have turbochannels.
* None of the four are the same.
*/
#define C(x) ((void *)(u_long)x)
#define TC_SCSI "PMAZ-AA "
#define TC_ETHER "PMAD-AA "
/*
* 3MIN and 3MAXPLUS turbochannel slots.
* The kmin (3MIN) and kn03 (3MAXPLUS) have the same number of slots.
* We can share one configuration-struct table and use two slot-address
* tables to handle the fact that the turbochannel slot size and base
* addresses are different on the two machines.
* (thankfully, the IOCTL ASIC subslots are all the same size on all
* DECstations with IOASICs.) The devices are listed in the order in which
* we should probe and attach them.
*/
/*
* The only builtin Turbochannel device on the kn03 and kmin
* is the IOCTL asic, which is mapped into TC slot 3.
*/
const struct tc_builtin tc_kn03_builtins[] = {
{ "IOCTL ", 3, 0x0, C(3), /*C(3)*/ }
};
/* 3MAXPLUS TC slot addresses */
static struct tc_slotdesc tc_kn03_slots [4] = {
{ KV(KN03_PHYS_TC_0_START), C(0) }, /* slot0 - tc option slot 0 */
{ KV(KN03_PHYS_TC_1_START), C(1) }, /* slot1 - tc option slot 1 */
{ KV(KN03_PHYS_TC_2_START), C(2) }, /* slot2 - tc option slot 2 */
{ KV(KN03_PHYS_TC_3_START), C(3) } /* slot3 - IO asic on b'board */
};
int tc_kn03_nslots =
sizeof(tc_kn03_slots) / sizeof(tc_kn03_slots[0]);
/* 3MAXPLUS turbochannel autoconfiguration table */
struct tcbus_attach_args kn03_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_25_MHZ,
KN03_TC_NSLOTS, tc_kn03_slots,
1, tc_kn03_builtins,
tc_ds_ioasic_intr_establish,
tc_ds_ioasic_intr_disestablish
};
/************************************************************************/
/* 3MIN slot addreseses */
static struct tc_slotdesc tc_kmin_slots [] = {
{ KV(KMIN_PHYS_TC_0_START), C(0) }, /* slot0 - tc option slot 0 */
{ KV(KMIN_PHYS_TC_1_START), C(1) }, /* slot1 - tc option slot 1 */
{ KV(KMIN_PHYS_TC_2_START), C(2) }, /* slot2 - tc option slot 2 */
{ KV(KMIN_PHYS_TC_3_START), C(3) } /* slot3 - IO asic on b'board */
};
int tc_kmin_nslots =
sizeof(tc_kmin_slots) / sizeof(tc_kmin_slots[0]);
/* 3MIN turbochannel autoconfiguration table */
struct tcbus_attach_args kmin_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_12_5_MHZ,
KMIN_TC_NSLOTS, tc_kmin_slots,
1, tc_kn03_builtins, /*XXX*/
tc_ds_ioasic_intr_establish,
tc_ds_ioasic_intr_disestablish,
};
/************************************************************************/
/*
* The builtin Turbonchannel devices on the MAXINE
* is the IOCTL asic, which is mapped into TC slot 3, and the PMAG-DV
* xcfb framebuffer, which is built into the baseboard.
*/
const struct tc_builtin tc_xine_builtins[] = {
{ "IOCTL ", 3, 0x0, C(3), /*C(3)*/ },
{ "PMAG-DV ", 2, 0x0, C(2), /*C(4)*/ }
};
/* MAXINE slot addreseses */
static struct tc_slotdesc tc_xine_slots [4] = {
{ KV(XINE_PHYS_TC_0_START), C(0) }, /* slot 0 - tc option slot 0 */
{ KV(XINE_PHYS_TC_1_START), C(1) }, /* slot 1 - tc option slot 1 */
/*{ KV(-1), C(-1) },*/ /* physical space for ``slot 2'' is reserved */
{ KV(XINE_PHYS_CFB_START), C(2) }, /* slot 2 - fb on b'board */
{ KV(XINE_PHYS_TC_3_START), C(3) } /* slot 3 - IO asic on b'board */
};
int tc_xine_nslots =
sizeof(tc_xine_slots) / sizeof(tc_xine_slots[0]);
struct tcbus_attach_args xine_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_12_5_MHZ, /* TC bus speed */
XINE_TC_NSLOTS, tc_xine_slots,
2, tc_xine_builtins,
tc_ds_ioasic_intr_establish,
tc_ds_ioasic_intr_disestablish
};
/************************************************************************/
/* 3MAX (kn02) turbochannel slots */
/* slot addreseses */
static struct tc_slotdesc tc_kn02_slots [8] = {
{ KV(KN02_PHYS_TC_0_START), C(0)}, /* slot 0 - tc option slot 0 */
{ KV(KN02_PHYS_TC_1_START), C(1), }, /* slot 1 - tc option slot 1 */
{ KV(KN02_PHYS_TC_2_START), C(2), }, /* slot 2 - tc option slot 2 */
{ KV(KN02_PHYS_TC_3_START), C(3), }, /* slot 3 - reserved */
{ KV(KN02_PHYS_TC_4_START), C(4), }, /* slot 4 - reserved */
{ KV(KN02_PHYS_TC_5_START), C(5), }, /* slot 5 - SCSI on b`board */
{ KV(KN02_PHYS_TC_6_START), C(6), }, /* slot 6 - b'board Ether */
{ KV(KN02_PHYS_TC_7_START), C(7), } /* slot 7 - system CSR, etc. */
};
int tc_kn02_nslots =
sizeof(tc_kn02_slots) / sizeof(tc_kn02_slots[0]);
#define KN02_ROM_NAME KN02_ASIC_NAME
#define TC_KN02_DEV_IOASIC -1
#define TC_KN02_DEV_ETHER 6
#define TC_KN02_DEV_SCSI 5
const struct tc_builtin tc_kn02_builtins[] = {
{ KN02_ROM_NAME,7, 0x0, C(TC_KN02_DEV_IOASIC) /* C(7)*/ },
{ TC_ETHER, 6, 0x0, C(TC_KN02_DEV_ETHER) /* C(6)*/ },
{ TC_SCSI, 5, 0x0, C(TC_KN02_DEV_SCSI) /* C(5)*/ }
};
struct tcbus_attach_args kn02_tc_desc =
{
"tc", /* XXX common substructure */
0, /* XXX bus_space_tag */
TC_SPEED_25_MHZ,
8, tc_kn02_slots,
3, tc_kn02_builtins, /*XXX*/
tc_ds_ioasic_intr_establish,
tc_ds_ioasic_intr_disestablish
};
/************************************************************************/
/*
* Function to map from a CPU code to a tcbus_attach_args struct.
* This should really be in machine-dependent code, where
* it could even be a macro.
* Map from systype code to a tcbus_attach_args struct.
* XXX make table-driven.
*/
struct tcbus_attach_args *
cpu_tcdesc(cpu)
int cpu;
{
if (cpu == DS_3MAXPLUS) {
switch (cpu) {
#ifdef DEC_3MAXPLUS
tc_enable_interrupt = dec_3maxplus_enable_intr;
return &kn03_tc_desc;
#else
return (0);
case DS_3MAXPLUS: {
extern struct tcbus_attach_args kn03_tc_desc[];
return &kn03_tc_desc[0];
}
#endif /* DEC_3MAXPLUS */
} else if (cpu == DS_3MAX) {
#ifdef DEC_3MAX
tc_enable_interrupt = dec_3max_enable_intr;
return &kn02_tc_desc;
#else
return (0);
case DS_3MAX: {
extern struct tcbus_attach_args kn02_tc_desc[];
return &kn02_tc_desc[0];
}
#endif /* DEC_3MAX */
} else if (cpu == DS_3MIN) {
#ifdef DEC_3MIN
tc_enable_interrupt = dec_3min_enable_intr;
return &kmin_tc_desc;
#else
return (0);
case DS_3MIN: {
extern struct tcbus_attach_args kmin_tc_desc[];
return &kmin_tc_desc[0];
}
#endif /*DEC_3MIN*/
} else if (cpu == DS_MAXINE) {
#ifdef DEC_MAXINE
tc_enable_interrupt = dec_maxine_enable_intr;
return &xine_tc_desc;
#else
return (0);
case DS_MAXINE: {
extern struct tcbus_attach_args xine_tc_desc[];
return xine_tc_desc;
}
#endif /*DEC_MAXINE*/
} else if (cpu == DS_PMAX) {
default:
#ifdef DIAGNOSTIC
printf("tcattach: PMAX, no turbochannel\n");
printf("tcattach: systype %d, no turbochannel\n", cpu);
return NULL;
#endif /*DIAGNOSTIC*/
return NULL;
} else if (cpu == DS_MIPSFAIR) {
printf("tcattach: Mipsfair (5100), no turbochannel\n");
return NULL;
} else {
panic("cpu_tc: Unrecognized bus type 0x%x\n", cpu);
panic("cpu_tc: system type 0x%x, no TurboChannel configured\n",
cpu);
}
}
/*
* We have a TurboChannel bus. Configure it.
*/
@ -334,7 +194,7 @@ config_tcbus(parent, systype, printfn)
{
struct tcbus_attach_args tcb;
struct tcbus_attach_args * tcbus = cpu_tcdesc(pmax_boardtype);
struct tcbus_attach_args * tcbus = cpu_tcdesc(systype);
if (tcbus == NULL) {
printf("no TurboChannel configuration info for this machine\n");
@ -353,105 +213,19 @@ config_tcbus(parent, systype, printfn)
tcb.tba_nbuiltins = tcbus->tba_nbuiltins;
tcb.tba_builtins = tcbus->tba_builtins;
tcb.tba_intr_establish = tc_ds_intr_establish; /*XXX*/
tcb.tba_intr_disestablish = tc_ds_ioasic_intr_disestablish; /*XXX*/
tcb.tba_intr_establish = tc_ds_intr_establish;
tcb.tba_intr_disestablish = tc_ds_intr_disestablish;
config_found(parent, (struct confargs*)&tcb, printfn);
}
/*
* Called before autoconfiguration, to find a system console.
*
* Probe the turbochannel for a framebuffer option card, starting at
* the preferred slot and then scanning all slots. Configure the first
* supported framebuffer device found, if any, as the console, and
* return 1 if found.
*/
int
tc_findconsole(preferred_slot)
int preferred_slot;
{
int slot;
struct tcbus_attach_args * sc_desc;
/* First, try the slot configured as console in NVRAM. */
/* if (consprobeslot(preferred_slot)) return (1); */
/*
* Try to configure each turbochannel (or CPU-internal) device.
* Knows about gross internals of TurboChannel bus autoconfig
* descriptor, which needs to be fixed badly.
*/
if ((sc_desc = cpu_tcdesc(pmax_boardtype)) == NULL)
return 0;
for (slot = 0; slot < sc_desc->tba_nslots; slot++) {
if (tc_consprobeslot(sc_desc->tba_slots[slot].tcs_addr))
return (1);
}
return (0);
}
/*
* Look in a single TC option slot to see if it contains a possible
* framebuffer console device.
* Configure only the framebuffers for which driver are configured
* into the kernel. If a suitable framebuffer is found, initialize
* it, and set up glass-tty emulation.
*/
static int
tc_consprobeslot(tc_slotaddr)
tc_addr_t tc_slotaddr;
{
char name[20];
void *slotaddr = (void *) tc_slotaddr;
if (tc_badaddr(slotaddr))
return (0);
if (tc_checkslot(tc_slotaddr, name) == 0)
return (0);
/*
* We found an device in the given slot. Now see if it's a
* framebuffer for which we have a driver.
*/
/*printf(", trying to init a \"%s\"", name);*/
#define DRIVER_FOR_SLOT(slotname, drivername) \
(strcmp (slotname, drivername) == 0)
#if NMFB > 0
if (DRIVER_FOR_SLOT(name, "PMAG-AA ") &&
mfbinit(NULL, slotaddr, 0, 1)) {
return (1);
}
#endif /* NMFB */
#if NSFB > 0
if (DRIVER_FOR_SLOT(name, "PMAGB-BA") &&
sfbinit(NULL, slotaddr, 0, 1)) {
return (1);
}
#endif /* NSFB */
#if NCFB > 0
/*"cfb"*/
if (DRIVER_FOR_SLOT(name, "PMAG-BA ") &&
cfbinit(NULL, slotaddr, 0, 1)) {
return (1);
}
#endif /* NCFB */
return (0);
}
/*
* Establish an interrupt handler, but on what bus -- TC or ioctl asic?
* Establish an interrupt handler.
* For both TC and IOCTL asic, we must upcall to motherboard-specific
* interrupt-hanlder functions, in case we need to recompute masks for
* CPU interrupt lines.
*/
void
tc_ds_intr_establish(dev, cookie, level, handler, val)
@ -481,45 +255,95 @@ tc_ds_intr_establish(dev, cookie, level, handler, val)
(*tc_enable_interrupt) ((int)cookie, handler, val, 1);
}
/* hack for kn03 ioasic */
void
tc_ds_ioasic_intr_setup ()
{
printf("not setting up TC intrs\n");
}
/*
* Establish an interrupt handler for an ioasic device.
* On NetBSD/pmax, there is currently a single, merged interrupt handler for
* both TC and ioasic. Just use the tc interrupt-establish function.
*/
void
tc_ds_ioasic_intr_establish(dev, cookie, level, handler, val)
struct device *dev;
void *cookie;
tc_intrlevel_t level;
intr_handler_t handler;
void *val;
{
tc_intr_establish(dev, cookie, level, handler, val);
}
void
tc_ds_ioasic_intr_disestablish(dev, arg)
tc_ds_intr_disestablish(dev, arg)
struct device *dev;
void *arg;
{
/*(*tc_enable_interrupt) (ca->ca_slot, handler, 0);*/
printf("cannot dis-establish IOASIC interrupts\n");
}
void
tc_ds_ioasic_iointr (framep, vec)
void * framep;
int vec;
/*
* Console initialization --
* Called before autoconfiguration, to find a system console.
*/
/*
* Probe the turbochannel for a framebuffer option card, starting at
* the preferred slot and then scanning all slots. Configure the first
* supported framebuffer device found, if any, as the console, and
* return 1 if found.
* XXX knows about internals of TurboChannel bus autoconfig descriptor,
* which needs to be fixed badly.
*/
int
tc_findconsole(preferred_slot)
int preferred_slot;
{
printf("bogus interrupt handler fp %p vec %d\n", framep, vec);
int slot;
struct tcbus_attach_args *tc_desc;
/* First, try the slot configured as console in NVRAM. */
/* if (consprobeslot(preferred_slot)) return (1); */
if ((tc_desc = cpu_tcdesc(systype)) == NULL)
return 0;
/*
* Try to configure each turbochannel option or builtin framebuffer.
*/
for (slot = 0; slot < tc_desc->tba_nslots; slot++) {
if (tc_consprobeslot(tc_desc->tba_slots[slot].tcs_addr))
return (1);
}
return (0);
}
/*
* Look in a single TC option slot to see if it contains a possible
* framebuffer console device.
*
* Configure only the framebuffers for which driver are configured
* into the kernel. If a suitable framebuffer is found, initialize
* it, and set up glass-tty emulation.
*/
static int
tc_consprobeslot(tc_slotaddr)
tc_addr_t tc_slotaddr;
{
void *slotaddr = (void *) tc_slotaddr;
char name[20];
int i;
/*
* check specified TC slot address
*/
if (tc_badaddr(slotaddr))
return (0);
/* check slot matches name */
if (tc_checkslot(tc_slotaddr, name) == 0)
return (0);
/*
* We found an device in the given slot. Now see if it's a
* framebuffer for which we have a driver.
*/
for (i = 0; i < ntcfbsw; i++) {
if (tcfbsw[i].fbsw_initfn == 0)
break;
if (strcmp(name, tcfbsw[i].fbsw_name) == 0) {
if (tcfbsw[i].fbsw_initfn(NULL, slotaddr, 0, 0))
return (1);
}
}
return (0);
}