summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/pmax/conf/files.pmax4
-rw-r--r--sys/arch/pmax/pmax/cpu_cons.c105
-rw-r--r--sys/arch/pmax/tc/ds-asic-conf.c47
-rw-r--r--sys/arch/pmax/tc/ds-tc-conf.c108
-rw-r--r--sys/arch/pmax/tc/tc.c300
-rw-r--r--sys/arch/pmax/tc/tc.h76
6 files changed, 327 insertions, 313 deletions
diff --git a/sys/arch/pmax/conf/files.pmax b/sys/arch/pmax/conf/files.pmax
index 027b2857321..a3c1211e24f 100644
--- a/sys/arch/pmax/conf/files.pmax
+++ b/sys/arch/pmax/conf/files.pmax
@@ -1,4 +1,4 @@
-# $NetBSD: files.pmax,v 1.24 1995/10/05 01:53:05 jonathan Exp $
+# $NetBSD: files.pmax,v 1.25 1996/01/03 20:33:25 jonathan Exp $
# DECstation-specific configuration info
# maxpartitions must be first item in files.${ARCH}.
@@ -54,7 +54,7 @@ device oldscsibus at oldscsi {target = -1, drive = -1}
# asc: system-slot or turbochannel-option SCSI interface
device asc at ioasic,tc: oldscsi,scsi
-file arch/pmax/dev/asc.c asc needs-flag
+file dev/tc/asc.c asc needs-flag
# sii: kn01 SCSI interface
device sii at mainbus: oldscsi,scsi
diff --git a/sys/arch/pmax/pmax/cpu_cons.c b/sys/arch/pmax/pmax/cpu_cons.c
index a35ffc49ae6..200a8f56265 100644
--- a/sys/arch/pmax/pmax/cpu_cons.c
+++ b/sys/arch/pmax/pmax/cpu_cons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_cons.c,v 1.5 1995/09/20 05:36:15 jonathan Exp $ */
+/* $NetBSD: cpu_cons.c,v 1.6 1996/01/03 20:39:19 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -74,9 +74,8 @@
#include <pmax/dev/fbreg.h>
#include <machine/autoconf.h>
-#include <pmax/tc/tc.h>
#include <pmax/dev/lk201.h>
-
+#include <dev/tc/tcvar.h>
#include <pm.h>
#include <cfb.h>
@@ -143,8 +142,6 @@ struct consdev cd = {
*/
-int consprobetc __P((int prom_slot));
-int consprobeslot __P((int slot));
void consinit __P((void));
void xconsinit __P((void));
@@ -281,7 +278,7 @@ consinit()
/*
* Check for a suitable turbochannel frame buffer.
*/
- if (consprobetc(crt)) {
+ if (tc_findconsole(crt)) {
cd.cn_pri = CN_NORMAL;
#ifdef RCONS_HACK
/* FIXME */ cd.cn_putc = v_putc;
@@ -371,102 +368,6 @@ xconsinit()
/*
- * Probe for a framebuffer option card. Configure the first one
- * found as a console.
- */
-int
-consprobetc(preferred_slot)
- int preferred_slot;
-{
- int slot;
-
- struct tc_cpu_desc * sc_desc;
-
- /*printf("Looking for fb console in slot %d", slot);*/
-
- /* 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->tcd_ndevs; slot++) {
-
- if (consprobeslot(slot))
- return (1);
- }
- return (0);
-}
-
-/*
- * Try and configure one slot as framebuffer console.
- * Accept only the framebuffers configured in.
- * Attach the framebuffer if found.
- */
-int
-consprobeslot(slot)
- int slot;
-{
- void *slotaddr;
- char name[20];
- struct tc_cpu_desc * sc_desc;
-
- if (slot < 0 || ((sc_desc = cpu_tcdesc(pmax_boardtype)) == NULL))
- return 0;
- slotaddr = (void *)sc_desc->tcd_slots[slot].tsd_dense;
-
- /*printf("probing slot %d at 0x%x\n", slot, slotaddr);*/
-
- if (tc_checkdevmem(slotaddr) == 0)
- return (0);
-
- if (tc_checkslot(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(slotaddr, 0, 1)) {
- cd.cn_pri = CN_NORMAL;
- return (1);
- }
-#endif /* NMFB */
-
-#if NSFB > 0
- if (DRIVER_FOR_SLOT(name, "PMAGB-BA") &&
- sfbinit(slotaddr, 0, 1)) {
- cd.cn_pri = CN_NORMAL;
- return (1);
- }
-#endif /* NSFB */
-
-#if NCFB > 0
- /*"cfb"*/
- if (DRIVER_FOR_SLOT(name, "PMAG-BA ") &&
- cfbinit(NULL, slotaddr, 0, 1)) {
- cd.cn_pri = CN_NORMAL;
- return (1);
- }
-#endif /* NCFB */
- return (0);
-}
-
-
-
-/*
* Get character from ROM console.
*/
static int romgetc(dev)
diff --git a/sys/arch/pmax/tc/ds-asic-conf.c b/sys/arch/pmax/tc/ds-asic-conf.c
index b7891790897..6215fec2010 100644
--- a/sys/arch/pmax/tc/ds-asic-conf.c
+++ b/sys/arch/pmax/tc/ds-asic-conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ds-asic-conf.c,v 1.3 1995/10/09 01:45:29 jonathan Exp $ */
+/* $NetBSD: ds-asic-conf.c,v 1.4 1996/01/03 20:39:14 jonathan Exp $ */
/*
* Copyright (c) 1995 Jonathan Stone
@@ -20,50 +20,51 @@ struct asic_slot {
struct asic_slot kn03_asic_slots[] =
{
- { { "lance", 0, KN03_LANCE_SLOT, (u_int) (3 * 0x40000), },
+ /* name slot offset intpri */
+ { { "lance", 0, (u_int) (3 * 0x40000), KN03_LANCE_SLOT, },
KN03_INTR_LANCE, asic_intrnull, (void*) KN03_LANCE_SLOT, },
- { { "scc", 1, KN03_SCC0_SLOT, (u_int) (4 * 0x40000), },
+ { { "scc", 1, (u_int) (4 * 0x40000), KN03_SCC0_SLOT, },
KN03_INTR_SCC_0, asic_intrnull, (void *)KN03_SCC0_SLOT, },
- { { "scc", 2, KN03_SCC1_SLOT, (u_int) (6 * 0x40000), },
- KN03_INTR_SCC_1, asic_intrnull, (void*)KN03_SCC1_SLOT, },
+ { { "scc", 2, (u_int) (6 * 0x40000), KN03_SCC1_SLOT, },
+ KN03_INTR_SCC_1, asic_intrnull, (void *)KN03_SCC1_SLOT, },
- { { "dallas_rtc", 3, 0 /*XXX*/, (u_int) (8* 0x40000), },
- 0, asic_intrnull, (void *)(long) 16 /*XXX*/, },
+ { { "dallas_rtc", 3, (u_int) (8* 0x40000), 0 /*XXX*/, },
+ 0, asic_intrnull, (void *)(long) 16 /*XXX*/, },
- { { "asc", 4, KN03_SCSI_SLOT, (u_int) (12 * 0x40000), },
- 0, asic_intrnull, (void*)KN03_SCSI_SLOT, },
+ { { "asc", 4, (u_int) (12* 0x40000), KN03_SCSI_SLOT, },
+ 0, asic_intrnull, (void *)KN03_SCSI_SLOT, },
{ { NULL, 0, 0, 0 }, 0, NULL, NULL }
};
-/* UNTESTED*/
+
struct asic_slot xine_asic_slots[] =
{
- { { "lance", 0, KN03_LANCE_SLOT, (u_int) (3 * 0x40000), },
+ { { "lance", 0, (u_int) (3 * 0x40000), KN03_LANCE_SLOT, },
KN03_INTR_LANCE, asic_intrnull, (void*) KN03_LANCE_SLOT, },
- { { "scc", 1, KN03_SCC0_SLOT, (u_int) (4 * 0x40000), },
+ { { "scc", 1, (u_int) (4 * 0x40000), KN03_SCC0_SLOT, },
KN03_INTR_SCC_0, asic_intrnull, (void *)KN03_SCC0_SLOT, },
{ { "dallas_rtc", 2, 0, (u_int) (8* 0x40000), },
0, asic_intrnull, (void *)(long) 16 /*XXX*/, },
- { { "isdn", 3, XINE_ISDN_SLOT, (u_int) (9* 0x40000), },
- 0, asic_intrnull, (void *)(long) XINE_ISDN_SLOT, },
+ { { "isdn", 3, (u_int) (9 * 0x40000), XINE_ISDN_SLOT, },
+ 0, asic_intrnull, (void *)(long) XINE_ISDN_SLOT, },
- { { "dtop", 4, XINE_DTOP_SLOT, (u_int) (10* 0x40000), },
- 0, asic_intrnull, (void *)(long) XINE_DTOP_SLOT, },
+ { { "dtop", 4, (u_int) (10* 0x40000), XINE_DTOP_SLOT, },
+ 0, asic_intrnull, (void *)(long) XINE_DTOP_SLOT, },
- { { "fdc", 5, XINE_FLOPPY_SLOT, (u_int) (11* 0x40000), },
- 0, asic_intrnull, (void *)(long) XINE_FLOPPY_SLOT, },
+ { { "fdc", 5, (u_int) (11* 0x40000), XINE_FLOPPY_SLOT, },
+ 0, asic_intrnull, (void *) (long)XINE_FLOPPY_SLOT, },
- { { "asc", 6, XINE_SCSI_SLOT, (u_int) (12 * 0x40000), },
+ { { "asc", 6, (u_int) (12* 0x40000), XINE_SCSI_SLOT, },
0 /*XINE_INTR_SCSI*/, asic_intrnull, (void*)XINE_SCSI_SLOT, },
#if 0
- { { "frc", 3, (u_int) XINE_SLOT_FRC, (15* 0x40000), },
- 0, asic_intrnull, (void *)(long) XINE_SLOT_FRC, },
+ { { "frc", 3, (u_int) (15* 0x40000), XINE_SLOT_FRC, },
+ 0, asic_intrnull, (void *)(long) XINE_SLOT_FRC, },
#endif
{ { NULL, 0, 0, }, 0, NULL, NULL }
};
@@ -79,10 +80,10 @@ struct asic_slot xine_asic_slots[] =
*/
struct asic_slot kn02_asic_slots[] = {
- { { "dc", 0, 7, (u_int) (4 * 0x80000), },
+ { { "dc", 0, (u_int) (4 * 0x80000), 7 },
KN03_INTR_SCC_0, asic_intrnull, (void *) 7, },
- { { "dallas_rtc", 0, 0, (u_int) (5 * 0x80000), },
+ { { "dallas_rtc", 0, (u_int) (5 * 0x80000), 0, },
0, asic_intrnull, (void *) 16 /*XXX*/, },
{ { NULL, 0, 0 }, 0, NULL, NULL }
diff --git a/sys/arch/pmax/tc/ds-tc-conf.c b/sys/arch/pmax/tc/ds-tc-conf.c
index 166b5f628c5..316554ecdf1 100644
--- a/sys/arch/pmax/tc/ds-tc-conf.c
+++ b/sys/arch/pmax/tc/ds-tc-conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ds-tc-conf.c,v 1.4 1995/10/09 01:45:28 jonathan Exp $ */
+/* $NetBSD: ds-tc-conf.c,v 1.5 1996/01/03 20:39:16 jonathan Exp $ */
/*
* Copyright (c) 1995 Jonathan Stone
@@ -13,27 +13,33 @@
* addresses are different on the two machines.
* (thankfully the IOASIC subslots are all the same size.)
*/
+
+#define C(x) ((void *)(u_long)x)
+
struct confargs tc3_devs[4] = {
- /* name entry pri xxx */
- { "IOCTL ", 3, -1, /*0x040000*/ 0x0, },
- { NULL, 2, 2, 0x0, },
- { NULL, 1, 1, 0x0, },
- { NULL, 0, 0, 0x0, }
+ /* name slot offset intpri */
+ { "IOCTL ", 3, 0x0, -1, }, /* offset 0x040000 ?*/
+ { NULL, 2, 0x0, 2, },
+ { NULL, 1, 0x0, 1, },
+ { NULL, 0, 0x0, 0, }
};
/* 3MAXPLUS slot addreseses */
- static struct tc_slot_desc kn03_slot_addrs [4] = {
- { KV(KN03_PHYS_TC_0_START), }, /* slot 0 - tc option slot 0 */
- { KV(KN03_PHYS_TC_1_START), }, /* slot 1 - tc option slot 1 */
- { KV(KN03_PHYS_TC_2_START), }, /* slot 2 - tc option slot 2 */
- { KV(KN03_PHYS_TC_3_START), } /* slot 3 - IOCTL asic on CPU board */
+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 tc_cpu_desc kn03_tc_desc =
{
- kn03_slot_addrs, KN03_TC_NSLOTS,
+ tc_kn03_slots, KN03_TC_NSLOTS,
tc3_devs, KN03_TC_NSLOTS, /*XXX*/
tc_ds_ioasic_intr_setup,
tc_ds_ioasic_intr_establish,
@@ -44,17 +50,20 @@ struct tc_cpu_desc kn03_tc_desc =
/************************************************************************/
/* 3MIN slot addreseses */
-static struct tc_slot_desc kmin_slot_addrs [4] = {
- { KV(KMIN_PHYS_TC_0_START), }, /* slot 0 - tc option slot 0 */
- { KV(KMIN_PHYS_TC_1_START), }, /* slot 1 - tc option slot 1 */
- { KV(KMIN_PHYS_TC_2_START), }, /* slot 2 - tc option slot 2 */
- { KV(KMIN_PHYS_TC_3_START), } /* slot 3 - IOCTL asic on CPU board */
+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(3) }, /* slot2 - tc option slot 2 */
+ { KV(KMIN_PHYS_TC_3_START), C(4) } /* slot3 - IO asic on b'board */
};
+int tc_kmin_nslots =
+ sizeof(tc_kmin_slots) / sizeof(tc_kmin_slots[0]);
+
/* 3MIN turbochannel autoconfiguration table */
struct tc_cpu_desc kmin_tc_desc =
{
- kmin_slot_addrs, KMIN_TC_NSLOTS,
+ tc_kmin_slots, KMIN_TC_NSLOTS,
tc3_devs, KMIN_TC_NSLOTS, /*XXX*/
tc_ds_ioasic_intr_setup,
tc_ds_ioasic_intr_establish,
@@ -66,23 +75,28 @@ struct tc_cpu_desc kmin_tc_desc =
/* MAXINE turbochannel slots */
struct confargs xine_devs[4] = {
- { "PMAG-DV ", 3, 3, 0x0, }, /* xcfb ? */
- { "IOCTL ", 2, -1, 0x0, },
- { NULL, 1, 1, 0x0, },
- { NULL, 0, 0, 0x0, }
+ /* name slot offset intpri */
+ { "PMAG-DV ", 3, 0x0, 3, }, /* xcfb */
+ { "IOCTL ", 2, 0x0, -1, },
+ { NULL, 1, 0x0, 1, },
+ { NULL, 0, 0x0, 0, }
};
/* MAXINE slot addreseses */
-static struct tc_slot_desc xine_slot_addrs [4] = {
- { KV(XINE_PHYS_TC_0_START), }, /* slot 0 - tc option slot 0 */
- { KV(XINE_PHYS_TC_1_START), }, /* slot 1 - tc option slot 1 */
- { KV(XINE_PHYS_TC_3_START), }, /* slot 2 - IOCTL asic on CPU board */
- { KV(XINE_PHYS_CFB_START), } /* slot 3 - fb on CPU board */
+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 */
+ /* physical space for ``slot 2'' is reserved */
+ { KV(XINE_PHYS_TC_3_START), C(8) }, /* slot 2 - IO asic on b'board */
+ { KV(XINE_PHYS_CFB_START), C(-1) } /* slot 3 - fb on b'board */
};
+int tc_xine_nslots =
+ sizeof(tc_xine_slots) / sizeof(tc_xine_slots[0]);
+
struct tc_cpu_desc xine_tc_desc =
{
- xine_slot_addrs, XINE_TC_NSLOTS,
+ tc_xine_slots, XINE_TC_NSLOTS,
xine_devs, 4, /*XXX*/
tc_ds_ioasic_intr_setup,
tc_ds_ioasic_intr_establish,
@@ -90,6 +104,7 @@ struct tc_cpu_desc xine_tc_desc =
/*xine_intr*/ (void *) -1
};
+
/************************************************************************/
#if 0
@@ -104,19 +119,19 @@ struct tc_cpu_desc xine_tc_desc =
struct confargs kn02_devs[8] = {
/* The 3max supposedly has "KN02 " at 0xbffc0410 */
- /* name entry pri xxx */
- { KN02_ASIC_NAME, 7, -1, 0x0, }, /* System CSR and subslots */
- { TC_ETHER, 6, 6, 0x0, }, /* slot 6: Ether on cpu board*/
- { TC_SCSI, 5, 5, 0x0, }, /* slot 5: SCSI on cpu board */
-/*XXX*/ { NULL, 4, 0, -1, }, /* slot 3 reserved */
-/*XXX*/ { NULL, 3, 0, -1, }, /* slot 3 reserved */
- { NULL, 2, 2, 0x0, }, /* slot 2 - TC option slot 2 */
- { NULL, 1, 1, 0x0, }, /* slot 1 - TC option slot 1 */
- { NULL, 0, 0, 0x0, } /* slot 0 - TC option slot 0 */
+ /* name slot offset intpri */
+ { KN02_ASIC_NAME, 7, 0x0, -1, }, /* System CSR and subslots */
+ { TC_ETHER, 6, 0x0, 6, }, /* slot 6: Ether on cpu board*/
+ { TC_SCSI, 5, 0x0, 5, }, /* slot 5: SCSI on cpu board */
+/*XXX*/ { NULL, 4, -1, 0, }, /* slot 3 reserved */
+/*XXX*/ { NULL, 3, -1, 0, }, /* slot 3 reserved */
+ { NULL, 2, 0x0, 2, }, /* slot 2 - TC option slot 2 */
+ { NULL, 1, 0x0, 1, }, /* slot 1 - TC option slot 1 */
+ { NULL, 0, 0x0, 0, } /* slot 0 - TC option slot 0 */
};
/* slot addreseses */
-static struct tc_slot_desc kn02_slot_addrs [8] = {
+static struct tc_slotdesc tc_kn02_slots [8] = {
{ KV(KN02_PHYS_TC_0_START), }, /* slot 0 - tc option slot 0 */
{ KV(KN02_PHYS_TC_1_START), }, /* slot 1 - tc option slot 1 */
{ KV(KN02_PHYS_TC_2_START), }, /* slot 2 - tc option slot 2 */
@@ -128,10 +143,25 @@ static struct tc_slot_desc kn02_slot_addrs [8] = {
};
+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
+
+struct tc_builtin tc_kn02_builtins[] = {
+ { KN02_ROM_NAME,7, 0x00000000, C(TC_KN02_DEV_IOASIC), },
+ { TC_ETHER, 6, 0x00000000, C(TC_KN02_DEV_ETHER), },
+ { TC_SCSI, 5, 0x00000000, C(TC_KN02_DEV_SCSI), },
+};
+
struct tc_cpu_desc kn02_tc_desc =
{
- kn02_slot_addrs, KN02_TC_NSLOTS,
+ tc_kn02_slots, KN02_TC_NSLOTS,
kn02_devs, 8, /*XXX*/
tc_ds_ioasic_intr_setup,
tc_ds_ioasic_intr_establish,
diff --git a/sys/arch/pmax/tc/tc.c b/sys/arch/pmax/tc/tc.c
index 02cc6023f1d..f98d1783bc6 100644
--- a/sys/arch/pmax/tc/tc.c
+++ b/sys/arch/pmax/tc/tc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tc.c,v 1.6 1995/12/28 06:44:57 jonathan Exp $ */
+/* $NetBSD: tc.c,v 1.7 1996/01/03 20:39:10 jonathan Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -29,24 +29,56 @@
#include <sys/param.h>
#include <sys/device.h>
-
+#include <dev/cons.h>
+#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
#ifdef alpha
#include <machine/rpb.h>
-#include <alpha/tc/tc.h>
#endif
-#ifdef pmax
-#include <pmax/tc/tc.h>
-#endif
+/* Which TC framebuffers have drivers, for configuring a console device. */
+#include <cfb.h>
+#include <mfb.h>
+#include <sfb.h>
+
+extern int pmax_boardtype;
+
struct tc_softc {
struct device sc_dv;
+ int sc_nslots;
+ struct tc_slotdesc *sc_slots;
+
+ void (*sc_intr_establish) __P((struct device *, void *,
+ tc_intrlevel_t, int (*)(void *), void *));
+ void (*sc_intr_disestablish) __P((struct device *, void *));
+#ifndef goneverysoon
struct abus sc_bus;
struct tc_cpu_desc *sc_desc;
+#endif /* goneverysoon */
};
+/*
+ * Old-style model-specific autoconfiguration description.
+ */
+struct tc_cpu_desc {
+ struct tc_slotdesc *tcd_slots;
+ long tcd_nslots;
+ struct confargs *tcd_devs;
+ long tcd_ndevs;
+ void (*tc_intr_setup) __P((void));
+ void (*tc_intr_establish) __P((struct device *dev, void *cookie,
+ int level, intr_handler_t handler, void *arg));
+ void (*tc_intr_disestablish) __P((struct device *, void *));
+ int (*tc_iointr) __P((u_int mask, u_int pc,
+ u_int statusReg, u_int causeReg));
+};
+
+/* Return the appropriate tc_cpu_desc for a given cputype */
+extern struct tc_cpu_desc * cpu_tcdesc __P ((int cputype));
+
+
/* Definition of the driver for autoconfig. */
int tcmatch(struct device *, void *, void *);
void tcattach(struct device *, struct device *, void *);
@@ -54,13 +86,17 @@ int tcprint(void *, char *);
struct cfdriver tccd =
{ NULL, "tc", tcmatch, tcattach, DV_DULL, sizeof (struct tc_softc) };
-void tc_intr_establish __P((struct confargs *, intr_handler_t handler,
- intr_arg_t));
-void tc_intr_disestablish __P((struct confargs *));
+void tc_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 *));
int tc_matchname __P((struct confargs *, char *));
extern int cputype;
+extern int tc_findconsole __P((int prom_slot));
+
+/* Forward declarations */
+int consprobeslot __P((int slot));
/*XXX*/ /* should be in separate source file */
@@ -82,13 +118,15 @@ extern int cputype;
#include <pmax/pmax/turbochannel.h>
-#include <pmax/pmax/nameglue.h>
+/*#include <pmax/pmax/nameglue.h>*/
+#define KV(x) ((tc_addr_t)MACH_PHYS_TO_UNCACHED(x))
+
void tc_ds_ioasic_intr_setup __P((void));
-void tc_ds_ioasic_intr_establish
- __P((struct confargs *, intr_handler_t, void *));
-void tc_ds_ioasic_intr_disestablish __P((struct confargs *));
+void tc_ds_ioasic_intr_establish __P((struct device *dev, void *cookie,
+ int 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 *));
@@ -111,36 +149,12 @@ extern void xine_enable_intr __P ((u_int slot, tc_handler_t,
void *intr_arg, int on));
/*
- * configuration tables for the four models of
+ * Configuration tables for the four models of
* Decstation that have turbochannels.
* None of the four are the same.
*/
#include "ds-tc-conf.c"
-
-/*
- * Mapping from CPU type to a tc_cpu_desc for that CPU type.
- * (Alpha-specific.)
- */
-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];
/*
* Function to map from a CPU code to a tc_cpu_desc.
@@ -151,8 +165,6 @@ struct tc_cpu_desc *
cpu_tcdesc(cpu)
int cpu;
{
- /*XXX*/
-#ifdef pmax
if (cpu == DS_3MAXPLUS) {
tc_enable_interrupt = kn03_enable_intr;
return &kn03_tc_desc;
@@ -160,27 +172,60 @@ cpu_tcdesc(cpu)
tc_enable_interrupt = kn02_enable_intr;
return &kn02_tc_desc;
} else if (cpu == DS_3MIN) {
- DPRINTF(("tcattach: 3MIN Turbochannel\n"));
tc_enable_interrupt = kmin_enable_intr;
return &kmin_tc_desc;
} else if (cpu == DS_MAXINE) {
- DPRINTF(("MAXINE turbochannel\n"));
+#ifdef DEBUG
+ printf("MAXINE turbochannel\n");
+#endif
tc_enable_interrupt = xine_enable_intr;
return &xine_tc_desc;
} else if (cpu == DS_PMAX) {
- DPRINTF(("tcattach: PMAX, no turbochannel\n"));
+#ifdef DIAGNOSTIC
+ printf("tcattach: PMAX, no turbochannel\n");
+#endif
return NULL;
} else if (cpu == DS_MIPSFAIR) {
- DPRINTF(("tcattach: Mipsfair (5100), no turbochannel\n"));
+ printf("tcattach: Mipsfair (5100), no turbochannel\n");
+ return NULL;
} else {
panic("tcattach: Unrecognized bus type 0x%x\n", cpu);
}
+}
+
+
+/*
+ * Temporary glue:
+ * present the old-style signatures as used by BUS_INTR_ESTABLISH(),
+ * but using the new NetBSD machine-independent TC infrastructure.
+ */
-#else /* alpha?*/
- return tc_cpu_devs[cputype];
-#endif /* alpha?*/
+void
+confglue_tc_intr_establish(ca, handler, arg)
+ struct confargs *ca;
+ intr_handler_t handler;
+ intr_arg_t arg;
+{
+ struct tc_softc *sc = tccd.cd_devs[0]; /* XXX */
+ /* XXX guess at level */
+ (*sc->sc_desc->tc_intr_establish)
+ ((struct device*)sc, (void*)ca->ca_slotpri, 0, handler, arg);
}
+void
+confglue_tc_intr_disestablish(ca)
+ struct confargs *ca;
+{
+ struct tc_softc *sc = tccd.cd_devs[0]; /* XXX */
+
+ (*sc->sc_desc->tc_intr_disestablish)(
+ (struct device*)sc, (void*)ca->ca_slotpri);
+}
+/*
+ * End of temporary glue.
+ */
+
+
int
tcmatch(parent, cfdata, aux)
struct device *parent;
@@ -239,8 +284,8 @@ tcattach(parent, self, aux)
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_intr_establish = confglue_tc_intr_establish;
+ sc->sc_bus.ab_intr_disestablish = confglue_tc_intr_disestablish;
sc->sc_bus.ab_cvtaddr = tc_cvtaddr;
sc->sc_bus.ab_matchname = tc_matchname;
@@ -296,28 +341,40 @@ tc_cvtaddr(ca)
{
struct tc_softc *sc = tccd.cd_devs[0];
- return (sc->sc_desc->tcd_slots[ca->ca_slot].tsd_dense + ca->ca_offset);
+ return ((caddr_t)sc->sc_desc->tcd_slots[ca->ca_slot].tcs_addr +
+ ca->ca_offset);
}
void
-tc_intr_establish(ca, handler, val)
- struct confargs *ca;
+tc_intr_establish(dev, cookie, level, handler, arg)
+ /*struct confargs *ca;*/
+ struct device *dev;
+ void *cookie;
+ tc_intrlevel_t level;
intr_handler_t handler;
- intr_arg_t val;
+ intr_arg_t arg;
{
- struct tc_softc *sc = tccd.cd_devs[0];
+ struct tc_softc *sc = (struct tc_softc *)dev;
+
+#ifdef DEBUG
+ printf("tc_intr_establish: %s parent intrcode %d\n",
+ dev->dv_xname, dev->dv_parent->dv_xname, (int) cookie);
+#endif
- (*sc->sc_desc->tc_intr_establish)(ca, handler, val);
+ /* XXX pmax interrupt-enable interface */
+ (*sc->sc_desc->tc_intr_establish)(sc->sc_dv.dv_parent, cookie,
+ level, handler, arg);
}
void
-tc_intr_disestablish(ca)
- struct confargs *ca;
+tc_intr_disestablish(dev, cookie)
+ struct device *dev;
+ void *cookie;
{
- struct tc_softc *sc = tccd.cd_devs[0];
+ struct tc_softc *sc = (struct tc_softc *)dev;
- (*sc->sc_desc->tc_intr_disestablish)(ca);
+ (*sc->sc_intr_disestablish)(sc->sc_dv.dv_parent, cookie);
}
int
@@ -390,8 +447,102 @@ tc_intrnull(val)
panic("uncaught TC intr for slot %ld\n", (long)val);
}
+
-/* hack for kn03 */
+
+/*
+ * 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.
+ * Called before autoconfiguration, to find a system console.
+ */
+int
+tc_findconsole(preferred_slot)
+ int preferred_slot;
+{
+ int slot;
+
+ struct tc_cpu_desc * 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->tcd_ndevs; slot++) {
+
+ if (tc_consprobeslot(slot))
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Try and configure one slot as framebuffer console.
+ * Accept only the framebuffers for which driver are configured into
+ * the kernel. If a suitable framebuffer is found, attach it and
+ * set up glass-tty emulation.
+ */
+int
+tc_consprobeslot(slot)
+ int slot;
+{
+ void *slotaddr;
+ char name[20];
+ struct tc_cpu_desc * sc_desc;
+
+ if (slot < 0 || ((sc_desc = cpu_tcdesc(pmax_boardtype)) == NULL))
+ return 0;
+ slotaddr = (void *)(sc_desc->tcd_slots[slot].tcs_addr);
+
+ if (tc_checkdevmem(slotaddr) == 0)
+ return (0);
+
+ if (tc_checkslot(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(slotaddr, 0, 1)) {
+ return (1);
+ }
+#endif /* NMFB */
+
+#if NSFB > 0
+ if (DRIVER_FOR_SLOT(name, "PMAGB-BA") &&
+ sfbinit(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);
+}
+
+
+/* hack for kn03 ioasic */
void
tc_ds_ioasic_intr_setup ()
@@ -399,14 +550,19 @@ tc_ds_ioasic_intr_setup ()
printf("not setting up TC intrs\n");
}
+/*
+ * Estabish an interrupt handler, but on what bus -- TC or ioctl asic?
+ */
void
-tc_ds_ioasic_intr_establish(ca, handler, val)
- struct confargs *ca;
+tc_ds_ioasic_intr_establish(dev, cookie, level, handler, val)
+ struct device *dev;
+ void *cookie;
+ int level;
intr_handler_t handler;
void *val;
{
- int unit = (int) val;
+#ifdef notanymore
if (BUS_MATCHNAME(ca, "IOCTL ")) {
printf("(no interrupt for asic");
return;
@@ -417,23 +573,27 @@ tc_ds_ioasic_intr_establish(ca, handler, val)
printf("(no interrupt for proto-asic)\n");
return;
}
+#endif
+
/* Never tested on these processors */
if (cputype == DS_3MIN || cputype == DS_MAXINE)
- printf("tc_enable %s%d slot %d\n",
- ca->ca_name, (int)unit, ca->ca_slotpri);
+ printf("tc_enable %s sc %x slot %d\n",
+ dev->dv_xname, (int)val, cookie);
#ifdef DIAGNOSTIC
if (tc_enable_interrupt == NULL)
panic("tc_intr_establish: tc_enable not set\n");
#endif
- (*tc_enable_interrupt) (ca->ca_slotpri, handler, (void*)unit, 1);
+ /* Enable interrupt number "cookie" on this CPU */
+ (*tc_enable_interrupt) ((int)cookie, handler, val, 1);
}
void
-tc_ds_ioasic_intr_disestablish(args)
- struct confargs *args;
+tc_ds_ioasic_intr_disestablish(dev, arg)
+ struct device *dev;
+ void *arg;
{
/*(*tc_enable_interrupt) (ca->ca_slot, handler, 0);*/
printf("cannot dis-establish TC intrs\n");
@@ -443,8 +603,6 @@ void
tc_ds_ioasic_iointr (framep, vec)
void * framep;
int vec;
-
-
{
- printf("bogus interrupt handler\n");
+ printf("bogus interrupt handler fp %x vec %d\n", framep, vec);
}
diff --git a/sys/arch/pmax/tc/tc.h b/sys/arch/pmax/tc/tc.h
deleted file mode 100644
index 793bd8dc26c..00000000000
--- a/sys/arch/pmax/tc/tc.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $NetBSD: tc.h,v 1.2 1995/12/28 08:42:16 jonathan 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.
- */
-
-#define TC_SLOT_ROM 0x000003e0
-#define TC_SLOT_PROTOROM 0x003c03e0
-
-#include <machine/tc_machdep.h>
-#include <dev/tc/tcreg.h>
-
-
-/*
- * 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 {
- 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 *));
- int (*tc_iointr) __P((u_int mask, u_int pc,
- u_int statusReg, u_int causeReg));
-};
-
-int tc_intrnull __P((void *));