-$OpenBSD: STATUS,v 1.5 1996/10/30 22:37:54 niklas Exp $
-$NetBSD: STATUS,v 1.5 1996/09/06 04:01:37 cgd Exp $
+$OpenBSD: STATUS,v 1.6 1997/01/24 19:56:15 niklas Exp $
+$NetBSD: STATUS,v 1.6 1996/11/26 15:58:04 cgd Exp $
OpenBSD/Alpha's Status
AXPpci systems (including Multia), with the same supported
hardware list as the AlphaStation {200,250,255,400} systems.
+ EB164 (AlphaPC 164) systems, with the same supported hardware
+ as systems mentioned above.
+
At this time none of the following systems are supported:
DECpc AXP 150 systems (EISA-bus PC-like systems)
Alpha "server" systems (other than perhaps the
Boot the machine with the keyboard/mouse connector
unplugged.
- DECpc AXPs, AlphaStations, and AXPpci systems:
+ DECpc AXPs, AlphaStations, AXPpci, and EB164 systems:
Get to the console prompt. Set the variable
"console" to be "serial", and "init" or power cycle
the system.
-/* $OpenBSD: autoconf.c,v 1.5 1996/11/06 02:01:19 deraadt Exp $ */
-/* $NetBSD: autoconf.c,v 1.14 1996/10/13 02:59:23 christos Exp $ */
+/* $OpenBSD: autoconf.c,v 1.6 1997/01/24 19:56:18 niklas Exp $ */
+/* $NetBSD: autoconf.c,v 1.16 1996/11/13 21:13:04 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
#include <machine/autoconf.h>
#include <machine/rpb.h>
#include <machine/prom.h>
+#include <machine/cpuconf.h>
#include <dev/cons.h>
void
configure()
{
- extern int cold;
parse_prom_bootdev();
buf[--len] = '\0';
dv = getdisk(buf, len, 1, &nrootdev);
if (dv != NULL) {
- rootdv = dv;
+ rootdv = swapdv = dv;
nswapdev = nrootdev;
goto gotswap;
}
struct device *dev;
void *aux;
{
- extern void (*cpu_device_register) __P((struct device *dev, void *aux));
+ extern const struct cpusw *cpu_fn_switch;
if (bootdev_data == NULL) {
/*
return;
}
- (*cpu_device_register)(dev, aux);
+ (*cpu_fn_switch->device_register)(dev, aux);
}
-/* $OpenBSD: clock.c,v 1.6 1996/10/30 22:37:58 niklas Exp $ */
-/* $NetBSD: clock.c,v 1.13 1996/10/13 02:59:25 christos Exp $ */
+/* $OpenBSD: clock.c,v 1.7 1997/01/24 19:56:19 niklas Exp $ */
+/* $NetBSD: clock.c,v 1.14 1996/11/23 06:31:57 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
{
/*
- * establish the clock interrupt; it's a special case
+ * Just bookkeeping.
*/
- set_clockintr();
-#ifdef EVCNT_COUNTERS
- evcnt_attach(self, "intr", &clock_intr_evcnt);
-#endif
printf("\n");
if (clockfns != NULL)
panic("clockattach: multiple clocks");
clockdev = dev;
clockfns = fns;
+#ifdef EVCNT_COUNTERS
+ evcnt_attach(dev, "intr", &clock_intr_evcnt);
+#endif
}
/*
tickfixinterval = hz >> (ftp - 1);
}
+ /*
+ * Establish the clock interrupt; it's a special case.
+ *
+ * We establish the clock interrupt this late because if
+ * we do it at clock attach time, we may have never been at
+ * spl0() since taking over the system. Some versions of
+ * PALcode save a clock interrupt, which would get delivered
+ * when we spl0() in autoconf.c. If established the clock
+ * interrupt handler earlier, that interrupt would go to
+ * hardclock, which would then fall over because p->p_stats
+ * isn't set at that time.
+ */
+ set_clockintr();
+
/*
* Get the clock started.
*/
-/* $OpenBSD: cpu.c,v 1.5 1996/10/30 22:38:01 niklas Exp $ */
-/* $NetBSD: cpu.c,v 1.12 1996/10/13 02:59:26 christos Exp $ */
+/* $OpenBSD: cpu.c,v 1.6 1997/01/24 19:56:20 niklas Exp $ */
+/* $NetBSD: cpu.c,v 1.16 1996/12/05 01:39:27 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
/* Definition of the driver for autoconfig. */
-int cpumatch __P((struct device *, void *, void *));
+#ifdef __BROKEN_INDIRECT_CONFIG
+int cpumatch(struct device *, void *, void *);
+#else
+int cpumatch(struct device *, struct cfdata *, void *);
+#endif
void cpuattach __P((struct device *, struct device *, void *));
struct cfattach cpu_ca = {
int
cpumatch(parent, cfdata, aux)
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cfdata;
+#endif
void *aux;
{
struct confargs *ca = aux;
void *aux;
{
struct pcs *p;
- char *cpu_major[] = {
- "UNKNOWN MAJOR TYPE (0)",
- "EV3", /* PCS_PROC_EV3 */
- "21064 (EV4)", /* PCS_PROC_EV4 */
- "Simulator", /* PCS_PROC_SIMULATOR */
- "21066/21068 (LCA4)", /* PCS_PROC_LCA4 */
- "21164 (EV5)", /* PCS_PROC_EV5 */
- "21064A (EV45)", /* PCS_PROC_EV45 */
- };
- int ncpu_major = sizeof(cpu_major) / sizeof(cpu_major[0]);
- char *dc21064_cpu_minor[] = {
- "Pass 2 or 2.1",
- "Pass 3",
- };
- int ndc21064_cpu_minor =
- sizeof(dc21064_cpu_minor) / sizeof(dc21064_cpu_minor[0]);
- u_int32_t major, minor;
int needcomma;
+ u_int32_t major, minor;
p = (struct pcs*)((char *)hwrpb + hwrpb->rpb_pcs_off +
(dev->dv_unit * hwrpb->rpb_pcs_size));
- printf(": ");
-
major = (p->pcs_proc_type & PCS_PROC_MAJOR) >> PCS_PROC_MAJORSHIFT;
minor = (p->pcs_proc_type & PCS_PROC_MINOR) >> PCS_PROC_MINORSHIFT;
- if (major < ncpu_major)
- printf("%s", cpu_major[major]);
- else
- printf("UNKNOWN MAJOR TYPE (%d)", major);
-
- printf(", ");
-
+ printf(": ");
switch (major) {
+ case PCS_PROC_EV3:
+ printf("EV3 (minor type 0x%x)", minor);
+ break;
+
case PCS_PROC_EV4:
- if (minor < ndc21064_cpu_minor)
- printf("%s", dc21064_cpu_minor[minor]);
- else
- printf("UNKNOWN MINOR TYPE (%d)", minor);
+ printf("21064 ");
+ switch (minor) {
+ case 0:
+ printf("(pass 2 or 2.1)");
+ break;
+ case 1:
+ printf("(pass 3)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
+ break;
+
+ case PCS_PROC_SIMULATION:
+ printf("simulation (minor type 0x%x)", minor);
+ break;
+
+ case PCS_PROC_LCA4:
+ switch (minor) {
+ case 0:
+ printf("LCA family (reserved minor type)");
+ break;
+ case 1:
+ printf("21066 (pass 1 or 1.1)");
+ break;
+ case 2:
+ printf("21066 (pass 2)");
+ break;
+ case 3:
+ printf("21068 (pass 1 or 1.1)");
+ break;
+ case 4:
+ printf("21068 (pass 2)");
+ break;
+ case 5:
+ printf("21066A (pass 1)");
+ break;
+ case 6:
+ printf("21068A (pass 1)");
+ break;
+ default:
+ printf("LCA family (unknown minor type 0x%x)", minor);
+ break;
+ }
break;
- case PCS_PROC_EV45:
case PCS_PROC_EV5:
- printf("Pass %d", minor + 1);
+ printf("21164 ");
+ switch (minor) {
+ case 0:
+ printf("(reserved minor type/pass 1)");
+ break;
+ case 1:
+ printf("(pass 2 or 2.2)");
+ break;
+ case 2:
+ printf("(pass 2.3)");
+ break;
+ case 3:
+ printf("(pass 3)");
+ break;
+ case 4:
+ printf("(pass 3.2)");
+ break;
+ case 5:
+ printf("(pass 4)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
break;
- default:
- printf("UNKNOWN MINOR TYPE (%d)", minor);
- }
+ case PCS_PROC_EV45:
+ printf("21064A ");
+ switch (minor) {
+ case 0:
+ printf("(reserved minor type)");
+ break;
+ case 1:
+ printf("(pass 1)");
+ break;
+ case 2:
+ printf("(pass 1.1)");
+ break;
+ case 3:
+ printf("(pass 2)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
+ break;
- if (p->pcs_proc_revision[0] != 0) { /* XXX bad test? */
- printf(", ");
+ case PCS_PROC_EV56:
+ printf("21164A ");
+ switch (minor) {
+ case 0:
+ printf("(reserved minor type)");
+ break;
+ case 1:
+ printf("(pass 1)");
+ break;
+ case 2:
+ printf("(pass 2)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
+ break;
- printf("Revision %c%c%c%c", p->pcs_proc_revision[0],
- p->pcs_proc_revision[1], p->pcs_proc_revision[2],
- p->pcs_proc_revision[3]);
- }
+ case PCS_PROC_EV6:
+ printf("21264 ");
+ switch (minor) {
+ case 0:
+ printf("(reserved minor type)");
+ break;
+ case 1:
+ printf("(pass 1)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
+ break;
+
+ case PCS_PROC_PCA56:
+ printf("21164PC ");
+ switch (minor) {
+ case 0:
+ printf("(reserved minor type)");
+ break;
+ case 1:
+ printf("(pass 1)");
+ break;
+ default:
+ printf("(unknown minor type 0x%x)", minor);
+ break;
+ }
+ break;
+ default:
+ printf("UNKNOWN CPU TYPE (0x%x:0x%x)", major, minor);
+ break;
+ }
printf("\n");
+ /* XXX SHOULD CHECK ARCHITECTURE MASK, TOO */
if (p->pcs_proc_var != 0) {
printf("cpu%d: ", dev->dv_unit);
}
/*
- * Though we could (should?) attach the LCA's PCI
+ * Though we could (should?) attach the LCA cpus' PCI
* bus here there is no good reason to do so, and
* the bus attachment code is easier to understand
* and more compact if done the 'normal' way.
--- /dev/null
+/* $OpenBSD: cpuconf.c,v 1.1 1997/01/24 19:56:21 niklas Exp $ */
+/* $NetBSD: cpuconf.c,v 1.2 1996/11/13 23:42:55 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou
+ * 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.
+ */
+
+/*
+ * CPU (machine) type configuration switch.
+ *
+ * This table should probably go at the end of conf.c, but
+ * I didn't want to make conf.c "different."
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <machine/cpuconf.h>
+
+#undef DEC_2100_A50 /* config 'option' with flag brokenness */
+#include "dec_2100_a50.h"
+cpu_decl(dec_2100_a50);
+
+#undef DEC_21000 /* config 'option' with flag brokenness */
+#include "dec_21000.h"
+cpu_decl(dec_21000);
+
+#undef DEC_3000_300 /* config 'option' with flag brokenness */
+#include "dec_3000_300.h"
+cpu_decl(dec_3000_300);
+
+#undef DEC_3000_500 /* config 'option' with flag brokenness */
+#include "dec_3000_500.h"
+cpu_decl(dec_3000_500);
+
+#undef DEC_AXPPCI_33 /* config 'option' with flag brokenness */
+#include "dec_axppci_33.h"
+cpu_decl(dec_axppci_33);
+
+#undef DEC_EB164 /* config 'option' with flag brokenness */
+#include "dec_eb164.h"
+cpu_decl(dec_eb164);
+
+#undef DEC_KN20AA /* config 'option' with flag brokenness */
+#include "dec_kn20aa.h"
+cpu_decl(dec_kn20aa);
+
+const struct cpusw cpusw[] = {
+ cpu_unknown(), /* 0: ??? */
+ cpu_notdef("Alpha Demonstration Unit"), /* 1: ST_ADU */
+ cpu_notdef("DEC 4000 (\"Cobra\")"), /* 2: ST_DEC_4000 */
+ cpu_notdef("DEC 7000 (\"Ruby\")"), /* 3: ST_DEC_7000 */
+ cpu_init("DEC 3000/500 (\"Flamingo\")",DEC_3000_500,dec_3000_500),
+ /* 4: ST_DEC_3000_500 */
+ cpu_unknown(), /* 5: ??? */
+ cpu_notdef("DEC 2000/300 (\"Jensen\")"),
+ /* 6: ST_DEC_2000_300 */
+ cpu_init("DEC 3000/300 (\"Pelican\")",DEC_3000_300,dec_3000_300),
+ /* 7: ST_DEC_3000_300 */
+ cpu_unknown(), /* 8: ??? */
+ cpu_notdef("DEC 2100/A500 (\"Sable\")"),
+ /* 9: ST_DEC_2100_A500 */
+ cpu_notdef("AXPvme 64"), /* 10: ST_DEC_APXVME_64 */
+ cpu_init("DEC AXPpci",DEC_AXPPCI_33,dec_axppci_33),
+ /* 11: ST_DEC_AXPPCI_33 */
+ cpu_init("DEC 21000",DEC_21000,dec_21000),
+ /* 12: ST_DEC_21000 */
+ cpu_init("AlphaStation 200/400 (\"Avanti\")",DEC_2100_A50,dec_2100_a50),
+ /* 13: ST_DEC_2100_A50 */
+ cpu_notdef("Mustang"), /* 14: ST_DEC_MUSTANG */
+ cpu_init("AlphaStation 600 (KN20AA)",DEC_KN20AA,dec_kn20aa),
+ /* 15: ST_DEC_KN20AA */
+ cpu_unknown(), /* 16: ??? */
+ cpu_notdef("DEC 1000 (\"Mikasa\")"), /* 17: ST_DEC_1000 */
+ cpu_unknown(), /* 18: ??? */
+ cpu_notdef("EB66"), /* 19: ST_EB66 */
+ cpu_notdef("EB64+"), /* 20: ST_EB64P */
+ cpu_unknown(), /* 21: ??? */
+ cpu_notdef("DEC 4100 (\"Rawhide\")"), /* 22: ST_DEC_4100 */
+ cpu_notdef("??? (\"Lego\")"), /* 23: ST_DEC_EV45_PBP */
+ cpu_notdef("DEC 2100A/A500 (\"Lynx\")"),
+ /* 24: ST_DEC_2100A_A500 */
+ cpu_unknown(), /* 25: ??? */
+ cpu_init("EB164",DEC_EB164,dec_eb164), /* 26: ST_EB164 */
+ cpu_notdef("DEC 1000A (\"Noritake\")"), /* 27: ST_DEC_1000A */
+ cpu_notdef("AlphaVME 224 (\"Cortex\")"),
+ /* 28: ST_DEC_ALPHAVME_224 */
+};
+const int ncpusw = sizeof (cpusw) / sizeof (cpusw[0]);
-/* $OpenBSD: dec_2100_a50.c,v 1.6 1996/12/08 00:20:14 niklas Exp $ */
-/* $NetBSD: dec_2100_a50.c,v 1.15 1996/10/23 04:12:13 cgd Exp $ */
+/* $OpenBSD: dec_2100_a50.c,v 1.7 1997/01/24 19:56:22 niklas Exp $ */
+/* $NetBSD: dec_2100_a50.c,v 1.18 1996/11/25 03:59:19 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
#include <dev/isa/isavar.h>
#include <dev/ic/comreg.h>
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-#include <alpha/alpha/dec_2100_a50.h>
-
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
-char *
-dec_2100_a50_modelname()
+cpu_decl(dec_2100_a50);
+
+const char *
+dec_2100_a50_model_name()
{
static char s[80];
}
void
-dec_2100_a50_consinit()
+dec_2100_a50_cons_init()
{
struct ctb *ctb;
struct apecs_config *acp;
extern struct apecs_config apecs_configuration;
acp = &apecs_configuration;
- apecs_init(acp);
+ apecs_init(acp, 0);
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
case 3:
/* display console ... */
/* XXX */
- pci_display_console(acp->ac_iot, acp->ac_memt, &acp->ac_pc,
- (ctb->ctb_turboslot >> 8) & 0xff,
- ctb->ctb_turboslot & 0xff, 0);
+ if (ctb->ctb_turboslot == 0)
+ isa_display_console(acp->ac_iot, acp->ac_memt);
+ else
+ pci_display_console(acp->ac_iot, acp->ac_memt,
+ &acp->ac_pc, (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
}
}
+const char *
+dec_2100_a50_iobus_name()
+{
+
+ return ("apecs");
+}
+
void
dec_2100_a50_device_register(dev, aux)
struct device *dev;
-/* $OpenBSD: dec_2100_a50.h,v 1.4 1996/10/30 22:38:02 niklas Exp $ */
-/* $NetBSD: dec_2100_a50.h,v 1.6 1996/06/13 18:31:49 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-char *dec_2100_a50_modelname __P((void));
-void dec_2100_a50_consinit __P((void));
-void dec_2100_a50_device_register __P((struct device *, void *));
+/* $OpenBSD: dec_2100_a50.h,v 1.5 1997/01/24 19:56:23 niklas Exp $ */
-/* $OpenBSD: dec_3000_300.c,v 1.4 1996/10/30 22:38:03 niklas Exp $ */
-/* $NetBSD: dec_3000_300.c,v 1.9 1996/10/13 02:59:30 christos Exp $ */
+/* $OpenBSD: dec_3000_300.c,v 1.5 1997/01/24 19:56:24 niklas Exp $ */
+/* $NetBSD: dec_3000_300.c,v 1.10 1996/11/12 05:14:30 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
#include <dev/tc/tcvar.h>
#include <scsi/scsiconf.h>
char *dec_3000_300_modelname __P((void));
-void dec_3000_300_consinit __P((void));
+void dec_3000_300_cons_init __P((void));
+const char *dec_3000_300_iobus_name __P((void));
void dec_3000_300_device_register __P((struct device *, void *));
-char *
-dec_3000_300_modelname()
+cpu_decl(dec_3000_300);
+
+const char *
+dec_3000_300_model_name()
{
switch (hwrpb->rpb_variation & SV_ST_MASK) {
}
void
-dec_3000_300_consinit()
+dec_3000_300_cons_init()
+{
+}
+
+const char *
+dec_3000_300_iobus_name()
{
+ return ("tcasic");
}
void
-/* $OpenBSD: dec_3000_300.h,v 1.4 1996/10/30 22:38:04 niklas Exp $ */
-/* $NetBSD: dec_3000_300.h,v 1.6 1996/06/13 18:32:00 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-char *dec_3000_300_modelname __P((void));
-void dec_3000_300_consinit __P((void));
-void dec_3000_300_device_register __P((struct device *, void *));
+/* $OpenBSD: dec_3000_300.h,v 1.5 1997/01/24 19:56:25 niklas Exp $ */
-/* $OpenBSD: dec_3000_500.c,v 1.4 1996/10/30 22:38:05 niklas Exp $ */
-/* $NetBSD: dec_3000_500.c,v 1.8 1996/10/13 02:59:31 christos Exp $ */
+/* $OpenBSD: dec_3000_500.c,v 1.5 1997/01/24 19:56:25 niklas Exp $ */
+/* $NetBSD: dec_3000_500.c,v 1.9 1996/11/12 05:14:31 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
#include <dev/tc/tcvar.h>
#include <scsi/scsiconf.h>
char *dec_3000_500_modelname __P((void));
-void dec_3000_500_consinit __P((void));
+void dec_3000_500_cons_init __P((void));
+const char *dec_3000_500_iobus_name __P((void));
void dec_3000_500_device_register __P((struct device *, void *));
-char *
-dec_3000_500_modelname()
+cpu_decl(dec_3000_500);
+
+const char *
+dec_3000_500_model_name()
{
switch (hwrpb->rpb_variation & SV_ST_MASK) {
}
void
-dec_3000_500_consinit()
+dec_3000_500_cons_init()
+{
+}
+
+const char *
+dec_3000_500_iobus_name()
{
+ return ("tcasic");
}
void
-/* $OpenBSD: dec_3000_500.h,v 1.4 1996/10/30 22:38:05 niklas Exp $ */
-/* $NetBSD: dec_3000_500.h,v 1.6 1996/06/13 18:32:04 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-char *dec_3000_500_modelname __P((void));
-void dec_3000_500_consinit __P((void));
-void dec_3000_500_device_register __P((struct device *, void *));
+/* $OpenBSD: dec_3000_500.h,v 1.5 1997/01/24 19:56:26 niklas Exp $ */
-/* $OpenBSD: dec_axppci_33.c,v 1.5 1996/12/08 00:20:16 niklas Exp $ */
-/* $NetBSD: dec_axppci_33.c,v 1.13 1996/10/23 04:12:14 cgd Exp $ */
+/* $OpenBSD: dec_axppci_33.c,v 1.6 1997/01/24 19:56:27 niklas Exp $ */
+/* $NetBSD: dec_axppci_33.c,v 1.16 1996/11/25 03:59:20 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
#include <dev/isa/isavar.h>
#include <dev/ic/comreg.h>
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
-#include <alpha/alpha/dec_axppci_33.h>
-
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
-char *
-dec_axppci_33_modelname()
+cpu_decl(dec_axppci_33);
+
+const char *
+dec_axppci_33_model_name()
{
switch (hwrpb->rpb_variation & SV_ST_MASK) {
}
void
-dec_axppci_33_consinit()
+dec_axppci_33_cons_init()
{
struct ctb *ctb;
struct lca_config *lcp;
extern struct lca_config lca_configuration;
lcp = &lca_configuration;
- lca_init(lcp);
+ lca_init(lcp, 0);
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
case 3:
/* display console ... */
/* XXX */
- pci_display_console(lcp->lc_iot, lcp->lc_memt, &lcp->lc_pc,
- (ctb->ctb_turboslot >> 8) & 0xff,
- ctb->ctb_turboslot & 0xff, 0);
+ if (ctb->ctb_turboslot == 0)
+ isa_display_console(lcp->lc_iot, lcp->lc_memt);
+ else
+ pci_display_console(lcp->lc_iot, lcp->lc_memt,
+ &lcp->lc_pc, (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
}
}
+const char *
+dec_axppci_33_iobus_name()
+{
+
+ return ("lca");
+}
+
void
dec_axppci_33_device_register(dev, aux)
struct device *dev;
-/* $OpenBSD: dec_axppci_33.h,v 1.4 1996/10/30 22:38:07 niklas Exp $ */
-/* $NetBSD: dec_axppci_33.h,v 1.5 1996/06/13 18:32:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-char *dec_axppci_33_modelname __P((void));
-void dec_axppci_33_consinit __P((void));
-void dec_axppci_33_device_register __P((struct device *, void *));
+/* $OpenBSD: dec_axppci_33.h,v 1.5 1997/01/24 19:56:28 niklas Exp $ */
--- /dev/null
+/* $NetBSD: dec_eb164.c,v 1.4 1996/11/25 03:59:21 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/termios.h>
+#include <dev/cons.h>
+
+#include <machine/rpb.h>
+#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <alpha/pci/ciareg.h>
+#include <alpha/pci/ciavar.h>
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
+cpu_decl(dec_eb164);
+
+const char *
+dec_eb164_model_name()
+{
+
+ switch (hwrpb->rpb_variation & SV_ST_MASK) {
+ default:
+ printf("unknown system variation %lx\n",
+ hwrpb->rpb_variation & SV_ST_MASK);
+ return NULL;
+ }
+}
+
+void
+dec_eb164_cons_init()
+{
+ struct ctb *ctb;
+ struct cia_config *ccp;
+ extern struct cia_config cia_configuration;
+
+ ccp = &cia_configuration;
+ cia_init(ccp, 0);
+
+ ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
+
+ switch (ctb->ctb_term_type) {
+ case 2:
+ /* serial console ... */
+ /* XXX */
+ {
+ static struct consdev comcons = { NULL, NULL,
+ comcngetc, comcnputc, comcnpollc, NODEV, 1 };
+
+ /* Delay to allow PROM putchars to complete */
+ DELAY(10000);
+
+ comconsaddr = 0x3f8;
+ comconsinit = 0;
+ comconsiot = ccp->cc_iot;
+ if (bus_space_map(comconsiot, comconsaddr, COM_NPORTS,
+ 0, &comconsioh))
+ panic("can't map serial console I/O ports");
+ comconscflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
+ cominit(comconsiot, comconsioh, comdefaultrate);
+
+ cn_tab = &comcons;
+ comcons.cn_dev = makedev(26, 0); /* XXX */
+ break;
+ }
+
+ case 3:
+ /* display console ... */
+ /* XXX */
+ if (ctb->ctb_turboslot == 0)
+ isa_display_console(ccp->cc_iot, ccp->cc_memt);
+ else
+ pci_display_console(ccp->cc_iot, ccp->cc_memt,
+ &ccp->cc_pc, (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
+ break;
+
+ default:
+ printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
+ printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+
+ panic("consinit: unknown console type %d\n",
+ ctb->ctb_term_type);
+ }
+}
+
+const char *
+dec_eb164_iobus_name()
+{
+
+ return ("cia");
+}
+
+void
+dec_eb164_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
+{
+ static int found, initted, scsiboot, netboot;
+ static struct device *pcidev, *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (!initted) {
+ scsiboot = (strcmp(b->protocol, "SCSI") == 0);
+ netboot = (strcmp(b->protocol, "BOOTP") == 0);
+#if 0
+ printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+#endif
+ initted =1;
+ }
+
+ if (pcidev == NULL) {
+ if (strcmp(cd->cd_name, "pci"))
+ return;
+ else {
+ struct pcibus_attach_args *pba = aux;
+
+ if (b->bus != pba->pba_bus)
+ return;
+
+ pcidev = dev;
+#if 0
+ printf("\npcidev = %s\n", pcidev->dv_xname);
+#endif
+ return;
+ }
+ }
+
+ if (scsiboot && (scsidev == NULL)) {
+ if (parent != pcidev)
+ return;
+ else {
+ struct pci_attach_args *pa = aux;
+
+ if (b->slot != pa->pa_device)
+ return;
+
+ /* XXX function? */
+
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", scsidev->dv_xname);
+#endif
+ return;
+ }
+ }
+
+ if (scsiboot &&
+ (!strcmp(cd->cd_name, "sd") ||
+ !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd"))) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
+
+ if (netboot) {
+ if (parent != pcidev)
+ return;
+ else {
+ struct pci_attach_args *pa = aux;
+
+ if (b->slot != pa->pa_device)
+ return;
+
+ /* XXX function? */
+
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ return;
+ }
+ }
+}
-/* $OpenBSD: dec_kn20aa.c,v 1.5 1996/12/08 00:20:17 niklas Exp $ */
-/* $NetBSD: dec_kn20aa.c,v 1.13 1996/10/23 04:12:15 cgd Exp $ */
+/* $OpenBSD: dec_kn20aa.c,v 1.6 1997/01/24 19:56:30 niklas Exp $ */
+/* $NetBSD: dec_kn20aa.c,v 1.16 1996/11/25 03:59:22 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/rpb.h>
#include <machine/autoconf.h>
+#include <machine/cpuconf.h>
#include <dev/isa/isavar.h>
#include <dev/ic/comreg.h>
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#include <alpha/alpha/dec_kn20aa.h>
-
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
-char *
-dec_kn20aa_modelname()
+cpu_decl(dec_kn20aa);
+
+const char *
+dec_kn20aa_model_name()
{
switch (hwrpb->rpb_variation & SV_ST_MASK) {
}
void
-dec_kn20aa_consinit()
+dec_kn20aa_cons_init()
{
struct ctb *ctb;
struct cia_config *ccp;
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
- cia_init(ccp);
+ cia_init(ccp, 0);
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
case 3:
/* display console ... */
/* XXX */
- pci_display_console(ccp->cc_iot, ccp->cc_memt, &ccp->cc_pc,
- (ctb->ctb_turboslot >> 8) & 0xff,
- ctb->ctb_turboslot & 0xff, 0);
+ if (ctb->ctb_turboslot == 0)
+ isa_display_console(ccp->cc_iot, ccp->cc_memt);
+ else
+ pci_display_console(ccp->cc_iot, ccp->cc_memt,
+ &ccp->cc_pc, (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
}
}
+const char *
+dec_kn20aa_iobus_name()
+{
+
+ return ("cia");
+}
+
void
dec_kn20aa_device_register(dev, aux)
struct device *dev;
-/* $OpenBSD: dec_kn20aa.h,v 1.4 1996/10/30 22:38:09 niklas Exp $ */
-/* $NetBSD: dec_kn20aa.h,v 1.5 1996/06/13 18:32:07 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-char *dec_kn20aa_modelname __P((void));
-void dec_kn20aa_consinit __P((void));
-void dec_kn20aa_device_register __P((struct device *, void *));
+/* $OpenBSD: dec_kn20aa.h,v 1.5 1997/01/24 19:56:31 niklas Exp $ */
-/* $OpenBSD: disksubr.c,v 1.5 1996/10/30 22:38:10 niklas Exp $ */
-/* $NetBSD: disksubr.c,v 1.8 1996/10/13 02:59:35 christos Exp $ */
+/* $OpenBSD: disksubr.c,v 1.6 1997/01/24 19:56:32 niklas Exp $ */
+/* $NetBSD: disksubr.c,v 1.9 1996/11/13 21:13:05 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
char *
readdisklabel(dev, strat, lp, clp)
dev_t dev;
- void (*strat) __P ((struct buf *));
+ void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *clp;
{
-/* $OpenBSD: in_cksum.c,v 1.3 1996/10/30 22:38:11 niklas Exp $ */
-/* $NetBSD: in_cksum.c,v 1.3 1996/05/30 23:08:36 cgd Exp $ */
+/* $OpenBSD: in_cksum.c,v 1.4 1997/01/24 19:56:33 niklas Exp $ */
+/* $NetBSD: in_cksum.c,v 1.4 1996/11/13 21:13:06 cgd Exp $ */
/*
* Copyright (c) 1988, 1992, 1993
u_int64_t q;
};
+u_int64_t in_cksumdata __P((caddr_t buf, int len));
+
u_int64_t
in_cksumdata(buf, len)
register caddr_t buf;
register int mlen = 0;
register int clen = 0;
register caddr_t addr;
- union q_util q_util;
union l_util l_util;
+ union q_util q_util;
for (; m && len; m = m->m_next) {
if (m->m_len == 0)
-/* $OpenBSD: interrupt.c,v 1.5 1996/10/30 22:38:12 niklas Exp $ */
-/* $NetBSD: interrupt.c,v 1.12 1996/10/13 19:57:49 cgd Exp $ */
+/* $OpenBSD: interrupt.c,v 1.6 1997/01/24 19:56:34 niklas Exp $ */
+/* $NetBSD: interrupt.c,v 1.14 1996/11/13 22:20:54 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Authors: Keith Bostic, Chris G. Demetriou
/* Unspecified. */
};
-void interrupt __P((u_long, u_long, u_long, struct trapframe *));
-void machine_check __P((struct trapframe *, u_long, u_long));
-void real_clockintr __P((void *, u_long));
-void nullintr __P((void *, u_long));
+void interrupt __P((u_long, u_long, u_long, struct trapframe *));
+void machine_check __P((struct trapframe *, u_long, u_long));
+void nullintr __P((void *, u_long));
+void real_clockintr __P((void *, u_long));
static void (*iointr) __P((void *, u_long)) = nullintr;
static void (*clockintr) __P((void *, u_long)) = nullintr;
-/* $OpenBSD: locore.s,v 1.6 1996/11/14 13:17:06 niklas Exp $ */
-/* $NetBSD: locore.s,v 1.26 1996/10/17 02:50:38 cgd Exp $ */
+/* $OpenBSD: locore.s,v 1.7 1997/01/24 19:56:35 niklas Exp $ */
+/* $NetBSD: locore.s,v 1.27 1996/12/03 19:54:16 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
beq t1, Lchkast /* no, try an AST*/
/* We've got a SIR. */
- ldiq a0, ALPHA_PSL_IPL_SOFT /* yes, lower IPL to soft */
- call_pal PAL_OSF1_swpipl
- CALL(do_sir) /* do the SIR */
+ CALL(do_sir) /* do the SIR; lowers IPL */
Lchkast:
ldiq a0, ALPHA_PSL_IPL_0 /* drop IPL to zero*/
ldq t10,(FRAME_T10*8)(sp)
ldq t11,(FRAME_T11*8)(sp)
ldq t12,(FRAME_T12*8)(sp)
-#ifndef __OpenBSD__
RET
-#endif
END(exception_restore_regs)
/**************************************************************************/
-/* $OpenBSD: machdep.c,v 1.14 1997/01/17 05:53:37 kstailey Exp $ */
-/* $NetBSD: machdep.c,v 1.52 1996/11/06 20:19:19 cgd Exp $ */
+/* $OpenBSD: machdep.c,v 1.15 1997/01/24 19:56:37 niklas Exp $ */
+/* $NetBSD: machdep.c,v 1.61 1996/12/07 01:54:49 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
#include <machine/reg.h>
#include <machine/rpb.h>
#include <machine/prom.h>
-
-#ifdef DEC_3000_500
-#include <alpha/alpha/dec_3000_500.h>
-#endif
-#ifdef DEC_3000_300
-#include <alpha/alpha/dec_3000_300.h>
-#endif
-#ifdef DEC_2100_A50
-#include <alpha/alpha/dec_2100_a50.h>
-#endif
-#ifdef DEC_KN20AA
-#include <alpha/alpha/dec_kn20aa.h>
-#endif
-#ifdef DEC_AXPPCI_33
-#include <alpha/alpha/dec_axppci_33.h>
-#endif
-#ifdef DEC_21000
-#include <alpha/alpha/dec_21000.h>
-#endif
+#include <machine/cpuconf.h>
#include <net/netisr.h>
#include <net/if.h>
#include <netiso/iso.h>
#include <netiso/clnp.h>
#endif
+#ifdef CCITT
+#include <netccitt/x25.h>
+#include <netccitt/pk.h>
+#include <netccitt/pk_extern.h>
+#endif
+#ifdef NATM
+#include <netnatm/natm.h>
+#endif
#include "ppp.h"
#if NPPP > 0
#include <net/ppp_defs.h>
vm_map_t buffer_map;
-void dumpsys __P((void));
-int cpu_dumpsize __P((void));
-int cpu_dump __P((void));
-void printregs __P((struct reg *));
-void regdump __P((struct trapframe *framep));
-void netintr __P((void));
-void do_sir __P((void));
+void alpha_init __P((u_long, u_long));
+int cpu_dump __P((void));
+int cpu_dumpsize __P((void));
+void do_sir __P((void));
+void dumpsys __P((void));
+void identifycpu __P((void));
+void netintr __P((void));
+void regdump __P((struct trapframe *framep));
+void printregs __P((struct reg *));
/*
* Declare these as initialized data so we can patch them.
/* the following is used externally (sysctl_hw) */
char machine[] = "alpha";
char cpu_model[128];
-char *model_names[] = {
- "UNKNOWN (0)",
- "Alpha Demonstration Unit",
- "DEC 4000 (\"Cobra\")",
- "DEC 7000 (\"Ruby\")",
- "DEC 3000/500 (\"Flamingo\") family",
- "UNKNOWN (5)",
- "DEC 2000/300 (\"Jensen\")",
- "DEC 3000/300 (\"Pelican\")",
- "UNKNOWN (8)",
- "DEC 2100/A500 (\"Sable\")",
- "AXPvme 64",
- "AXPpci 33 (\"NoName\")",
- "DEC 21000 (\"TurboLaser\")",
- "DEC 2100/A50 (\"Avanti\") family",
- "Mustang",
- "DEC KN20AA",
- "UNKNOWN (16)",
- "DEC 1000 (\"Mikasa\")",
-};
-int nmodel_names = sizeof model_names/sizeof model_names[0];
+const struct cpusw *cpu_fn_switch; /* function switch */
struct user *proc0paddr;
/* some memory areas for device DMA. "ick." */
caddr_t le_iomem; /* XXX iomem for LANCE DMA */
-/* Interrupt vectors (in locore) */
-extern int XentInt __P((void)), XentArith __P((void)), XentMM __P((void)),
- XentIF __P((void)), XentUna __P((void)), XentSys __P((void));
-
/* number of cpus in the box. really! */
int ncpus;
-/* various CPU-specific functions. */
-char *(*cpu_modelname) __P((void));
-void (*cpu_consinit) __P((void));
-void (*cpu_device_register) __P((struct device *dev, void *aux));
-char *cpu_iobus;
-
char boot_flags[64];
+char booted_kernel[64];
/* for cpu_sysctl() */
char root_device[17];
int alpha_unaligned_fix = 1; /* fix up unaligned accesses */
int alpha_unaligned_sigbus = 0; /* don't SIGBUS on fixed-up accesses */
-void identifycpu __P((void));
-int alpha_init __P((u_long, u_long));
-
-int
+void
alpha_init(pfn, ptb)
u_long pfn; /* first free PFN number */
u_long ptb; /* PFN of current level 1 page table */
* Find out what hardware we're on, and remember its type name.
*/
cputype = hwrpb->rpb_type;
- switch (cputype) {
-#ifdef DEC_3000_500 /* and 400, [6-9]00 */
- case ST_DEC_3000_500:
- cpu_modelname = dec_3000_500_modelname;
- cpu_consinit = dec_3000_500_consinit;
- cpu_device_register = dec_3000_500_device_register;
- cpu_iobus = "tcasic";
- break;
-#endif
-
-#ifdef DEC_3000_300
- case ST_DEC_3000_300:
- cpu_modelname = dec_3000_300_modelname;
- cpu_consinit = dec_3000_300_consinit;
- cpu_device_register = dec_3000_300_device_register;
- cpu_iobus = "tcasic";
- break;
-#endif
-
-#ifdef DEC_2100_A50
- case ST_DEC_2100_A50:
- cpu_modelname = dec_2100_a50_modelname;
- cpu_consinit = dec_2100_a50_consinit;
- cpu_device_register = dec_2100_a50_device_register;
- cpu_iobus = "apecs";
- break;
-#endif
-
-#ifdef DEC_KN20AA
- case ST_DEC_KN20AA:
- cpu_modelname = dec_kn20aa_modelname;
- cpu_consinit = dec_kn20aa_consinit;
- cpu_device_register = dec_kn20aa_device_register;
- cpu_iobus = "cia";
- break;
-#endif
-
-#ifdef DEC_AXPPCI_33
- case ST_DEC_AXPPCI_33:
- cpu_modelname = dec_axppci_33_modelname;
- cpu_consinit = dec_axppci_33_consinit;
- cpu_device_register = dec_axppci_33_device_register;
- cpu_iobus = "lca";
- break;
-#endif
-
-#ifdef DEC_2000_300
- case ST_DEC_2000_300:
- cpu_modelname = dec_2000_300_modelname;
- cpu_consinit = dec_2000_300_consinit;
- cpu_device_register = dec_2000_300_device_register;
- cpu_iobus = "ibus";
- XXX DEC 2000/300 NOT SUPPORTED
- break;
-#endif
-
-#ifdef DEC_21000
- case ST_DEC_21000:
- cpu_modelname = dec_21000_modelname;
- cpu_consinit = dec_21000_consinit;
- cpu_device_register = dec_21000_device_register;
- cpu_iobus = "tlsb";
- XXX DEC 21000 NOT SUPPORTED
- break;
-#endif
-
- default:
- if (cputype > nmodel_names)
- panic("Unknown system type %d", cputype);
- else
- panic("Support for %s system type not in kernel.",
- model_names[cputype]);
+ if (cputype < 0 || cputype > ncpusw) {
+unknown_cputype:
+ printf("\n");
+ printf("Unknown system type %d.\n", cputype);
+ printf("\n");
+ panic("unknown system type");
+ }
+ cpu_fn_switch = &cpusw[cputype];
+ if (cpu_fn_switch->family == NULL)
+ goto unknown_cputype;
+ if (cpu_fn_switch->option == NULL) {
+ printf("\n");
+ printf("NetBSD does not currently support system type %d\n",
+ cputype);
+ printf("(%s family).\n", cpu_fn_switch->family);
+ printf("\n");
+ panic("unsupported system type");
+ }
+ if (!cpu_fn_switch->present) {
+ printf("\n");
+ printf("Support for system type %d (%s family) is\n", cputype,
+ cpu_fn_switch->family);
+ printf("not present in this kernel. Build a kernel with \"options %s\"\n",
+ cpu_fn_switch->option);
+ printf("to include support for this system type.\n");
+ printf("\n");
+ panic("support for system not present");
}
- if ((*cpu_modelname)() != NULL)
- strncpy(cpu_model, (*cpu_modelname)(), sizeof cpu_model - 1);
- else
- strncpy(cpu_model, model_names[cputype], sizeof cpu_model - 1);
+ if ((*cpu_fn_switch->model_name)() != NULL)
+ strncpy(cpu_model, (*cpu_fn_switch->model_name)(),
+ sizeof cpu_model - 1);
+ else {
+ strncpy(cpu_model, cpu_fn_switch->family, sizeof cpu_model - 1);
+ strcat(cpu_model, " family"); /* XXX */
+ }
cpu_model[sizeof cpu_model - 1] = '\0';
#if NLE_IOASIC > 0
/*
* Look at arguments passed to us and compute boothowto.
+ * Also, get kernel name so it can be used in user-land.
*/
prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags));
#if 0
printf("boot flags = \"%s\"\n", boot_flags);
#endif
+ prom_getenv(PROM_E_BOOTED_FILE, booted_kernel,
+ sizeof(booted_kernel));
+#if 0
+ printf("booted kernel = \"%s\"\n", booted_kernel);
+#endif
boothowto = RB_SINGLE;
#ifdef KADB
if ((pcsp->pcs_flags & PCS_PP) != 0)
ncpus++;
}
-
- return (0);
}
void
consinit()
{
- (*cpu_consinit)();
+ (*cpu_fn_switch->cons_init)();
pmap_unmap_prom();
}
* Note that bootstrapping is finished, and set the HWRPB up
* to do restarts.
*/
- hwrbp_restart_setup();
+ hwrpb_restart_setup();
}
void
return (sysctl_int(oldp, oldlenp, newp, newlen,
&alpha_unaligned_sigbus));
+ case CPU_BOOTED_KERNEL:
+ return (sysctl_rdstring(oldp, oldlenp, newp, booted_kernel));
+
default:
return (EOPNOTSUPP);
}
register_t *retval;
{
struct trapframe *tfp = p->p_md.md_tf;
- int i;
extern struct proc *fpcurproc;
+#ifdef DEBUG
+ int i;
+#endif
#ifdef DEBUG
/*
void
do_sir()
{
-
- if (ssir & SIR_NET) {
- siroff(SIR_NET);
- cnt.v_soft++;
- netintr();
- }
- if (ssir & SIR_CLOCK) {
- siroff(SIR_CLOCK);
- cnt.v_soft++;
- softclock();
- }
+ u_int64_t n;
+
+ do {
+ (void)splhigh();
+ n = ssir;
+ ssir = 0;
+ splsoft(); /* don't recurse through spl0() */
+
+#define DO_SIR(bit, fn) \
+ do { \
+ if (n & (bit)) { \
+ cnt.v_soft++; \
+ fn; \
+ } \
+ } while (0)
+
+ DO_SIR(SIR_NET, netintr());
+ DO_SIR(SIR_CLOCK, softclock());
+
+#undef DO_SIR
+ } while (ssir != 0);
}
int
spl0()
{
- if (ssir) {
- splsoft();
- do_sir();
- }
+ if (ssir)
+ do_sir(); /* it lowers the IPL itself */
return (alpha_pal_swpipl(ALPHA_PSL_IPL_0));
}
}
#if defined(COMPAT_OSF1) || 1 /* XXX */
+void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *,
+ u_long, register_t *));
+
void
cpu_exec_ecoff_setregs(p, epp, stack, retval)
struct proc *p;
-/* $OpenBSD: mainbus.c,v 1.7 1996/11/23 21:44:50 kstailey Exp $ */
-/* $NetBSD: mainbus.c,v 1.12 1996/10/13 02:59:40 christos Exp $ */
+/* $OpenBSD: mainbus.c,v 1.8 1997/01/24 19:56:38 niklas Exp $ */
+/* $NetBSD: mainbus.c,v 1.15 1996/12/05 01:39:28 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
#include <machine/autoconf.h>
#include <machine/rpb.h>
+#include <machine/cpuconf.h>
struct mainbus_softc {
struct device sc_dv;
};
/* Definition of the mainbus driver. */
+#ifdef __BROKEN_INDIRECT_CONFIG
static int mbmatch __P((struct device *, void *, void *));
+#else
+static int mbmatch __P((struct device *, struct cfdata *, void *));
+#endif
static void mbattach __P((struct device *, struct device *, void *));
static int mbprint __P((void *, const char *));
int mb_matchname __P((struct confargs *, char *));
static int
+#ifdef __BROKEN_INDIRECT_CONFIG
mbmatch(parent, cfdata, aux)
+#else
+mbmatch(parent, cf, aux)
+#endif
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cf;
+#endif
void *aux;
{
+#ifdef __BROKEN_INDIRECT_CONFIG
struct cfdata *cf = cfdata;
+#endif
/*
* Only one mainbus, but some people are stupid...
struct mainbus_softc *sc = (struct mainbus_softc *)self;
struct confargs nca;
int i, cpuattachcnt;
+ struct pcs* pcsp;
extern int ncpus;
- extern char *cpu_iobus;
+ extern const struct cpusw *cpu_fn_switch;
printf("\n");
*/
cpuattachcnt = 0;
for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
- struct pcs *pcsp;
-
pcsp = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off +
(i * hwrpb->rpb_pcs_size));
if ((pcsp->pcs_flags & PCS_PP) == 0)
printf("WARNING: %d cpus in machine, %d attached\n",
ncpus, cpuattachcnt);
- if (cpu_iobus != NULL) {
- nca.ca_name = cpu_iobus;
+ if ((*cpu_fn_switch->iobus_name)() != NULL) {
+ char iobus_name[16];
+
+ strncpy(iobus_name, (*cpu_fn_switch->iobus_name)(), 16);
+ nca.ca_name = iobus_name;
nca.ca_slot = 0;
nca.ca_offset = 0;
nca.ca_bus = &sc->sc_bus;
-/* $OpenBSD: mem.c,v 1.5 1996/10/30 22:38:17 niklas Exp $ */
-/* $NetBSD: mem.c,v 1.9 1996/08/20 23:00:25 cgd Exp $ */
+/* $OpenBSD: mem.c,v 1.6 1997/01/24 19:56:39 niklas Exp $ */
+/* $NetBSD: mem.c,v 1.10 1996/11/13 21:13:10 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <vm/vm.h>
+#define mmread mmrw
+#define mmwrite mmrw
+cdev_decl(mm);
+
caddr_t zeropage;
extern int firstusablepage, lastusablepage;
-int mmopen __P((dev_t, int, int, struct proc *));
-int mmclose __P((dev_t, int, int, struct proc *));
-int mmrw __P((dev_t, struct uio *, int));
-int mmmmap __P((dev_t, vm_offset_t, int));
-
/*ARGSUSED*/
int
mmopen(dev, flag, mode, p)
int
mmmmap(dev, off, prot)
dev_t dev;
- vm_offset_t off;
+ int off; /* XXX */
int prot;
{
/*
-/* $OpenBSD: pmap.old.c,v 1.1 1996/10/30 22:38:22 niklas Exp $ */
-/* $NetBSD: pmap.old.c,v 1.13 1996/10/13 02:59:44 christos Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.2 1997/01/24 19:56:41 niklas Exp $ */
+/* $NetBSD: pmap.old.c,v 1.14 1996/11/13 21:13:10 cgd Exp $ */
/*
* Copyright (c) 1991, 1993
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_BOOTSTRAP))
- printf("pmap_bootstrap_alloc(%lx)\n", size);
+ printf("pmap_bootstrap_alloc(%x)\n", size);
#endif
if (vm_page_startup_initialized)
panic("pmap_bootstrap_alloc: called after startup initialized");
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_init(%x, %x)\n", phys_start, phys_end);
+ printf("pmap_init(%lx, %lx)\n", phys_start, phys_end);
#endif
/* initialize protection array */
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_map(%lx, %lx, %lx, %lx)\n", virt, start, end, prot);
+ printf("pmap_map(%lx, %lx, %lx, %x)\n", virt, start, end, prot);
#endif
while (start < end) {
pmap_enter(pmap_kernel(), virt, start, prot, FALSE);
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%lx)\n", pmap);
+ printf("pmap_pinit(%p)\n", pmap);
#endif
/*
* No need to allocate page table space yet but we do need a
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_destroy(%lx)\n", pmap);
+ printf("pmap_destroy(%p)\n", pmap);
#endif
if (pmap == NULL)
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_release(%lx)\n", pmap);
+ printf("pmap_release(%p)\n", pmap);
#endif
#ifdef notdef /* DIAGNOSTIC */
/* count would be 0 from pmap_destroy... */
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%lx)\n", pmap);
+ printf("pmap_reference(%p)\n", pmap);
#endif
if (pmap != NULL) {
simple_lock(&pmap->pm_lock);
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%lx, %lx, %lx)\n", pmap, sva, eva);
+ printf("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva);
#endif
if (pmap == NULL)
#ifdef DEBUG
if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
(prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)))
- printf("pmap_page_protect(%lx, %lx)\n", pa, prot);
+ printf("pmap_page_protect(%lx, %x)\n", pa, prot);
#endif
if (!PAGE_IS_MANAGED(pa))
return;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%lx, %lx, %lx, %lx)\n", pmap, sva, eva, prot);
+ printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot);
#endif
if (pmap == NULL)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%lx, %lx, %lx, %lx, %lx)\n",
+ printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
pmap, va, pa, prot, wired);
#endif
if (pmap == NULL)
opa = pmap_pte_pa(pte);
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
- printf("enter: pte %lx, *pte %lx\n", pte, *pte);
+ printf("enter: pte %p, *pte %lx\n", pte, *pte);
#endif
/*
if (pmap_pte_w_chg(pte, wired ? PG_WIRED : 0)) {
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
- printf("enter: wiring change -> %lx\n", wired);
+ printf("enter: wiring change -> %x\n", wired);
#endif
if (wired)
pmap->pm_stats.wired_count++;
s = splimp();
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
- printf("enter: pv at %lx: %lx/%lx/%lx\n",
+ printf("enter: pv at %p: %lx/%p/%p\n",
pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
#endif
/*
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_change_wiring(%lx, %lx, %lx)\n", pmap, va, wired);
+ printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
#endif
if (pmap == NULL)
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%lx, %lx) -> ", pmap, va);
+ printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
pa = 0;
if (pmap && pmap_ste_v(pmap, va)) {
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%lx, %lx, %lx, %lx, %lx)\n",
+ printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n",
dst_pmap, src_pmap, dst_addr, len, src_addr);
#endif
}
#ifdef DEBUG
pt_entry_t *ste;
- int opmapdebug;
+ int opmapdebug = 0;
#endif
if (pmap != pmap_kernel())
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%lx)\n", pmap);
+ printf("pmap_collect(%p)\n", pmap);
#endif
#ifdef PMAPSTATS
kpt_stats.collectscans++;
#ifdef DEBUG
if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT)) {
- printf("collect: freeing KPT page at %lx (ste %lx@%lx)\n",
+ printf("collect: freeing KPT page at %lx (ste %lx@%p)\n",
pv->pv_va, *pv->pv_ptpte, pv->pv_ptpte);
opmapdebug = pmapdebug;
pmapdebug |= PDB_PTPAGE;
pmapdebug = opmapdebug;
if (*ste)
- printf("collect: kernel STE at %lx still valid (%lx)\n",
+ printf("collect: kernel STE at %p still valid (%lx)\n",
ste, *ste);
ste = &Sysptmap[(pt_entry_t *)ste-pmap_ste(pmap_kernel(), 0)];
if (*ste)
- printf("collect: kernel PTmap at %lx still valid (%lx)\n",
+ printf("collect: kernel PTmap at %p still valid (%lx)\n",
ste, *ste);
#endif
}
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_SEGTAB))
- printf("pmap_activate(%lx)\n", pmap);
+ printf("pmap_activate(%p)\n", pmap);
#endif
iscurproc = curproc != NULL && pmap == curproc->p_vmspace->vm_map.pmap;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%lx, %lx, %lx, %lx)\n",
+ printf("pmap_pageable(%p, %lx, %lx, %x)\n",
pmap, sva, eva, pageable);
#endif
/*
#ifdef DEBUG
if ((pmapdebug & (PDB_FOLLOW|PDB_PTPAGE)) == PDB_PTPAGE)
- printf("pmap_pageable(%lx, %lx, %lx, %lx)\n",
+ printf("pmap_pageable(%p, %lx, %lx, %x)\n",
pmap, sva, eva, pageable);
#endif
if (!pmap_ste_v(pmap, sva))
return;
#ifdef DEBUG
if (pv->pv_va != sva || pv->pv_next) {
- printf("pmap_pageable: bad PT page va %lx next %lx\n",
+ printf("pmap_pageable: bad PT page va %lx next %p\n",
pv->pv_va, pv->pv_next);
return;
}
pmap_clear_modify(pa);
#ifdef DEBUG
if ((PHYS_TO_VM_PAGE(pa)->flags & PG_CLEAN) == 0) {
- printf("pa %lx: flags=%lx: not clean\n",
+ printf("pa %lx: flags=%x: not clean\n",
pa, PHYS_TO_VM_PAGE(pa)->flags);
PHYS_TO_VM_PAGE(pa)->flags |= PG_CLEAN;
}
pt_entry_t opte;
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove_mapping(%lx, %lx, %lx, %lx)\n",
+ printf("pmap_remove_mapping(%p, %lx, %p, %x)\n",
pmap, va, pte, flags);
#endif
*/
#ifdef DEBUG
if (pmapdebug & PDB_REMOVE)
- printf("remove: invalidating pte at %lx\n", pte);
+ printf("remove: invalidating pte at %p\n", pte);
#endif
*pte = PG_NV;
if ((flags & PRM_TFLUSH) && active_pmap(pmap))
#endif
#ifdef DEBUG
if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE))
- printf("remove: ste was %lx@%lx pte was %lx@%lx\n",
+ printf("remove: ste was %lx@%p pte was %lx@%p\n",
*ste, ste, opte, pmap_pte(pmap, va));
#endif
*ste = PG_NV;
if (ptpmap != pmap_kernel()) {
#ifdef DEBUG
if (pmapdebug & (PDB_REMOVE|PDB_SEGTAB))
- printf("remove: stab %lx, refcnt %d\n",
+ printf("remove: stab %p, refcnt %d\n",
ptpmap->pm_stab, ptpmap->pm_sref - 1);
if ((pmapdebug & PDB_PARANOIA) &&
ptpmap->pm_stab != (pt_entry_t *)trunc_page(ste))
if (--(ptpmap->pm_sref) == 0) {
#ifdef DEBUG
if (pmapdebug&(PDB_REMOVE|PDB_SEGTAB))
- printf("remove: free stab %lx\n",
+ printf("remove: free stab %p\n",
ptpmap->pm_stab);
#endif
kmem_free_wakeup(st_map,
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE))
- printf("pmap_enter_ptpage: pmap %lx, va %lx\n", pmap, va);
+ printf("pmap_enter_ptpage: pmap %p, va %lx\n", pmap, va);
#endif
#ifdef PMAPSTATS
enter_stats.ptpneeded++;
PMAP_ACTIVATE(pmap, 1);
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
- printf("enter: pmap %lx stab %lx(%lx)\n",
+ printf("enter: pmap %p stab %p(%lx)\n",
pmap, pmap->pm_stab, pmap->pm_stpte);
#endif
}
pv->pv_ptpmap = pmap;
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
- printf("enter: new PT page at PA %lx, ste at %lx\n", ptpa, ste);
+ printf("enter: new PT page at PA 0x%lx, ste at %p\n", ptpa, ste);
#endif
/*
if (pmap != pmap_kernel()) {
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
- printf("enter: stab %lx refcnt %d\n",
+ printf("enter: stab %p refcnt %d\n",
pmap->pm_stab, pmap->pm_sref);
#endif
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_emulate_reference: 0x%lx, 0x%lx, %d, %d\n",
+ printf("pmap_emulate_reference: %p, 0x%lx, %d, %d\n",
p, v, user, write);
#endif
}
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
- printf("\tpte = 0x%lx, ", pte);
+ printf("\tpte = %p, ", pte);
printf("*pte = 0x%lx\n", *pte);
}
#endif
#endif
#ifdef DIAGNOSTIC
if (!PAGE_IS_MANAGED(pa))
- printf("WARNING: pmap_emulate_reference(0x%lx, 0x%lx, %d, %d): pa 0x%lx not managed\n", p, v, user, write, pa);
+ printf("WARNING: pmap_emulate_reference(%p, 0x%lx, %d, %d): pa 0x%lx not managed\n", p, v, user, write, pa);
#endif
/*
printf("pa %lx", pa);
for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next)
- printf(" -> pmap %lx, va %lx, stpte %lx, ptpmap %lx, flags %lx",
+ printf(" -> pmap %p, va %lx, stpte %p, ptpmap %p, flags %x",
pv->pv_pmap, pv->pv_va, pv->pv_ptpte, pv->pv_ptpmap,
pv->pv_flags);
printf("\n");
-/* $OpenBSD: prom.c,v 1.4 1996/10/30 22:38:23 niklas Exp $ */
-/* $NetBSD: prom.c,v 1.11 1996/10/16 00:00:40 cgd Exp $ */
+/* $OpenBSD: prom.c,v 1.5 1997/01/24 19:56:42 niklas Exp $ */
+/* $NetBSD: prom.c,v 1.12 1996/11/13 21:13:11 cgd Exp $ */
/*
* Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/user.h>
-#include <sys/systm.h>
#include <machine/rpb.h>
#include <machine/prom.h>
#include <dev/cons.h>
-/* XXX this is to fake out the console routines, while booting. */
-void promcnputc __P((dev_t, int));
-int promcngetc __P((dev_t));
u_int64_t hwrpb_checksum __P((void));
-long console_restart __P((u_int64_t, u_int64_t, u_int64_t));
+/* XXX this is to fake out the console routines, while booting. */
struct consdev promcons = { NULL, NULL, promcngetc, promcnputc,
nullcnpollc, makedev(23,0), 1 };
c = (struct crb*)((char*)hwrpb + hwrpb->rpb_crb_off);
prom_dispatch_v.routine_arg = c->crb_v_dispatch;
- prom_dispatch_v.routine = c->crb_v_dispatch->code;
+ prom_dispatch_v.routine = c->crb_v_dispatch->entry_va;
prom_getenv(PROM_E_TTY_DEV, buf, 4);
alpha_console = buf[0] - '0';
*to = c;
do {
- ret.bits = prom_dispatch(PROM_R_PUTS, alpha_console, to, 1);
+ ret.bits = prom_putstr(alpha_console, to, 1);
} while ((ret.u.retval & 1) == 0);
if (!prom_mapped) { /* XXX */
*rom_ptep = rom_pte; /* XXX */
ALPHA_TBIA(); /* XXX */
} /* XXX */
- ret.bits = prom_dispatch(PROM_R_GETC, alpha_console, 0, 0);
+ ret.bits = prom_getc(alpha_console);
if (!prom_mapped) { /* XXX */
*rom_ptep = saved_pte; /* XXX */
ALPHA_TBIA(); /* XXX */
*rom_ptep = rom_pte; /* XXX */
ALPHA_TBIA(); /* XXX */
} /* XXX */
- ret.bits = prom_dispatch(PROM_R_GETC, alpha_console, 0, 0);
+ ret.bits = prom_getc(alpha_console);
if (!prom_mapped) { /* XXX */
*rom_ptep = saved_pte; /* XXX */
ALPHA_TBIA(); /* XXX */
*rom_ptep = rom_pte; /* XXX */
ALPHA_TBIA(); /* XXX */
} /* XXX */
- ret.bits = prom_dispatch(PROM_R_GETENV, id, to, len);
+ ret.bits = prom_getenv_disp(id, to, len);
bcopy(to, buf, len);
if (!prom_mapped) { /* XXX */
*rom_ptep = saved_pte; /* XXX */
return (sum);
}
-void XentRestart __P((void));
-
void
-hwrbp_restart_setup()
+hwrpb_restart_setup()
{
struct pcs *p;
hwrpb->rpb_vptb = VPTBASE;
/* when 'c'ontinuing from console halt, do a dump */
- hwrpb->rpb_rest_term = (long (*) __P((long)))&XentRestart;
+ hwrpb->rpb_rest_term = (u_int64_t)&XentRestart;
hwrpb->rpb_rest_term_val = 0x1;
#if 0
/* don't know what this is really used by, so don't mess with it. */
- hwrpb->rpb_restart = (long (*) __P((long)))&XentRestart;
+ hwrpb->rpb_restart = (u_int64_t)&XentRestart;
hwrpb->rpb_restart_val = 0x2;
#endif
p->pcs_flags |= (PCS_RC | PCS_CV);
}
-long
+u_int64_t
console_restart(ra, ai, pv)
u_int64_t ra, ai, pv;
{
-/* $OpenBSD: promcons.c,v 1.4 1996/10/30 22:38:25 niklas Exp $ */
-/* $NetBSD: promcons.c,v 1.3 1996/05/30 18:44:30 cgd Exp $ */
+/* $OpenBSD: promcons.c,v 1.5 1997/01/24 19:56:43 niklas Exp $ */
+/* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
-/* $OpenBSD: support.c,v 1.4 1996/10/30 22:38:27 niklas Exp $ */
-/* $NetBSD: support.c,v 1.2 1995/11/23 02:34:32 cgd Exp $ */
+/* $OpenBSD: support.c,v 1.5 1997/01/24 19:56:44 niklas Exp $ */
+/* $NetBSD: support.c,v 1.4 1996/11/13 22:20:56 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
* Some C support functions that aren't (yet) in libkern or assembly.
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/errno.h>
struct qelem {
-/* $OpenBSD: sys_machdep.c,v 1.4 1996/10/30 22:38:28 niklas Exp $ */
-/* $NetBSD: sys_machdep.c,v 1.3 1995/11/23 02:34:35 cgd Exp $ */
+/* $OpenBSD: sys_machdep.c,v 1.5 1997/01/24 19:56:44 niklas Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.5 1996/11/13 22:20:57 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
-/* $OpenBSD: trap.c,v 1.5 1996/10/30 22:38:29 niklas Exp $ */
-/* $NetBSD: trap.c,v 1.16 1996/10/13 02:59:48 christos Exp $ */
+/* $OpenBSD: trap.c,v 1.6 1997/01/24 19:56:46 niklas Exp $ */
+/* $NetBSD: trap.c,v 1.19 1996/11/27 01:28:30 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
struct proc *fpcurproc; /* current user of the FPU */
+void userret __P((struct proc *, u_int64_t, u_quad_t));
+
+unsigned long Sfloat_to_reg __P((unsigned int));
+unsigned int reg_to_Sfloat __P((unsigned long));
+unsigned long Tfloat_reg_cvt __P((unsigned long));
+#ifdef FIX_UNALIGNED_VAX_FP
+unsigned long Ffloat_to_reg __P((unsigned int));
+unsigned int reg_to_Ffloat __P((unsigned long));
+unsigned long Gfloat_reg_cvt __P((unsigned long));
+#endif
+
+int unaligned_fixup __P((unsigned long, unsigned long,
+ unsigned long, struct proc *));
+
/*
* Define the code needed before returning to user mode, for
* trap and syscall.
*/
-static __inline void
+void
userret(p, pc, oticks)
register struct proc *p;
u_int64_t pc;
cnt.v_trap++;
p = curproc;
ucode = 0;
- if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) {
- user = 1;
+ user = (framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0;
+ if (user) {
sticks = p->p_sticks;
p->p_md.md_tf = framep;
- } else
- user = 0;
+ } else {
+#ifdef DIAGNOSTIC
+ sticks = 0xdeadbeef; /* XXX for -Wuninitialized */
+#endif
+ }
switch (entry) {
case ALPHA_KENTRY_UNA:
register vm_map_t map;
vm_prot_t ftype;
int rv;
- extern int fswintrberr __P((void));
extern vm_map_t kernel_map;
#ifdef NEW_PMAP
case 1: /* store instruction */
ftype = VM_PROT_WRITE;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ goto dopanic;
+#endif
}
va = trunc_page((vm_offset_t)a0);
return;
dopanic:
- printf("\n");
- printf("fatal %s trap:\n", user ? "user" : "kernel");
- printf("\n");
- printf(" trap entry = 0x%lx\n", entry);
- printf(" a0 = 0x%lx\n", a0);
- printf(" a1 = 0x%lx\n", a1);
- printf(" a2 = 0x%lx\n", a2);
- printf(" pc = 0x%lx\n", framep->tf_regs[FRAME_PC]);
- printf(" ra = 0x%lx\n", framep->tf_regs[FRAME_RA]);
- printf(" curproc = %p\n", curproc);
- if (curproc != NULL)
- printf(" pid = %d, comm = %s\n", curproc->p_pid,
- curproc->p_comm);
- printf("\n");
+ {
+ const char *entryname;
+
+ switch (entry) {
+ case ALPHA_KENTRY_INT:
+ entryname = "interrupt";
+ break;
+ case ALPHA_KENTRY_ARITH:
+ entryname = "arithmetic trap";
+ break;
+ case ALPHA_KENTRY_MM:
+ entryname = "memory management fault";
+ break;
+ case ALPHA_KENTRY_IF:
+ entryname = "instruction fault";
+ break;
+ case ALPHA_KENTRY_UNA:
+ entryname = "unaligned access fault";
+ break;
+ case ALPHA_KENTRY_SYS:
+ entryname = "system call";
+ break;
+ default:
+ entryname = "???";
+ break;
+ }
+
+ printf("\n");
+ printf("fatal %s trap:\n", user ? "user" : "kernel");
+ printf("\n");
+ printf(" trap entry = 0x%lx (%s)\n", entry, entryname);
+ printf(" a0 = 0x%lx\n", a0);
+ printf(" a1 = 0x%lx\n", a1);
+ printf(" a2 = 0x%lx\n", a2);
+ printf(" pc = 0x%lx\n", framep->tf_regs[FRAME_PC]);
+ printf(" ra = 0x%lx\n", framep->tf_regs[FRAME_RA]);
+ printf(" curproc = %p\n", curproc);
+ if (curproc != NULL)
+ printf(" pid = %d, comm = %s\n", curproc->p_pid,
+ curproc->p_comm);
+ printf("\n");
+ }
/* XXX dump registers */
/* XXX kernel debugger */
-/* $OpenBSD: vm_machdep.c,v 1.5 1996/10/30 22:38:30 niklas Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.20 1996/10/13 02:59:50 christos Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.6 1997/01/24 19:56:47 niklas Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.21 1996/11/13 21:13:15 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
--- /dev/null
+/* $NetBSD: shared_intr.c,v 1.1 1996/11/17 02:03:08 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: 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.
+ */
+
+/*
+ * Common shared-interrupt-line functionality.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/queue.h>
+
+#include <machine/intr.h>
+
+extern int cold;
+
+static const char *intr_typename __P((int));
+
+static const char *
+intr_typename(type)
+ int type;
+{
+
+ switch (type) {
+ case IST_UNUSABLE:
+ return ("disabled");
+ case IST_NONE:
+ return ("none");
+ case IST_PULSE:
+ return ("pulsed");
+ case IST_EDGE:
+ return ("edge-triggered");
+ case IST_LEVEL:
+ return ("level-triggered");
+ }
+ panic("intr_typename: unknown type %d", type);
+}
+
+struct alpha_shared_intr *
+alpha_shared_intr_alloc(n)
+ unsigned int n;
+{
+ struct alpha_shared_intr *intr;
+ unsigned int i;
+
+ intr = malloc(n * sizeof (struct alpha_shared_intr), M_DEVBUF,
+ cold ? M_NOWAIT : M_WAITOK);
+ if (intr == NULL)
+ panic("alpha_shared_intr_alloc: couldn't malloc intr");
+
+ for (i = 0; i < n; i++) {
+ TAILQ_INIT(&intr[i].intr_q);
+ intr[i].intr_sharetype = IST_NONE;
+ intr[i].intr_dfltsharetype = IST_NONE;
+ intr[i].intr_nstrays = 0;
+ intr[i].intr_maxstrays = 5;
+ }
+
+ return (intr);
+}
+
+int
+alpha_shared_intr_dispatch(intr, num)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+{
+ struct alpha_shared_intrhand *ih;
+ int rv, handled;
+
+ ih = intr[num].intr_q.tqh_first;
+ handled = 0;
+ while (ih != NULL) {
+
+ /*
+ * The handler returns one of three values:
+ * 0: This interrupt wasn't for me.
+ * 1: This interrupt was for me.
+ * -1: This interrupt might have been for me, but I can't say
+ * for sure.
+ */
+ rv = (*ih->ih_fn)(ih->ih_arg);
+
+ handled = handled || (rv != 0);
+ ih = ih->ih_q.tqe_next;
+ }
+
+ return (handled);
+}
+
+void *
+alpha_shared_intr_establish(intr, num, type, level, fn, arg, basename)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+ int type, level;
+ int (*fn) __P((void *));
+ void *arg;
+ const char *basename;
+{
+ struct alpha_shared_intrhand *ih;
+
+ if (intr[num].intr_sharetype == IST_UNUSABLE) {
+ printf("alpha_shared_intr_establish: %s %d: unusable\n",
+ basename, num);
+ return NULL;
+ }
+
+ /* no point in sleeping unless someone can free memory. */
+ ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
+ if (ih == NULL)
+ panic("alpha_shared_intr_establish: can't malloc intrhand");
+
+#ifdef DIAGNOSTIC
+ if (type == IST_NONE)
+ panic("alpha_shared_intr_establish: bogus type");
+#endif
+
+ switch (intr[num].intr_sharetype) {
+ case IST_EDGE:
+ case IST_LEVEL:
+ if (type == intr[num].intr_sharetype)
+ break;
+ case IST_PULSE:
+ if (type != IST_NONE) {
+ if (intr[num].intr_q.tqh_first == NULL) {
+ printf("alpha_shared_intr_establish: %s %d: warning: using %s on %s\n",
+ basename, num, intr_typename(type),
+ intr_typename(intr[num].intr_sharetype));
+ type = intr[num].intr_sharetype;
+ } else {
+ panic("alpha_shared_intr_establish: %s %d: can't share %s with %s",
+ basename, num, intr_typename(type),
+ intr_typename(intr[num].intr_sharetype));
+ }
+ }
+ break;
+
+ case IST_NONE:
+ /* not currently used; safe */
+ break;
+ }
+
+ ih->ih_fn = fn;
+ ih->ih_arg = arg;
+ ih->ih_level = level;
+
+ intr[num].intr_sharetype = type;
+ TAILQ_INSERT_TAIL(&intr[num].intr_q, ih, ih_q);
+
+ return (ih);
+}
+
+int
+alpha_shared_intr_get_sharetype(intr, num)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+{
+
+ return (intr[num].intr_sharetype);
+}
+
+int
+alpha_shared_intr_isactive(intr, num)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+{
+
+ return (intr[num].intr_q.tqh_first != NULL);
+}
+
+void
+alpha_shared_intr_set_dfltsharetype(intr, num, newdfltsharetype)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+ int newdfltsharetype;
+{
+
+#ifdef DIAGNOSTIC
+ if (alpha_shared_intr_isactive(intr, num))
+ panic("alpha_shared_intr_set_dfltsharetype on active intr");
+#endif
+
+ intr[num].intr_dfltsharetype = newdfltsharetype;
+ intr[num].intr_sharetype = intr[num].intr_dfltsharetype;
+}
+
+void
+alpha_shared_intr_set_maxstrays(intr, num, newmaxstrays)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+ int newmaxstrays;
+{
+
+#ifdef DIAGNOSTIC
+ if (alpha_shared_intr_isactive(intr, num))
+ panic("alpha_shared_intr_set_maxstrays on active intr");
+#endif
+
+ intr[num].intr_maxstrays = newmaxstrays;
+ intr[num].intr_nstrays = 0;
+}
+
+void
+alpha_shared_intr_stray(intr, num, basename)
+ struct alpha_shared_intr *intr;
+ unsigned int num;
+ const char *basename;
+{
+
+ intr[num].intr_nstrays++;
+ if (intr[num].intr_nstrays <= intr[num].intr_maxstrays)
+ log(LOG_ERR, "stray %s %d%s\n", basename, num,
+ intr[num].intr_nstrays >= intr[num].intr_maxstrays ?
+ "; stopped logging" : "");
+}
--- /dev/null
+/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <machine/bus.h>
+
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/common/vgavar.h>
+
+#define VGA_IO_D_6845_ADDR 0x4
+#define VGA_IO_D_6845_DATA 0x5
+
+struct cfdriver vga_cd = {
+ NULL, "vga", DV_DULL,
+};
+
+static void vga_cursor __P((void *, int, int, int));
+static void vga_putstr __P((void *, int, int, char *, int));
+static void vga_copycols __P((void *, int, int, int,int));
+static void vga_erasecols __P((void *, int, int, int));
+static void vga_copyrows __P((void *, int, int, int));
+static void vga_eraserows __P((void *, int, int));
+
+struct wscons_emulfuncs vga_emulfuncs = {
+ vga_cursor,
+ vga_putstr,
+ vga_copycols,
+ vga_erasecols,
+ vga_copyrows,
+ vga_eraserows,
+};
+
+static int vgaprint __P((void *, const char *));
+static int vgaioctl __P((void *, u_long, caddr_t, int, struct proc *));
+static int vgammap __P((void *, off_t, int));
+
+/*
+ * The following functions implement back-end configuration grabbing
+ * and attachment.
+ */
+int
+vga_common_probe(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ bus_space_handle_t ioh_b, ioh_c, ioh_d, memh;
+ u_int16_t vgadata;
+ int gotio_b, gotio_c, gotio_d, gotmem, rv;
+
+ gotio_b = gotio_c = gotio_d = gotmem = rv = 0;
+
+ if (bus_space_map(iot, 0x3b0, 0xc, 0, &ioh_b))
+ goto bad;
+ gotio_b = 1;
+ if (bus_space_map(iot, 0x3c0, 0x10, 0, &ioh_c))
+ goto bad;
+ gotio_c = 1;
+ if (bus_space_map(iot, 0x3d0, 0x10, 0, &ioh_d))
+ goto bad;
+ gotio_d = 1;
+ if (bus_space_map(memt, 0xb8000, 0x8000, 0, &memh))
+ goto bad;
+ gotmem = 1;
+
+ vgadata = bus_space_read_2(memt, memh, 0);
+ bus_space_write_2(memt, memh, 0, 0xa55a);
+ rv = (bus_space_read_2(memt, memh, 0) == 0xa55a);
+ bus_space_write_2(memt, memh, 0, vgadata);
+
+bad:
+ if (gotio_b)
+ bus_space_unmap(iot, ioh_b, 0xc);
+ if (gotio_c)
+ bus_space_unmap(iot, ioh_c, 0x10);
+ if (gotio_d)
+ bus_space_unmap(iot, ioh_d, 0x10);
+ if (gotmem)
+ bus_space_unmap(memt, memh, 0x8000);
+
+ return (rv);
+}
+
+void
+vga_common_setup(iot, memt, vc)
+ bus_space_tag_t iot, memt;
+ struct vga_config *vc;
+{
+ int cpos;
+
+ vc->vc_iot = iot;
+ vc->vc_memt = memt;
+
+ if (bus_space_map(vc->vc_iot, 0x3b0, 0xc, 0, &vc->vc_ioh_b))
+ panic("vga_common_setup: couldn't map io b");
+ if (bus_space_map(vc->vc_iot, 0x3c0, 0x10, 0, &vc->vc_ioh_c))
+ panic("vga_common_setup: couldn't map io c");
+ if (bus_space_map(vc->vc_iot, 0x3d0, 0x10, 0, &vc->vc_ioh_d))
+ panic("vga_common_setup: couldn't map io d");
+ if (bus_space_map(vc->vc_memt, 0xb8000, 0x8000, 0, &vc->vc_memh))
+ panic("vga_common_setup: couldn't map memory");
+
+ vc->vc_nrow = 25;
+ vc->vc_ncol = 80;
+
+ bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 14);
+ cpos = bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA) << 8;
+ bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 15);
+ cpos |= bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA);
+ vc->vc_crow = cpos / vc->vc_ncol;
+ vc->vc_ccol = cpos % vc->vc_ncol;
+
+ vc->vc_so = 0;
+#if 0
+ vc->vc_at = 0x00 | 0xf; /* black bg|white fg */
+ vc->vc_so_at = 0x00 | 0xf | 0x80; /* black bg|white fg|blink */
+
+ /* clear screen, frob cursor, etc.? */
+ pcivga_eraserows(vc, 0, vc->vc_nrow);
+#endif
+ /*
+ * XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!!
+ * XXX Therefore, though the comments say "blue bg", the code uses
+ * XXX the value for a red background!
+ */
+ vc->vc_at = 0x40 | 0x0f; /* blue bg|white fg */
+ vc->vc_so_at = 0x40 | 0x0f | 0x80; /* blue bg|white fg|blink */
+}
+
+void
+vga_wscons_attach(parent, vc, console)
+ struct device *parent;
+ struct vga_config *vc;
+ int console;
+{
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
+
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+
+ wo->wo_emulfuncs = &vga_emulfuncs;
+ wo->wo_emulfuncs_cookie = vc;
+
+ wo->wo_ioctl = vgaioctl;
+ wo->wo_mmap = vgammap;
+ wo->wo_miscfuncs_cookie = vc;
+
+ wo->wo_nrows = vc->vc_nrow;
+ wo->wo_ncols = vc->vc_ncol;
+ wo->wo_crow = vc->vc_crow;
+ wo->wo_ccol = vc->vc_ccol;
+
+ config_found(parent, &waa, vgaprint);
+}
+
+void
+vga_wscons_console(vc)
+ struct vga_config *vc;
+{
+ struct wscons_odev_spec wo;
+
+ wo.wo_emulfuncs = &vga_emulfuncs;
+ wo.wo_emulfuncs_cookie = vc;
+
+ /* ioctl and mmap are unused until real attachment. */
+
+ wo.wo_nrows = vc->vc_nrow;
+ wo.wo_ncols = vc->vc_ncol;
+ wo.wo_crow = vc->vc_crow;
+ wo.wo_ccol = vc->vc_ccol;
+
+ wscons_attach_console(&wo);
+}
+
+static int
+vgaprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
+}
+
+static int
+vgaioctl(v, cmd, data, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+
+ /* XXX */
+ return -1;
+}
+
+static int
+vgammap(v, offset, prot)
+ void *v;
+ off_t offset;
+ int prot;
+{
+
+ /* XXX */
+ return -1;
+}
+
+/*
+ * The following functions implement the MI ANSI terminal emulation on
+ * a VGA display.
+ */
+static void
+vga_cursor(id, on, row, col)
+ void *id;
+ int on, row, col;
+{
+ struct vga_config *vc = id;
+ bus_space_tag_t iot = vc->vc_iot;
+ bus_space_handle_t ioh_d = vc->vc_ioh_d;
+ int pos;
+
+#if 0
+ printf("vga_cursor: %d %d\n", row, col);
+#endif
+ /* turn the cursor off */
+ if (!on) {
+ /* XXX disable cursor how??? */
+ vc->vc_crow = vc->vc_ccol = -1;
+ } else {
+ vc->vc_crow = row;
+ vc->vc_ccol = col;
+ }
+
+ pos = row * vc->vc_ncol + col;
+
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 14);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos >> 8);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 15);
+ bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos);
+}
+
+static void
+vga_putstr(id, row, col, cp, len)
+ void *id;
+ int row, col;
+ char *cp;
+ int len;
+{
+ struct vga_config *vc = id;
+ bus_space_tag_t memt = vc->vc_memt;
+ bus_space_handle_t memh = vc->vc_memh;
+ int i, off;
+
+ off = (row * vc->vc_ncol + col) * 2;
+ for (i = 0; i < len; i++, cp++, off += 2) {
+ bus_space_write_1(memt, memh, off, *cp);
+ bus_space_write_1(memt, memh, off + 1,
+ vc->vc_so ? vc->vc_so_at : vc->vc_at);
+ }
+}
+
+static void
+vga_copycols(id, row, srccol, dstcol, ncols)
+ void *id;
+ int row, srccol, dstcol, ncols;
+{
+ struct vga_config *vc = id;
+ bus_size_t srcoff, dstoff;
+
+ srcoff = (row * vc->vc_ncol + srccol) * 2;
+ dstoff = (row * vc->vc_ncol + dstcol) * 2;
+
+ /* XXX SHOULDN'T USE THIS IF REGIONS OVERLAP... */
+ bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff,
+ ncols);
+}
+
+static void
+vga_erasecols(id, row, startcol, ncols)
+ void *id;
+ int row, startcol, ncols;
+{
+ struct vga_config *vc = id;
+ bus_size_t off, count;
+ u_int16_t val;
+
+ off = (row * vc->vc_ncol + startcol) * 2;
+ count = ncols * 2;
+
+ val = (vc->vc_at << 8) | ' ';
+
+ bus_space_set_region_2(vc->vc_memt, vc->vc_memh, off, count, val);
+}
+
+static void
+vga_copyrows(id, srcrow, dstrow, nrows)
+ void *id;
+ int srcrow, dstrow, nrows;
+{
+ struct vga_config *vc = id;
+ bus_size_t srcoff, dstoff;
+
+ srcoff = (srcrow * vc->vc_ncol + 0) * 2;
+ dstoff = (dstrow * vc->vc_ncol + 0) * 2;
+
+ /* XXX SHOULDN'T USE THIS IF REGIONS OVERLAP... */
+ bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff,
+ nrows * vc->vc_ncol);
+}
+
+static void
+vga_eraserows(id, startrow, nrows)
+ void *id;
+ int startrow, nrows;
+{
+ struct vga_config *vc = id;
+ bus_size_t off, count;
+ u_int16_t val;
+
+ off = (startrow * vc->vc_ncol + 0) * 2;
+ count = nrows * vc->vc_ncol;
+
+ val = (vc->vc_at << 8) | ' ';
+
+ bus_space_set_region_2(vc->vc_memt, vc->vc_memh, off, val, count);
+}
--- /dev/null
+/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+struct vga_config {
+ /*
+ * Filled in by front-ends.
+ */
+ bus_space_tag_t vc_iot, vc_memt;
+ bus_space_handle_t vc_ioh_b, vc_ioh_c, vc_ioh_d, vc_memh;
+
+ /*
+ * Private to back-end.
+ */
+ int vc_ncol, vc_nrow; /* screen width & height */
+ int vc_ccol, vc_crow; /* current cursor position */
+
+ char vc_so; /* in standout mode? */
+ char vc_at; /* normal attributes */
+ char vc_so_at; /* standout attributes */
+};
+
+int vga_common_probe __P((bus_space_tag_t, bus_space_tag_t));
+void vga_common_setup __P((bus_space_tag_t, bus_space_tag_t,
+ struct vga_config *));
+void vga_wscons_attach __P((struct device *, struct vga_config *, int));
+void vga_wscons_console __P((struct vga_config *));
-# $OpenBSD: ALPHA,v 1.8 1996/10/30 22:38:37 niklas Exp $
-# $NetBSD: ALPHA,v 1.24 1996/09/27 17:08:32 cgd Exp $
+# $OpenBSD: ALPHA,v 1.9 1997/01/24 19:56:53 niklas Exp $
+# $NetBSD: ALPHA,v 1.30 1996/12/03 17:25:27 cgd Exp $
#
# Alpha kernel with all the options you'd want, and more.
options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
options DEC_KN20AA # KN20AA: AlphaStation 600
options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
+options DEC_EB164 # EB164: AlphaPC 164
#options DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
# needs to be set per system
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
# Misc. options
options EISAVERBOSE # recognize "unknown" EISA devices
+#options EXTENT_DEBUG # extent alloc/dealloc code debugging
options FIX_UNALIGNED_VAX_FP # fix unaligned VAX FP loads & stores
options PCIVERBOSE # recognize "unknown" PCI devices
options TCVERBOSE # recognize "unknown" TC devices
tc* at tcasic?
# TurboChannel devices
-ioasic0 at tc? slot ? offset ?
-mcclock0 at ioasic? offset ?
+ioasic* at tc? slot ? offset ?
+mcclock* at ioasic? offset ?
le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
le* at pci? dev ? function ? # PCI LANCE Ethernet (untested)
ncr* at pci? dev ? function ? # NCR 53c8xx SCSI
pceb* at pci? dev ? function ? # Intel PCI-EISA brige
-pcivga* at pci? dev ? function ? # PCI VGA graphics
+vga* at pci? dev ? function ? # PCI VGA graphics
ppb* at pci? dev ? function ? # PCI-PCI bridges
sio* at pci? dev ? function ? # Intel PCI-ISA bridge
tga* at pci? dev ? function ? # DEC ZLXp-E[123] graphics
isa* at sio?
# ISA devices
-mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+mcclock* at isa? port 0x70
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
+com* at isa? port 0x3f8 irq 4 # standard serial ports
+com* at isa? port 0x2f8 irq 3
+lpt* at isa? port 0x3bc irq 7 # standard parallel port
+vga* at isa? # ISA (EISA: XXX) VGA
+#wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# EISA devices
fea* at eisa? slot ? # DEC DEFEA FDDI cards
scsibus* at ncr?
# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+ch* at scsibus? target ? lun ? # SCSI autochangers
+sd* at scsibus? target ? lun ? # SCSI disk drives
+ss* at scsibus? target ? lun ? # SCSI scanners
+st* at scsibus? target ? lun ? # SCSI tape drives
+uk* at scsibus? target ? lun ? # SCSI unknown
# Workstation Console attachments
wscons* at cfb?
-wscons* at pcivga?
+wscons* at vga?
wscons* at sfb?
wscons* at tga?
pseudo-device loop
pseudo-device ppp 4
pseudo-device pty 64
+pseudo-device rd 1
pseudo-device sl 4
pseudo-device strip 4
pseudo-device tun 4
pseudo-device vnd 4
-pseudo-device rd 1
-# $OpenBSD: BUNNY,v 1.7 1996/10/30 22:38:38 niklas Exp $
-# $NetBSD: BUNNY,v 1.9 1996/09/27 17:08:35 cgd Exp $
+# $OpenBSD: BUNNY,v 1.8 1997/01/24 19:56:54 niklas Exp $
+# $NetBSD: BUNNY,v 1.12 1996/11/25 04:16:15 cgd Exp $
#
# Kernel for bunnahabhain.pdl.cs.cmu.edu.
#
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
# PCI devices
de* at pci?
ncr* at pci?
-pcivga* at pci?
+vga* at pci?
sio* at pci?
tga* at pci?
isa* at sio?
# ISA devices
-mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+mcclock* at isa? port 0x70
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
+com* at isa? port 0x3f8 irq 4 # standard serial ports
+com* at isa? port 0x2f8 irq 3
+lpt* at isa? port 0x3bc irq 7 # standard parallel port
+#wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# SCSI bus support
scsibus* at ncr?
cd* at scsibus? target ? lun ?
# Workstation Console attachments
-wscons* at pcivga?
+wscons* at vga?
wscons* at tga?
pseudo-device bpfilter 16
-# $OpenBSD: GENERIC,v 1.11 1996/12/08 00:20:20 niklas Exp $
-# $NetBSD: GENERIC,v 1.24 1996/09/27 17:08:32 cgd Exp $
+# $OpenBSD: GENERIC,v 1.12 1997/01/24 19:56:55 niklas Exp $
+# $NetBSD: GENERIC,v 1.31 1996/12/03 17:25:29 cgd Exp $
#
# Generic Alpha kernel. Enough to get booted, etc., but not much more.
options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
options DEC_KN20AA # KN20AA: AlphaStation 600
options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
+options DEC_EB164 # EB164: AlphaPC 164
#options DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
# needs to be set per system
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
tc* at tcasic?
# TurboChannel devices
-ioasic0 at tc? slot ? offset ?
-mcclock0 at ioasic? offset ?
+ioasic* at tc? slot ? offset ?
+mcclock* at ioasic? offset ?
le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
le* at pci? dev ? function ? # PCI LANCE Ethernet (untested)
ncr* at pci? dev ? function ? # NCR 53c8xx SCSI
pceb* at pci? dev ? function ? # Intel PCI-EISA brige
-pcivga* at pci? dev ? function ? # PCI VGA graphics
+vga* at pci? dev ? function ? # PCI VGA graphics
ppb* at pci? dev ? function ? # PCI-PCI bridges
sio* at pci? dev ? function ? # Intel PCI-ISA bridge
tga* at pci? dev ? function ? # DEC ZLXp-E[123] graphics
isa* at sio?
# ISA devices
-mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+mcclock* at isa? port 0x70
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
+com* at isa? port 0x3f8 irq 4 # standard serial ports
+com* at isa? port 0x2f8 irq 3
+lpt* at isa? port 0x3bc irq 7 # standard parallel port
+vga* at isa? # ISA (EISA: XXX) VGA
+#wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# EISA devices
fea* at eisa? slot ? # DEC DEFEA FDDI cards
scsibus* at ncr?
# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
cd* at scsibus? target ? lun ?
+sd* at scsibus? target ? lun ?
ss* at scsibus? target ? lun ?
+st* at scsibus? target ? lun ?
uk* at scsibus? target ? lun ?
# Workstation Console attachments
wscons* at cfb?
-wscons* at pcivga?
+wscons* at vga?
wscons* at sfb?
wscons* at tga?
pseudo-device bpfilter 16
pseudo-device loop
pseudo-device pty 64
+pseudo-device rd 1
pseudo-device sl 4
pseudo-device vnd 4
-pseudo-device rd 1
-# $OpenBSD: GENERIC.PROF,v 1.1 1996/10/30 22:38:39 niklas Exp $
-# $NetBSD: GENERIC.PROF,v 1.4 1996/09/27 17:08:33 cgd Exp $
+# $OpenBSD: GENERIC.PROF,v 1.2 1997/01/24 19:56:56 niklas Exp $
+# $NetBSD: GENERIC.PROF,v 1.10 1996/12/03 17:25:31 cgd Exp $
#
# Generic Alpha kernel. Enough to get booted, etc., but not much more.
options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
options DEC_KN20AA # KN20AA: AlphaStation 600
options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
+options DEC_EB164 # EB164: AlphaPC 164
#options DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
# needs to be set per system
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
tc* at tcasic?
# TurboChannel devices
-ioasic0 at tc? slot ? offset ?
-mcclock0 at ioasic? offset ?
+ioasic* at tc? slot ? offset ?
+mcclock* at ioasic? offset ?
le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
le* at pci? dev ? function ? # PCI LANCE Ethernet (untested)
ncr* at pci? dev ? function ? # NCR 53c8xx SCSI
pceb* at pci? dev ? function ? # Intel PCI-EISA brige
-pcivga* at pci? dev ? function ? # PCI VGA graphics
+vga* at pci? dev ? function ? # PCI VGA graphics
ppb* at pci? dev ? function ? # PCI-PCI bridges
sio* at pci? dev ? function ? # Intel PCI-ISA bridge
tga* at pci? dev ? function ? # DEC ZLXp-E[123] graphics
isa* at sio?
# ISA devices
-mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+mcclock* at isa? port 0x70
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
+com* at isa? port 0x3f8 irq 4 # standard serial ports
+com* at isa? port 0x2f8 irq 3
+lpt* at isa? port 0x3bc irq 7 # standard parallel port
+vga* at isa? # ISA (EISA: XXX) VGA
+#wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# EISA devices
fea* at eisa? slot ? # DEC DEFEA FDDI cards
scsibus* at ncr?
# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+sd* at scsibus? target ? lun ? # SCSI disk drives
+ss* at scsibus? target ? lun ?
+st* at scsibus? target ? lun ? # SCSI tape drives
+uk* at scsibus? target ? lun ?
# Workstation Console attachments
wscons* at cfb?
-wscons* at pcivga?
+wscons* at vga?
wscons* at sfb?
wscons* at tga?
pseudo-device bpfilter 16
pseudo-device loop
pseudo-device pty 64
+pseudo-device rd 1
pseudo-device sl 4
pseudo-device vnd 4
-# $OpenBSD: JURA,v 1.7 1996/10/30 22:38:40 niklas Exp $
-# $NetBSD: JURA,v 1.9 1996/09/27 17:08:34 cgd Exp $
+# $OpenBSD: JURA,v 1.8 1997/01/24 19:56:57 niklas Exp $
+# $NetBSD: JURA,v 1.11 1996/11/25 04:16:18 cgd Exp $
#
# Kernel for jura.pdl.cs.cmu.edu.
#
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
isa* at jcombo?
mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-# $OpenBSD: Makefile.alpha,v 1.9 1996/12/08 00:20:21 niklas Exp $
-# $NetBSD: Makefile.alpha,v 1.25 1996/09/27 17:33:04 cgd Exp $
+# $OpenBSD: Makefile.alpha,v 1.10 1997/01/24 19:56:58 niklas Exp $
+# $NetBSD: Makefile.alpha,v 1.27 1996/12/01 06:12:25 jonathan Exp $
# Makefile for OpenBSD
#
LD?= ld
MKDEP?= mkdep
STRIP?= strip
+COPTS?= -O2
# source tree is located via $S relative to the compilation directory
.ifndef S
-# $OpenBSD: NOSY,v 1.5 1996/10/30 22:38:42 niklas Exp $
-# $NetBSD: NOSY,v 1.9 1996/09/27 17:08:34 cgd Exp $
+# $OpenBSD: NOSY,v 1.6 1997/01/24 19:56:59 niklas Exp $
+# $NetBSD: NOSY,v 1.10 1996/11/15 19:37:31 cgd Exp $
#
# Jason's DEC 3000/400 in the lab...
#
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
-# $OpenBSD: OPAL,v 1.4 1996/10/30 22:38:43 niklas Exp $
+# $OpenBSD: OPAL,v 1.5 1997/01/24 19:57:00 niklas Exp $
#
# OPAL, kernel for a DEC Multia at Applitron
option DST=1 # Daylight savings rules (for param.c)
# Standard system options
-option SWAPPAGER, DEVPAGER # Paging (mandatory)
option DEBUG, DIAGNOSTIC # Extra kernel debugging
option KTRACE # System call tracing support
#option DDB # Kernel debugger (not yet supported)
+option BOOTKEY # Wait for key press before reboot/halt
# File system options
option FIFO # POSIX fifo support (in all file systems)
le* at pci?
ncr* at pci?
pceb* at pci?
-pcivga* at pci?
+vga* at pci?
ppb* at pci?
sio* at pci?
tga* at pci?
# ISA devices
#isadma0 at isa?
mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
lpt0 at isa? port 0x3bc irq 7 # standard parallel port
# Workstation Console attachments
wscons* at cfb?
-wscons* at pcivga?
+wscons* at vga?
wscons* at sfb?
wscons* at tga?
-# $OpenBSD: RAMDISK,v 1.1 1996/10/30 22:38:44 niklas Exp $
-# $NetBSD: RAMDISK,v 1.4 1996/10/03 20:47:19 cgd Exp $
+# $OpenBSD: RAMDISK,v 1.2 1997/01/24 19:57:02 niklas Exp $
+# $NetBSD: RAMDISK,v 1.9 1996/12/03 17:25:33 cgd Exp $
#
# Generic Alpha kernel. Enough to get booted, etc., but not much more.
options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
options DEC_KN20AA # KN20AA: AlphaStation 600
options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
+options DEC_EB164 # EB164: AlphaPC 164
#options DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
# Enable the hooks used for initializing the ram-disk.
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
-options SWAPPAGER, DEVPAGER # Paging (mandatory)
options DEBUG, DIAGNOSTIC # Extra kernel debugging
options KTRACE # System call tracing support
tc* at tcasic?
# TurboChannel devices
-ioasic0 at tc? slot ? offset ?
-mcclock0 at ioasic? offset ?
+ioasic* at tc? slot ? offset ?
+mcclock* at ioasic? offset ?
le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
le* at pci? dev ? function ? # PCI LANCE Ethernet (untested)
ncr* at pci? dev ? function ? # NCR 53c8xx SCSI
pceb* at pci? dev ? function ? # Intel PCI-EISA brige
-pcivga* at pci? dev ? function ? # PCI VGA graphics
+vga* at pci? dev ? function ? # PCI VGA graphics
ppb* at pci? dev ? function ? # PCI-PCI bridges
sio* at pci? dev ? function ? # Intel PCI-ISA bridge
tga* at pci? dev ? function ? # DEC ZLXp-E[123] graphics
isa* at sio?
# ISA devices
-mcclock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+mcclock* at isa? port 0x70
+pcppi* at isa? # PC prog. periph. interface
+pckbd* at pcppi? # PC keyboard (kbd port)
+pms* at pcppi? # PS/2-style mouse (aux port)
+com* at isa? port 0x3f8 irq 4 # standard serial ports
+com* at isa? port 0x2f8 irq 3
+lpt* at isa? port 0x3bc irq 7 # standard parallel port
+vga* at isa? # ISA (EISA: XXX) VGA
+#wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# EISA devices
fea* at eisa? slot ? # DEC DEFEA FDDI cards
scsibus* at ncr?
# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+sd* at scsibus? target ? lun ? # SCSI disk drives
+st* at scsibus? target ? lun ? # SCSI tape drives
# Workstation Console attachments
wscons* at cfb?
-wscons* at pcivga?
+wscons* at vga?
wscons* at sfb?
wscons* at tga?
pseudo-device bpfilter 16
pseudo-device loop
pseudo-device pty 64
+pseudo-device rd 1
pseudo-device sl 4
pseudo-device vnd 4
-pseudo-device rd 1
-# $OpenBSD: files.alpha,v 1.7 1996/12/08 00:20:22 niklas Exp $
-# $NetBSD: files.alpha,v 1.27 1996/10/22 21:15:45 cgd Exp $
+# $OpenBSD: files.alpha,v 1.8 1997/01/24 19:57:03 niklas Exp $
+# $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $
#
# alpha-specific configuration info
maxusers 2 8 64
+# a wscons output device; used later, but needs to be near the top for
+# common file (e.g. vga) definitions.
+define wsconsdev {[console = -1]}
+
+# this loses, but there's no way to define attributes which have attributes
+define alpha_shared_intr
+file arch/alpha/common/shared_intr.c alpha_shared_intr | dec_eb164 |
+ dec_kn20aa
+
+device vga: wsconsdev
+file arch/alpha/common/vga.c vga
#
# Bus-independent devices
#
-device mainbus { } # no locators (yet?)
+device mainbus { } # no locators (yet?)
attach mainbus at root
-device cpu { } # not really optional; can be a 'bus'
+device cpu { } # not really optional
attach cpu at mainbus
file arch/alpha/alpha/cpu.c cpu
#
# "Workstation Console" glue; attaches frame buffer to emulator & kbd.
#
-define wsconsdev {[console = -1]}
device wscons
attach wscons at wsconsdev
file arch/alpha/wscons/wscons.c wscons needs-flag
file arch/alpha/wscons/kbd.c wscons
file arch/alpha/wscons/ms.c wscons
-
#
# TurboChannel Devices
#
#device jcombo at ibus: isabus
#device jeisa at ibus: eisabus
-device pckbd
-attach pckbd at isa
-file arch/alpha/isa/pckbd.c pckbd needs-flag
-device pms
-attach pms at isa
-file arch/alpha/isa/pms.c pms needs-flag
+file arch/alpha/isa/isa_machdep.c isa
+
+device pcppi { }
+attach pcppi at isa
+file arch/alpha/isa/pcppi.c pcppi
+device pckbd
+attach pckbd at pcppi
+file arch/alpha/isa/pckbd.c pckbd
+
+device pms
+attach pms at pcppi
+file arch/alpha/isa/pms.c pms
+
+attach vga at isa with vga_isa
+file arch/alpha/isa/vga_isa.c vga_isa needs-flag
#
# EISA Bus support
device apecs: pcibus
attach apecs at mainbus
file arch/alpha/pci/apecs.c apecs
+file arch/alpha/pci/apecs_bus_io.c apecs
+file arch/alpha/pci/apecs_bus_mem.c apecs
file arch/alpha/pci/apecs_pci.c apecs
device lca: pcibus
attach lca at mainbus
file arch/alpha/pci/lca.c lca
+file arch/alpha/pci/lca_bus_io.c lca
+file arch/alpha/pci/lca_bus_mem.c lca
file arch/alpha/pci/lca_pci.c lca
-file arch/alpha/pci/apecs_lca_bus_io.c apecs | lca
-file arch/alpha/pci/apecs_lca_bus_mem.c apecs | lca
-
device cia: pcibus
attach cia at mainbus
file arch/alpha/pci/cia.c cia
file arch/alpha/pci/cia_pci.c cia
file arch/alpha/pci/pci_2100_a50.c dec_2100_a50
-file arch/alpha/pci/pci_kn20aa.c dec_kn20aa
file arch/alpha/pci/pci_axppci_33.c dec_axppci_33
+file arch/alpha/pci/pci_eb164.c dec_eb164
+file arch/alpha/pci/pci_eb164_intr.s dec_eb164
+file arch/alpha/pci/pci_kn20aa.c dec_kn20aa
#
file arch/alpha/pci/pci_machdep.c pci
-device sio: isabus
+device sio: isabus, alpha_shared_intr
attach sio at pci
device pceb: isabus, eisabus
attach pceb at pci
file arch/alpha/pci/tga_bt485.c tga
-device pcivga: wsconsdev
-attach pcivga at pci
-file arch/alpha/pci/pcivga.c pcivga needs-flag
+attach vga at pci with vga_pci
+file arch/alpha/pci/vga_pci.c vga_pci needs-flag
#
file arch/alpha/alpha/promcons.c
# XXX
-file arch/alpha/alpha/dec_3000_500.c dec_3000_500
-file arch/alpha/alpha/dec_3000_300.c dec_3000_300
-file arch/alpha/alpha/dec_2100_a50.c dec_2100_a50
-file arch/alpha/alpha/dec_kn20aa.c dec_kn20aa
-file arch/alpha/alpha/dec_axppci_33.c dec_axppci_33
-file arch/alpha/alpha/dec_21000.c dec_21000
+file arch/alpha/alpha/cpuconf.c
+file arch/alpha/alpha/dec_2100_a50.c dec_2100_a50 needs-flag
+file arch/alpha/alpha/dec_21000.c dec_21000 needs-flag
+file arch/alpha/alpha/dec_3000_300.c dec_3000_300 needs-flag
+file arch/alpha/alpha/dec_3000_500.c dec_3000_500 needs-flag
+file arch/alpha/alpha/dec_axppci_33.c dec_axppci_33 needs-flag
+file arch/alpha/alpha/dec_eb164.c dec_eb164 needs-flag
+file arch/alpha/alpha/dec_kn20aa.c dec_kn20aa needs-flag
# OSF/1 Binary Compatibility (COMPAT_OSF1)
include "compat/osf1/files.osf1"
-# $OpenBSD: std.alpha,v 1.4 1996/12/08 00:20:23 niklas Exp $
-# $NetBSD: std.alpha,v 1.8 1996/09/27 17:18:02 cgd Exp $
+# $OpenBSD: std.alpha,v 1.5 1997/01/24 19:57:04 niklas Exp $
+# $NetBSD: std.alpha,v 1.11 1996/11/15 19:37:34 cgd Exp $
#
# Standard/required configuration info for OpenBSD/alpha.
machine alpha
makeoptions DEBUG="-g"
-# NetBSD has these, OpenBSD has them in CDIAGFLAGS in Makefile.alpha instead.
-#makeoptions CWARNFLAGS="-Werror -Wcast-qual"
-options EXEC_ECOFF
-options EXEC_ELF64
-options EXEC_SCRIPT
+# standard ("mandatory") kernel options.
+
+# Executable support: once transitioned to ELF, EXEC_ECOFF will become optional
+options EXEC_ECOFF # (native) ECOFF binary support
+options EXEC_ELF64 # (native) ELF64 binary support
+options EXEC_SCRIPT # shell script support
+
+# VM pager support
+options SWAPPAGER # paging; REQUIRED
+options VNODEPAGER # mmap() of files; REQUIRED
+options DEVPAGER # mmap() of devices; REQUIRED
-/* $OpenBSD: alpha_cpu.h,v 1.1 1996/10/30 22:38:49 niklas Exp $ */
-/* $NetBSD: alpha_cpu.h,v 1.6 1996/08/20 23:02:17 cgd Exp $ */
+/* $OpenBSD: alpha_cpu.h,v 1.2 1997/01/24 19:57:05 niklas Exp $ */
+/* $NetBSD: alpha_cpu.h,v 1.7 1996/11/23 06:25:31 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
#define ALPHA_K1SEG_BASE 0xfffffe0000000000 /* virtual */
#define ALPHA_K1SEG_END 0xffffffffffffffff
-#define ALPHA_K0SEG_TO_PHYS(x) ((x) & 0x00000003ffffffff)
+#define ALPHA_K0SEG_TO_PHYS(x) ((x) & ~ALPHA_K0SEG_BASE)
#define ALPHA_PHYS_TO_K0SEG(x) ((x) | ALPHA_K0SEG_BASE)
#define ALPHA_PTE_VALID 0x0001
-/* $OpenBSD: ansi.h,v 1.5 1996/10/30 22:38:50 niklas Exp $ */
-/* $NetBSD: ansi.h,v 1.5 1996/10/09 21:13:04 cgd Exp $ */
+/* $OpenBSD: ansi.h,v 1.6 1997/01/24 19:57:06 niklas Exp $ */
+/* $NetBSD: ansi.h,v 1.6 1996/11/15 22:38:45 jtc Exp $ */
/*-
* Copyright (c) 1990, 1993
int pad;
} __va_list;
#define _BSD_VA_LIST_ __va_list /* va_list */
+#define _BSD_CLOCKID_T_ int
+#define _BSD_TIMER_T_ int
/*
* Runes (wchar_t) is declared to be an ``int'' instead of the more natural
-/* $OpenBSD: asm.h,v 1.5 1996/10/30 22:38:52 niklas Exp $ */
-/* $NetBSD: asm.h,v 1.10 1996/10/17 18:33:53 cgd Exp $ */
+/* $OpenBSD: asm.h,v 1.6 1997/01/24 19:57:07 niklas Exp $ */
+/* $NetBSD: asm.h,v 1.11 1996/11/30 02:48:57 jtc Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
* MCOUNT
*/
-#ifndef PROF
+#ifndef GPROF
#define MCOUNT /* nothing */
#else
#define MCOUNT \
-/* $OpenBSD: autoconf.h,v 1.6 1996/10/30 22:38:54 niklas Exp $ */
-/* $NetBSD: autoconf.h,v 1.5 1996/07/14 04:12:59 cgd Exp $ */
+/* $OpenBSD: autoconf.h,v 1.7 1997/01/24 19:57:08 niklas Exp $ */
+/* $NetBSD: autoconf.h,v 1.6 1996/11/13 21:13:17 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
char *ctrl_dev_type;
};
-void set_clockintr __P((void));
-void set_iointr __P((void (*)(void *, unsigned long)));
-int badaddr __P((void *, size_t));
void configure __P((void));
void device_register __P((struct device *, void *));
void dumpconf __P((void));
-/* $OpenBSD: bus.h,v 1.4 1996/11/12 22:46:26 niklas Exp $ */
-/* $NetBSD: bus.h,v 1.6 1996/10/22 21:23:49 cgd Exp $ */
+/* $OpenBSD: bus.h,v 1.5 1997/01/24 19:57:09 niklas Exp $ */
+/* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
void (*abs_free) __P((void *, bus_space_handle_t,
bus_size_t));
+ /* barrier */
+ void (*abs_barrier) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_size_t, int));
+
/* read (single) */
u_int8_t (*abs_r_1) __P((void *, bus_space_handle_t,
bus_size_t));
u_int64_t (*abs_r_8) __P((void *, bus_space_handle_t,
bus_size_t));
- /* read multi */
+ /* read multiple */
void (*abs_rm_1) __P((void *, bus_space_handle_t,
bus_size_t, u_int8_t *, bus_size_t));
void (*abs_rm_2) __P((void *, bus_space_handle_t,
void (*abs_w_8) __P((void *, bus_space_handle_t,
bus_size_t, u_int64_t));
- /* write multi */
+ /* write multiple */
void (*abs_wm_1) __P((void *, bus_space_handle_t,
bus_size_t, const u_int8_t *, bus_size_t));
void (*abs_wm_2) __P((void *, bus_space_handle_t,
void (*abs_wr_8) __P((void *, bus_space_handle_t,
bus_size_t, const u_int64_t *, bus_size_t));
- /* set multi */
- /* XXX IMPLEMENT */
+ /* set multiple */
+ void (*abs_sm_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+ void (*abs_sm_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+ void (*abs_sm_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+ void (*abs_sm_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
/* set region */
- /* XXX IMPLEMENT */
+ void (*abs_sr_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+ void (*abs_sr_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+ void (*abs_sr_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+ void (*abs_sr_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
/* copy */
- /* XXX IMPLEMENT */
-
- /* barrier */
- void (*abs_barrier) __P((void *, bus_space_handle_t,
- bus_size_t, bus_size_t, int));
+ void (*abs_c_1) __P((void *, bus_space_handle_t, bus_size_t,
+ bus_space_handle_t, bus_size_t, bus_size_t));
+ void (*abs_c_2) __P((void *, bus_space_handle_t, bus_size_t,
+ bus_space_handle_t, bus_size_t, bus_size_t));
+ void (*abs_c_4) __P((void *, bus_space_handle_t, bus_size_t,
+ bus_space_handle_t, bus_size_t, bus_size_t));
+ void (*abs_c_8) __P((void *, bus_space_handle_t, bus_size_t,
+ bus_space_handle_t, bus_size_t, bus_size_t));
};
(*(t)->__abs_opname(r,sz))((t)->abs_cookie, h, o)
#define __abs_ws(sz, t, h, o, v) \
(*(t)->__abs_opname(w,sz))((t)->abs_cookie, h, o, v)
+#ifndef DEBUG
#define __abs_nonsingle(type, sz, t, h, o, a, c) \
(*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, a, c)
+#else
+#define __abs_nonsingle(type, sz, t, h, o, a, c) \
+ do { \
+ if (((unsigned long)a & (sz - 1)) != 0) \
+ panic("bus non-single %d-byte unaligned (to %p) at %s:%d", \
+ sz, a, __FILE__, __LINE__); \
+ (*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, a, c); \
+ } while (0)
+#endif
+#define __abs_set(type, sz, t, h, o, v, c) \
+ (*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, v, c)
+#define __abs_copy(sz, t, h1, o1, h2, o2, cnt) \
+ (*(t)->__abs_opname(c,sz))((t)->abs_cookie, h1, o1, h2, o2, cnt)
/*
(*(t)->abs_free)((t)->abs_cookie, (h), (s))
+/*
+ * Bus barrier operations.
+ */
+#define bus_space_barrier(t, h, o, l, f) \
+ (*(t)->abs_barrier)((t)->abs_cookie, (h), (o), (l), (f))
+
+#define BUS_BARRIER_READ 0x01
+#define BUS_BARRIER_WRITE 0x02
+
+
/*
* Bus read (single) operations.
*/
/*
* Set multiple operations.
*/
-/* XXX IMPLEMENT */
+#define bus_space_set_multi_1(t, h, o, v, c) \
+ __abs_set(sm,1,(t),(h),(o),(v),(c))
+#define bus_space_set_multi_2(t, h, o, v, c) \
+ __abs_set(sm,2,(t),(h),(o),(v),(c))
+#define bus_space_set_multi_4(t, h, o, v, c) \
+ __abs_set(sm,4,(t),(h),(o),(v),(c))
+#define bus_space_set_multi_8(t, h, o, v, c) \
+ __abs_set(sm,8,(t),(h),(o),(v),(c))
/*
* Set region operations.
*/
-/* XXX IMPLEMENT */
+#define bus_space_set_region_1(t, h, o, v, c) \
+ __abs_set(sr,1,(t),(h),(o),(v),(c))
+#define bus_space_set_region_2(t, h, o, v, c) \
+ __abs_set(sr,2,(t),(h),(o),(v),(c))
+#define bus_space_set_region_4(t, h, o, v, c) \
+ __abs_set(sr,4,(t),(h),(o),(v),(c))
+#define bus_space_set_region_8(t, h, o, v, c) \
+ __abs_set(sr,8,(t),(h),(o),(v),(c))
/*
* Copy operations.
*/
-/* XXX IMPLEMENT */
-
-
-/*
- * Bus barrier operations.
- */
-#define bus_space_barrier(t, h, o, l, f) \
- (*(t)->abs_barrier)((t)->abs_cookie, (h), (o), (l), (f))
-
-#define BUS_BARRIER_READ 0x01
-#define BUS_BARRIER_WRITE 0x02
+#define bus_space_copy_1(t, h1, o1, h2, o2, c) \
+ __abs_copy(1, t, h1, o1, h2, o2, c)
+#define bus_space_copy_2(t, h1, o1, h2, o2, c) \
+ __abs_copy(2, t, h1, o1, h2, o2, c)
+#define bus_space_copy_4(t, h1, o1, h2, o2, c) \
+ __abs_copy(4, t, h1, o1, h2, o2, c)
+#define bus_space_copy_8(t, h1, o1, h2, o2, c) \
+ __abs_copy(8, t, h1, o1, h2, o2, c)
#endif /* _ALPHA_BUS_H_ */
-/* $OpenBSD: cpu.h,v 1.5 1996/10/30 22:38:58 niklas Exp $ */
-/* $NetBSD: cpu.h,v 1.12 1996/07/14 04:15:10 cgd Exp $ */
+/* $OpenBSD: cpu.h,v 1.6 1997/01/24 19:57:10 niklas Exp $ */
+/* $NetBSD: cpu.h,v 1.14 1996/12/07 01:54:50 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */
#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
-#define CPU_MAXID 6 /* 5 valid machdep IDs */
+#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */
+#define CPU_MAXID 7 /* 6 valid machdep IDs */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "unaligned_print", CTLTYPE_INT }, \
{ "unaligned_fix", CTLTYPE_INT }, \
{ "unaligned_sigbus", CTLTYPE_INT }, \
+ { "booted_kernel", CTLTYPE_STRING }, \
}
+#ifdef _KERNEL
+
+struct pcb;
+struct proc;
+struct reg;
+struct rpb;
+struct trapframe;
+
+extern int cold;
+extern struct proc *fpcurproc;
+extern struct rpb *hwrpb;
+
+void XentArith __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void XentIF __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void XentInt __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void XentMM __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void XentRestart __P((void)); /* MAGIC */
+void XentSys __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void XentUna __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
+void alpha_init __P((u_long, u_long));
+void ast __P((struct trapframe *));
+int badaddr __P((void *, size_t));
+void child_return __P((struct proc *p));
+void configure __P((void));
+u_int64_t console_restart __P((u_int64_t, u_int64_t, u_int64_t));
+void do_sir __P((void));
+void dumpconf __P((void));
+void exception_return __P((void)); /* MAGIC */
+void frametoreg __P((struct trapframe *, struct reg *));
+long fswintrberr __P((void)); /* MAGIC */
+void init_prom_interface __P((void));
+void interrupt __P((unsigned long, unsigned long, unsigned long,
+ struct trapframe *));
+u_int64_t hwrpb_checksum __P((void));
+void hwrpb_restart_setup __P((void));
+void regdump __P((struct trapframe *));
+void regtoframe __P((struct reg *, struct trapframe *));
+void savectx __P((struct pcb *));
+void set_clockintr __P((void));
+void set_iointr __P((void (*)(void *, unsigned long)));
+void switch_exit __P((struct proc *)); /* MAGIC */
+void switch_trampoline __P((void)); /* MAGIC */
+void syscall __P((u_int64_t, struct trapframe *));
+void trap __P((unsigned long, unsigned long, unsigned long, unsigned long,
+ struct trapframe *));
+
+#endif /* _KERNEL */
+
#endif /* _ALPHA_CPU_H_ */
--- /dev/null
+/* $NetBSD: cpuconf.h,v 1.1 1996/11/12 05:14:40 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou
+ * 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.
+ */
+
+struct cpusw {
+ const char *family, *option;
+ int present;
+ const char *(*model_name) __P((void));
+ void (*cons_init) __P((void));
+ const char *(*iobus_name) __P((void));
+ void (*device_register) __P((struct device *dev,
+ void *aux));
+};
+
+#define CONCAT(a,b) __CONCAT(a,b)
+
+#define cpu_fn_name(p,f) CONCAT(CONCAT(p,_),f)
+
+#define cpu_decl(p) \
+ extern const char *cpu_fn_name(p,model_name) __P((void)); \
+ extern void cpu_fn_name(p,cons_init) __P((void)); \
+ extern const char *cpu_fn_name(p,iobus_name) __P((void)); \
+ extern void cpu_fn_name(p,device_register) \
+ __P((struct device *, void*));
+
+#define cpu_unknown() { NULL, NULL, 0, }
+#define cpu_notdef(f) { f, NULL, 0 }
+
+#define cpu_option_string(o) __STRING(o)
+#define cpu_option_present(o) (CONCAT(N,o) > NULL)
+#define cpu_function_init(o,p,f) \
+ (cpu_option_present(o) ? cpu_fn_name(p,f) : 0)
+#define cpu_init(f,o,p) \
+ { \
+ f, cpu_option_string(o) , cpu_option_present(o), \
+ cpu_function_init(o,p,model_name), \
+ cpu_function_init(o,p,cons_init), \
+ cpu_function_init(o,p,iobus_name), \
+ cpu_function_init(o,p,device_register), \
+ }
+
+#ifdef _KERNEL
+extern const struct cpusw cpusw[];
+extern const int ncpusw;
+#endif
-/* $OpenBSD: intr.h,v 1.3 1996/10/30 22:39:09 niklas Exp $ */
-/* $NetBSD: intr.h,v 1.2 1996/07/09 00:33:25 cgd Exp $ */
+/* $OpenBSD: intr.h,v 1.4 1997/01/24 19:57:12 niklas Exp $ */
+/* $NetBSD: intr.h,v 1.4 1996/12/03 17:34:47 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
#ifndef _ALPHA_INTR_H_
#define _ALPHA_INTR_H_
+#include <sys/queue.h>
+
#define IPL_NONE 0 /* disable only this interrupt */
#define IPL_BIO 1 /* disable block I/O interrupts */
#define IPL_NET 2 /* disable network interrupts */
#define IPL_CLOCK 4 /* disable clock interrupts */
#define IPL_HIGH 5 /* disable all interrupts */
+#define IST_UNUSABLE -1 /* interrupt cannot be used */
#define IST_NONE 0 /* none (dummy) */
#define IST_PULSE 1 /* pulsed */
#define IST_EDGE 2 /* edge-triggered */
#define SIR_NET 0x1
#define SIR_CLOCK 0x2
-#define siroff(x) ssir &= ~(x)
#define setsoftnet() ssir |= SIR_NET
#define setsoftclock() ssir |= SIR_CLOCK
+/*
+ * Alpha shared-interrupt-line common code.
+ */
+
+struct alpha_shared_intrhand {
+ TAILQ_ENTRY(alpha_shared_intrhand)
+ ih_q;
+ int (*ih_fn) __P((void *));
+ void *ih_arg;
+ int ih_level;
+};
+
+struct alpha_shared_intr {
+ TAILQ_HEAD(,alpha_shared_intrhand)
+ intr_q;
+ int intr_sharetype;
+ int intr_dfltsharetype;
+ int intr_nstrays;
+ int intr_maxstrays;
+};
+
+struct alpha_shared_intr *alpha_shared_intr_alloc __P((unsigned int));
+int alpha_shared_intr_dispatch __P((struct alpha_shared_intr *,
+ unsigned int));
+void *alpha_shared_intr_establish __P((struct alpha_shared_intr *,
+ unsigned int, int, int, int (*)(void *), void *, const char *));
+int alpha_shared_intr_get_sharetype __P((struct alpha_shared_intr *,
+ unsigned int));
+int alpha_shared_intr_isactive __P((struct alpha_shared_intr *,
+ unsigned int));
+void alpha_shared_intr_set_dfltsharetype __P((struct alpha_shared_intr *,
+ unsigned int, int));
+void alpha_shared_intr_set_maxstrays __P((struct alpha_shared_intr *,
+ unsigned int, int));
+void alpha_shared_intr_stray __P((struct alpha_shared_intr *, unsigned int,
+ const char *));
+
#endif
-/* $OpenBSD: intrcnt.h,v 1.4 1996/10/30 22:39:10 niklas Exp $ */
-/* $NetBSD: intrcnt.h,v 1.6 1996/06/05 03:38:02 cgd Exp $ */
+/* $OpenBSD: intrcnt.h,v 1.5 1997/01/24 19:57:13 niklas Exp $ */
+/* $NetBSD: intrcnt.h,v 1.7 1996/11/16 23:11:57 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
ASCIZ "ioasic le"; \
ASCIZ "ioasic scc 0"; \
ASCIZ "ioasic scc 1"; \
- ASCIZ "ioasic am79c30";
+ ASCIZ "ioasic am79c30"; \
+ ASCIZ "eb164 irq 0"; \
+ ASCIZ "eb164 irq 1"; \
+ ASCIZ "eb164 irq 2"; \
+ ASCIZ "eb164 irq 3"; \
+ ASCIZ "eb164 irq 4"; \
+ ASCIZ "eb164 irq 5"; \
+ ASCIZ "eb164 irq 6"; \
+ ASCIZ "eb164 irq 7"; \
+ ASCIZ "eb164 irq 8"; \
+ ASCIZ "eb164 irq 9"; \
+ ASCIZ "eb164 irq 10"; \
+/* 0x50 */ ASCIZ "eb164 irq 11"; \
+ ASCIZ "eb164 irq 12"; \
+ ASCIZ "eb164 irq 13"; \
+ ASCIZ "eb164 irq 14"; \
+ ASCIZ "eb164 irq 15"; \
+ ASCIZ "eb164 irq 16"; \
+ ASCIZ "eb164 irq 17"; \
+ ASCIZ "eb164 irq 18"; \
+ ASCIZ "eb164 irq 19"; \
+ ASCIZ "eb164 irq 20"; \
+ ASCIZ "eb164 irq 21"; \
+ ASCIZ "eb164 irq 22"; \
+ ASCIZ "eb164 irq 23";
#define INTRCNT_DEFINITION \
/* 0x00 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
/* 0x10 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
/* 0x20 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
/* 0x30 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x40 */ .quad 0, 0, 0, 0, 0;
+/* 0x40 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
+/* 0x50 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
#define INTRCNT_CLOCK 0
#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
#define INTRCNT_TCDS_LEN 2
#define INTRCNT_IOASIC (INTRCNT_TCDS + INTRCNT_TCDS_LEN)
#define INTRCNT_IOASIC_LEN 4
+#define INTRCNT_EB164_IRQ (INTRCNT_IOASIC + INTRCNT_IOASIC_LEN)
+#define INTRCNT_EB164_IRQ_LEN 24
#ifndef _LOCORE
extern volatile long intrcnt[];
-/* $OpenBSD: param.h,v 1.8 1996/12/11 11:12:51 deraadt Exp $ */
-/* $NetBSD: param.h,v 1.14 1996/10/25 20:48:59 cgd Exp $ */
+/* $OpenBSD: param.h,v 1.9 1997/01/24 19:57:14 niklas Exp $ */
+/* $NetBSD: param.h,v 1.15 1996/11/13 21:13:19 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define MID_MACHINE MID_ALPHA
#include <machine/alpha_cpu.h>
+#include <machine/cpu.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
-/* $OpenBSD: pcb.h,v 1.3 1996/10/30 22:39:14 niklas Exp $ */
-/* $NetBSD: pcb.h,v 1.4 1996/10/07 23:57:21 cgd Exp $ */
+/* $OpenBSD: pcb.h,v 1.4 1997/01/24 19:57:15 niklas Exp $ */
+/* $NetBSD: pcb.h,v 1.5 1996/11/13 22:21:00 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
-/* $OpenBSD: pmap.old.h,v 1.1 1996/10/30 22:39:18 niklas Exp $ */
-/* $NetBSD: pmap.old.h,v 1.5 1996/07/09 00:39:24 cgd Exp $ */
+/* $OpenBSD: pmap.old.h,v 1.2 1997/01/24 19:57:16 niklas Exp $ */
+/* $NetBSD: pmap.old.h,v 1.6 1996/11/13 21:13:19 cgd Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
/* Machine-specific functions. */
void pmap_activate __P((pmap_t));
-void pmap_emulate_reference __P((struct proc *p, vm_offset_t v,
- int user, int write));
+void pmap_emulate_reference __P((struct proc *, vm_offset_t, int, int));
void pmap_bootstrap __P((vm_offset_t, vm_offset_t));
+void pmap_unmap_prom __P((void));
#endif /* _KERNEL */
#endif /* _PMAP_MACHINE_ */
-/* $OpenBSD: proc.h,v 1.3 1996/10/30 22:39:19 niklas Exp $ */
+/* $OpenBSD: proc.h,v 1.4 1997/01/24 19:57:16 niklas Exp $ */
/* $NetBSD: proc.h,v 1.2 1995/03/24 15:01:36 cgd Exp $ */
/*
#ifdef _KERNEL
void switch_exit __P((struct proc *));
-void switch_trampoline __P((void (*) __P((struct proc *)), void *));
#endif
-/* $OpenBSD: profile.h,v 1.4 1996/10/30 22:39:20 niklas Exp $ */
-/* $NetBSD: profile.h,v 1.6 1996/09/15 22:33:28 cgd Exp $ */
+/* $OpenBSD: profile.h,v 1.5 1997/01/24 19:57:17 niklas Exp $ */
+/* $NetBSD: profile.h,v 1.7 1996/11/13 22:21:01 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
-/* $OpenBSD: prom.h,v 1.5 1996/11/28 20:09:29 niklas Exp $ */
-/* $NetBSD: prom.h,v 1.4 1996/10/15 23:52:49 cgd Exp $ */
+/* $OpenBSD: prom.h,v 1.6 1997/01/24 19:57:18 niklas Exp $ */
+/* $NetBSD: prom.h,v 1.6 1996/11/13 22:21:03 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Keith Bostic, Chris G. Demetriou
void init_prom_interface __P((void));
void hwrbp_restart_setup __P((void));
-int prom_dispatch __P((int, ...));
-int promcnlookc __P((dev_t, char *));
#endif
/* Prom operation values. */
* either don't need to copy anything, or don't need the copy because it's
* already being done elsewhere, are defined here.
*/
-#define prom_close(chan) prom_dispatch(PROM_R_CLOSE, chan)
-#define prom_read(chan, len, buf, blkno) \
- prom_dispatch(PROM_R_READ, chan, len, buf, blkno)
-#define prom_write(chan, len, buf, blkno) \
- prom_dispatch(PROM_R_WRITE, chan, len, buf, blkno)
+#define prom_close(chan) \
+ prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0)
+#define prom_read(chan, len, buf, blkno) \
+ prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno)
+#define prom_write(chan, len, buf, blkno) \
+ prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno)
+#define prom_putstr(chan, str, len) \
+ prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0)
+#define prom_getc(chan) \
+ prom_dispatch(PROM_R_GETC, chan, 0, 0, 0)
+#define prom_getenv_disp(id, buf, len) \
+ prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0)
+
+#ifndef ASSEMBLER
+#ifdef _KERNEL
+void promcnputc __P((dev_t, int));
+int promcngetc __P((dev_t));
+int promcnlookc __P((dev_t, char *));
+
+u_int64_t prom_dispatch __P((u_int64_t, u_int64_t, u_int64_t, u_int64_t,
+ u_int64_t));
+#endif /* _KERNEL */
+#endif /* ASSEMBLER */
-/* $OpenBSD: pte.h,v 1.5 1996/10/30 22:39:23 niklas Exp $ */
-/* $NetBSD: pte.h,v 1.7 1996/10/01 20:21:05 cgd Exp $ */
+/* $OpenBSD: pte.h,v 1.6 1997/01/24 19:57:19 niklas Exp $ */
+/* $NetBSD: pte.h,v 1.8 1996/11/13 22:21:04 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
-/* $OpenBSD: rpb.h,v 1.5 1996/10/30 22:39:26 niklas Exp $ */
-/* $NetBSD: rpb.h,v 1.7 1996/04/29 16:23:11 cgd Exp $ */
+/* $OpenBSD: rpb.h,v 1.6 1997/01/24 19:57:20 niklas Exp $ */
+/* $NetBSD: rpb.h,v 1.11 1996/11/13 22:26:41 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Keith Bostic, Chris G. Demetriou
#define ST_DEC_3000_300 7 /* "Pelican" (TC) */
#define ST_DEC_2100_A500 9 /* "Sable" (?) */
#define ST_DEC_APXVME_64 10 /* "AXPvme" (VME?) */
-#define ST_DEC_AXPPCI_33 11 /* "NoName" (PCI/ISA?) */
+#define ST_DEC_AXPPCI_33 11 /* "NoName" (PCI/ISA) */
#define ST_DEC_21000 12 /* "TurboLaser" (?) */
#define ST_DEC_2100_A50 13 /* "Avanti" (PCI/ISA) */
#define ST_DEC_MUSTANG 14 /* "Mustang" (?) */
#define ST_DEC_KN20AA 15 /* kn20aa (PCI/EISA) */
#define ST_DEC_1000 17 /* "Mikasa" (PCI/ISA?) */
+#define ST_EB66 19 /* EB66 (PCI/ISA?) */
+#define ST_EB64P 20 /* EB64+ (PCI/ISA?) */
+#define ST_DEC_4100 22 /* "Rawhide" (?) */
+#define ST_DEC_EV45_PBP 23 /* "Lego" (?) */
+#define ST_DEC_2100A_A500 24 /* "Lynx" (?) */
+#define ST_EB164 26 /* EB164 (PCI/ISA) */
+#define ST_DEC_1000A 27 /* "Noritake" (?) */
+#define ST_DEC_ALPHAVME_224 28 /* "Cortex" (?) */
u_int64_t rpb_type; /* 50: */
vm_offset_t rpb_memdat_off; /* C8: memory data offset */
vm_offset_t rpb_condat_off; /* D0: config data offset */
vm_offset_t rpb_fru_off; /* D8: FRU table offset */
- /* XXX Are the protos below correct? */
- long (*rpb_save_term) __P((long));
- /* E0: terminal save */
- long rpb_save_term_val; /* E8: */
- long (*rpb_rest_term) __P((long));
- /* F0: terminal restore */
- long rpb_rest_term_val; /* F8: */
- long (*rpb_restart) __P((long));
- /* 100: restart */
- long rpb_restart_val; /* 108: */
+ u_int64_t rpb_save_term; /* E0: terminal save */
+ u_int64_t rpb_save_term_val; /* E8: */
+ u_int64_t rpb_rest_term; /* F0: terminal restore */
+ u_int64_t rpb_rest_term_val; /* F8: */
+ u_int64_t rpb_restart; /* 100: restart */
+ u_int64_t rpb_restart_val; /* 108: */
u_int64_t rpb_reserve_os; /* 110: */
u_int64_t rpb_reserve_hw; /* 118: */
u_int64_t rpb_checksum; /* 120: HWRPB checksum */
u_int64_t rpb_tbhint[8]; /* 149: TB hint block */
};
-#ifdef _KERNEL
-extern struct rpb *hwrpb;
-#endif
-
/*
* PCS: Per-CPU information.
*/
#define PCS_PROC_MAJOR 0x00000000ffffffff
#define PCS_PROC_MAJORSHIFT 0
+
#define PCS_PROC_EV3 1 /* EV3 */
#define PCS_PROC_EV4 2 /* EV4: 21064 */
-#define PCS_PROC_SIMULATOR 3 /* simulation */
+#define PCS_PROC_SIMULATION 3 /* Simulation */
#define PCS_PROC_LCA4 4 /* LCA4: 2106[68] */
#define PCS_PROC_EV5 5 /* EV5: 21164 */
#define PCS_PROC_EV45 6 /* EV45: 21064A */
+#define PCS_PROC_EV56 7 /* EV56: 21164A */
+#define PCS_PROC_EV6 8 /* EV6: 21264 */
+#define PCS_PROC_PCA56 9 /* PCA256: 21164PC */
#define PCS_PROC_MINOR 0xffffffff00000000
#define PCS_PROC_MINORSHIFT 32
-#define PCS_PROC_PASS2 0 /* pass 2 or 2.1 */
-#define PCS_PROC_PASS3 1 /* pass 3 */
- /* 4 == ev4s? or 1 == ... ? */
- /* minor on the LCA appears to be pass number */
+
+ /* Minor number interpretation is processor specific. See cpu.c. */
u_int64_t pcs_proc_var; /* B8: processor variation. */
* CRD: Console Routine Descriptor
*/
struct crd {
- int64_t descriptor;
- int (*code) __P((struct crd *));
+ int64_t descriptor;
+ int (*entry_va) __P((struct crd *));
};
/*
-/* $OpenBSD: types.h,v 1.3 1996/10/30 22:39:32 niklas Exp $ */
-/* $NetBSD: types.h,v 1.5 1996/10/01 14:26:18 cgd Exp $ */
+/* $OpenBSD: types.h,v 1.4 1997/01/24 19:57:21 niklas Exp $ */
+/* $NetBSD: types.h,v 1.6 1996/12/05 00:13:47 cgd Exp $ */
/*-
* Copyright (c) 1990, 1993
typedef int64_t register_t;
+#define __BROKEN_INDIRECT_CONFIG
+
#endif /* _MACHTYPES_H_ */
--- /dev/null
+/* $NetBSD: isa_machdep.c,v 1.5 1996/11/23 06:38:49 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+/*
+ * Machine-specific functions for PCI autoconfiguration.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <dev/isa/isavar.h>
+
+#include "vga_isa.h"
+#if NVGA_ISA
+#include <alpha/isa/vga_isavar.h>
+#endif
+
+struct {
+ int (*probe) __P((bus_space_tag_t, bus_space_tag_t));
+ void (*console) __P((bus_space_tag_t, bus_space_tag_t));
+} isa_display_console_devices[] = {
+#if NVGA_ISA
+ { vga_isa_console_match, vga_isa_console_attach },
+#endif
+ { },
+};
+
+void
+isa_display_console(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ int i = 0;
+
+ while (isa_display_console_devices[i].probe != NULL)
+ if ((*isa_display_console_devices[i].probe)(iot, memt)) {
+ (*isa_display_console_devices[i].console)(iot, memt);
+ break;
+ }
+}
-/* $OpenBSD: isa_machdep.h,v 1.3 1996/10/30 22:39:37 niklas Exp $ */
-/* $NetBSD: isa_machdep.h,v 1.2 1996/04/12 05:39:02 cgd Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.4 1997/01/24 19:57:24 niklas Exp $ */
+/* $NetBSD: isa_machdep.h,v 1.3 1996/11/19 04:53:07 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
(*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (nm))
#define isa_intr_disestablish(c, h) \
(*(c)->ic_intr_disestablish)((c)->ic_v, (h))
+
+/*
+ * alpha-specific ISA functions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+void isa_display_console __P((bus_space_tag_t, bus_space_tag_t));
-/* $OpenBSD: mcclock_isa.c,v 1.5 1996/12/08 00:20:27 niklas Exp $ */
-/* $NetBSD: mcclock_isa.c,v 1.3 1996/10/23 04:12:19 cgd Exp $ */
+/* $OpenBSD: mcclock_isa.c,v 1.6 1997/01/24 19:57:24 niklas Exp $ */
+/* $NetBSD: mcclock_isa.c,v 1.5 1996/12/05 01:39:29 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
bus_space_handle_t sc_ioh;
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int mcclock_isa_match __P((struct device *, void *, void *));
+#else
+int mcclock_isa_match __P((struct device *, struct cfdata *, void *));
+#endif
void mcclock_isa_attach __P((struct device *, struct device *, void *));
struct cfattach mcclock_isa_ca = {
int
mcclock_isa_match(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct isa_attach_args *ia = aux;
+ bus_space_handle_t ioh;
+
+ if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x70) ||
+ /* (ia->ia_iosize != 0 && ia->ia_iosize != 0x2) || XXX isa.c */
+ ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
- if (ia->ia_iobase != 0x70 && ia->ia_iobase != -1)
+ if (bus_space_map(ia->ia_iot, 0x70, 0x2, 0, &ioh))
return (0);
- ia->ia_iobase = 0x70; /* XXX */
- ia->ia_iosize = 2; /* XXX */
- ia->ia_msize = 0;
+ bus_space_unmap(ia->ia_iot, ioh, 0x2);
+
+ ia->ia_iobase = 0x70;
+ ia->ia_iosize = 0x2;
return (1);
}
-/* $OpenBSD: pckbd.c,v 1.8 1996/12/08 00:20:28 niklas Exp $ */
-/* $NetBSD: pckbd.c,v 1.10 1996/10/23 04:12:20 cgd Exp $ */
+/* $OpenBSD: pckbd.c,v 1.9 1997/01/24 19:57:26 niklas Exp $ */
+/* $NetBSD: pckbd.c,v 1.14 1996/12/05 01:39:30 cgd Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
#include <alpha/isa/spkrreg.h>
#include <alpha/isa/timerreg.h>
#include <machine/wsconsio.h>
+#include <alpha/isa/pcppivar.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/kbd.h>
#include "wscons.h"
+#undef KBDATAP
+#undef KBOUTP
+#undef KBSTATP
+#undef KBCMDP
+#undef PITAUX_PORT
+#define KBDATAP 0x0 /* kbd data port (I) */
+#define KBOUTP 0x0 /* kbd data port (O) */
+#define KBSTATP 0x4 /* kbd controller status port (I) */
+#define KBCMDP 0x4 /* kbd controller port (O) */
+#define PITAUX_PORT 0x1 /* port B of PPI */
+
static volatile u_char ack, nak; /* Don't ask. */
static u_char async, kernel, polling; /* Really, you don't want to know. */
static u_char lock_state = 0x00, /* all off */
bus_space_tag_t pckbd_iot;
isa_chipset_tag_t pckbd_ic;
-bus_space_handle_t pckbd_data_ioh;
-#define pckbd_out_ioh pckbd_data_ioh
-bus_space_handle_t pckbd_status_ioh;
-#define pckbd_cmd_ioh pckbd_status_ioh
+bus_space_handle_t pckbd_ioh;
bus_space_handle_t pckbd_timer_ioh;
-bus_space_handle_t pckbd_pitaux_ioh;
bus_space_handle_t pckbd_delay_ioh;
struct pckbd_softc {
int sc_bellpitch; /* last pitch programmed */
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int pckbdprobe __P((struct device *, void *, void *));
+#else
+int pckbdprobe __P((struct device *, struct cfdata *, void *));
+#endif
void pckbdattach __P((struct device *, struct device *, void *));
int pckbdintr __P((void *));
int pckbd_cngetc __P((struct device *));
void pckbd_cnpollc __P((struct device *, int));
void pckbd_bell __P((struct device *, struct wsconsio_bell_data *));
-int pckbd_ioctl __P((struct device *, u_long, caddr_t, int,
+int pckbd_ioctl __P((void *, u_long, caddr_t, int,
struct proc *));
-
char *pckbd_translate __P((struct device *dev, int c));
#if NWSCONS
#endif
void pckbd_bell_stop __P((void *));
-
static __inline int kbd_wait_output __P((void));
static __inline int kbd_wait_input __P((void));
static __inline void kbd_flush_input __P((void));
-u_char kbc_get8042cmd __P((void));
-int kbc_put8042cmd __P((u_char));
+u_char kbc_get8042cmd __P((void));
+int kbc_put8042cmd __P((u_char));
+int kbd_cmd __P((u_char, u_char));
+void do_async_update __P((void *));
+void async_update __P((void));
+
int kbd_cmd __P((u_char, u_char));
void do_async_update __P((void *));
void async_update __P((void));
u_int i;
for (i = 100000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_IBF)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_IBF)
== 0) {
KBD_DELAY;
return 1;
u_int i;
for (i = 100000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
!= 0) {
KBD_DELAY;
return 1;
u_int i;
for (i = 10; i; i--) {
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
== 0)
return;
KBD_DELAY;
- (void) bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ (void) bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
}
}
if (!kbd_wait_output())
return -1;
- bus_space_write_1(pckbd_iot, pckbd_cmd_ioh, 0, K_RDCMDBYTE);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBCMDP, K_RDCMDBYTE);
if (!kbd_wait_input())
return -1;
- return bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ return bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
}
#endif
if (!kbd_wait_output())
return 0;
- bus_space_write_1(pckbd_iot, pckbd_cmd_ioh, 0, K_LDCMDBYTE);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBCMDP, K_LDCMDBYTE);
if (!kbd_wait_output())
return 0;
- bus_space_write_1(pckbd_iot, pckbd_out_ioh, 0, val);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBOUTP, val);
return 1;
}
if (!kbd_wait_output())
return 0;
ack = nak = 0;
- bus_space_write_1(pckbd_iot, pckbd_out_ioh, 0, val);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, KBOUTP, val);
if (polling)
for (i = 100000; i; i--) {
if (bus_space_read_1(pckbd_iot,
- pckbd_status_ioh, 0) & KBS_DIB) {
+ pckbd_ioh, KBSTATP) & KBS_DIB) {
register u_char c;
KBD_DELAY;
c = bus_space_read_1(pckbd_iot,
- pckbd_data_ioh, 0);
+ pckbd_ioh, KBDATAP);
if (c == KBR_ACK || c == KBR_ECHO) {
ack = 1;
return 1;
else
for (i = 100000; i; i--) {
(void) bus_space_read_1(pckbd_iot,
- pckbd_status_ioh, 0);
+ pckbd_ioh, KBSTATP);
if (ack)
return 1;
if (nak)
int
pckbdprobe(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
- struct isa_attach_args *ia = aux;
- u_int i;
-
- pckbd_iot = ia->ia_iot;
- pckbd_ic = ia->ia_ic;
+ struct pcppi_attach_args *pa = aux;
+ u_int i, rv;
- if (bus_space_map(pckbd_iot, KBDATAP, 1, 0, &pckbd_data_ioh) ||
- bus_space_map(pckbd_iot, KBSTATP, 1, 0, &pckbd_status_ioh) ||
- bus_space_map(pckbd_iot, IO_TIMER1, 4, 0, &pckbd_timer_ioh) ||
- bus_space_map(pckbd_iot, PITAUX_PORT, 1, 0, &pckbd_pitaux_ioh))
+ if (pa->pa_slot != PCPPI_KBD_SLOT)
return 0;
- pckbd_delay_ioh = ia->ia_delaybah;
+ rv = 0;
+
+ pckbd_iot = pa->pa_iot;
+ pckbd_ic = pa->pa_ic;
+ pckbd_ioh = pa->pa_ioh;
+ pckbd_timer_ioh = pa->pa_pit_ioh;
+ pckbd_delay_ioh = pa->pa_delaybah;
/* Enable interrupts and keyboard, etc. */
if (!kbc_put8042cmd(CMDBYTE)) {
printf("pcprobe: command error\n");
- return 0;
+ goto lose;
}
+ rv = 1; /* from here one out, we let it succeed */
#if 1
/* Flush any garbage. */
kbd_flush_input();
goto lose;
}
for (i = 600000; i; i--)
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
!= 0) {
KBD_DELAY;
break;
}
- if (i == 0 || bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0)
+ if (i == 0 || bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP)
!= KBR_RSTDONE) {
printf("pcprobe: reset error %d\n", 2);
goto lose;
*/
#endif
- ia->ia_iobase = 16;
- ia->ia_iosize = 0;
- return 1;
+ return rv;
}
void
void *aux;
{
struct pckbd_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
-
- pckbd_iot = ia->ia_iot;
- pckbd_ic = ia->ia_ic;
+ struct pcppi_attach_args *pa = aux;
- if (bus_space_map(pckbd_iot, KBDATAP, 1, 0, &pckbd_data_ioh) ||
- bus_space_map(pckbd_iot, KBSTATP, 1, 0, &pckbd_status_ioh) ||
- bus_space_map(pckbd_iot, IO_TIMER1, 4, 0, &pckbd_timer_ioh) ||
- bus_space_map(pckbd_iot, PITAUX_PORT, 1, 0, &pckbd_pitaux_ioh))
- panic("pckbdattach couldn't map");
+ pckbd_iot = pa->pa_iot;
+ pckbd_ic = pa->pa_ic;
+ pckbd_ioh = pa->pa_ioh;
+ pckbd_timer_ioh = pa->pa_pit_ioh;
+ pckbd_delay_ioh = pa->pa_delaybah;
- pckbd_delay_ioh = ia->ia_delaybah;
-
- sc->sc_ih = isa_intr_establish(pckbd_ic, ia->ia_irq, IST_EDGE,
- IPL_TTY, pckbdintr, sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(pckbd_ic, 1, IST_EDGE, IPL_TTY,
+ pckbdintr, sc, sc->sc_dev.dv_xname);
sc->sc_bellactive = sc->sc_bellpitch = 0;
u_char data;
static u_char last;
- if ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB) == 0)
+ if ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB) == 0)
return 0;
if (polling)
return 1;
do {
KBD_DELAY;
- data = bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ data = bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
switch (data) {
case KBR_ACK:
#endif
break;
}
- } while (bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB);
+ } while (bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB);
return 1;
}
void
-do_async_update(vp)
- void *vp;
+do_async_update(v)
+ void *v;
{
- int poll = *(int *)vp;
+ u_long poll = (u_long)v;
async = 0;
void
async_update()
{
- static int nopoll = 0;
- static int poll = 1;
-
if (kernel || polling) {
if (async)
- untimeout(do_async_update, &nopoll);
- do_async_update(&poll);
+ untimeout(do_async_update, NULL);
+ do_async_update((void *)1);
} else {
if (async)
return;
async = 1;
- timeout(do_async_update, &nopoll, 1);
+ timeout(do_async_update, NULL, 1);
}
}
int
-pckbd_ioctl(dev, cmd, data, flag, p)
- struct device *dev;
+pckbd_ioctl(v, cmd, data, flag, p)
+ void *v;
u_long cmd;
caddr_t data;
int flag;
char shift[CODE_SIZE];
char ctl[CODE_SIZE];
} Scan_def;
-
static Scan_def scan_codes[] = {
- { NONE, "", "", "" }, /* 0 unused */
- { ASCII, "\033", "\033", "\033" }, /* 1 ESCape */
- { ASCII, "1", "!", "!" }, /* 2 1 */
- { ASCII, "2", "@", "\000" }, /* 3 2 */
- { ASCII, "3", "#", "#" }, /* 4 3 */
- { ASCII, "4", "$", "$" }, /* 5 4 */
- { ASCII, "5", "%", "%" }, /* 6 5 */
- { ASCII, "6", "^", "\036" }, /* 7 6 */
- { ASCII, "7", "&", "&" }, /* 8 7 */
- { ASCII, "8", "*", "\010" }, /* 9 8 */
- { ASCII, "9", "(", "(" }, /* 10 9 */
- { ASCII, "0", ")", ")" }, /* 11 0 */
- { ASCII, "-", "_", "\037" }, /* 12 - */
- { ASCII, "=", "+", "+" }, /* 13 = */
- { ASCII, "\177", "\177", "\010" }, /* 14 backspace */
- { ASCII, "\t", "\177\t", "\t" }, /* 15 tab */
- { ASCII, "q", "Q", "\021" }, /* 16 q */
- { ASCII, "w", "W", "\027" }, /* 17 w */
- { ASCII, "e", "E", "\005" }, /* 18 e */
- { ASCII, "r", "R", "\022" }, /* 19 r */
- { ASCII, "t", "T", "\024" }, /* 20 t */
- { ASCII, "y", "Y", "\031" }, /* 21 y */
- { ASCII, "u", "U", "\025" }, /* 22 u */
- { ASCII, "i", "I", "\011" }, /* 23 i */
- { ASCII, "o", "O", "\017" }, /* 24 o */
- { ASCII, "p", "P", "\020" }, /* 25 p */
- { ASCII, "[", "{", "\033" }, /* 26 [ */
- { ASCII, "]", "}", "\035" }, /* 27 ] */
- { ASCII, "\r", "\r", "\n" }, /* 28 return */
- { CTL, "", "", "" }, /* 29 control */
- { ASCII, "a", "A", "\001" }, /* 30 a */
- { ASCII, "s", "S", "\023" }, /* 31 s */
- { ASCII, "d", "D", "\004" }, /* 32 d */
- { ASCII, "f", "F", "\006" }, /* 33 f */
- { ASCII, "g", "G", "\007" }, /* 34 g */
- { ASCII, "h", "H", "\010" }, /* 35 h */
- { ASCII, "j", "J", "\n" }, /* 36 j */
- { ASCII, "k", "K", "\013" }, /* 37 k */
- { ASCII, "l", "L", "\014" }, /* 38 l */
- { ASCII, ";", ":", ";" }, /* 39 ; */
- { ASCII, "'", "\"", "'" }, /* 40 ' */
- { ASCII, "`", "~", "`" }, /* 41 ` */
- { SHIFT, "", "", "" }, /* 42 shift */
- { ASCII, "\\", "|", "\034" }, /* 43 \ */
- { ASCII, "z", "Z", "\032" }, /* 44 z */
- { ASCII, "x", "X", "\030" }, /* 45 x */
- { ASCII, "c", "C", "\003" }, /* 46 c */
- { ASCII, "v", "V", "\026" }, /* 47 v */
- { ASCII, "b", "B", "\002" }, /* 48 b */
- { ASCII, "n", "N", "\016" }, /* 49 n */
- { ASCII, "m", "M", "\r" }, /* 50 m */
- { ASCII, ",", "<", "<" }, /* 51 , */
- { ASCII, ".", ">", ">" }, /* 52 . */
- { ASCII, "/", "?", "\037" }, /* 53 / */
- { SHIFT, "", "", "" }, /* 54 shift */
- { KP, "*", "*", "*" }, /* 55 kp * */
- { ALT, "", "", "" }, /* 56 alt */
- { ASCII, " ", " ", "\000" }, /* 57 space */
- { CAPS, "", "", "" }, /* 58 caps */
- { FUNC, "\033[M", "\033[Y", "\033[k" }, /* 59 f1 */
- { FUNC, "\033[N", "\033[Z", "\033[l" }, /* 60 f2 */
- { FUNC, "\033[O", "\033[a", "\033[m" }, /* 61 f3 */
- { FUNC, "\033[P", "\033[b", "\033[n" }, /* 62 f4 */
- { FUNC, "\033[Q", "\033[c", "\033[o" }, /* 63 f5 */
- { FUNC, "\033[R", "\033[d", "\033[p" }, /* 64 f6 */
- { FUNC, "\033[S", "\033[e", "\033[q" }, /* 65 f7 */
- { FUNC, "\033[T", "\033[f", "\033[r" }, /* 66 f8 */
- { FUNC, "\033[U", "\033[g", "\033[s" }, /* 67 f9 */
- { FUNC, "\033[V", "\033[h", "\033[t" }, /* 68 f10 */
- { NUM, "", "", "" }, /* 69 num lock */
- { SCROLL, "", "", "" }, /* 70 scroll lock */
- { KP, "7", "\033[H", "7" }, /* 71 kp 7 */
- { KP, "8", "\033[A", "8" }, /* 72 kp 8 */
- { KP, "9", "\033[I", "9" }, /* 73 kp 9 */
- { KP, "-", "-", "-" }, /* 74 kp - */
- { KP, "4", "\033[D", "4" }, /* 75 kp 4 */
- { KP, "5", "\033[E", "5" }, /* 76 kp 5 */
- { KP, "6", "\033[C", "6" }, /* 77 kp 6 */
- { KP, "+", "+", "+" }, /* 78 kp + */
- { KP, "1", "\033[F", "1" }, /* 79 kp 1 */
- { KP, "2", "\033[B", "2" }, /* 80 kp 2 */
- { KP, "3", "\033[G", "3" }, /* 81 kp 3 */
- { KP, "0", "\033[L", "0" }, /* 82 kp 0 */
- { KP, ".", "\177", "." }, /* 83 kp . */
- { NONE, "", "", "" }, /* 84 0 */
- { NONE, "100", "", "" }, /* 85 0 */
- { NONE, "101", "", "" }, /* 86 0 */
- { FUNC, "\033[W", "\033[i", "\033[u" }, /* 87 f11 */
- { FUNC, "\033[X", "\033[j", "\033[v" }, /* 88 f12 */
- { NONE, "102", "", "" }, /* 89 0 */
- { NONE, "103", "", "" }, /* 90 0 */
- { NONE, "", "", "" }, /* 91 0 */
- { NONE, "", "", "" }, /* 92 0 */
- { NONE, "", "", "" }, /* 93 0 */
- { NONE, "", "", "" }, /* 94 0 */
- { NONE, "", "", "" }, /* 95 0 */
- { NONE, "", "", "" }, /* 96 0 */
- { NONE, "", "", "" }, /* 97 0 */
- { NONE, "", "", "" }, /* 98 0 */
- { NONE, "", "", "" }, /* 99 0 */
- { NONE, "", "", "" }, /* 100 */
- { NONE, "", "", "" }, /* 101 */
- { NONE, "", "", "" }, /* 102 */
- { NONE, "", "", "" }, /* 103 */
- { NONE, "", "", "" }, /* 104 */
- { NONE, "", "", "" }, /* 105 */
- { NONE, "", "", "" }, /* 106 */
- { NONE, "", "", "" }, /* 107 */
- { NONE, "", "", "" }, /* 108 */
- { NONE, "", "", "" }, /* 109 */
- { NONE, "", "", "" }, /* 110 */
- { NONE, "", "", "" }, /* 111 */
- { NONE, "", "", "" }, /* 112 */
- { NONE, "", "", "" }, /* 113 */
- { NONE, "", "", "" }, /* 114 */
- { NONE, "", "", "" }, /* 115 */
- { NONE, "", "", "" }, /* 116 */
- { NONE, "", "", "" }, /* 117 */
- { NONE, "", "", "" }, /* 118 */
- { NONE, "", "", "" }, /* 119 */
- { NONE, "", "", "" }, /* 120 */
- { NONE, "", "", "" }, /* 121 */
- { NONE, "", "", "" }, /* 122 */
- { NONE, "", "", "" }, /* 123 */
- { NONE, "", "", "" }, /* 124 */
- { NONE, "", "", "" }, /* 125 */
- { NONE, "", "", "" }, /* 126 */
- { NONE, "", "", "" } /* 127 */
+ { NONE, "", "", "", }, /* 0 unused */
+ { ASCII, "\033", "\033", "\033", }, /* 1 ESCape */
+ { ASCII, "1", "!", "!", }, /* 2 1 */
+ { ASCII, "2", "@", "\000", }, /* 3 2 */
+ { ASCII, "3", "#", "#", }, /* 4 3 */
+ { ASCII, "4", "$", "$", }, /* 5 4 */
+ { ASCII, "5", "%", "%", }, /* 6 5 */
+ { ASCII, "6", "^", "\036", }, /* 7 6 */
+ { ASCII, "7", "&", "&", }, /* 8 7 */
+ { ASCII, "8", "*", "\010", }, /* 9 8 */
+ { ASCII, "9", "(", "(", }, /* 10 9 */
+ { ASCII, "0", ")", ")", }, /* 11 0 */
+ { ASCII, "-", "_", "\037", }, /* 12 - */
+ { ASCII, "=", "+", "+", }, /* 13 = */
+ { ASCII, "\177", "\177", "\010", }, /* 14 backspace */
+ { ASCII, "\t", "\177\t", "\t", }, /* 15 tab */
+ { ASCII, "q", "Q", "\021", }, /* 16 q */
+ { ASCII, "w", "W", "\027", }, /* 17 w */
+ { ASCII, "e", "E", "\005", }, /* 18 e */
+ { ASCII, "r", "R", "\022", }, /* 19 r */
+ { ASCII, "t", "T", "\024", }, /* 20 t */
+ { ASCII, "y", "Y", "\031", }, /* 21 y */
+ { ASCII, "u", "U", "\025", }, /* 22 u */
+ { ASCII, "i", "I", "\011", }, /* 23 i */
+ { ASCII, "o", "O", "\017", }, /* 24 o */
+ { ASCII, "p", "P", "\020", }, /* 25 p */
+ { ASCII, "[", "{", "\033", }, /* 26 [ */
+ { ASCII, "]", "}", "\035", }, /* 27 ] */
+ { ASCII, "\r", "\r", "\n", }, /* 28 return */
+ { CTL, "", "", "", }, /* 29 control */
+ { ASCII, "a", "A", "\001", }, /* 30 a */
+ { ASCII, "s", "S", "\023", }, /* 31 s */
+ { ASCII, "d", "D", "\004", }, /* 32 d */
+ { ASCII, "f", "F", "\006", }, /* 33 f */
+ { ASCII, "g", "G", "\007", }, /* 34 g */
+ { ASCII, "h", "H", "\010", }, /* 35 h */
+ { ASCII, "j", "J", "\n", }, /* 36 j */
+ { ASCII, "k", "K", "\013", }, /* 37 k */
+ { ASCII, "l", "L", "\014", }, /* 38 l */
+ { ASCII, ";", ":", ";", }, /* 39 ; */
+ { ASCII, "'", "\"", "'", }, /* 40 ' */
+ { ASCII, "`", "~", "`", }, /* 41 ` */
+ { SHIFT, "", "", "", }, /* 42 shift */
+ { ASCII, "\\", "|", "\034", }, /* 43 \ */
+ { ASCII, "z", "Z", "\032", }, /* 44 z */
+ { ASCII, "x", "X", "\030", }, /* 45 x */
+ { ASCII, "c", "C", "\003", }, /* 46 c */
+ { ASCII, "v", "V", "\026", }, /* 47 v */
+ { ASCII, "b", "B", "\002", }, /* 48 b */
+ { ASCII, "n", "N", "\016", }, /* 49 n */
+ { ASCII, "m", "M", "\r", }, /* 50 m */
+ { ASCII, ",", "<", "<", }, /* 51 , */
+ { ASCII, ".", ">", ">", }, /* 52 . */
+ { ASCII, "/", "?", "\037", }, /* 53 / */
+ { SHIFT, "", "", "", }, /* 54 shift */
+ { KP, "*", "*", "*", }, /* 55 kp * */
+ { ALT, "", "", "", }, /* 56 alt */
+ { ASCII, " ", " ", "\000", }, /* 57 space */
+ { CAPS, "", "", "", }, /* 58 caps */
+ { FUNC, "\033[M", "\033[Y", "\033[k", }, /* 59 f1 */
+ { FUNC, "\033[N", "\033[Z", "\033[l", }, /* 60 f2 */
+ { FUNC, "\033[O", "\033[a", "\033[m", }, /* 61 f3 */
+ { FUNC, "\033[P", "\033[b", "\033[n", }, /* 62 f4 */
+ { FUNC, "\033[Q", "\033[c", "\033[o", }, /* 63 f5 */
+ { FUNC, "\033[R", "\033[d", "\033[p", }, /* 64 f6 */
+ { FUNC, "\033[S", "\033[e", "\033[q", }, /* 65 f7 */
+ { FUNC, "\033[T", "\033[f", "\033[r", }, /* 66 f8 */
+ { FUNC, "\033[U", "\033[g", "\033[s", }, /* 67 f9 */
+ { FUNC, "\033[V", "\033[h", "\033[t", }, /* 68 f10 */
+ { NUM, "", "", "", }, /* 69 num lock */
+ { SCROLL, "", "", "", }, /* 70 scroll lock */
+ { KP, "7", "\033[H", "7", }, /* 71 kp 7 */
+ { KP, "8", "\033[A", "8", }, /* 72 kp 8 */
+ { KP, "9", "\033[I", "9", }, /* 73 kp 9 */
+ { KP, "-", "-", "-", }, /* 74 kp - */
+ { KP, "4", "\033[D", "4", }, /* 75 kp 4 */
+ { KP, "5", "\033[E", "5", }, /* 76 kp 5 */
+ { KP, "6", "\033[C", "6", }, /* 77 kp 6 */
+ { KP, "+", "+", "+", }, /* 78 kp + */
+ { KP, "1", "\033[F", "1", }, /* 79 kp 1 */
+ { KP, "2", "\033[B", "2", }, /* 80 kp 2 */
+ { KP, "3", "\033[G", "3", }, /* 81 kp 3 */
+ { KP, "0", "\033[L", "0", }, /* 82 kp 0 */
+ { KP, ".", "\177", ".", }, /* 83 kp . */
+ { NONE, "", "", "", }, /* 84 0 */
+ { NONE, "100", "", "", }, /* 85 0 */
+ { NONE, "101", "", "", }, /* 86 0 */
+ { FUNC, "\033[W", "\033[i", "\033[u", }, /* 87 f11 */
+ { FUNC, "\033[X", "\033[j", "\033[v", }, /* 88 f12 */
+ { NONE, "102", "", "", }, /* 89 0 */
+ { NONE, "103", "", "", }, /* 90 0 */
+ { NONE, "", "", "", }, /* 91 0 */
+ { NONE, "", "", "", }, /* 92 0 */
+ { NONE, "", "", "", }, /* 93 0 */
+ { NONE, "", "", "", }, /* 94 0 */
+ { NONE, "", "", "", }, /* 95 0 */
+ { NONE, "", "", "", }, /* 96 0 */
+ { NONE, "", "", "", }, /* 97 0 */
+ { NONE, "", "", "", }, /* 98 0 */
+ { NONE, "", "", "", }, /* 99 0 */
+ { NONE, "", "", "", }, /* 100 */
+ { NONE, "", "", "", }, /* 101 */
+ { NONE, "", "", "", }, /* 102 */
+ { NONE, "", "", "", }, /* 103 */
+ { NONE, "", "", "", }, /* 104 */
+ { NONE, "", "", "", }, /* 105 */
+ { NONE, "", "", "", }, /* 106 */
+ { NONE, "", "", "", }, /* 107 */
+ { NONE, "", "", "", }, /* 108 */
+ { NONE, "", "", "", }, /* 109 */
+ { NONE, "", "", "", }, /* 110 */
+ { NONE, "", "", "", }, /* 111 */
+ { NONE, "", "", "", }, /* 112 */
+ { NONE, "", "", "", }, /* 113 */
+ { NONE, "", "", "", }, /* 114 */
+ { NONE, "", "", "", }, /* 115 */
+ { NONE, "", "", "", }, /* 116 */
+ { NONE, "", "", "", }, /* 117 */
+ { NONE, "", "", "", }, /* 118 */
+ { NONE, "", "", "", }, /* 119 */
+ { NONE, "", "", "", }, /* 120 */
+ { NONE, "", "", "", }, /* 121 */
+ { NONE, "", "", "", }, /* 122 */
+ { NONE, "", "", "", }, /* 123 */
+ { NONE, "", "", "", }, /* 124 */
+ { NONE, "", "", "", }, /* 125 */
+ { NONE, "", "", "", }, /* 126 */
+ { NONE, "", "", "", }, /* 127 */
};
-
/*
* Get characters from the keyboard. If none are present, return NULL.
*/
pckbd_cngetc(dev)
struct device *dev;
{
- register char *cp;
+ register char *cp = NULL;
u_char data;
static u_char last;
do {
/* wait for byte */
- while ((bus_space_read_1(pckbd_iot, pckbd_status_ioh, 0) & KBS_DIB)
+ while ((bus_space_read_1(pckbd_iot, pckbd_ioh, KBSTATP) & KBS_DIB)
== 0)
KBD_DELAY;
KBD_DELAY;
- data = bus_space_read_1(pckbd_iot, pckbd_data_ioh, 0);
+ data = bus_space_read_1(pckbd_iot, pckbd_ioh, KBDATAP);
if (data == KBR_ACK) {
ack = 1;
bus_space_write_1(pckbd_iot, pckbd_timer_ioh, TIMER_CNTR2,
TIMER_DIV(pitch) / 256);
/* enable speaker */
- bus_space_write_1(pckbd_iot, pckbd_pitaux_ioh, 0,
- bus_space_read_1(pckbd_iot, pckbd_pitaux_ioh, 0) |
+ bus_space_write_1(pckbd_iot, pckbd_ioh, PITAUX_PORT,
+ bus_space_read_1(pckbd_iot, pckbd_ioh, PITAUX_PORT) |
PIT_SPKR);
splx(s);
}
/* disable bell */
s = splhigh();
- bus_space_write_1(pckbd_iot, pckbd_pitaux_ioh, 0,
- bus_space_read_1(pckbd_iot, pckbd_pitaux_ioh, 0) & ~PIT_SPKR);
+ bus_space_write_1(pckbd_iot, pckbd_ioh, PITAUX_PORT,
+ bus_space_read_1(pckbd_iot, pckbd_ioh, PITAUX_PORT) & ~PIT_SPKR);
sc->sc_bellactive = 0;
splx(s);
}
--- /dev/null
+/* $NetBSD: pcppi.c,v 1.3 1996/12/05 01:39:31 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/bus.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+#include <alpha/isa/pcppivar.h>
+
+struct pcppi_softc {
+ struct device sc_dv;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_pit1_ioh, sc_ppi_ioh;
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int pcppi_match __P((struct device *, void *, void *));
+#else
+int pcppi_match __P((struct device *, struct cfdata *, void *));
+#endif
+void pcppi_attach __P((struct device *, struct device *, void *));
+
+struct cfattach pcppi_ca = {
+ sizeof(struct pcppi_softc), pcppi_match, pcppi_attach,
+};
+
+struct cfdriver pcppi_cd = {
+ NULL, "pcppi", DV_DULL,
+};
+
+int pcppiprint __P((void *, const char *));
+
+int
+pcppi_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ bus_space_handle_t ppi_ioh, pit1_ioh;
+ int have_pit1, have_ppi, rv;
+ u_int8_t v, nv;
+
+ /* If values are hardwired to something that they can't be, punt. */
+ if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */
+ ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
+
+ rv = 0;
+ have_pit1 = have_ppi = 0;
+
+ if (bus_space_map(ia->ia_iot, 0x40, 4, 0, &pit1_ioh)) /* XXX */
+ goto lose;
+ have_pit1 = 1;
+ if (bus_space_map(ia->ia_iot, 0x60, 4, 0, &ppi_ioh)) /* XXX */
+ goto lose;
+ have_ppi = 1;
+
+ /*
+ * Check for existence of PPI. Realistically, this is either going to
+ * be here or nothing is going to be here.
+ *
+ * We don't want to have any chance of changing speaker output (which
+ * this test might, if it crashes in the middle, or something;
+ * normally it's be to quick to produce anthing audible), but
+ * many "combo chip" mock-PPI's don't seem to support the top bit
+ * of Port B as a settable bit. The bottom bit has to be settable,
+ * since the speaker driver hardware still uses it.
+ */
+ v = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ bus_space_write_1(ia->ia_iot, ppi_ioh, 1, v ^ 0x01); /* XXX */
+ nv = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ if (((nv ^ v) & 0x01) == 0x01)
+ rv = 1;
+ bus_space_write_1(ia->ia_iot, ppi_ioh, 1, v); /* XXX */
+ nv = bus_space_read_1(ia->ia_iot, ppi_ioh, 1); /* XXX */
+ if (((nv ^ v) & 0x01) != 0x00)
+ rv = 0;
+
+ /*
+ * We assume that the programmable interval timer is there.
+ */
+
+lose:
+ if (have_pit1)
+ bus_space_unmap(ia->ia_iot, pit1_ioh, 4);
+ if (have_ppi)
+ bus_space_unmap(ia->ia_iot, ppi_ioh, 4);
+ if (rv) {
+ ia->ia_iobase = 0x60;
+ ia->ia_iosize = 0x5;
+ ia->ia_msize = 0x0;
+ }
+ return (rv);
+}
+
+void
+pcppi_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pcppi_softc *sc = (struct pcppi_softc *)self;
+ struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args pa;
+ bus_space_tag_t iot;
+
+ sc->sc_iot = iot = ia->ia_iot;
+ if (bus_space_map(iot, 0x40, 4, 0, &sc->sc_pit1_ioh) || /*XXX*/
+ bus_space_map(iot, 0x60, 5, 0, &sc->sc_ppi_ioh)) /*XXX*/
+ panic("pcppi_attach: couldn't map");
+
+ printf("\n");
+
+ pa.pa_slot = PCPPI_KBD_SLOT;
+ pa.pa_iot = iot; /* XXX */
+ pa.pa_ioh = sc->sc_ppi_ioh; /* XXX */
+ pa.pa_pit_ioh = sc->sc_pit1_ioh; /* XXX */
+ pa.pa_delaybah = ia->ia_delaybah; /* XXX */
+ pa.pa_ic = ia->ia_ic; /* XXX */
+ config_found(self, &pa, pcppiprint);
+
+ /* XXX SHOULD ONLY ATTACH IF SOMETHING IS THERE */
+ pa.pa_slot = PCPPI_AUX_SLOT;
+ pa.pa_iot = iot; /* XXX */
+ pa.pa_ioh = sc->sc_ppi_ioh; /* XXX */
+ pa.pa_pit_ioh = sc->sc_pit1_ioh; /* XXX */
+ pa.pa_delaybah = ia->ia_delaybah; /* XXX */
+ pa.pa_ic = ia->ia_ic; /* XXX */
+ config_found(self, &pa, pcppiprint);
+}
+
+int
+pcppiprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+ struct pcppi_attach_args *pa = aux;
+ const char *type;
+
+ switch (pa->pa_slot) {
+ case PCPPI_KBD_SLOT:
+ type = "pckbd";
+ break;
+ case PCPPI_AUX_SLOT:
+ type = "pms";
+ /* XXX XXX XXX should make sure it's there before configuring */
+ return (QUIET);
+ break;
+ default:
+ panic("pcppiprint: bad slot");
+ }
+
+ if (pnp)
+ printf("%s at %s", type, pnp);
+ return (UNCONF);
+}
--- /dev/null
+/* $NetBSD: pcppivar.h,v 1.1 1996/11/25 03:26:37 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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.
+ */
+
+struct pcppi_attach_args {
+ unsigned int pa_slot;
+ /* XXX should have a device type number */
+ /* XXX should have a cookie to be passed to callbacks */
+
+ /* XXX THESE DO NOT BELONG */
+ bus_space_tag_t pa_iot;
+ bus_space_handle_t pa_ioh;
+ bus_space_handle_t pa_pit_ioh;
+ bus_space_handle_t pa_delaybah;
+ isa_chipset_tag_t pa_ic;
+};
+
+#define PCPPI_KBD_SLOT 0
+#define PCPPI_AUX_SLOT 1
-/* $OpenBSD: pms.c,v 1.4 1996/12/08 00:20:29 niklas Exp $ */
-/* $NetBSD: pms.c,v 1.4 1996/10/23 04:12:21 cgd Exp $ */
+/* $OpenBSD: pms.c,v 1.5 1997/01/24 19:57:28 niklas Exp $ */
+/* $NetBSD: pms.c,v 1.7 1996/12/05 01:39:31 cgd Exp $ */
/*-
* Copyright (c) 1994 Charles Hannum.
* may result in dropped characters and/or corrupted mouse events.
*/
-#include "pms.h"
-#if NPMS > 1
-#error Only one PS/2 style mouse may be configured into your system.
-#endif
-
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/buf.h>
+#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <dev/isa/isavar.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/ms.h>
+#include <alpha/isa/pcppivar.h>
-#define PMS_DATA 0x60 /* offset for data port, read-write */
-#define PMS_CNTRL 0x64 /* offset for control port, write-only */
-#define PMS_STATUS 0x64 /* offset for status port, read-only */
+#define PMS_DATA 0x0 /* offset for data port, read-write */
+#define PMS_CNTRL 0x4 /* offset for control port, write-only */
+#define PMS_STATUS 0x4 /* offset for status port, read-only */
#define PMS_NPORTS 8
/* status bits */
};
bus_space_tag_t pms_iot;
+bus_space_handle_t pms_ioh;
isa_chipset_tag_t pms_ic;
-bus_space_handle_t pms_cntrl_ioh;
-#define pms_status_ioh pms_cntrl_ioh
-bus_space_handle_t pms_data_ioh;
+#ifdef __BROKEN_INDIRECT_CONFIG
int pmsprobe __P((struct device *, void *, void *));
+#else
+int pmsprobe __P((struct device *, struct cfdata *, void *));
+#endif
void pmsattach __P((struct device *, struct device *, void *));
int pmsintr __P((void *));
{
u_char c;
- while ((c = bus_space_read_1(pms_iot, pms_status_ioh, 0) & 0x03) != 0)
+ while ((c = bus_space_read_1(pms_iot, pms_ioh, PMS_STATUS) & 0x03) !=
+ 0)
if ((c & PMS_OBUF_FULL) == PMS_OBUF_FULL) {
/* XXX - delay is needed to prevent some keyboards from
wedging when the system boots */
delay(6);
- (void) bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ (void) bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
}
}
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, 0xd4);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0xd4);
pms_flush();
- bus_space_write_1(pms_iot, pms_data_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
}
static __inline void
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, value);
}
static __inline void
{
pms_flush();
- bus_space_write_1(pms_iot, pms_cntrl_ioh, 0, 0x60);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_CNTRL, 0x60);
pms_flush();
- bus_space_write_1(pms_iot, pms_data_ioh, 0, value);
+ bus_space_write_1(pms_iot, pms_ioh, PMS_DATA, value);
}
int
pmsprobe(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
- struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args *pa = aux;
u_char x;
- pms_iot = ia->ia_iot;
-
- if (ia->ia_iobase != 0x60)
+ if (pa->pa_slot != PCPPI_AUX_SLOT)
return 0;
- if (bus_space_map(pms_iot, PMS_DATA, 1, 0, &pms_data_ioh) ||
- bus_space_map(pms_iot, PMS_CNTRL, 1, 0, &pms_cntrl_ioh))
- return 0;
+ pms_iot = pa->pa_iot;
+ pms_ioh = pa->pa_ioh;
pms_dev_cmd(PMS_RESET);
pms_aux_cmd(PMS_AUX_TEST);
delay(1000);
- x = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ x = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
pms_pit_cmd(PMS_INT_DISABLE);
if (x & 0x04)
return 0;
- ia->ia_iosize = PMS_NPORTS;
- ia->ia_msize = 0;
return 1;
}
void *aux;
{
struct pms_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
+ struct pcppi_attach_args *pa = aux;
- pms_iot = ia->ia_iot;
- pms_ic = ia->ia_ic;
-
- if (bus_space_map(pms_iot, PMS_DATA, 1, 0, &pms_data_ioh) ||
- bus_space_map(pms_iot, PMS_CNTRL, 1, 0, &pms_cntrl_ioh)) {
- printf(": can't map I/O ports!\n");
- return;
- }
+ pms_iot = pa->pa_iot;
+ pms_ioh = pa->pa_ioh;
+ pms_ic = pa->pa_ic;
msattach(self, &pms_mdev_spec);
/* Other initialization was done by pmsprobe. */
sc->sc_state = 0;
- sc->sc_ih = isa_intr_establish(pms_ic, ia->ia_irq, IST_EDGE, IPL_TTY,
- pmsintr, sc, sc->sc_dev.dv_xname);
+ sc->sc_ih = isa_intr_establish(pms_ic, 12, IST_EDGE, IPL_TTY, pmsintr,
+ sc, sc->sc_dev.dv_xname);
}
int
switch (state) {
case 0:
- buttons = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ buttons = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
if ((buttons & 0xc0) == 0)
++state;
break;
case 1:
- dx = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ dx = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
/* Bounding at -127 avoids a bug in XFree86. */
dx = (dx == -128) ? -127 : dx;
++state;
break;
case 2:
- dy = bus_space_read_1(pms_iot, pms_data_ioh, 0);
+ dy = bus_space_read_1(pms_iot, pms_ioh, PMS_DATA);
dy = (dy == -128) ? -127 : dy;
state = 0;
--- /dev/null
+/* $NetBSD: vga_isa.c,v 1.4 1996/12/05 01:39:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+#include <dev/isa/isavar.h>
+
+#include <alpha/common/vgavar.h>
+#include <alpha/isa/vga_isavar.h>
+
+struct vga_isa_softc {
+ struct device sc_dev;
+
+ struct vga_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vga_isa_match __P((struct device *, void *, void *));
+#else
+int vga_isa_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vga_isa_attach __P((struct device *, struct device *, void *));
+
+struct cfattach vga_isa_ca = {
+ sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach,
+};
+
+int vga_isa_console_tag; /* really just a boolean. */
+struct vga_config vga_isa_console_vc;
+
+int
+vga_isa_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ int rv;
+
+ /* If values are hardwired to something that they can't be, punt. */
+ if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */
+ (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xb8000) ||
+ (ia->ia_msize != 0 && ia->ia_msize != 0x8000) ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
+
+ if (vga_isa_console_tag)
+ return (1);
+
+ rv = vga_common_probe(ia->ia_iot, ia->ia_memt);
+
+ if (rv) {
+ ia->ia_iobase = 0x3b0;
+ ia->ia_iosize = 0x30;
+ ia->ia_maddr = 0xb8000;
+ ia->ia_msize = 0x8000;
+ }
+ return (rv);
+}
+
+void
+vga_isa_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ struct vga_isa_softc *sc = (struct vga_isa_softc *)self;
+ struct vga_config *vc;
+ int console;
+
+ console = vga_isa_console_tag;
+ if (console)
+ vc = sc->sc_vc = &vga_isa_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vga_config *)
+ malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(ia->ia_iot, ia->ia_memt, vc);
+ }
+
+ printf("\n");
+
+ vga_wscons_attach(self, vc, console);
+}
+
+int
+vga_isa_console_match(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+
+ return (vga_common_probe(iot, memt));
+}
+
+void
+vga_isa_console_attach(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ struct vga_config *vc = &vga_isa_console_vc;
+
+ /* for later recognition */
+ vga_isa_console_tag = 1;
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(iot, memt, vc);
+
+ vga_wscons_console(vc);
+}
--- /dev/null
+/* $NetBSD: vga_isavar.h,v 1.2 1996/11/23 06:06:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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.
+ */
+
+int vga_isa_console_match __P((bus_space_tag_t, bus_space_tag_t));
+void vga_isa_console_attach __P((bus_space_tag_t, bus_space_tag_t));
-/* $OpenBSD: apecs.c,v 1.7 1996/12/08 00:20:30 niklas Exp $ */
-/* $NetBSD: apecs.c,v 1.13 1996/10/23 04:12:22 cgd Exp $ */
+/* $OpenBSD: apecs.c,v 1.8 1997/01/24 19:57:32 niklas Exp $ */
+/* $NetBSD: apecs.c,v 1.16 1996/12/05 01:39:34 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <alpha/pci/pci_2100_a50.h>
#endif
+#ifdef __BROKEN_INDIRECT_CONFIG
int apecsmatch __P((struct device *, void *, void *));
+#else
+int apecsmatch __P((struct device *, struct cfdata *, void *));
+#endif
void apecsattach __P((struct device *, struct device *, void *));
struct cfattach apecs_ca = {
int
apecsmatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct confargs *ca = aux;
* Set up the chipset's function pointers.
*/
void
-apecs_init(acp)
+apecs_init(acp, mallocsafe)
struct apecs_config *acp;
+ int mallocsafe;
{
-
acp->ac_comanche_pass2 =
(REGVAL(COMANCHE_ED) & COMANCHE_ED_PASS2) != 0;
acp->ac_memwidth =
acp->ac_epic_pass2 =
(REGVAL(EPIC_DCSR) & EPIC_DCSR_PASS2) != 0;
+ acp->ac_haxr1 = REGVAL(EPIC_HAXR1);
+ acp->ac_haxr2 = REGVAL(EPIC_HAXR2);
+
/*
* Can't set up SGMAP data here; can be called before malloc().
+ * XXX THIS COMMENT NO LONGER MAKES SENSE.
*/
- acp->ac_iot = apecs_lca_bus_io_init(acp);
- acp->ac_memt = apecs_lca_bus_mem_init(acp);
+ if (!acp->ac_initted) {
+ /* don't do these twice since they set up extents */
+ acp->ac_iot = apecs_bus_io_init(acp);
+ acp->ac_memt = apecs_bus_mem_init(acp);
+ }
+ acp->ac_mallocsafe = mallocsafe;
+
apecs_pci_init(&acp->ac_pc, acp);
/* Turn off DMA window enables in PCI Base Reg 1. */
alpha_XXX_dmamap_or = 0x40000000; /* XXX */
} /* XXX */
/* XXX XXX END XXX XXX */
+
+ acp->ac_initted = 1;
}
void
* (maybe), but doesn't hurt to do twice.
*/
acp = sc->sc_acp = &apecs_configuration;
- apecs_init(acp);
+ apecs_init(acp, 1);
/* XXX SGMAP FOO */
pci_2100_a50_pickintr(acp);
break;
#endif
+
default:
panic("apecsattach: shouldn't be here, really...");
}
void *aux;
const char *pnp;
{
- register struct pcibus_attach_args *pba = aux;
+ register struct pcibus_attach_args *pba = aux;
/* only PCIs can attach to APECSes; easy. */
if (pnp)
--- /dev/null
+/* $NetBSD: apecs_bus_io.c,v 1.1 1996/11/25 03:42:09 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/apecsreg.h>
+#include <alpha/pci/apecsvar.h>
+
+#define CHIP apecs
+
+#define CHIP_EX_MALLOC_SAFE(v) (((struct apecs_config *)(v))->ac_mallocsafe)
+#define CHIP_IO_EXTENT(v) (((struct apecs_config *)(v))->ac_io_ex)
+
+/* IO region 1 */
+#define CHIP_IO_W1_BUS_START(v) 0x00000000UL
+#define CHIP_IO_W1_BUS_END(v) 0x0003ffffUL
+#define CHIP_IO_W1_SYS_START(v) APECS_PCI_SIO
+#define CHIP_IO_W1_SYS_END(v) (APECS_PCI_SIO + (0x00040000UL << 5) - 1)
+
+/* IO region 2 */
+#define CHIP_IO_W2_BUS_START(v) \
+ ((((struct apecs_config *)(v))->ac_haxr2 & EPIC_HAXR2_EADDR) + \
+ 0x00040000UL)
+#define CHIP_IO_W2_BUS_END(v) \
+ ((((struct apecs_config *)(v))->ac_haxr2 & EPIC_HAXR2_EADDR) + \
+ 0x00ffffffUL)
+#define CHIP_IO_W2_SYS_START(v) (APECS_PCI_SIO + (0x00040000UL << 5))
+#define CHIP_IO_W2_SYS_END(v) (APECS_PCI_SIO + (0x01000000UL << 5) - 1)
+
+#include "pcs_bus_io_common.c"
--- /dev/null
+/* $NetBSD: apecs_bus_mem.c,v 1.1 1996/11/25 03:42:11 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/apecsreg.h>
+#include <alpha/pci/apecsvar.h>
+
+#define CHIP apecs
+
+#define CHIP_EX_MALLOC_SAFE(v) (((struct apecs_config *)(v))->ac_mallocsafe)
+#define CHIP_D_MEM_EXTENT(v) (((struct apecs_config *)(v))->ac_d_mem_ex)
+#define CHIP_S_MEM_EXTENT(v) (((struct apecs_config *)(v))->ac_s_mem_ex)
+
+/* Dense region 1 */
+#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL
+#define CHIP_D_MEM_W1_BUS_END(v) 0xffffffffUL
+#define CHIP_D_MEM_W1_SYS_START(v) APECS_PCI_DENSE
+#define CHIP_D_MEM_W1_SYS_END(v) (APECS_PCI_DENSE + 0xffffffffUL)
+
+/* Sparse region 1 */
+#define CHIP_S_MEM_W1_BUS_START(v) 0x00000000UL
+#define CHIP_S_MEM_W1_BUS_END(v) 0x00ffffffUL
+#define CHIP_S_MEM_W1_SYS_START(v) APECS_PCI_SPARSE
+#define CHIP_S_MEM_W1_SYS_END(v) \
+ (APECS_PCI_SPARSE + (0x01000000UL << 5) - 1)
+
+/* Sparse region 2 */
+#define CHIP_S_MEM_W2_BUS_START(v) \
+ ((((struct apecs_config *)(v))->ac_haxr1 & EPIC_HAXR1_EADDR) + \
+ 0x01000000UL)
+#define CHIP_S_MEM_W2_BUS_END(v) \
+ ((((struct apecs_config *)(v))->ac_haxr1 & EPIC_HAXR1_EADDR) + \
+ 0x07ffffffUL)
+#define CHIP_S_MEM_W2_SYS_START(v) \
+ (APECS_PCI_SPARSE + (0x01000000UL << 5))
+#define CHIP_S_MEM_W2_SYS_END(v) \
+ (APECS_PCI_SPARSE + (0x08000000UL << 5) - 1)
+
+#include "pcs_bus_mem_common.c"
-/* $OpenBSD: apecs_pci.c,v 1.5 1996/10/30 22:39:49 niklas Exp $ */
-/* $NetBSD: apecs_pci.c,v 1.9 1996/10/13 03:00:02 christos Exp $ */
+/* $OpenBSD: apecs_pci.c,v 1.6 1997/01/24 19:57:34 niklas Exp $ */
+/* $NetBSD: apecs_pci.c,v 1.10 1996/11/13 21:13:25 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
int s, secondary, ba;
int32_t old_haxr2; /* XXX */
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&acp->ac_pc, tag, &secondary, 0, 0);
if (secondary) {
int s, secondary;
int32_t old_haxr2; /* XXX */
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&acp->ac_pc, tag, &secondary, 0, 0);
if (secondary) {
-/* $OpenBSD: apecsvar.h,v 1.5 1996/12/08 00:20:34 niklas Exp $ */
-/* $NetBSD: apecsvar.h,v 1.4 1996/10/23 04:12:23 cgd Exp $ */
+/* $OpenBSD: apecsvar.h,v 1.6 1997/01/24 19:57:35 niklas Exp $ */
+/* $NetBSD: apecsvar.h,v 1.5 1996/11/25 03:49:36 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* do their dirty work (and more!).
*/
struct apecs_config {
+ int ac_initted;
+
int ac_comanche_pass2;
int ac_epic_pass2;
int ac_memwidth;
bus_space_tag_t ac_iot, ac_memt;
struct alpha_pci_chipset ac_pc;
+
+ u_int32_t ac_haxr1, ac_haxr2;
+
+ struct extent *ac_io_ex, *ac_d_mem_ex, *ac_s_mem_ex;
+ int ac_mallocsafe;
};
struct apecs_softc {
struct apecs_config *sc_acp;
};
-void apecs_init __P((struct apecs_config *));
+void apecs_init __P((struct apecs_config *, int));
void apecs_pci_init __P((pci_chipset_tag_t, void *));
-bus_space_tag_t apecs_lca_bus_io_init __P((void *iov));
-bus_space_tag_t apecs_lca_bus_mem_init __P((void *memv));
+bus_space_tag_t apecs_bus_io_init __P((void *));
+bus_space_tag_t apecs_bus_mem_init __P((void *));
-/* $OpenBSD: cia.c,v 1.6 1996/12/08 00:20:34 niklas Exp $ */
-/* $NetBSD: cia.c,v 1.12 1996/10/23 04:12:24 cgd Exp $ */
+/* $OpenBSD: cia.c,v 1.7 1997/01/24 19:57:36 niklas Exp $ */
+/* $NetBSD: cia.c,v 1.15 1996/12/05 01:39:35 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#if defined(DEC_KN20AA)
#include <alpha/pci/pci_kn20aa.h>
#endif
+#if defined(DEC_EB164)
+#include <alpha/pci/pci_eb164.h>
+#endif
+#ifdef __BROKEN_INDIRECT_CONFIG
int ciamatch __P((struct device *, void *, void *));
+#else
+int ciamatch __P((struct device *, struct cfdata *, void *));
+#endif
void ciaattach __P((struct device *, struct device *, void *));
struct cfattach cia_ca = {
int
ciamatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct confargs *ca = aux;
* Set up the chipset's function pointers.
*/
void
-cia_init(ccp)
+cia_init(ccp, mallocsafe)
struct cia_config *ccp;
+ int mallocsafe;
{
/*
* Can't set up SGMAP data here; can be called before malloc().
+ * XXX THIS COMMENT NO LONGER MAKES SENSE.
*/
- ccp->cc_iot = cia_bus_io_init(ccp);
- ccp->cc_memt = cia_bus_mem_init(ccp);
- cia_pci_init(&ccp->cc_pc, ccp);
-
ccp->cc_hae_mem = REGVAL(CIA_CSR_HAE_MEM);
ccp->cc_hae_io = REGVAL(CIA_CSR_HAE_IO);
+ if (!ccp->cc_initted) {
+ /* don't do these twice since they set up extents */
+ ccp->cc_iot = cia_bus_io_init(ccp);
+ ccp->cc_memt = cia_bus_mem_init(ccp);
+ }
+ ccp->cc_mallocsafe = mallocsafe;
+
+ cia_pci_init(&ccp->cc_pc, ccp);
+
/* XXX XXX BEGIN XXX XXX */
{ /* XXX */
extern vm_offset_t alpha_XXX_dmamap_or; /* XXX */
alpha_XXX_dmamap_or = 0x40000000; /* XXX */
} /* XXX */
/* XXX XXX END XXX XXX */
+
+ ccp->cc_initted = 1;
}
void
* (maybe), but doesn't hurt to do twice.
*/
ccp = sc->sc_ccp = &cia_configuration;
- cia_init(ccp);
+ cia_init(ccp, 1);
/* XXX print chipset information */
printf("\n");
#endif
break;
#endif
+
+#if defined(DEC_EB164)
+ case ST_EB164:
+ pci_eb164_pickintr(ccp);
+#ifdef EVCNT_COUNTERS
+ evcnt_attach(self, "intr", &eb164_intr_evcnt);
+#endif
+ break;
+#endif
+
default:
panic("ciaattach: shouldn't be here, really...");
}
-/* $OpenBSD: cia_bus_io.c,v 1.5 1996/12/08 00:20:35 niklas Exp $ */
-/* $NetBSD: cia_bus_io.c,v 1.5 1996/08/27 16:29:25 cgd Exp $ */
+/* $OpenBSD: cia_bus_io.c,v 1.6 1997/01/24 19:57:37 niklas Exp $ */
+/* $NetBSD: cia_bus_io.c,v 1.6 1996/11/25 03:46:07 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
#define CHIP cia
+#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
+#define CHIP_IO_EXTENT(v) (((struct cia_config *)(v))->cc_io_ex)
+
/* IO region 1 */
-#define CHIP_IO_W1_START(v) \
+#define CHIP_IO_W1_BUS_START(v) \
HAE_IO_REG1_START(((struct cia_config *)(v))->cc_hae_io)
-#define CHIP_IO_W1_END(v) \
- (CHIP_IO_W1_START(v) + HAE_IO_REG1_MASK)
-#define CHIP_IO_W1_BASE(v) \
+#define CHIP_IO_W1_BUS_END(v) \
+ (CHIP_IO_W1_BUS_START(v) + HAE_IO_REG1_MASK)
+#define CHIP_IO_W1_SYS_START(v) \
CIA_PCI_SIO1
-#define CHIP_IO_W1_MASK(v) \
- HAE_IO_REG1_MASK
+#define CHIP_IO_W1_SYS_END(v) \
+ (CIA_PCI_SIO1 + ((HAE_IO_REG1_MASK + 1) << 5) - 1)
/* IO region 2 */
-#define CHIP_IO_W2_START(v) \
+#define CHIP_IO_W2_BUS_START(v) \
HAE_IO_REG2_START(((struct cia_config *)(v))->cc_hae_io)
-#define CHIP_IO_W2_END(v) \
- (CHIP_IO_W2_START(v) + HAE_IO_REG2_MASK)
-#define CHIP_IO_W2_BASE(v) \
+#define CHIP_IO_W2_BUS_END(v) \
+ (CHIP_IO_W2_BUS_START(v) + HAE_IO_REG2_MASK)
+#define CHIP_IO_W2_SYS_START(v) \
CIA_PCI_SIO2
-#define CHIP_IO_W2_MASK(v) \
- HAE_IO_REG2_MASK
+#define CHIP_IO_W2_SYS_END(v) \
+ (CIA_PCI_SIO2 + ((HAE_IO_REG2_MASK + 1) << 5) - 1)
#include "pcs_bus_io_common.c"
-/* $OpenBSD: cia_bus_mem.c,v 1.5 1996/12/08 00:20:36 niklas Exp $ */
-/* $NetBSD: cia_bus_mem.c,v 1.5 1996/08/27 16:29:26 cgd Exp $ */
+/* $OpenBSD: cia_bus_mem.c,v 1.6 1997/01/24 19:57:38 niklas Exp $ */
+/* $NetBSD: cia_bus_mem.c,v 1.7 1996/11/25 03:46:09 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
#define CHIP cia
+#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
+#define CHIP_D_MEM_EXTENT(v) (((struct cia_config *)(v))->cc_d_mem_ex)
+#define CHIP_S_MEM_EXTENT(v) (((struct cia_config *)(v))->cc_s_mem_ex)
+
/* Dense region 1 */
-#define CHIP_D_MEM_W1_START(v) 0x00000000
-#define CHIP_D_MEM_W1_END(v) 0xffffffff
-#define CHIP_D_MEM_W1_BASE(v) CIA_PCI_DENSE
-#define CHIP_D_MEM_W1_MASK(v) 0xffffffff
+#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL
+#define CHIP_D_MEM_W1_BUS_END(v) 0xffffffffUL
+#define CHIP_D_MEM_W1_SYS_START(v) CIA_PCI_DENSE
+#define CHIP_D_MEM_W1_SYS_END(v) (CIA_PCI_DENSE + 0xffffffffUL)
/* Sparse region 1 */
-#define CHIP_S_MEM_W1_START(v) \
+#define CHIP_S_MEM_W1_BUS_START(v) \
HAE_MEM_REG1_START(((struct cia_config *)(v))->cc_hae_mem)
-#define CHIP_S_MEM_W1_END(v) \
- (CHIP_S_MEM_W1_START(v) + HAE_MEM_REG1_MASK)
-#define CHIP_S_MEM_W1_BASE(v) \
+#define CHIP_S_MEM_W1_BUS_END(v) \
+ (CHIP_S_MEM_W1_BUS_START(v) + HAE_MEM_REG1_MASK)
+#define CHIP_S_MEM_W1_SYS_START(v) \
CIA_PCI_SMEM1
-#define CHIP_S_MEM_W1_MASK(v) \
- HAE_MEM_REG1_MASK
+#define CHIP_S_MEM_W1_SYS_END(v) \
+ (CIA_PCI_SMEM1 + ((HAE_MEM_REG1_MASK + 1) << 5) - 1)
/* Sparse region 2 */
-#define CHIP_S_MEM_W2_START(v) \
+#define CHIP_S_MEM_W2_BUS_START(v) \
HAE_MEM_REG2_START(((struct cia_config *)(v))->cc_hae_mem)
-#define CHIP_S_MEM_W2_END(v) \
- (CHIP_S_MEM_W2_START(v) + HAE_MEM_REG2_MASK)
-#define CHIP_S_MEM_W2_BASE(v) \
+#define CHIP_S_MEM_W2_BUS_END(v) \
+ (CHIP_S_MEM_W2_BUS_START(v) + HAE_MEM_REG2_MASK)
+#define CHIP_S_MEM_W2_SYS_START(v) \
CIA_PCI_SMEM2
-#define CHIP_S_MEM_W2_MASK(v) \
- HAE_MEM_REG2_MASK
+#define CHIP_S_MEM_W2_SYS_END(v) \
+ (CIA_PCI_SMEM2 + ((HAE_MEM_REG2_MASK + 1) << 5) - 1)
/* Sparse region 3 */
-#define CHIP_S_MEM_W3_START(v) \
+#define CHIP_S_MEM_W3_BUS_START(v) \
HAE_MEM_REG3_START(((struct cia_config *)(v))->cc_hae_mem)
-#define CHIP_S_MEM_W3_END(v) \
- (CHIP_S_MEM_W3_START(v) + HAE_MEM_REG3_MASK)
-#define CHIP_S_MEM_W3_BASE(v) \
+#define CHIP_S_MEM_W3_BUS_END(v) \
+ (CHIP_S_MEM_W3_BUS_START(v) + HAE_MEM_REG3_MASK)
+#define CHIP_S_MEM_W3_SYS_START(v) \
CIA_PCI_SMEM3
-#define CHIP_S_MEM_W3_MASK(v) \
- HAE_MEM_REG3_MASK
+#define CHIP_S_MEM_W3_SYS_END(v) \
+ (CIA_PCI_SMEM3 + ((HAE_MEM_REG3_MASK + 1) << 5) - 1)
#include "pcs_bus_mem_common.c"
-/* $OpenBSD: cia_pci.c,v 1.4 1996/10/30 22:39:56 niklas Exp $ */
-/* $NetBSD: cia_pci.c,v 1.5 1996/10/13 03:00:04 christos Exp $ */
+/* $OpenBSD: cia_pci.c,v 1.5 1997/01/24 19:57:39 niklas Exp $ */
+/* $NetBSD: cia_pci.c,v 1.7 1996/11/23 06:46:50 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
+#include <machine/rpb.h> /* XXX for eb164 CIA firmware workarounds. */
+#include "dec_eb164.h" /* XXX for eb164 CIA firmware workarounds. */
+
void cia_attach_hook __P((struct device *, struct device *,
struct pcibus_attach_args *));
int cia_bus_maxdevs __P((void *, int));
pcireg_t *datap, data;
int s, secondary, ba;
int32_t old_haxr2; /* XXX */
+#if NDEC_EB164
+ extern int cputype; /* XXX */
+#endif
+
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
+#if NDEC_EB164
+ /*
+ * Some (apparently-common) revisions of EB164 firmware do the
+ * Wrong thing with PCI master aborts, which are caused by
+ * accesing the configuration space of devices that don't
+ * exist (for example).
+ *
+ * On EB164's we clear the CIA error register's PCI master
+ * abort bit before touching PCI configuration space and
+ * check it afterwards. If it indicates a master abort,
+ * the device wasn't there so we return 0xffffffff.
+ */
+ if (cputype == ST_EB164) {
+ /* clear the PCI master abort bit in CIA error register */
+ REGVAL(CIA_CSR_CIA_ERR) = 0x00000080; /* XXX */
+ alpha_mb();
+ alpha_pal_draina();
+ }
+#endif
/* secondary if bus # != 0 */
pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
splx(s);
}
+#if NDEC_EB164
+ if (cputype == ST_EB164) {
+ alpha_pal_draina();
+ /* check CIA error register for PCI master abort */
+ if (REGVAL(CIA_CSR_CIA_ERR) & 0x00000080) { /* XXX */
+ ba = 1;
+ data = 0xffffffff;
+ }
+ }
+#endif
+
#if 0
printf("cia_conf_read: tag 0x%lx, reg 0x%lx -> %x @ %p%s\n", tag, reg,
data, datap, ba ? " (badaddr)" : "");
int s, secondary;
int32_t old_haxr2; /* XXX */
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
if (secondary) {
-/* $OpenBSD: ciareg.h,v 1.4 1996/10/30 22:39:57 niklas Exp $ */
-/* $NetBSD: ciareg.h,v 1.5 1996/07/09 00:54:44 cgd Exp $ */
+/* $OpenBSD: ciareg.h,v 1.5 1997/01/24 19:57:40 niklas Exp $ */
+/* $NetBSD: ciareg.h,v 1.7 1996/11/23 06:42:55 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
/*
* Base addresses
*/
-#define CIA_PCI_SMEM1 0x8000000000L
-#define CIA_PCI_SMEM2 0x8400000000L
-#define CIA_PCI_SMEM3 0x8500000000L
-#define CIA_PCI_SIO1 0x8580000000L
-#define CIA_PCI_SIO2 0x85c0000000L
-#define CIA_PCI_DENSE 0x8600000000L
-#define CIA_PCI_CONF 0x8700000000L
-#define CIA_PCI_IACK 0x8720000000L
-#define CIA_CSRS 0x8740000000L
-#define CIA_PCI_MC_CSRS 0x8750000000L
-#define CIA_PCI_ATRANS 0x8760000000L
+#define CIA_PCI_SMEM1 0x8000000000UL
+#define CIA_PCI_SMEM2 0x8400000000UL
+#define CIA_PCI_SMEM3 0x8500000000UL
+#define CIA_PCI_SIO1 0x8580000000UL
+#define CIA_PCI_SIO2 0x85c0000000UL
+#define CIA_PCI_DENSE 0x8600000000UL
+#define CIA_PCI_CONF 0x8700000000UL
+#define CIA_PCI_IACK 0x8720000000UL
+#define CIA_CSRS 0x8740000000UL
+#define CIA_PCI_MC_CSRS 0x8750000000UL
+#define CIA_PCI_ATRANS 0x8760000000UL
/*
* General CSRs
#define CIA_CSR_HAE_MEM (CIA_CSRS + 0x400)
-#define HAE_MEM_REG1_START(x) (((u_int32_t)(x) & 0xe0000000) << 0)
-#define HAE_MEM_REG1_MASK 0x1fffffff
-#define HAE_MEM_REG2_START(x) (((u_int32_t)(x) & 0x0000f800) << 16)
-#define HAE_MEM_REG2_MASK 0x07ffffff
-#define HAE_MEM_REG3_START(x) (((u_int32_t)(x) & 0x000000fc) << 16)
-#define HAE_MEM_REG3_MASK 0x03ffffff
+#define HAE_MEM_REG1_START(x) (((u_int32_t)(x) & 0xe0000000UL) << 0)
+#define HAE_MEM_REG1_MASK 0x1fffffffUL
+#define HAE_MEM_REG2_START(x) (((u_int32_t)(x) & 0x0000f800UL) << 16)
+#define HAE_MEM_REG2_MASK 0x07ffffffUL
+#define HAE_MEM_REG3_START(x) (((u_int32_t)(x) & 0x000000fcUL) << 24)
+#define HAE_MEM_REG3_MASK 0x03ffffffUL
#define CIA_CSR_HAE_IO (CIA_CSRS + 0x440)
-#define HAE_IO_REG1_START(x) 0
-#define HAE_IO_REG1_MASK 0x01ffffff
-#define HAE_IO_REG2_START(x) (((u_int32_t)(x) & 0xfe000000) << 0)
-#define HAE_IO_REG2_MASK 0x01ffffff
+#define HAE_IO_REG1_START(x) 0UL
+#define HAE_IO_REG1_MASK 0x01ffffffUL
+#define HAE_IO_REG2_START(x) (((u_int32_t)(x) & 0xfe000000UL) << 0)
+#define HAE_IO_REG2_MASK 0x01ffffffUL
+
+#define CIA_CSR_CIA_ERR (CIA_CSRS + 0x8200)
-/* $OpenBSD: ciavar.h,v 1.5 1996/12/08 00:20:37 niklas Exp $ */
-/* $NetBSD: ciavar.h,v 1.5 1996/10/23 04:12:24 cgd Exp $ */
+/* $OpenBSD: ciavar.h,v 1.6 1997/01/24 19:57:40 niklas Exp $ */
+/* $NetBSD: ciavar.h,v 1.6 1996/11/25 03:49:11 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* do their dirty work (and more!).
*/
struct cia_config {
+ int cc_initted;
+
bus_space_tag_t cc_iot, cc_memt;
struct alpha_pci_chipset cc_pc;
u_int32_t cc_hae_mem;
u_int32_t cc_hae_io;
+
+ struct extent *cc_io_ex, *cc_d_mem_ex, *cc_s_mem_ex;
+ int cc_mallocsafe;
};
struct cia_softc {
/* XXX SGMAP info */
};
-void cia_init __P((struct cia_config *));
+void cia_init __P((struct cia_config *, int));
void cia_pci_init __P((pci_chipset_tag_t, void *));
-bus_space_tag_t cia_bus_io_init __P((void *iov));
-bus_space_tag_t cia_bus_mem_init __P((void *memv));
+bus_space_tag_t cia_bus_io_init __P((void *));
+bus_space_tag_t cia_bus_mem_init __P((void *));
-/* $OpenBSD: lca.c,v 1.6 1996/12/08 00:20:37 niklas Exp $ */
-/* $NetBSD: lca.c,v 1.11 1996/10/23 04:12:25 cgd Exp $ */
+/* $OpenBSD: lca.c,v 1.7 1997/01/24 19:57:41 niklas Exp $ */
+/* $NetBSD: lca.c,v 1.14 1996/12/05 01:39:35 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <alpha/pci/pci_axppci_33.h>
#endif
+#ifdef __BROKEN_INDIRECT_CONFIG
int lcamatch __P((struct device *, void *, void *));
+#else
+int lcamatch __P((struct device *, struct cfdata *, void *));
+#endif
void lcaattach __P((struct device *, struct device *, void *));
struct cfattach lca_ca = {
int
lcamatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct confargs *ca = aux;
* Set up the chipset's function pointers.
*/
void
-lca_init(lcp)
+lca_init(lcp, mallocsafe)
struct lca_config *lcp;
+ int mallocsafe;
{
/*
* Can't set up SGMAP data here; can be called before malloc().
*/
- lcp->lc_iot = apecs_lca_bus_io_init(lcp);
- lcp->lc_memt = apecs_lca_bus_mem_init(lcp);
+ /*
+ * The LCA HAE register is WRITE-ONLY, so we can't tell where
+ * the second sparse window is actually mapped. Therefore,
+ * we have to guess where it is. This seems to be the normal
+ * address.
+ */
+ lcp->lc_s_mem_w2_masked_base = 0x80000000;
+
+ if (!lcp->lc_initted) {
+ /* don't do these twice since they set up extents */
+ lcp->lc_iot = lca_bus_io_init(lcp);
+ lcp->lc_memt = lca_bus_mem_init(lcp);
+ }
+ lcp->lc_mallocsafe = mallocsafe;
+
lca_pci_init(&lcp->lc_pc, lcp);
/*
alpha_XXX_dmamap_or = 0x40000000; /* XXX */
} /* XXX */
/* XXX XXX END XXX XXX */
+
+ lcp->lc_initted = 1;
}
#ifdef notdef
/* Set up Translated Base Register 1; translate to sybBus addr 0. */
/* check size against APEC XXX JH */
- REGVAL(LCA_IOC_T_BASE_0) = vtophys(lcp->lc_sgmap) >> 1;
+ REGVAL(LCA_IOC_T_BASE_0) = vtophys(lcp->lc_sgmap) >> 1;
- /* Set up PCI mask register 1; map 8MB space. */
- REGVAL(LCA_IOC_W_MASK0) = 0x00700000;
+ /* Set up PCI mask register 1; map 8MB space. */
+ REGVAL(LCA_IOC_W_MASK0) = 0x00700000;
- /* Enable window 1; from PCI address 8MB, direct mapped. */
- REGVAL(LCA_IOC_W_BASE0) = 0x300800000;
- alpha_mb();
+ /* Enable window 1; from PCI address 8MB, direct mapped. */
+ REGVAL(LCA_IOC_W_BASE0) = 0x300800000;
+ alpha_mb();
}
#endif
* (maybe), but doesn't hurt to do twice.
*/
lcp = sc->sc_lcp = &lca_configuration;
- lca_init(lcp);
+ lca_init(lcp, 1);
#ifdef notdef
lca_init_sgmap(lcp);
#endif
pci_axppci_33_pickintr(lcp);
break;
#endif
+
default:
panic("lcaattach: shouldn't be here, really...");
}
void *aux;
const char *pnp;
{
- register struct pcibus_attach_args *pba = aux;
+ register struct pcibus_attach_args *pba = aux;
/* only PCIs can attach to LCAes; easy. */
if (pnp)
--- /dev/null
+/* $NetBSD: lca_bus_io.c,v 1.1 1996/11/25 03:42:14 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/lcareg.h>
+#include <alpha/pci/lcavar.h>
+
+#define CHIP lca
+
+#define CHIP_EX_MALLOC_SAFE(v) (((struct lca_config *)(v))->lc_mallocsafe)
+#define CHIP_IO_EXTENT(v) (((struct lca_config *)(v))->lc_io_ex)
+
+/* IO region 1 */
+#define CHIP_IO_W1_BUS_START(v) 0x00000000UL
+#define CHIP_IO_W1_BUS_END(v) 0x00ffffffUL
+#define CHIP_IO_W1_SYS_START(v) LCA_PCI_SIO
+#define CHIP_IO_W1_SYS_END(v) (LCA_PCI_SIO + ((0x00ffffffUL + 1) << 5) - 1)
+
+#include "pcs_bus_io_common.c"
--- /dev/null
+/* $NetBSD: lca_bus_mem.c,v 1.1 1996/11/25 03:42:15 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/lcareg.h>
+#include <alpha/pci/lcavar.h>
+
+#define CHIP lca
+
+#define CHIP_EX_MALLOC_SAFE(v) (((struct lca_config *)(v))->lc_mallocsafe)
+#define CHIP_D_MEM_EXTENT(v) (((struct lca_config *)(v))->lc_d_mem_ex)
+#define CHIP_S_MEM_EXTENT(v) (((struct lca_config *)(v))->lc_s_mem_ex)
+
+/* Dense region 1 */
+#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL
+#define CHIP_D_MEM_W1_BUS_END(v) 0xffffffffUL
+#define CHIP_D_MEM_W1_SYS_START(v) LCA_PCI_DENSE
+#define CHIP_D_MEM_W1_SYS_END(v) (LCA_PCI_DENSE + 0xffffffffUL)
+
+/* Sparse region 1 */
+#define CHIP_S_MEM_W1_BUS_START(v) 0x00000000UL
+#define CHIP_S_MEM_W1_BUS_END(v) 0x00ffffffUL
+#define CHIP_S_MEM_W1_SYS_START(v) LCA_PCI_SPARSE
+#define CHIP_S_MEM_W1_SYS_END(v) \
+ (LCA_PCI_SPARSE + (0x01000000UL << 5) - 1)
+
+/* Sparse region 2 */
+#define CHIP_S_MEM_W2_BUS_START(v) \
+ ((((struct lca_config *)(v))->lc_s_mem_w2_masked_base) + \
+ 0x01000000UL)
+#define CHIP_S_MEM_W2_BUS_END(v) \
+ ((((struct lca_config *)(v))->lc_s_mem_w2_masked_base) + \
+ 0x07ffffffUL)
+#define CHIP_S_MEM_W2_SYS_START(v) \
+ (LCA_PCI_SPARSE + (0x01000000UL << 5))
+#define CHIP_S_MEM_W2_SYS_END(v) \
+ (LCA_PCI_SPARSE + (0x08000000UL << 5) - 1)
+
+#include "pcs_bus_mem_common.c"
-/* $OpenBSD: lca_pci.c,v 1.4 1996/10/30 22:40:00 niklas Exp $ */
-/* $NetBSD: lca_pci.c,v 1.6 1996/10/13 03:00:08 christos Exp $ */
+/* $OpenBSD: lca_pci.c,v 1.5 1997/01/24 19:57:44 niklas Exp $ */
+/* $NetBSD: lca_pci.c,v 1.7 1996/11/13 21:13:28 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
pcireg_t *datap, data;
int s, secondary, device, ba;
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0);
if (secondary) {
pcireg_t *datap;
int s, secondary, device;
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0);
if (secondary) {
-/* $OpenBSD: lcareg.h,v 1.4 1996/10/30 22:40:00 niklas Exp $ */
-/* $NetBSD: lcareg.h,v 1.3 1996/07/09 00:54:51 cgd Exp $ */
+/* $OpenBSD: lcareg.h,v 1.5 1997/01/24 19:57:45 niklas Exp $ */
+/* $NetBSD: lcareg.h,v 1.4 1996/11/23 06:41:00 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
*/
#define REGVAL(r) (*(int32_t *)ALPHA_PHYS_TO_K0SEG(r))
+#define REGVAL64(r) (*(int64_t *)ALPHA_PHYS_TO_K0SEG(r))
/*
* Base addresses
#define LCA_PCI_SPARSE 0x200000000L /* PCI Sparse Space */
#define LCA_PCI_DENSE 0x300000000L /* PCI Dense Space */
-#define LCA_IOC_HAE LCA_IOC_BASE /* Host Address Extension */
+#define LCA_IOC_HAE LCA_IOC_BASE /* Host Address Ext. (64) */
+#define IOC_HAE_ADDREXT 0x00000000f8000000UL
+#define IOC_HAE_RSVSD 0xffffffff07ffffffUL
#define LCA_IOC_CONF (LCA_IOC_BASE + 0x020) /* Configuration Cycle Type */
#define LCA_IOC_STAT0 (LCA_IOC_BASE + 0x040) /* Status 0 */
-/* $OpenBSD: lcavar.h,v 1.5 1996/12/08 00:20:38 niklas Exp $ */
-/* $NetBSD: lcavar.h,v 1.4 1996/10/23 04:12:26 cgd Exp $ */
+/* $OpenBSD: lcavar.h,v 1.6 1997/01/24 19:57:46 niklas Exp $ */
+/* $NetBSD: lcavar.h,v 1.5 1996/11/25 03:49:38 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* do their dirty work (and more!).
*/
struct lca_config {
+ int lc_initted;
+
bus_space_tag_t lc_iot, lc_memt;
struct alpha_pci_chipset lc_pc;
+
+ bus_addr_t lc_s_mem_w2_masked_base;
+
+ struct extent *lc_io_ex, *lc_d_mem_ex, *lc_s_mem_ex;
+ int lc_mallocsafe;
};
struct lca_softc {
struct lca_config *sc_lcp;
};
-void lca_init __P((struct lca_config *));
+void lca_init __P((struct lca_config *, int));
void lca_pci_init __P((pci_chipset_tag_t, void *));
-bus_space_tag_t apecs_lca_bus_io_init __P((void *));
-bus_space_tag_t apecs_lca_bus_mem_init __P((void *));
+bus_space_tag_t lca_bus_io_init __P((void *));
+bus_space_tag_t lca_bus_mem_init __P((void *));
-/* $OpenBSD: pci_2100_a50.c,v 1.9 1996/12/08 00:20:39 niklas Exp $ */
-/* $NetBSD: pci_2100_a50.c,v 1.11 1996/10/23 04:12:26 cgd Exp $ */
+/* $OpenBSD: pci_2100_a50.c,v 1.10 1997/01/24 19:57:47 niklas Exp $ */
+/* $NetBSD: pci_2100_a50.c,v 1.12 1996/11/13 21:13:29 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
return 1;
}
if (buspin > 4) {
- printf("pci_map_int: bad interrupt pin %d\n", buspin);
+ printf("dec_2100_a50_intr_map: bad interrupt pin %d\n",
+ buspin);
return 1;
}
case PCI_INTERRUPT_PIN_C:
pirq = 1;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
case PCI_INTERRUPT_PIN_C:
pirq = 2;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
case PCI_INTERRUPT_PIN_C:
pirq = 0;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
+
+ default:
+ printf("dec_2100_a50_intr_map: weird device number %d\n",
+ device);
+ return 1;
}
pirqreg = pci_conf_read(pc, pci_make_tag(pc, 0, APECS_SIO_DEVICE, 0),
-/* $OpenBSD: pci_axppci_33.c,v 1.8 1996/12/08 00:20:40 niklas Exp $ */
-/* $NetBSD: pci_axppci_33.c,v 1.9 1996/10/23 04:12:27 cgd Exp $ */
+/* $OpenBSD: pci_axppci_33.c,v 1.9 1997/01/24 19:57:48 niklas Exp $ */
+/* $NetBSD: pci_axppci_33.c,v 1.10 1996/11/13 21:13:29 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
case PCI_INTERRUPT_PIN_C:
pirq = 1;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_axppci_33_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
case PCI_INTERRUPT_PIN_C:
pirq = 2;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_axppci_33_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
case PCI_INTERRUPT_PIN_C:
pirq = 0;
break;
+#ifdef DIAGNOSTIC
+ default: /* XXX gcc -Wuninitialized */
+ panic("dec_axppci_33_intr_map bogus PCI pin %d\n",
+ buspin);
+#endif
};
break;
+
default:
- printf("dec_axppci_33_pci_map_int: unknown device %d\n",
- device);
- panic("dec_axppci_33_pci_map_int: bad device number");
+ printf("dec_axppci_33_intr_map: weird device number %d\n",
+ device);
+ return 1;
}
pirqreg = pci_conf_read(pc, pci_make_tag(pc, 0, LCA_SIO_DEVICE, 0),
--- /dev/null
+/* $OpenBSD: pci_eb164.c,v 1.1 1997/01/24 19:57:48 niklas Exp $ */
+/* $NetBSD: pci_eb164.c,v 1.4 1996/11/25 03:47:05 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+#include <sys/syslog.h>
+
+#include <vm/vm.h>
+
+#include <machine/autoconf.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <alpha/pci/ciareg.h>
+#include <alpha/pci/ciavar.h>
+
+#include <alpha/pci/pci_eb164.h>
+
+#ifndef EVCNT_COUNTERS
+#include <machine/intrcnt.h>
+#endif
+
+#include "sio.h"
+#if NSIO
+#include <alpha/pci/siovar.h>
+#endif
+
+int dec_eb164_intr_map __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *dec_eb164_intr_string __P((void *, pci_intr_handle_t));
+void *dec_eb164_intr_establish __P((void *, pci_intr_handle_t,
+ int, int (*)(void *), void *, char *));
+void dec_eb164_intr_disestablish __P((void *, void *));
+
+#define EB164_SIO_IRQ 4
+#define EB164_MAX_IRQ 24
+#define PCI_STRAY_MAX 5
+
+struct alpha_shared_intr *eb164_pci_intr;
+#ifdef EVCNT_COUNTERS
+struct evcnt eb164_intr_evcnt;
+#endif
+
+bus_space_tag_t eb164_intrgate_iot;
+bus_space_handle_t eb164_intrgate_ioh;
+
+void eb164_iointr __P((void *framep, unsigned long vec));
+extern void eb164_intr_enable __P((int irq)); /* pci_eb164_intr.S */
+extern void eb164_intr_disable __P((int irq)); /* pci_eb164_intr.S */
+
+void
+pci_eb164_pickintr(ccp)
+ struct cia_config *ccp;
+{
+ bus_space_tag_t iot = ccp->cc_iot;
+ pci_chipset_tag_t pc = &ccp->cc_pc;
+ int i;
+
+ pc->pc_intr_v = ccp;
+ pc->pc_intr_map = dec_eb164_intr_map;
+ pc->pc_intr_string = dec_eb164_intr_string;
+ pc->pc_intr_establish = dec_eb164_intr_establish;
+ pc->pc_intr_disestablish = dec_eb164_intr_disestablish;
+
+ eb164_intrgate_iot = iot;
+ if (bus_space_map(eb164_intrgate_iot, 0x804, 3, 0,
+ &eb164_intrgate_ioh) != 0)
+ panic("pci_eb164_pickintr: couldn't map interrupt PLD");
+ for (i = 0; i < EB164_MAX_IRQ; i++)
+ eb164_intr_disable(i);
+
+ eb164_pci_intr = alpha_shared_intr_alloc(EB164_MAX_IRQ);
+ for (i = 0; i < EB164_MAX_IRQ; i++)
+ alpha_shared_intr_set_maxstrays(eb164_pci_intr, i,
+ PCI_STRAY_MAX);
+
+#if NSIO
+ sio_intr_setup(iot);
+ eb164_intr_enable(EB164_SIO_IRQ);
+#endif
+
+ set_iointr(eb164_iointr);
+}
+
+int
+dec_eb164_intr_map(ccv, bustag, buspin, line, ihp)
+ void *ccv;
+ pcitag_t bustag;
+ int buspin, line;
+ pci_intr_handle_t *ihp;
+{
+ struct cia_config *ccp = ccv;
+ pci_chipset_tag_t pc = &ccp->cc_pc;
+ int device;
+ int eb164_irq, pinbase, pinoff;
+
+ if (buspin == 0) {
+ /* No IRQ used. */
+ return 1;
+ }
+ if (buspin > 4) {
+ printf("pci_map_int: bad interrupt pin %d\n", buspin);
+ return 1;
+ }
+
+ pci_decompose_tag(pc, bustag, NULL, &device, NULL);
+ switch (device) {
+#if 0 /* THIS CODE SHOULD NEVER BE CALLED FOR THE SIO */
+ case 8: /* SIO */
+ eb164_irq = 4;
+ break;
+#endif
+
+ case 11:
+ eb164_irq = 5; /* IDE */
+ break;
+
+ case 5:
+ case 6:
+ case 7:
+ case 9:
+ switch (buspin) {
+ case 1:
+ pinbase = 0;
+ break;
+ case 2:
+ case 3:
+ case 4:
+ pinbase = (buspin * 4) - 1;
+ break;
+#ifdef DIAGNOSTIC
+ default:
+ panic("dec_eb164_intr_map: slot buspin switch");
+#endif
+ };
+ switch (device) {
+ case 5:
+ pinoff = 2;
+ break;
+
+ case 6:
+ case 7:
+ case 9:
+ pinoff = device - 6;
+ break;
+#ifdef DIAGNOSTIC
+ default:
+ panic("dec_eb164_intr_map: slot device switch");
+#endif
+ }
+ eb164_irq = pinoff + pinbase;
+ break;
+ default:
+ panic("pci_eb164_map_int: invalid device number %d\n",
+ device);
+ }
+
+ if (eb164_irq > EB164_MAX_IRQ)
+ panic("pci_eb164_map_int: eb164_irq too large (%d)\n",
+ eb164_irq);
+
+ *ihp = eb164_irq;
+ return (0);
+}
+
+const char *
+dec_eb164_intr_string(ccv, ih)
+ void *ccv;
+ pci_intr_handle_t ih;
+{
+#if 0
+ struct cia_config *ccp = ccv;
+#endif
+ static char irqstr[15]; /* 11 + 2 + NULL + sanity */
+
+ if (ih > EB164_MAX_IRQ)
+ panic("dec_eb164_intr_string: bogus eb164 IRQ 0x%x\n", ih);
+ sprintf(irqstr, "eb164 irq %d", ih);
+ return (irqstr);
+}
+
+void *
+dec_eb164_intr_establish(ccv, ih, level, func, arg, name)
+ void *ccv, *arg;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
+ char *name;
+{
+ void *cookie;
+
+ if (ih > EB164_MAX_IRQ)
+ panic("dec_eb164_intr_establish: bogus eb164 IRQ 0x%x\n", ih);
+
+ cookie = alpha_shared_intr_establish(eb164_pci_intr, ih, IST_LEVEL,
+ level, func, arg, name);
+
+ if (cookie != NULL && alpha_shared_intr_isactive(eb164_pci_intr, ih))
+ eb164_intr_enable(ih);
+ return (cookie);
+}
+
+void
+dec_eb164_intr_disestablish(ccv, cookie)
+ void *ccv, *cookie;
+{
+#if 0
+ struct cia_config *ccp = ccv;
+#endif
+
+ panic("dec_eb164_intr_disestablish not implemented"); /* XXX */
+}
+
+void
+eb164_iointr(framep, vec)
+ void *framep;
+ unsigned long vec;
+{
+ int irq;
+
+ if (vec >= 0x900) {
+ if (vec >= 0x900 + (EB164_MAX_IRQ << 4))
+ panic("eb164_iointr: vec 0x%x out of range\n", vec);
+ irq = (vec - 0x900) >> 4;
+
+#ifdef EVCNT_COUNTERS
+ eb164_intr_evcnt.ev_count++;
+#else
+ if (EB164_MAX_IRQ != INTRCNT_EB164_IRQ_LEN)
+ panic("eb164 interrupt counter sizes inconsistent");
+ intrcnt[INTRCNT_EB164_IRQ + irq]++;
+#endif
+
+ if (!alpha_shared_intr_dispatch(eb164_pci_intr, irq)) {
+ alpha_shared_intr_stray(eb164_pci_intr, irq,
+ "eb164 irq");
+ if (eb164_pci_intr[irq].intr_nstrays ==
+ eb164_pci_intr[irq].intr_maxstrays)
+ eb164_intr_disable(irq);
+ }
+ return;
+ }
+#if NSIO
+ if (vec >= 0x800) {
+ sio_iointr(framep, vec);
+ return;
+ }
+#endif
+ panic("eb164_iointr: weird vec 0x%x\n", vec);
+}
+
+#if 0 /* THIS DOES NOT WORK! see pci_eb164_intr.S. */
+u_int8_t eb164_intr_mask[3] = { 0xff, 0xff, 0xff };
+
+void
+eb164_intr_enable(irq)
+ int irq;
+{
+ int byte = (irq / 8), bit = (irq % 8);
+
+#if 1
+ printf("eb164_intr_enable: enabling %d (%d:%d)\n", irq, byte, bit);
+#endif
+ eb164_intr_mask[byte] &= ~(1 << bit);
+
+ bus_space_write_1(eb164_intrgate_iot, eb164_intrgate_ioh, byte,
+ eb164_intr_mask[byte]);
+}
+
+void
+eb164_intr_disable(irq)
+ int irq;
+{
+ int byte = (irq / 8), bit = (irq % 8);
+
+#if 1
+ printf("eb164_intr_disable: disabling %d (%d:%d)\n", irq, byte, bit);
+#endif
+ eb164_intr_mask[byte] |= (1 << bit);
+
+ bus_space_write_1(eb164_intrgate_iot, eb164_intrgate_ioh, byte,
+ eb164_intr_mask[byte]);
+}
+#endif
--- /dev/null
+/* $NetBSD: pci_eb164.h,v 1.1 1996/11/11 21:08:13 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+void pci_eb164_pickintr __P((struct cia_config *));
+
+#ifdef EVCNT_COUNTERS
+extern struct evcnt eb164_intr_evcnt;
+#endif
--- /dev/null
+/* $NetBSD: pci_eb164_intr.s,v 1.1 1996/11/25 03:47:07 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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.
+ */
+
+/*
+ * The description of how to enable and disable interrupts in the
+ * AlphaPC 164 motherboard technical reference manual is incorrect,
+ * at least for the OSF/1 PALcode.
+ *
+ * These functions were written by disassembling a Digital UNIX kernel's
+ * eb164_intrdsabl and eb164_intrenabl functions (because they had
+ * interesting names), and then playing with them to see how to call
+ * them correctly.
+ *
+ * It looks like the right thing to do is to call them with the interrupt
+ * request that you want to enable or disable (presumably in the range
+ * 0 -> 23, since there are 3 8-bit interrupt-enable bits in the
+ * interrupt mask PLD).
+ */
+
+#include <machine/asm.h>
+
+ .text
+LEAF(eb164_intr_enable,1)
+ mov a0, a1
+ ldiq a0, 0x34
+ call_pal PAL_cserve
+ RET
+ END(eb164_intr_enable)
+
+ .text
+LEAF(eb164_intr_disable,1)
+ mov a0, a1
+ ldiq a0, 0x35
+ call_pal PAL_cserve
+ RET
+ END(eb164_intr_enable)
-/* $OpenBSD: pci_kn20aa.c,v 1.8 1996/12/08 00:20:41 niklas Exp $ */
-/* $NetBSD: pci_kn20aa.c,v 1.19 1996/10/23 04:12:28 cgd Exp $ */
+/* $OpenBSD: pci_kn20aa.c,v 1.9 1997/01/24 19:57:51 niklas Exp $ */
+/* $NetBSD: pci_kn20aa.c,v 1.21 1996/11/17 02:05:27 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#define KN20AA_MAX_IRQ 32
#define PCI_STRAY_MAX 5
-struct kn20aa_intrhand {
- TAILQ_ENTRY(kn20aa_intrhand) ih_q;
- int (*ih_fun) __P((void *));
- void *ih_arg;
- u_long ih_count;
- int ih_level;
-};
-TAILQ_HEAD(kn20aa_intrchain, kn20aa_intrhand);
-
-struct kn20aa_intrchain kn20aa_pci_intrs[KN20AA_MAX_IRQ];
-int kn20aa_pci_strayintrcnt[KN20AA_MAX_IRQ];
+struct alpha_shared_intr *kn20aa_pci_intr;
#ifdef EVCNT_COUNTERS
struct evcnt kn20aa_intr_evcnt;
#endif
-void kn20aa_pci_strayintr __P((int irq));
void kn20aa_iointr __P((void *framep, unsigned long vec));
void kn20aa_enable_intr __P((int irq));
void kn20aa_disable_intr __P((int irq));
-struct kn20aa_intrhand *kn20aa_attach_intr __P((struct kn20aa_intrchain *,
- int, int (*) (void *), void *));
void
pci_kn20aa_pickintr(ccp)
bus_space_tag_t iot = ccp->cc_iot;
pci_chipset_tag_t pc = &ccp->cc_pc;
- for (i = 0; i < KN20AA_MAX_IRQ; i++)
- TAILQ_INIT(&kn20aa_pci_intrs[i]);
-
pc->pc_intr_v = ccp;
pc->pc_intr_map = dec_kn20aa_intr_map;
pc->pc_intr_string = dec_kn20aa_intr_string;
pc->pc_intr_establish = dec_kn20aa_intr_establish;
pc->pc_intr_disestablish = dec_kn20aa_intr_disestablish;
+ kn20aa_pci_intr = alpha_shared_intr_alloc(KN20AA_MAX_IRQ);
+ for (i = 0; i < KN20AA_MAX_IRQ; i++)
+ alpha_shared_intr_set_maxstrays(kn20aa_pci_intr, i,
+ PCI_STRAY_MAX);
+
#if NSIO
sio_intr_setup(iot);
+ kn20aa_enable_intr(KN20AA_PCEB_IRQ);
#endif
set_iointr(kn20aa_iointr);
-
-#if NSIO
- kn20aa_enable_intr(KN20AA_PCEB_IRQ);
-#if 0 /* XXX init PCEB interrupt handler? */
- kn20aa_attach_intr(&kn20aa_pci_intrs[KN20AA_PCEB_IRQ], ???, ???, ???);
-#endif
-#endif
}
int
break;
default:
-#ifdef KN20AA_BOGUS_IRQ_FROB
- *ihp = 0xdeadbeef;
- printf("\n\n BOGUS INTERRUPT MAPPING: dev %d, pin %d\n",
- device, buspin);
- return (0);
-#endif
- panic("pci_kn20aa_map_int: invalid device number %d\n",
+ printf("dec_kn20aa_intr_map: weird device number %d\n",
device);
+ return 1;
}
kn20aa_irq += buspin - 1;
{
static char irqstr[15]; /* 11 + 2 + NULL + sanity */
-#ifdef KN20AA_BOGUS_IRQ_FROB
- if (ih == 0xdeadbeef) {
- sprintf(irqstr, "BOGUS");
- return (irqstr);
- }
-#endif
if (ih > KN20AA_MAX_IRQ)
- panic("dec_kn20aa_a50_intr_string: bogus kn20aa IRQ 0x%x\n",
- ih);
+ panic("dec_kn20aa_intr_string: bogus kn20aa IRQ 0x%x\n", ih);
- sprintf(irqstr, "kn20aa irq %d", ih);
+ sprintf(irqstr, "kn20aa irq %ld", ih);
return (irqstr);
}
{
void *cookie;
-#ifdef KN20AA_BOGUS_IRQ_FROB
- if (ih == 0xdeadbeef) {
- int i;
- char chars[10];
-
- printf("dec_kn20aa_intr_establish: BOGUS IRQ\n");
- do {
- printf("IRQ to enable? ");
- getstr(chars, 10);
- i = atoi(chars);
- } while (i < 0 || i > 32);
- printf("ENABLING IRQ %d\n", i);
- kn20aa_enable_intr(i);
- return ((void *)0xbabefacedeadbeef);
- }
-#endif
if (ih > KN20AA_MAX_IRQ)
panic("dec_kn20aa_intr_establish: bogus kn20aa IRQ 0x%x\n",
ih);
- cookie = kn20aa_attach_intr(&kn20aa_pci_intrs[ih], level, func, arg);
- kn20aa_enable_intr(ih);
+ cookie = alpha_shared_intr_establish(kn20aa_pci_intr, ih, IST_LEVEL,
+ level, func, arg, name);
+
+ if (cookie != NULL &&
+ alpha_shared_intr_isactive(kn20aa_pci_intr, ih))
+ kn20aa_enable_intr(ih);
return (cookie);
}
panic("dec_kn20aa_intr_disestablish not implemented"); /* XXX */
}
-/*
- * caught a stray interrupt; notify if not too many seen already.
- */
-void
-kn20aa_pci_strayintr(irq)
- int irq;
-{
-
- kn20aa_pci_strayintrcnt[irq]++;
- if (kn20aa_pci_strayintrcnt[irq] == PCI_STRAY_MAX)
- kn20aa_disable_intr(irq);
-
- log(LOG_ERR, "stray kn20aa irq %d\n", irq);
- if (kn20aa_pci_strayintrcnt[irq] == PCI_STRAY_MAX)
- log(LOG_ERR, "disabling interrupts on kn20aa irq %d\n", irq);
-}
-
void
kn20aa_iointr(framep, vec)
void *framep;
unsigned long vec;
{
- struct kn20aa_intrhand *ih;
- int irq, handled;
+ int irq;
if (vec >= 0x900) {
if (vec >= 0x900 + (KN20AA_MAX_IRQ << 4))
intrcnt[INTRCNT_KN20AA_IRQ + irq]++;
#endif
- for (ih = kn20aa_pci_intrs[irq].tqh_first, handled = 0;
- ih != NULL; ih = ih->ih_q.tqe_next) {
- int rv;
-
- rv = (*ih->ih_fun)(ih->ih_arg);
-
- ih->ih_count++;
- handled = handled || (rv != 0);
+ if (!alpha_shared_intr_dispatch(kn20aa_pci_intr, irq)) {
+ alpha_shared_intr_stray(kn20aa_pci_intr, irq,
+ "kn20aa irq");
+ if (kn20aa_pci_intr[irq].intr_nstrays ==
+ kn20aa_pci_intr[irq].intr_maxstrays)
+ kn20aa_disable_intr(irq);
}
- if (!handled)
- kn20aa_pci_strayintr(irq);
return;
}
- if (vec >= 0x800) {
#if NSIO
+ if (vec >= 0x800) {
sio_iointr(framep, vec);
-#endif
return;
}
+#endif
panic("kn20aa_iointr: weird vec 0x%x\n", vec);
}
REGVAL(0x8780000000L + 0x40L) &= ~(1 << irq); /* XXX */
alpha_mb();
}
-
-struct kn20aa_intrhand *
-kn20aa_attach_intr(chain, level, func, arg)
- struct kn20aa_intrchain *chain;
- int level;
- int (*func) __P((void *));
- void *arg;
-{
- struct kn20aa_intrhand *nintrhand;
-
- nintrhand = (struct kn20aa_intrhand *)
- malloc(sizeof *nintrhand, M_DEVBUF, M_WAITOK);
-
- nintrhand->ih_fun = func;
- nintrhand->ih_arg = arg;
- nintrhand->ih_count = 0;
- nintrhand->ih_level = level;
- TAILQ_INSERT_TAIL(chain, nintrhand, ih_q);
-
- return (nintrhand);
-}
-/* $OpenBSD: pci_machdep.c,v 1.6 1996/12/08 00:20:42 niklas Exp $ */
-/* $NetBSD: pci_machdep.c,v 1.6 1996/10/23 04:12:29 cgd Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.7 1997/01/24 19:57:52 niklas Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.7 1996/11/19 04:57:32 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
-#include "pcivga.h"
-#if NPCIVGA
-#include <alpha/pci/pcivgavar.h>
+#include "vga_pci.h"
+#if NVGA_PCI
+#include <alpha/pci/vga_pcivar.h>
#endif
#include "tga.h"
match = 0;
fn = NULL;
-#if NPCIVGA
- nmatch = DEVICE_IS_PCIVGA(class, id);
+#if NVGA_PCI
+ nmatch = DEVICE_IS_VGA_PCI(class, id);
if (nmatch > match) {
match = nmatch;
- fn = pcivga_console;
+ fn = vga_pci_console;
}
#endif
#if NTGA
-/* $OpenBSD: pci_machdep.h,v 1.6 1996/12/08 00:20:43 niklas Exp $ */
-/* $NetBSD: pci_machdep.h,v 1.4 1996/04/12 06:08:52 cgd Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.7 1997/01/24 19:57:53 niklas Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
#define pci_intr_disestablish(c, iv) \
(*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
+/*
+ * alpha-specific PCI functions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+void pci_display_console __P((bus_space_tag_t, bus_space_tag_t,
+ pci_chipset_tag_t, int, int, int));
+
#ifdef _KERNEL
void pci_display_console
__P((bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t, int, int, int));
-/* $OpenBSD: pcivgavar.h,v 1.6 1996/12/08 00:20:44 niklas Exp $ */
-/* $NetBSD: pcivgavar.h,v 1.6 1996/10/23 04:12:30 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 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.
- */
-
-struct pcivga_devconfig {
- bus_space_tag_t dc_iot;
- bus_space_tag_t dc_memt;
- pci_chipset_tag_t dc_pc;
-
- pcitag_t dc_pcitag; /* PCI tag */
-
- bus_space_handle_t dc_ioh, dc_memh;
-
- int dc_ncol, dc_nrow; /* screen width & height */
- int dc_ccol, dc_crow; /* current cursor position */
-
- char dc_so; /* in standout mode? */
- char dc_at; /* normal attributes */
- char dc_so_at; /* standout attributes */
-};
-
-struct pcivga_softc {
- struct device sc_dev;
-
- struct pcivga_devconfig *sc_dc; /* device configuration */
- void *sc_intr; /* interrupt handler info */
-};
-
-#define DEVICE_IS_PCIVGA(class, id) \
- (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
- PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
- (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
- PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
-
-void pcivga_console __P((bus_space_tag_t, bus_space_tag_t,
- pci_chipset_tag_t, int, int, int));
+/* $OpenBSD: pcivgavar.h,v 1.7 1997/01/24 19:57:54 niklas Exp $ */
-/* $OpenBSD: pcs_bus_io_common.c,v 1.4 1996/12/08 00:20:45 niklas Exp $ */
-/* $NetBSD: pcs_bus_io_common.c,v 1.9 1996/10/23 04:12:31 cgd Exp $ */
+/* $OpenBSD: pcs_bus_io_common.c,v 1.5 1997/01/24 19:57:55 niklas Exp $ */
+/* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* CHIP_IO_BASE Sparse I/O space base to use.
*/
+#include <sys/extent.h>
+
#define __C(A,B) __CONCAT(A,B)
#define __S(S) __STRING(S)
void __C(CHIP,_io_free) __P((void *, bus_space_handle_t,
bus_size_t));
+/* barrier */
+inline void __C(CHIP,_io_barrier) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_size_t, int));
+
/* read (single) */
-u_int8_t __C(CHIP,_io_read_1) __P((void *, bus_space_handle_t,
+inline u_int8_t __C(CHIP,_io_read_1) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int16_t __C(CHIP,_io_read_2) __P((void *, bus_space_handle_t,
+inline u_int16_t __C(CHIP,_io_read_2) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int32_t __C(CHIP,_io_read_4) __P((void *, bus_space_handle_t,
+inline u_int32_t __C(CHIP,_io_read_4) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int64_t __C(CHIP,_io_read_8) __P((void *, bus_space_handle_t,
+inline u_int64_t __C(CHIP,_io_read_8) __P((void *, bus_space_handle_t,
bus_size_t));
/* read multiple */
bus_size_t, u_int64_t *, bus_size_t));
/* write (single) */
-void __C(CHIP,_io_write_1) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_io_write_1) __P((void *, bus_space_handle_t,
bus_size_t, u_int8_t));
-void __C(CHIP,_io_write_2) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_io_write_2) __P((void *, bus_space_handle_t,
bus_size_t, u_int16_t));
-void __C(CHIP,_io_write_4) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_io_write_4) __P((void *, bus_space_handle_t,
bus_size_t, u_int32_t));
-void __C(CHIP,_io_write_8) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_io_write_8) __P((void *, bus_space_handle_t,
bus_size_t, u_int64_t));
/* write multiple */
void __C(CHIP,_io_write_region_8) __P((void *, bus_space_handle_t,
bus_size_t, const u_int64_t *, bus_size_t));
-/* barrier */
-void __C(CHIP,_io_barrier) __P((void *, bus_space_handle_t,
- bus_size_t, bus_size_t, int));
+/* set multiple */
+void __C(CHIP,_io_set_multi_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void __C(CHIP,_io_set_multi_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void __C(CHIP,_io_set_multi_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void __C(CHIP,_io_set_multi_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* set region */
+void __C(CHIP,_io_set_region_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void __C(CHIP,_io_set_region_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void __C(CHIP,_io_set_region_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void __C(CHIP,_io_set_region_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* copy */
+void __C(CHIP,_io_copy_1) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_io_copy_2) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_io_copy_4) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_io_copy_8) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+
+static long
+ __C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
static struct alpha_bus_space __C(CHIP,_io_space) = {
/* cookie */
/* allocation/deallocation */
__C(CHIP,_io_alloc),
__C(CHIP,_io_free),
+
+ /* barrier */
+ __C(CHIP,_io_barrier),
/* read (single) */
__C(CHIP,_io_read_1),
__C(CHIP,_io_read_4),
__C(CHIP,_io_read_8),
- /* read multi */
+ /* read multiple */
__C(CHIP,_io_read_multi_1),
__C(CHIP,_io_read_multi_2),
__C(CHIP,_io_read_multi_4),
__C(CHIP,_io_write_4),
__C(CHIP,_io_write_8),
- /* write multi */
+ /* write multiple */
__C(CHIP,_io_write_multi_1),
__C(CHIP,_io_write_multi_2),
__C(CHIP,_io_write_multi_4),
__C(CHIP,_io_write_region_4),
__C(CHIP,_io_write_region_8),
- /* set multi */
- /* XXX IMPLEMENT */
-
+ /* set multiple */
+ __C(CHIP,_io_set_multi_1),
+ __C(CHIP,_io_set_multi_2),
+ __C(CHIP,_io_set_multi_4),
+ __C(CHIP,_io_set_multi_8),
+
/* set region */
- /* XXX IMPLEMENT */
+ __C(CHIP,_io_set_region_1),
+ __C(CHIP,_io_set_region_2),
+ __C(CHIP,_io_set_region_4),
+ __C(CHIP,_io_set_region_8),
/* copy */
- /* XXX IMPLEMENT */
-
- /* barrier */
- __C(CHIP,_io_barrier),
+ __C(CHIP,_io_copy_1),
+ __C(CHIP,_io_copy_2),
+ __C(CHIP,_io_copy_4),
+ __C(CHIP,_io_copy_8),
};
bus_space_tag_t
-__C(CHIP,_bus_io_init)(iov)
- void *iov;
+__C(CHIP,_bus_io_init)(v)
+ void *v;
{
- bus_space_tag_t h = &__C(CHIP,_io_space);;
+ bus_space_tag_t t = &__C(CHIP,_io_space);
+ struct extent *ex;
+
+ t->abs_cookie = v;
+
+ /* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
+ ex = extent_create(__S(__C(CHIP,_bus_io)), 0x0UL, 0xffffffffUL,
+ M_DEVBUF, (caddr_t)__C(CHIP,_io_ex_storage),
+ sizeof(__C(CHIP,_io_ex_storage)), EX_NOWAIT);
+ extent_alloc_region(ex, 0, 0xffffffffUL, EX_NOWAIT);
+
+#ifdef CHIP_IO_W1_BUS_START
+#ifdef EXTENT_DEBUG
+ printf("io: freeing from 0x%lx to 0x%lx\n", CHIP_IO_W1_BUS_START(v),
+ CHIP_IO_W1_BUS_END(v));
+#endif
+ extent_free(ex, CHIP_IO_W1_BUS_START(v),
+ CHIP_IO_W1_BUS_END(v) - CHIP_IO_W1_BUS_START(v) + 1, EX_NOWAIT);
+#endif
+#ifdef CHIP_IO_W2_BUS_START
+#ifdef EXTENT_DEBUG
+ printf("io: freeing from 0x%lx to 0x%lx\n", CHIP_IO_W2_BUS_START(v),
+ CHIP_IO_W2_BUS_END(v));
+#endif
+ extent_free(ex, CHIP_IO_W2_BUS_START(v),
+ CHIP_IO_W2_BUS_END(v) - CHIP_IO_W2_BUS_START(v) + 1, EX_NOWAIT);
+#endif
- h->abs_cookie = iov;
- return (h);
+#ifdef EXTENT_DEBUG
+ extent_print(ex);
+#endif
+ CHIP_IO_EXTENT(v) = ex;
+
+ return (t);
}
int
int cacheable;
bus_space_handle_t *iohp;
{
+ int error;
-#ifdef CHIP_IO_W1_START
- if (ioaddr >= CHIP_IO_W1_START(v) &&
- ioaddr <= CHIP_IO_W1_END(v)) {
- *iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W1_BASE(v)) >> 5) +
- (ioaddr & CHIP_IO_W1_MASK(v));
+#ifdef EXTENT_DEBUG
+ printf("io: allocating 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
+#endif
+ error = extent_alloc_region(CHIP_IO_EXTENT(v), ioaddr, iosize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
+ if (error) {
+#ifdef EXTENT_DEBUG
+ printf("io: allocation failed (%d)\n", error);
+ extent_print(CHIP_IO_EXTENT(v));
+#endif
+ return (error);
+ }
+
+#ifdef CHIP_IO_W1_BUS_START
+ if (ioaddr >= CHIP_IO_W1_BUS_START(v) &&
+ ioaddr <= CHIP_IO_W1_BUS_END(v)) {
+ *iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W1_SYS_START(v)) >> 5) +
+ (ioaddr - CHIP_IO_W1_BUS_START(v));
} else
#endif
-#ifdef CHIP_IO_W2_START
- if (ioaddr >= CHIP_IO_W2_START(v) &&
- ioaddr <= CHIP_IO_W2_END(v)) {
- *iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W2_BASE(v)) >> 5) +
- (ioaddr & CHIP_IO_W2_MASK(v));
+#ifdef CHIP_IO_W2_BUS_START
+ if (ioaddr >= CHIP_IO_W2_BUS_START(v) &&
+ ioaddr <= CHIP_IO_W2_BUS_END(v)) {
+ *iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W2_SYS_START(v)) >> 5) +
+ (ioaddr - CHIP_IO_W2_BUS_START(v));
} else
#endif
{
printf("\n");
-#ifdef CHIP_IO_W1_START
+#ifdef CHIP_IO_W1_BUS_START
printf("%s: window[1]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_io_map)), CHIP_IO_W1_START(v),
- CHIP_IO_W1_END(v)-1);
+ __S(__C(CHIP,_io_map)), CHIP_IO_W1_BUS_START(v),
+ CHIP_IO_W1_BUS_END(v));
#endif
-#ifdef CHIP_IO_W2_START
+#ifdef CHIP_IO_W2_BUS_START
printf("%s: window[2]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_io_map)), CHIP_IO_W2_START(v),
- CHIP_IO_W2_END(v)-1);
+ __S(__C(CHIP,_io_map)), CHIP_IO_W2_BUS_START(v),
+ CHIP_IO_W2_BUS_END(v));
#endif
- panic("%s: don't know how to map %lx non-cacheable",
+ panic("%s: don't know how to map %lx",
__S(__C(CHIP,_io_map)), ioaddr);
}
- /* XXX XXX XXX XXX XXX XXX */
return (0);
}
bus_space_handle_t ioh;
bus_size_t iosize;
{
+ bus_addr_t ioaddr;
+ int error;
- /* XXX nothing to do. */
- /* XXX XXX XXX XXX XXX XXX */
+#ifdef EXTENT_DEBUG
+ printf("io: freeing handle 0x%lx for 0x%lx\n", ioh, iosize);
+#endif
+
+ ioh = ALPHA_K0SEG_TO_PHYS(ioh << 5) >> 5;
+
+#ifdef CHIP_IO_W1_BUS_START
+ if ((ioh << 5) >= CHIP_IO_W1_SYS_START(v) &&
+ (ioh << 5) <= CHIP_IO_W1_SYS_END(v)) {
+ ioaddr = CHIP_IO_W1_BUS_START(v) +
+ (ioh - (CHIP_IO_W1_SYS_START(v) >> 5));
+ } else
+#endif
+#ifdef CHIP_IO_W2_BUS_START
+ if ((ioh << 5) >= CHIP_IO_W2_SYS_START(v) &&
+ (ioh << 5) <= CHIP_IO_W2_SYS_END(v)) {
+ ioaddr = CHIP_IO_W2_BUS_START(v) +
+ (ioh - (CHIP_IO_W2_SYS_START(v) >> 5));
+ } else
+#endif
+ {
+ printf("\n");
+#ifdef CHIP_IO_W1_BUS_START
+ printf("%s: sys window[1]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_io_map)), CHIP_IO_W1_SYS_START(v),
+ CHIP_IO_W1_SYS_END(v));
+#endif
+#ifdef CHIP_IO_W2_BUS_START
+ printf("%s: sys window[2]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_io_map)), CHIP_IO_W2_SYS_START(v),
+ CHIP_IO_W2_SYS_END(v));
+#endif
+ panic("%s: don't know how to unmap %lx",
+ __S(__C(CHIP,_io_unmap)), (ioh << 5));
+ }
+
+#ifdef EXTENT_DEBUG
+ printf("io: freeing 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
+#endif
+ error = extent_free(CHIP_IO_EXTENT(v), ioaddr, iosize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
+ if (error) {
+ printf("%s: WARNING: could not unmap 0x%lx-0x%lx (error %d)\n",
+ __S(__C(CHIP,_io_unmap)), ioaddr, ioaddr + iosize - 1,
+ error);
+#ifdef EXTENT_DEBUG
+ extent_print(CHIP_IO_EXTENT(v));
+#endif
+ }
}
int
panic("%s not implemented", __S(__C(CHIP,_io_free)));
}
-u_int8_t
+inline void
+__C(CHIP,_io_barrier)(v, h, o, l, f)
+ void *v;
+ bus_space_handle_t h;
+ bus_size_t o, l;
+ int f;
+{
+
+ if ((f & BUS_BARRIER_READ) != 0)
+ alpha_mb();
+ else if ((f & BUS_BARRIER_WRITE) != 0)
+ alpha_wmb();
+}
+
+inline u_int8_t
__C(CHIP,_io_read_1)(v, ioh, off)
void *v;
bus_space_handle_t ioh;
return rval;
}
-u_int16_t
+inline u_int16_t
__C(CHIP,_io_read_2)(v, ioh, off)
void *v;
bus_space_handle_t ioh;
return rval;
}
-u_int32_t
+inline u_int32_t
__C(CHIP,_io_read_4)(v, ioh, off)
void *v;
bus_space_handle_t ioh;
return rval;
}
-u_int64_t
+inline u_int64_t
__C(CHIP,_io_read_8)(v, ioh, off)
void *v;
bus_space_handle_t ioh;
CHIP_io_read_region_N(4,u_int32_t)
CHIP_io_read_region_N(8,u_int64_t)
-void
+inline void
__C(CHIP,_io_write_1)(v, ioh, off, val)
void *v;
bus_space_handle_t ioh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_io_write_2)(v, ioh, off, val)
void *v;
bus_space_handle_t ioh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_io_write_4)(v, ioh, off, val)
void *v;
bus_space_handle_t ioh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_io_write_8)(v, ioh, off, val)
void *v;
bus_space_handle_t ioh;
CHIP_io_write_region_N(4,u_int32_t)
CHIP_io_write_region_N(8,u_int64_t)
-void
-__C(CHIP,_io_barrier)(v, h, o, l, f)
- void *v;
- bus_space_handle_t h;
- bus_size_t o, l;
- int f;
-{
+#define CHIP_io_set_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_io_set_multi_),BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __C(__C(CHIP,_io_write_),BYTES)(v, h, o, val); \
+ __C(CHIP,_io_barrier)(v, h, o, sizeof val, \
+ BUS_BARRIER_WRITE); \
+ } \
+}
+CHIP_io_set_multi_N(1,u_int8_t)
+CHIP_io_set_multi_N(2,u_int16_t)
+CHIP_io_set_multi_N(4,u_int32_t)
+CHIP_io_set_multi_N(8,u_int64_t)
- if ((f & BUS_BARRIER_READ) != 0)
- alpha_mb();
- else if ((f & BUS_BARRIER_WRITE) != 0)
- alpha_wmb();
+#define CHIP_io_set_region_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_io_set_region_),BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __C(__C(CHIP,_io_write_),BYTES)(v, h, o, val); \
+ o += sizeof val; \
+ } \
+}
+CHIP_io_set_region_N(1,u_int8_t)
+CHIP_io_set_region_N(2,u_int16_t)
+CHIP_io_set_region_N(4,u_int32_t)
+CHIP_io_set_region_N(8,u_int64_t)
+
+#define CHIP_io_copy_N(BYTES) \
+void \
+__C(__C(CHIP,_io_copy_),BYTES)(v, h1, o1, h2, o2, c) \
+ void *v; \
+ bus_space_handle_t h1, h2; \
+ bus_size_t o1, o2, c; \
+{ \
+ bus_size_t i, o; \
+ \
+ for (i = 0, o = 0; i < c; i++, o += BYTES) \
+ __C(__C(CHIP,_io_write_),BYTES)(v, h2, o2 + o, \
+ __C(__C(CHIP,_io_read_),BYTES)(v, h1, o1 + o)); \
}
+CHIP_io_copy_N(1)
+CHIP_io_copy_N(2)
+CHIP_io_copy_N(4)
+CHIP_io_copy_N(8)
-/* $OpenBSD: pcs_bus_mem_common.c,v 1.4 1996/12/08 00:20:46 niklas Exp $ */
-/* $NetBSD: pcs_bus_mem_common.c,v 1.10 1996/10/23 04:12:32 cgd Exp $ */
+/* $OpenBSD: pcs_bus_mem_common.c,v 1.5 1997/01/24 19:57:56 niklas Exp $ */
+/* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* CHIP_S_MEM_BASE Sparse Mem space base to use.
*/
+#include <sys/extent.h>
+
#define __C(A,B) __CONCAT(A,B)
#define __S(S) __STRING(S)
void __C(CHIP,_mem_free) __P((void *, bus_space_handle_t,
bus_size_t));
+/* barrier */
+inline void __C(CHIP,_mem_barrier) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_size_t, int));
+
/* read (single) */
-u_int8_t __C(CHIP,_mem_read_1) __P((void *, bus_space_handle_t,
+inline u_int8_t __C(CHIP,_mem_read_1) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int16_t __C(CHIP,_mem_read_2) __P((void *, bus_space_handle_t,
+inline u_int16_t __C(CHIP,_mem_read_2) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int32_t __C(CHIP,_mem_read_4) __P((void *, bus_space_handle_t,
+inline u_int32_t __C(CHIP,_mem_read_4) __P((void *, bus_space_handle_t,
bus_size_t));
-u_int64_t __C(CHIP,_mem_read_8) __P((void *, bus_space_handle_t,
+inline u_int64_t __C(CHIP,_mem_read_8) __P((void *, bus_space_handle_t,
bus_size_t));
/* read multiple */
bus_size_t, u_int64_t *, bus_size_t));
/* write (single) */
-void __C(CHIP,_mem_write_1) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_mem_write_1) __P((void *, bus_space_handle_t,
bus_size_t, u_int8_t));
-void __C(CHIP,_mem_write_2) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_mem_write_2) __P((void *, bus_space_handle_t,
bus_size_t, u_int16_t));
-void __C(CHIP,_mem_write_4) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_mem_write_4) __P((void *, bus_space_handle_t,
bus_size_t, u_int32_t));
-void __C(CHIP,_mem_write_8) __P((void *, bus_space_handle_t,
+inline void __C(CHIP,_mem_write_8) __P((void *, bus_space_handle_t,
bus_size_t, u_int64_t));
/* write multiple */
void __C(CHIP,_mem_write_region_8) __P((void *, bus_space_handle_t,
bus_size_t, const u_int64_t *, bus_size_t));
-/* barrier */
-void __C(CHIP,_mem_barrier) __P((void *, bus_space_handle_t,
- bus_size_t, bus_size_t, int));
+/* set multiple */
+void __C(CHIP,_mem_set_multi_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void __C(CHIP,_mem_set_multi_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void __C(CHIP,_mem_set_multi_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void __C(CHIP,_mem_set_multi_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* set region */
+void __C(CHIP,_mem_set_region_1) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void __C(CHIP,_mem_set_region_2) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void __C(CHIP,_mem_set_region_4) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void __C(CHIP,_mem_set_region_8) __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* copy */
+void __C(CHIP,_mem_copy_1) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_mem_copy_2) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_mem_copy_4) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void __C(CHIP,_mem_copy_8) __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+
+static long
+ __C(CHIP,_dmem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
+static long
+ __C(CHIP,_smem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
static struct alpha_bus_space __C(CHIP,_mem_space) = {
/* cookie */
/* allocation/deallocation */
__C(CHIP,_mem_alloc),
__C(CHIP,_mem_free),
+
+ /* barrier */
+ __C(CHIP,_mem_barrier),
/* read (single) */
__C(CHIP,_mem_read_1),
__C(CHIP,_mem_read_4),
__C(CHIP,_mem_read_8),
- /* read multi */
+ /* read multiple */
__C(CHIP,_mem_read_multi_1),
__C(CHIP,_mem_read_multi_2),
__C(CHIP,_mem_read_multi_4),
__C(CHIP,_mem_write_4),
__C(CHIP,_mem_write_8),
- /* write multi */
+ /* write multiple */
__C(CHIP,_mem_write_multi_1),
__C(CHIP,_mem_write_multi_2),
__C(CHIP,_mem_write_multi_4),
__C(CHIP,_mem_write_region_4),
__C(CHIP,_mem_write_region_8),
- /* set multi */
- /* XXX IMPLEMENT */
-
+ /* set multiple */
+ __C(CHIP,_mem_set_multi_1),
+ __C(CHIP,_mem_set_multi_2),
+ __C(CHIP,_mem_set_multi_4),
+ __C(CHIP,_mem_set_multi_8),
+
/* set region */
- /* XXX IMPLEMENT */
+ __C(CHIP,_mem_set_region_1),
+ __C(CHIP,_mem_set_region_2),
+ __C(CHIP,_mem_set_region_4),
+ __C(CHIP,_mem_set_region_8),
/* copy */
- /* XXX IMPLEMENT */
-
- /* barrier */
- __C(CHIP,_mem_barrier),
+ __C(CHIP,_mem_copy_1),
+ __C(CHIP,_mem_copy_2),
+ __C(CHIP,_mem_copy_4),
+ __C(CHIP,_mem_copy_8),
};
bus_space_tag_t
-__C(CHIP,_bus_mem_init)(iov)
- void *iov;
+__C(CHIP,_bus_mem_init)(v)
+ void *v;
{
- bus_space_tag_t h = &__C(CHIP,_mem_space);;
+ bus_space_tag_t t = &__C(CHIP,_mem_space);
+ struct extent *dex, *sex;
+
+ t->abs_cookie = v;
+
+ /* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
+ dex = extent_create(__S(__C(CHIP,_bus_dmem)), 0x0UL,
+ 0xffffffffffffffffUL, M_DEVBUF,
+ (caddr_t)__C(CHIP,_dmem_ex_storage),
+ sizeof(__C(CHIP,_dmem_ex_storage)), EX_NOWAIT);
+ extent_alloc_region(dex, 0, 0xffffffffffffffffUL, EX_NOWAIT);
+
+#ifdef CHIP_D_MEM_W1_BUS_START
+#ifdef EXTENT_DEBUG
+ printf("dmem: freeing from 0x%lx to 0x%lx\n",
+ CHIP_D_MEM_W1_BUS_START(v), CHIP_D_MEM_W1_BUS_END(v));
+#endif
+ extent_free(dex, CHIP_D_MEM_W1_BUS_START(v),
+ CHIP_D_MEM_W1_BUS_END(v) - CHIP_D_MEM_W1_BUS_START(v) + 1,
+ EX_NOWAIT);
+#endif
+
+#ifdef EXTENT_DEBUG
+ extent_print(dex);
+#endif
+ CHIP_D_MEM_EXTENT(v) = dex;
+
+ /* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
+ sex = extent_create(__S(__C(CHIP,_bus_smem)), 0x0UL,
+ 0xffffffffffffffffUL, M_DEVBUF,
+ (caddr_t)__C(CHIP,_smem_ex_storage),
+ sizeof(__C(CHIP,_smem_ex_storage)), EX_NOWAIT);
+ extent_alloc_region(sex, 0, 0xffffffffffffffffUL, EX_NOWAIT);
+
+#ifdef CHIP_S_MEM_W1_BUS_START
+#ifdef EXTENT_DEBUG
+ printf("smem: freeing from 0x%lx to 0x%lx\n",
+ CHIP_S_MEM_W1_BUS_START(v), CHIP_S_MEM_W1_BUS_END(v));
+#endif
+ extent_free(sex, CHIP_S_MEM_W1_BUS_START(v),
+ CHIP_S_MEM_W1_BUS_END(v) - CHIP_S_MEM_W1_BUS_START(v) + 1,
+ EX_NOWAIT);
+#endif
+#ifdef CHIP_S_MEM_W2_BUS_START
+ if (CHIP_S_MEM_W2_BUS_START(v) != CHIP_S_MEM_W1_BUS_START(v)) {
+#ifdef EXTENT_DEBUG
+ printf("smem: freeing from 0x%lx to 0x%lx\n",
+ CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
+#endif
+ extent_free(sex, CHIP_S_MEM_W2_BUS_START(v),
+ CHIP_S_MEM_W2_BUS_END(v) - CHIP_S_MEM_W2_BUS_START(v) + 1,
+ EX_NOWAIT);
+ } else {
+#ifdef EXTENT_DEBUG
+ printf("smem: window 2 (0x%lx to 0x%lx) overlaps window 1\n",
+ CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
+#endif
+ }
+#endif
+#ifdef CHIP_S_MEM_W3_BUS_START
+ if (CHIP_S_MEM_W3_BUS_START(v) != CHIP_S_MEM_W1_BUS_START(v) &&
+ CHIP_S_MEM_W3_BUS_START(v) != CHIP_S_MEM_W2_BUS_START(v)) {
+#ifdef EXTENT_DEBUG
+ printf("smem: freeing from 0x%lx to 0x%lx\n",
+ CHIP_S_MEM_W3_BUS_START(v), CHIP_S_MEM_W3_BUS_END(v));
+#endif
+ extent_free(sex, CHIP_S_MEM_W3_BUS_START(v),
+ CHIP_S_MEM_W3_BUS_END(v) - CHIP_S_MEM_W3_BUS_START(v) + 1,
+ EX_NOWAIT);
+ } else {
+#ifdef EXTENT_DEBUG
+ printf("smem: window 2 (0x%lx to 0x%lx) overlaps window 1\n",
+ CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
+#endif
+ }
+#endif
- h->abs_cookie = iov;
- return (h);
+#ifdef EXTENT_DEBUG
+ extent_print(sex);
+#endif
+ CHIP_S_MEM_EXTENT(v) = sex;
+
+ return (t);
+}
+
+static int __C(CHIP,_xlate_addr_to_dense_handle) __P((void *,
+ bus_addr_t, bus_space_handle_t *));
+static int __C(CHIP,_xlate_dense_handle_to_addr) __P((void *,
+ bus_space_handle_t, bus_addr_t *));
+static int __C(CHIP,_xlate_addr_to_sparse_handle) __P((void *,
+ bus_addr_t, bus_space_handle_t *));
+static int __C(CHIP,_xlate_sparse_handle_to_addr) __P((void *,
+ bus_space_handle_t, bus_addr_t *));
+
+static int
+__C(CHIP,_xlate_addr_to_dense_handle)(v, memaddr, memhp)
+ void *v;
+ bus_addr_t memaddr;
+ bus_space_handle_t *memhp;
+{
+#ifdef CHIP_D_MEM_W1_BUS_START
+ if (memaddr >= CHIP_D_MEM_W1_BUS_START(v) &&
+ memaddr <= CHIP_D_MEM_W1_BUS_END(v)) {
+ *memhp = ALPHA_PHYS_TO_K0SEG(CHIP_D_MEM_W1_SYS_START(v)) +
+ (memaddr - CHIP_D_MEM_W1_BUS_START(v));
+ return (1);
+ } else
+#endif
+ return (0);
+}
+
+static int
+__C(CHIP,_xlate_dense_handle_to_addr)(v, memh, memaddrp)
+ void *v;
+ bus_space_handle_t memh;
+ bus_addr_t *memaddrp;
+{
+
+ memh = ALPHA_K0SEG_TO_PHYS(memh);
+
+#ifdef CHIP_D_MEM_W1_BUS_START
+ if (memh >= CHIP_D_MEM_W1_SYS_START(v) &&
+ memh <= CHIP_D_MEM_W1_SYS_END(v)) {
+ *memaddrp = CHIP_D_MEM_W1_BUS_START(v) +
+ (memh - CHIP_D_MEM_W1_SYS_START(v));
+ return (1);
+ } else
+#endif
+ return (0);
+}
+
+static int
+__C(CHIP,_xlate_addr_to_sparse_handle)(v, memaddr, memhp)
+ void *v;
+ bus_addr_t memaddr;
+ bus_space_handle_t *memhp;
+{
+
+#ifdef CHIP_S_MEM_W1_BUS_START
+ if (memaddr >= CHIP_S_MEM_W1_BUS_START(v) &&
+ memaddr <= CHIP_S_MEM_W1_BUS_END(v)) {
+ *memhp =
+ (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W1_SYS_START(v)) >> 5) +
+ (memaddr - CHIP_S_MEM_W1_BUS_START(v));
+ return (1);
+ } else
+#endif
+#ifdef CHIP_S_MEM_W2_BUS_START
+ if (memaddr >= CHIP_S_MEM_W2_BUS_START(v) &&
+ memaddr <= CHIP_S_MEM_W2_BUS_END(v)) {
+ *memhp =
+ (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W2_SYS_START(v)) >> 5) +
+ (memaddr - CHIP_S_MEM_W2_BUS_START(v));
+ return (1);
+ } else
+#endif
+#ifdef CHIP_S_MEM_W3_BUS_START
+ if (memaddr >= CHIP_S_MEM_W3_BUS_START(v) &&
+ memaddr <= CHIP_S_MEM_W3_BUS_END(v)) {
+ *memhp =
+ (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W3_SYS_START(v)) >> 5) +
+ (memaddr - CHIP_S_MEM_W3_BUS_START(v));
+ return (1);
+ } else
+#endif
+ return (0);
+}
+
+static int
+__C(CHIP,_xlate_sparse_handle_to_addr)(v, memh, memaddrp)
+ void *v;
+ bus_space_handle_t memh;
+ bus_addr_t *memaddrp;
+{
+
+ memh = ALPHA_K0SEG_TO_PHYS(memh << 5) >> 5;
+
+#ifdef CHIP_S_MEM_W1_BUS_START
+ if ((memh << 5) >= CHIP_S_MEM_W1_SYS_START(v) &&
+ (memh << 5) <= CHIP_S_MEM_W1_SYS_END(v)) {
+ *memaddrp = CHIP_S_MEM_W1_BUS_START(v) +
+ (memh - (CHIP_S_MEM_W1_SYS_START(v) >> 5));
+ return (1);
+ } else
+#endif
+#ifdef CHIP_S_MEM_W2_BUS_START
+ if ((memh << 5) >= CHIP_S_MEM_W2_SYS_START(v) &&
+ (memh << 5) <= CHIP_S_MEM_W2_SYS_END(v)) {
+ *memaddrp = CHIP_S_MEM_W2_BUS_START(v) +
+ (memh - (CHIP_S_MEM_W2_SYS_START(v) >> 5));
+ return (1);
+ } else
+#endif
+#ifdef CHIP_S_MEM_W3_BUS_START
+ if ((memh << 5) >= CHIP_S_MEM_W3_SYS_START(v) &&
+ (memh << 5) <= CHIP_S_MEM_W3_SYS_END(v)) {
+ *memaddrp = CHIP_S_MEM_W3_BUS_START(v) +
+ (memh - (CHIP_S_MEM_W3_SYS_START(v) >> 5));
+ return (1);
+ } else
+#endif
+ return (0);
}
int
int cacheable;
bus_space_handle_t *memhp;
{
+ bus_space_handle_t dh = 0, sh = 0; /* XXX -Wuninitialized */
+ int didd, dids, errord, errors, mustd, musts;
+
+ mustd = 1;
+ musts = (cacheable == 0);
+
+#ifdef EXTENT_DEBUG
+ printf("mem: allocating 0x%lx to 0x%lx\n", memaddr,
+ memaddr + memsize - 1);
+ printf("mem: %s dense, %s sparse\n", mustd ? "need" : "want",
+ musts ? "need" : "want");
+#endif
+ errord = extent_alloc_region(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
+ didd = (errord == 0);
+ errors = extent_alloc_region(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
+ dids = (errors == 0);
+
+#ifdef EXTENT_DEBUG
+ if (!didd)
+ printf("mem: failed to get dense (%d)\n", errord);
+ if (!dids)
+ printf("mem: failed to get sparse (%d)\n", errors);
+#endif
+
+ if ((mustd && !didd) || (musts && !dids))
+ goto bad;
+
+ if (didd && !__C(CHIP,_xlate_addr_to_dense_handle)(v, memaddr, &dh)) {
+ printf("\n");
+#ifdef CHIP_D_MEM_W1_BUS_START
+ printf("%s: window[1]=0x%lx-0x%lx\n", __S(__C(CHIP,_mem_map)),
+ CHIP_D_MEM_W1_BUS_START(v), CHIP_D_MEM_W1_BUS_END(v));
+#endif
+ panic("%s: don't know how to map %lx cacheable",
+ __S(__C(CHIP,_mem_map)), memaddr);
+ }
+
+ if (dids && !__C(CHIP,_xlate_addr_to_sparse_handle)(v, memaddr, &sh)) {
+ printf("\n");
+#ifdef CHIP_S_MEM_W1_BUS_START
+ printf("%s: window[1]=0x%lx-0x%lx\n", __S(__C(CHIP,_mem_map)),
+ CHIP_S_MEM_W1_BUS_START(v), CHIP_S_MEM_W1_BUS_END(v));
+#endif
+#ifdef CHIP_S_MEM_W2_BUS_START
+ printf("%s: window[2]=0x%lx-0x%lx\n", __S(__C(CHIP,_mem_map)),
+ CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
+#endif
+#ifdef CHIP_S_MEM_W3_BUS_START
+ printf("%s: window[3]=0x%lx-0x%lx\n", __S(__C(CHIP,_mem_map)),
+ CHIP_S_MEM_W3_BUS_START(v), CHIP_S_MEM_W3_BUS_END(v));
+#endif
+ panic("%s: don't know how to map %lx non-cacheable",
+ __S(__C(CHIP,_mem_map)), memaddr);
+ }
+
+ if (cacheable)
+ *memhp = dh;
+ else
+ *memhp = sh;
+ return (0);
- if (cacheable) {
-#ifdef CHIP_D_MEM_W1_START
- if (memaddr >= CHIP_D_MEM_W1_START(v) &&
- memaddr <= CHIP_D_MEM_W1_END(v)) {
- *memhp = ALPHA_PHYS_TO_K0SEG(CHIP_D_MEM_W1_BASE(v)) +
- (memaddr & CHIP_D_MEM_W1_MASK(v));
- } else
-#endif
- {
- printf("\n");
-#ifdef CHIP_D_MEM_W1_START
- printf("%s: window[1]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_mem_map)), CHIP_D_MEM_W1_START(v),
- CHIP_D_MEM_W1_END(v)-1);
-#endif
- panic("%s: don't know how to map %lx cacheable",
- __S(__C(CHIP,_mem_map)), memaddr);
+bad:
+#ifdef EXTENT_DEBUG
+ printf("mem: failed\n");
+#endif
+ if (didd) {
+#ifdef EXTENT_DEBUG
+ printf("mem: freeing dense\n");
+#endif
+ if (extent_free(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
+ printf("%s: WARNING: couldn't free dense 0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), memaddr,
+ memaddr + memsize - 1);
}
- } else {
-#ifdef CHIP_S_MEM_W1_START
- if (memaddr >= CHIP_S_MEM_W1_START(v) &&
- memaddr <= CHIP_S_MEM_W1_END(v)) {
- *memhp = (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W1_BASE(v)) >> 5) +
- (memaddr & CHIP_S_MEM_W1_MASK(v));
- } else
-#endif
-#ifdef CHIP_S_MEM_W2_START
- if (memaddr >= CHIP_S_MEM_W2_START(v) &&
- memaddr <= CHIP_S_MEM_W2_END(v)) {
- *memhp = (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W2_BASE(v)) >> 5) +
- (memaddr & CHIP_S_MEM_W2_MASK(v));
- } else
-#endif
-#ifdef CHIP_S_MEM_W3_START
- if (memaddr >= CHIP_S_MEM_W3_START(v) &&
- memaddr <= CHIP_S_MEM_W3_END(v)) {
- *memhp = (ALPHA_PHYS_TO_K0SEG(CHIP_S_MEM_W3_BASE(v)) >> 5) +
- (memaddr & CHIP_S_MEM_W3_MASK(v));
- } else
-#endif
- {
- printf("\n");
-#ifdef CHIP_S_MEM_W1_START
- printf("%s: window[1]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W1_START(v),
- CHIP_S_MEM_W1_END(v)-1);
-#endif
-#ifdef CHIP_S_MEM_W2_START
- printf("%s: window[2]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W2_START(v),
- CHIP_S_MEM_W2_END(v)-1);
-#endif
-#ifdef CHIP_S_MEM_W3_START
- printf("%s: window[3]=0x%lx-0x%lx\n",
- __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W3_START(v),
- CHIP_S_MEM_W3_END(v)-1);
-#endif
- panic("%s: don't know how to map %lx non-cacheable",
- __S(__C(CHIP,_mem_map)), memaddr);
+ }
+ if (dids) {
+#ifdef EXTENT_DEBUG
+ printf("mem: freeing sparse\n");
+#endif
+ if (extent_free(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
+ printf("%s: WARNING: couldn't free sparse 0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), memaddr,
+ memaddr + memsize - 1);
}
}
- /* XXX XXX XXX XXX XXX XXX */
- return (0);
+#ifdef EXTENT_DEBUG
+ extent_print(CHIP_D_MEM_EXTENT(v));
+ extent_print(CHIP_S_MEM_EXTENT(v));
+#endif
+
+ /*
+ * return dense error if we needed it but couldn't get it, else
+ * sparse error. The error _has_ to be one of the two...
+ */
+ return (mustd && !didd ? errord : (musts && !dids ? errors : EINVAL));
}
void
bus_space_handle_t memh;
bus_size_t memsize;
{
+ bus_addr_t memaddr;
+ bus_space_handle_t temph;
+ int sparse, haves, haved;
- /* XXX nothing to do. */
- /* XXX XXX XXX XXX XXX XXX */
+#ifdef EXTENT_DEBUG
+ printf("mem: freeing handle 0x%lx for 0x%lx\n", memh, memsize);
+#endif
+
+ /*
+ * Find out what space we're in.
+ */
+ sparse = ((memh >> 63) == 0);
+
+ /*
+ * Find out what address we're in in that space.
+ */
+ haves = haved = 0;
+ if (sparse)
+ haves = __C(CHIP,_xlate_sparse_handle_to_addr)(v, memh,
+ &memaddr);
+ else
+ haved = __C(CHIP,_xlate_dense_handle_to_addr)(v, memh,
+ &memaddr);
+
+ if (!haves && !haved)
+ panic("%s: couldn't get addr from %s handle 0x%lx",
+ __S(__C(CHIP,_mem_unmap)), sparse ? "sparse" : "dense",
+ memh);
+
+ /*
+ * Find out were/if that address lives in the other space.
+ */
+ if (sparse)
+ haved = __C(CHIP,_xlate_addr_to_dense_handle)(v, memaddr,
+ &temph);
+ else
+ haves = __C(CHIP,_xlate_addr_to_sparse_handle)(v, memaddr,
+ &temph);
+
+ /*
+ * Free any ranges we have.
+ */
+#ifdef EXTENT_DEBUG
+ printf("mem: it's at 0x%lx (%sdense, %ssparse)\n", memaddr,
+ haved ? "" : "not ", haves ? "" : "not ");
+#endif
+ if (haved && extent_free(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
+ printf("%s: WARNING: couldn't free dense 0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), memaddr,
+ memaddr + memsize - 1);
+ }
+ if (haves && extent_free(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
+ EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
+ printf("%s: WARNING: couldn't free sparse 0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), memaddr,
+ memaddr + memsize - 1);
+ }
}
int
panic("%s not implemented", __S(__C(CHIP,_mem_free)));
}
-u_int8_t
+inline void
+__C(CHIP,_mem_barrier)(v, h, o, l, f)
+ void *v;
+ bus_space_handle_t h;
+ bus_size_t o, l;
+ int f;
+{
+
+ if ((f & BUS_BARRIER_READ) != 0)
+ alpha_mb();
+ else if ((f & BUS_BARRIER_WRITE) != 0)
+ alpha_wmb();
+}
+
+inline u_int8_t
__C(CHIP,_mem_read_1)(v, memh, off)
void *v;
bus_space_handle_t memh;
return rval;
}
-u_int16_t
+inline u_int16_t
__C(CHIP,_mem_read_2)(v, memh, off)
void *v;
bus_space_handle_t memh;
return rval;
}
-u_int32_t
+inline u_int32_t
__C(CHIP,_mem_read_4)(v, memh, off)
void *v;
bus_space_handle_t memh;
return rval;
}
-u_int64_t
+inline u_int64_t
__C(CHIP,_mem_read_8)(v, memh, off)
void *v;
bus_space_handle_t memh;
CHIP_mem_read_region_N(4,u_int32_t)
CHIP_mem_read_region_N(8,u_int64_t)
-void
+inline void
__C(CHIP,_mem_write_1)(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_mem_write_2)(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_mem_write_4)(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb();
}
-void
+inline void
__C(CHIP,_mem_write_8)(v, memh, off, val)
void *v;
bus_space_handle_t memh;
CHIP_mem_write_region_N(4,u_int32_t)
CHIP_mem_write_region_N(8,u_int64_t)
-void
-__C(CHIP,_mem_barrier)(v, h, o, l, f)
- void *v;
- bus_space_handle_t h;
- bus_size_t o, l;
- int f;
-{
+#define CHIP_mem_set_multi_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_mem_set_multi_),BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __C(__C(CHIP,_mem_write_),BYTES)(v, h, o, val); \
+ __C(CHIP,_mem_barrier)(v, h, o, sizeof val, \
+ BUS_BARRIER_WRITE); \
+ } \
+}
+CHIP_mem_set_multi_N(1,u_int8_t)
+CHIP_mem_set_multi_N(2,u_int16_t)
+CHIP_mem_set_multi_N(4,u_int32_t)
+CHIP_mem_set_multi_N(8,u_int64_t)
- if ((f & BUS_BARRIER_READ) != 0)
- alpha_mb();
- else if ((f & BUS_BARRIER_WRITE) != 0)
- alpha_wmb();
+#define CHIP_mem_set_region_N(BYTES,TYPE) \
+void \
+__C(__C(CHIP,_mem_set_region_),BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __C(__C(CHIP,_mem_write_),BYTES)(v, h, o, val); \
+ o += sizeof val; \
+ } \
+}
+CHIP_mem_set_region_N(1,u_int8_t)
+CHIP_mem_set_region_N(2,u_int16_t)
+CHIP_mem_set_region_N(4,u_int32_t)
+CHIP_mem_set_region_N(8,u_int64_t)
+
+#define CHIP_mem_copy_N(BYTES) \
+void \
+__C(__C(CHIP,_mem_copy_),BYTES)(v, h1, o1, h2, o2, c) \
+ void *v; \
+ bus_space_handle_t h1, h2; \
+ bus_size_t o1, o2, c; \
+{ \
+ bus_size_t i, o; \
+ \
+ if ((h1 >> 63) != 0 && (h2 >> 63) != 0) { \
+ bcopy((void *)(h1 + o1), (void *)(h2 + o2), c * BYTES); \
+ return; \
+ } \
+ \
+ for (i = 0, o = 0; i < c; i++, o += BYTES) \
+ __C(__C(CHIP,_mem_write_),BYTES)(v, h2, o2 + o, \
+ __C(__C(CHIP,_mem_read_),BYTES)(v, h1, o1 + o)); \
}
+CHIP_mem_copy_N(1)
+CHIP_mem_copy_N(2)
+CHIP_mem_copy_N(4)
+CHIP_mem_copy_N(8)
-/* $OpenBSD: sio.c,v 1.8 1996/12/08 00:20:48 niklas Exp $ */
-/* $NetBSD: sio.c,v 1.12 1996/10/23 04:12:33 cgd Exp $ */
+/* $OpenBSD: sio.c,v 1.9 1997/01/24 19:57:57 niklas Exp $ */
+/* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <alpha/pci/siovar.h>
+struct sio_softc {
+ struct device sc_dv;
+
+ bus_space_tag_t sc_iot, sc_memt;
+ int sc_haseisa;
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
int siomatch __P((struct device *, void *, void *));
+#else
+int siomatch __P((struct device *, struct cfdata *, void *));
+#endif
void sioattach __P((struct device *, struct device *, void *));
struct cfattach sio_ca = {
- sizeof(struct device), siomatch, sioattach,
+ sizeof(struct sio_softc), siomatch, sioattach,
};
struct cfdriver sio_cd = {
NULL, "sio", DV_DULL,
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int pcebmatch __P((struct device *, void *, void *));
+#else
+int pcebmatch __P((struct device *, struct cfdata *, void *));
+#endif
struct cfattach pceb_ca = {
sizeof(struct device), pcebmatch, sioattach,
int sio_eisa_maxslots __P((void *));
int sio_eisa_intr_map __P((void *, u_int, eisa_intr_handle_t *));
+void sio_bridge_callback __P((void *));
+
int
siomatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct pci_attach_args *pa = aux;
int
pcebmatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct pci_attach_args *pa = aux;
struct device *parent, *self;
void *aux;
{
+ struct sio_softc *sc = (struct sio_softc *)self;
struct pci_attach_args *pa = aux;
- struct alpha_isa_chipset ic;
- struct alpha_eisa_chipset ec;
- union sio_attach_args sa;
- int sio, haseisa;
char devinfo[256];
- sio = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_SIO);
- haseisa = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB);
-
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
printf(": %s (rev. 0x%02x)\n", devinfo,
PCI_REVISION(pa->pa_class));
- if (sio) {
- pci_revision_t rev;
-
- rev = PCI_REVISION(pa->pa_class);
-
- if (rev < 3)
- printf("%s: WARNING: SIO I SUPPORT UNTESTED\n",
- self->dv_xname);
- }
+ sc->sc_iot = pa->pa_iot;
+ sc->sc_memt = pa->pa_memt;
+ sc->sc_haseisa = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB);
#ifdef EVCNT_COUNTERS
- evcnt_attach(self, "intr", &sio_intr_evcnt);
+ evcnt_attach(&sc->sc_dv, "intr", &sio_intr_evcnt);
#endif
- if (haseisa) {
+ set_pci_isa_bridge_callback(sio_bridge_callback, sc);
+}
+
+void
+sio_bridge_callback(v)
+ void *v;
+{
+ struct sio_softc *sc = v;
+ struct alpha_eisa_chipset ec;
+ struct alpha_isa_chipset ic;
+ union sio_attach_args sa;
+
+ if (sc->sc_haseisa) {
ec.ec_v = NULL;
ec.ec_attach_hook = sio_eisa_attach_hook;
ec.ec_maxslots = sio_eisa_maxslots;
ec.ec_intr_disestablish = sio_intr_disestablish;
sa.sa_eba.eba_busname = "eisa";
- sa.sa_eba.eba_iot = pa->pa_iot;
- sa.sa_eba.eba_memt = pa->pa_memt;
+ sa.sa_eba.eba_iot = sc->sc_iot;
+ sa.sa_eba.eba_memt = sc->sc_memt;
sa.sa_eba.eba_ec = &ec;
- config_found(self, &sa.sa_eba, sioprint);
+ config_found(&sc->sc_dv, &sa.sa_eba, sioprint);
}
ic.ic_v = NULL;
ic.ic_intr_disestablish = sio_intr_disestablish;
sa.sa_iba.iba_busname = "isa";
- sa.sa_iba.iba_iot = pa->pa_iot;
- sa.sa_iba.iba_memt = pa->pa_memt;
+ sa.sa_iba.iba_iot = sc->sc_iot;
+ sa.sa_iba.iba_memt = sc->sc_memt;
sa.sa_iba.iba_ic = ⁣
- config_found(self, &sa.sa_iba, sioprint);
+ config_found(&sc->sc_dv, &sa.sa_iba, sioprint);
}
int
-/* $OpenBSD: sio_pic.c,v 1.8 1996/12/08 00:20:49 niklas Exp $ */
-/* $NetBSD: sio_pic.c,v 1.14 1996/10/23 04:12:33 cgd Exp $ */
+/* $OpenBSD: sio_pic.c,v 1.9 1997/01/24 19:57:59 niklas Exp $ */
+/* $NetBSD: sio_pic.c,v 1.16 1996/11/17 02:05:26 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
/*
* Private functions and variables.
*/
-static void sio_strayintr __P((int));
-
bus_space_tag_t sio_iot;
bus_space_handle_t sio_ioh_icu1, sio_ioh_icu2, sio_ioh_elcr;
-/*
- * Interrupt handler chains. sio_intr_establish() inserts a handler into
- * the list. The handler is called with its (single) argument.
- */
-struct intrhand {
- int (*ih_fun) __P((void *));
- void *ih_arg;
- u_long ih_count;
- struct intrhand *ih_next;
- int ih_level;
- int ih_irq;
-};
-
#define ICU_LEN 16 /* number of ISA IRQs */
-static struct intrhand *sio_intrhand[ICU_LEN];
-static int sio_intrsharetype[ICU_LEN];
-static u_long sio_strayintrcnt[ICU_LEN];
+static struct alpha_shared_intr *sio_intr;
#ifdef EVCNT_COUNTERS
struct evcnt sio_intr_evcnt;
#endif
void sio_setirqstat __P((int, int, int));
+void sio_setirqstat __P((int, int, int));
+
void
sio_setirqstat(irq, enabled, type)
int irq, enabled;
enabled ? "enabled" : "disabled", isa_intr_typename(type));
#endif
- sio_intrsharetype[irq] = type;
-
icu = irq / 8;
bit = irq % 8;
#endif
#endif
+ sio_intr = alpha_shared_intr_alloc(ICU_LEN);
+
/*
* set up initial values for interrupt enables.
*/
for (i = 0; i < ICU_LEN; i++) {
+ alpha_shared_intr_set_maxstrays(sio_intr, i, STRAY_MAX);
+
switch (i) {
case 0:
case 1:
if (INITIALLY_LEVEL_TRIGGERED(i))
printf("sio_intr_setup: %d LT!\n", i);
sio_setirqstat(i, INITIALLY_ENABLED(i), IST_EDGE);
+ alpha_shared_intr_set_dfltsharetype(sio_intr, i,
+ IST_EDGE);
break;
case 2:
if (!INITIALLY_ENABLED(i))
printf("sio_intr_setup: %d not enabled!\n", i);
sio_setirqstat(i, 1, IST_EDGE);
+ alpha_shared_intr_set_dfltsharetype(sio_intr, i,
+ IST_UNUSABLE);
break;
default:
sio_setirqstat(i, INITIALLY_ENABLED(i),
INITIALLY_LEVEL_TRIGGERED(i) ? IST_LEVEL :
IST_NONE);
+ alpha_shared_intr_set_dfltsharetype(sio_intr, i,
+ INITIALLY_LEVEL_TRIGGERED(i) ? IST_LEVEL :
+ IST_NONE);
break;
}
}
static char irqstr[12]; /* 8 + 2 + NULL + sanity */
if (irq == 0 || irq >= ICU_LEN || irq == 2)
- panic("sio_intr_string: bogus IRQ 0x%x\n", irq);
+ panic("sio_intr_string: bogus isa irq 0x%x\n", irq);
sprintf(irqstr, "isa irq %d", irq);
return (irqstr);
}
void *
-sio_intr_establish(v, irq, type, level, ih_fun, ih_arg, name)
- void *v, *ih_arg;
+sio_intr_establish(v, irq, type, level, fn, arg, name)
+ void *v, *arg;
int irq;
int type;
int level;
- int (*ih_fun)(void *);
+ int (*fn)(void *);
char *name;
{
- struct intrhand **p, *c, *ih;
- extern int cold;
-
- /* no point in sleeping unless someone can free memory. */
- ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("sio_intr_establish: can't malloc handler info");
+ void *cookie;
if (irq > ICU_LEN || type == IST_NONE)
panic("sio_intr_establish: bogus irq or type");
- switch (sio_intrsharetype[irq]) {
- case IST_EDGE:
- case IST_LEVEL:
- if (type == sio_intrsharetype[irq])
- break;
- case IST_PULSE:
- if (type != IST_NONE) {
- if (sio_intrhand[irq] == NULL) {
- printf("sio_intr_establish: irq %d: warning: using %s on %s\n",
- irq, isa_intr_typename(type),
- isa_intr_typename(sio_intrsharetype[irq]));
- type = sio_intrsharetype[irq];
- } else {
- panic("sio_intr_establish: irq %d: can't share %s with %s",
- irq, isa_intr_typename(type),
- isa_intr_typename(sio_intrsharetype[irq]));
- }
- }
- break;
- }
-
- /*
- * Figure out where to put the handler.
- * This is O(N^2), but we want to preserve the order, and N is
- * generally small.
- */
- for (p = &sio_intrhand[irq]; (c = *p) != NULL; p = &c->ih_next)
- ;
-
- /*
- * Poke the real handler in now.
- */
- ih->ih_fun = ih_fun;
- ih->ih_arg = ih_arg;
- ih->ih_count = 0;
- ih->ih_next = NULL;
- ih->ih_level = 0; /* XXX meaningless on alpha */
- ih->ih_irq = irq;
- *p = ih;
+ cookie = alpha_shared_intr_establish(sio_intr, irq, type, level, fn,
+ arg, name);
- sio_setirqstat(irq, 1, type);
+ if (cookie)
+ sio_setirqstat(irq, alpha_shared_intr_isactive(sio_intr, irq),
+ alpha_shared_intr_get_sharetype(sio_intr, irq));
- return ih;
+ return (cookie);
}
void
void *cookie;
{
- printf("sio_intr_disestablish(%lx)\n", cookie);
+ printf("sio_intr_disestablish(%p)\n", cookie);
/* XXX */
/* XXX NEVER ALLOW AN INITIALLY-ENABLED INTERRUPT TO BE DISABLED */
/* XXX NEVER ALLOW AN INITIALLY-LT INTERRUPT TO BECOME UNTYPED */
}
-/*
- * caught a stray interrupt; notify if not too many seen already.
- */
-void
-sio_strayintr(irq)
- int irq;
-{
-
- sio_strayintrcnt[irq]++;
-
-#ifdef notyet
- if (sio_strayintrcnt[irq] == STRAY_MAX)
- sio_disable_intr(irq);
-
- log(LOG_ERR, "stray isa irq %d\n", irq);
- if (sio_strayintrcnt[irq] == STRAY_MAX)
- log(LOG_ERR, "disabling interrupts on isa irq %d\n", irq);
-#else
- if (sio_strayintrcnt[irq] <= STRAY_MAX)
- log(LOG_ERR, "stray isa irq %d%s\n", irq,
- sio_strayintrcnt[irq] >= STRAY_MAX ?
- "; stopped logging" : "");
-#endif
-}
-
void
sio_iointr(framep, vec)
void *framep;
unsigned long vec;
{
- int irq, handled;
- struct intrhand *ih;
+ int irq;
irq = (vec - 0x800) >> 4;
#ifdef DIAGNOSTIC
#ifdef EVCNT_COUNTERS
sio_intr_evcnt.ev_count++;
#else
+#ifdef DEBUG
if (ICU_LEN != INTRCNT_ISA_IRQ_LEN)
panic("sio interrupt counter sizes inconsistent");
+#endif
intrcnt[INTRCNT_ISA_IRQ + irq]++;
#endif
- /*
- * We cdr down the intrhand chain, calling each handler with
- * its appropriate argument;
- *
- * The handler returns one of three values:
- * 0 - This interrupt wasn't for me.
- * 1 - This interrupt was for me.
- * -1 - This interrupt might have been for me, but I don't know.
- * If there are no handlers, or they all return 0, we flags it as a
- * `stray' interrupt. On a system with level-triggered interrupts,
- * we could terminate immediately when one of them returns 1; but
- * this is PC-ish!
- */
- for (ih = sio_intrhand[irq], handled = 0; ih != NULL;
- ih = ih->ih_next) {
- int rv;
-
- rv = (*ih->ih_fun)(ih->ih_arg);
-
- ih->ih_count++;
- handled = handled || (rv != 0);
- }
-
- if (!handled)
- sio_strayintr(irq);
+ if (!alpha_shared_intr_dispatch(sio_intr, irq))
+ alpha_shared_intr_stray(sio_intr, irq, "isa irq");
/*
* Some versions of the machines which use the SIO
-/* $OpenBSD: tga.c,v 1.8 1996/12/08 00:20:51 niklas Exp $ */
-/* $NetBSD: tga.c,v 1.11 1996/10/23 04:12:35 cgd Exp $ */
+/* $OpenBSD: tga.c,v 1.9 1997/01/24 19:58:00 niklas Exp $ */
+/* $NetBSD: tga.c,v 1.13 1996/12/05 01:39:37 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/autoconf.h>
#include <machine/pte.h>
+#ifdef __BROKEN_INDIRECT_CONFIG
int tgamatch __P((struct device *, void *, void *));
+#else
+int tgamatch __P((struct device *, struct cfdata *, void *));
+#endif
void tgaattach __P((struct device *, struct device *, void *));
int tgaprint __P((void *, const char *));
rcons_eraserows,
};
-int tgaioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
-int tgammap __P((struct device *, off_t, int));
+int tgaioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int tgammap __P((void *, off_t, int));
void tga_blank __P((struct tga_devconfig *));
void tga_unblank __P((struct tga_devconfig *));
int
tgamatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct pci_attach_args *pa = aux;
intrstr);
waa.waa_isconsole = console;
+
wo = &waa.waa_odev_spec;
- wo->wo_ef = &tga_emulfuncs;
- wo->wo_efa = &sc->sc_dc->dc_rcons;
+
+ wo->wo_emulfuncs = &tga_emulfuncs;
+ wo->wo_emulfuncs_cookie = &sc->sc_dc->dc_rcons;
+
+ wo->wo_ioctl = tgaioctl;
+ wo->wo_mmap = tgammap;
+ wo->wo_miscfuncs_cookie = sc;
+
wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
wo->wo_crow = 0;
wo->wo_ccol = 0;
- wo->wo_ioctl = tgaioctl;
- wo->wo_mmap = tgammap;
config_found(self, &waa, tgaprint);
}
}
int
-tgaioctl(dev, cmd, data, flag, p)
- struct device *dev;
+tgaioctl(v, cmd, data, flag, p)
+ void *v;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{
- struct tga_softc *sc = (struct tga_softc *)dev;
+ struct tga_softc *sc = v;
struct tga_devconfig *dc = sc->sc_dc;
const struct tga_ramdac_conf *tgar = dc->dc_tgaconf->tgac_ramdac;
}
int
-tgammap(dev, offset, prot)
- struct device *dev;
+tgammap(v, offset, prot)
+ void *v;
off_t offset;
int prot;
{
- struct tga_softc *sc = (struct tga_softc *)dev;
+ struct tga_softc *sc = v;
if (offset > sc->sc_dc->dc_tgaconf->tgac_cspace_size)
return -1;
*/
(*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
- wo.wo_ef = &tga_emulfuncs;
- wo.wo_efa = &dcp->dc_rcons;
+ wo.wo_emulfuncs = &tga_emulfuncs;
+ wo.wo_emulfuncs_cookie = &dcp->dc_rcons;
+
+ /* ioctl and mmap are unused until real attachment. */
+
wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
wo.wo_crow = 0;
wo.wo_ccol = 0;
- /* ioctl and mmap are unused until real attachment. */
wscons_attach_console(&wo);
}
-/* $OpenBSD: tga_bt485.c,v 1.3 1996/10/30 22:40:21 niklas Exp $ */
-/* $NetBSD: tga_bt485.c,v 1.3 1996/07/09 00:55:05 cgd Exp $ */
+/* $OpenBSD: tga_bt485.c,v 1.4 1997/01/24 19:58:01 niklas Exp $ */
+/* $NetBSD: tga_bt485.c,v 1.4 1996/11/13 21:13:35 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
--- /dev/null
+/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <alpha/common/vgavar.h>
+#include <alpha/pci/vga_pcivar.h>
+
+struct vga_pci_softc {
+ struct device sc_dev;
+
+ pcitag_t sc_pcitag; /* PCI tag, in case we need it. */
+ struct vga_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vga_pci_match __P((struct device *, void *, void *));
+#else
+int vga_pci_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vga_pci_attach __P((struct device *, struct device *, void *));
+
+struct cfattach vga_pci_ca = {
+ sizeof(struct vga_pci_softc), vga_pci_match, vga_pci_attach,
+};
+
+pcitag_t vga_pci_console_tag;
+struct vga_config vga_pci_console_vc;
+
+int
+vga_pci_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ int potential;
+
+ potential = 0;
+
+ /*
+ * If it's prehistoric/vga or display/vga, we might match.
+ * For the console device, this is jut a sanity check.
+ */
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
+ potential = 1;
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA)
+ potential = 1;
+
+ if (!potential)
+ return (0);
+
+ /* If it's the console, we have a winner! */
+ if (pa->pa_tag == vga_pci_console_tag)
+ return (1);
+
+ /*
+ * If we might match, make sure that the card actually looks OK.
+ */
+ if (!vga_common_probe(pa->pa_iot, pa->pa_memt))
+ return (0);
+
+ return (1);
+}
+
+void
+vga_pci_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ struct vga_pci_softc *sc = (struct vga_pci_softc *)self;
+ struct vga_config *vc;
+ char devinfo[256];
+ int console;
+
+ console = (pa->pa_tag == vga_pci_console_tag);
+ if (console)
+ vc = sc->sc_vc = &vga_pci_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vga_config *)
+ malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(pa->pa_iot, pa->pa_memt, vc);
+ }
+
+ sc->sc_pcitag = pa->pa_tag;
+
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
+ printf(": %s (rev. 0x%02x)\n", devinfo,
+ PCI_REVISION(pa->pa_class));
+
+ vga_wscons_attach(self, vc, console);
+}
+
+void
+vga_pci_console(iot, memt, pc, bus, device, function)
+ bus_space_tag_t iot, memt;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
+{
+ struct vga_config *vc = &vga_pci_console_vc;
+
+ /* for later recognition */
+ vga_pci_console_tag = pci_make_tag(pc, bus, device, function);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(iot, memt, vc);
+
+ vga_wscons_console(vc);
+}
--- /dev/null
+/* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+#define DEVICE_IS_VGA_PCI(class, id) \
+ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
+ (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
+
+void vga_pci_console __P((bus_space_tag_t, bus_space_tag_t,
+ pci_chipset_tag_t, int, int, int));
--- /dev/null
+.\" $NetBSD: installboot.8,v 1.1 1996/11/06 23:07:55 cgd Exp $
+.\"
+.\" Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
+.\" Copyright (c) 1995 Paul Kranenburg
+.\" 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 Paul Kranenburg.
+.\" 3. 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.
+.\"
+.Dd November 6, 1996
+.Dt INSTALLBOOT 8
+.Os
+.Sh NAME
+.Nm installboot
+.Nd install bootstrap software on an FFS partition
+.Sh SYNOPSIS
+.Nm installboot
+.Op Fl nv
+.Ar boot
+.Ar bootxx
+.Ar device
+.Sh DESCRIPTION
+The
+.Nm installboot
+utility prepares an FFS partition for bootstrapping.
+.Pp
+The NetBSD/alpha disk bootstrap software is split into two parts:
+a small first-stage boot program that is written into the disklabel
+area of a disk
+.Po
+and hence is limited in size to 7680 bytes
+.Pc ,
+and a second-stage boot program that resides in the filesystem proper
+.Po
+typically with the name
+.Pa /boot
+.Pc .
+The first-stage boot program is loaded into memory by the SRM console
+software. After receiving control of the system, it loads the
+second-stage boot program from a set of filesystem block numbers that
+have been
+hard-coded into it by
+.Nm installboot .
+The second-stage boot program locates and loads the kernel.
+.Pp
+The second-stage boot program and the prototype code for the
+first-stage boot program can be found in
+.Pa /usr/mdec/boot
+and
+.Pa /usr/mdec/bootxx ,
+respectively.
+.Pa /usr/mdec/boot
+may be installed simply by copying it to the root directory of the
+partition you wish to boot from, but after it is installed
+.Nm installboot
+.Em must
+be run.
+.Pp
+The options recognized by
+.Nm installboot
+are as follows:
+.Bl -tag -width flag
+.It Fl n
+Do not actually write anything on the disk.
+.It Fl v
+Verbose mode.
+.El
+.Pp
+The arguments are:
+.Bl -tag -width bootxx
+.It Ar boot
+The name of the second-stage boot program in the file system
+where the first-stage boot program is to be installed.
+.It Ar bootxx
+The name of the prototype file for the first-stage boot program.
+.It Ar device
+The name of the raw device in which the first-stage boot program
+is to be installed.
+This should be the raw device containing the file system
+which holds
+.Ar boot .
+.El
+.Sh EXAMPLES
+The following command will install the first-stage boot program in the
+root filesystem
+.Pq assumed to be mounted from Dq sd0a
+using the file
+.Pa /boot
+as the second-stage boot program:
+.Bd -literal -offset indent
+installboot /boot /usr/mdec/bootxx /dev/rsd0a
+.Ed
+.Sh BUGS
+NetBSD/alpha systems are only capable of booting off of disks'
+.Dq a
+partitions, and bootable partitions must start at the beginning
+of the disk.
+.Pp
+.Nm Installboot
+requires simultaneous access to the mounted file system and
+the raw device.
+That is not allowed with the kernel
+.Dv securelevel
+variable
+.Po
+see
+.Xr sysctl 8
+.Pc
+set to a value greater than zero, so
+.Nm installboot
+only works when the system is in
+an insecure mode (e.g. single-user mode; see
+.Xr init 8 ).
+.Sh "SEE ALSO"
+.Xr disklabel 8 ,
+.Xr init 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The NetBSD/alpha
+.Nm
+command first appeared in
+.Nx 1.2 .
-/* $OpenBSD: prom.c,v 1.4 1996/11/27 19:54:49 niklas Exp $ */
-/* $NetBSD: prom.c,v 1.1 1995/11/23 02:39:07 cgd Exp $ */
+/* $OpenBSD: prom.c,v 1.5 1997/01/24 19:58:07 niklas Exp $ */
+/* $NetBSD: prom.c,v 1.2 1996/11/25 16:18:16 cgd Exp $ */
/*
* Mach Operating System
c = (struct crb *)((u_int8_t *)r + r->rpb_crb_off);
prom_dispatch_v.routine_arg = c->crb_v_dispatch;
- prom_dispatch_v.routine = c->crb_v_dispatch->code;
+ prom_dispatch_v.routine = c->crb_v_dispatch->entry_va;
/* Look for console tty. */
prom_getenv(PROM_E_TTY_DEV, buf, 4);
-/* $OpenBSD: cfb.c,v 1.6 1996/12/08 00:20:55 niklas Exp $ */
-/* $NetBSD: cfb.c,v 1.5 1996/10/13 03:00:27 christos Exp $ */
+/* $OpenBSD: cfb.c,v 1.7 1997/01/24 19:58:08 niklas Exp $ */
+/* $NetBSD: cfb.c,v 1.7 1996/12/05 01:39:39 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/autoconf.h>
#include <machine/pte.h>
+#ifdef __BROKEN_INDIRECT_CONFIG
int cfbmatch __P((struct device *, void *, void *));
+#else
+int cfbmatch __P((struct device *, struct cfdata *, void *));
+#endif
void cfbattach __P((struct device *, struct device *, void *));
int cfbprint __P((void *, const char *));
rcons_eraserows,
};
-int cfbioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
-int cfbmmap __P((struct device *, off_t, int));
+int cfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int cfbmmap __P((void *, off_t, int));
int cfbintr __P((void *));
int
cfbmatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct tc_attach_args *ta = aux;
/* initialize the raster */
waa.waa_isconsole = console;
wo = &waa.waa_odev_spec;
- wo->wo_ef = &cfb_emulfuncs;
- wo->wo_efa = &sc->sc_dc->dc_rcons;
+
+ wo->wo_emulfuncs = &cfb_emulfuncs;
+ wo->wo_emulfuncs_cookie = &sc->sc_dc->dc_rcons;
+
+ wo->wo_ioctl = cfbioctl;
+ wo->wo_mmap = cfbmmap;
+ wo->wo_miscfuncs_cookie = sc;
+
wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
wo->wo_crow = 0;
wo->wo_ccol = 0;
- wo->wo_ioctl = cfbioctl;
- wo->wo_mmap = cfbmmap;
config_found(self, &waa, cfbprint);
}
}
int
-cfbioctl(dev, cmd, data, flag, p)
- struct device *dev;
+cfbioctl(v, cmd, data, flag, p)
+ void *v;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{
- struct cfb_softc *sc = (struct cfb_softc *)dev;
+ struct cfb_softc *sc = v;
struct cfb_devconfig *dc = sc->sc_dc;
switch (cmd) {
}
int
-cfbmmap(dev, offset, prot)
- struct device *dev;
+cfbmmap(v, offset, prot)
+ void *v;
off_t offset;
int prot;
{
- struct cfb_softc *sc = (struct cfb_softc *)dev;
+ struct cfb_softc *sc = v;
if (offset > CFB_SIZE)
return -1;
-/* $OpenBSD: esp.c,v 1.7 1996/11/23 21:44:59 kstailey Exp $ */
-/* $NetBSD: esp.c,v 1.22 1996/10/15 21:30:19 mycroft Exp $ */
+/* $OpenBSD: esp.c,v 1.8 1997/01/24 19:58:10 niklas Exp $ */
+/* $NetBSD: esp.c,v 1.26 1996/12/05 01:39:40 cgd Exp $ */
#ifdef __sparc__
#define SPARC_DRIVER
int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/
-/*static*/ void espattach __P((struct device *, struct device *, void *));
+/*static*/ void espattach __P((struct device *, struct device *,
+ void *));
/*static*/ int espprint __P((void *, const char *));
+#ifdef __BROKEN_INDIRECT_CONFIG
/*static*/ int espmatch __P((struct device *, void *, void *));
+#else
+/*static*/ int espmatch __P((struct device *, struct cfdata *,
+ void *));
+#endif
/*static*/ u_int esp_adapter_info __P((struct esp_softc *));
/*static*/ void espreadregs __P((struct esp_softc *));
/*static*/ void esp_select __P((struct esp_softc *, struct esp_ecb *));
/*static*/ void esp_reset __P((struct esp_softc *));
/*static*/ void esp_init __P((struct esp_softc *, int));
/*static*/ int esp_scsi_cmd __P((struct scsi_xfer *));
-/*static*/ int esp_poll __P((struct esp_softc *, struct scsi_xfer *, int));
+/*static*/ int esp_poll __P((struct esp_softc *, struct scsi_xfer *,
+ int));
/*static*/ void esp_sched __P((struct esp_softc *));
/*static*/ void esp_done __P((struct esp_softc *, struct esp_ecb *));
/*static*/ void esp_msgin __P((struct esp_softc *));
}
int
+#ifdef __BROKEN_INDIRECT_CONFIG
espmatch(parent, vcf, aux)
+#else
+espmatch(parent, cf, aux)
+#endif
struct device *parent;
- void *vcf, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *vcf;
+#else
+ struct cfdata *cf;
+#endif
+ void *aux;
{
#ifdef SPARC_DRIVER
+#ifdef __BROKEN_INDIRECT_CONFIG
struct cfdata *cf = vcf;
+#endif
register struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra;
sc->sc_cookie = tcdsdev->tcdsda_cookie;
sc->sc_dma = tcdsdev->tcdsda_sc;
- printf(": address %x", sc->sc_reg);
+ printf(": address %p", sc->sc_reg);
tcds_intr_establish(parent, sc->sc_cookie, TC_IPL_BIO,
(int (*)(void *))espintr, sc);
#endif
{
register int v;
- ESP_TRACE(("[esp_msgin(curmsglen:%d)] ", sc->sc_imlen));
+ ESP_TRACE(("[esp_msgin(curmsglen:%ld)] ", (long)sc->sc_imlen));
if ((ESP_READ_REG(sc, ESP_FFLAG) & ESPFIFO_FF) == 0) {
printf("%s: msgin: no msg byte available\n",
*/
switch (sc->sc_state) {
struct esp_ecb *ecb;
- struct scsi_link *sc_link;
struct esp_tinfo *ti;
case ESP_CONNECTED:
case MSG_CMDCOMPLETE:
ESP_MSGS(("cmdcomplete "));
if (sc->sc_dleft < 0) {
- sc_link = ecb->xs->sc_link;
- printf("%s: %d extra bytes from %d:%d\n",
- sc->sc_dev.dv_xname, -sc->sc_dleft,
+ struct scsi_link *sc_link = ecb->xs->sc_link;
+ printf("%s: %ld extra bytes from %d:%d\n",
+ sc->sc_dev.dv_xname, -(long)sc->sc_dleft,
sc_link->target, sc_link->lun);
sc->sc_dleft = 0;
}
* change is expected.
*/
if (DMA_ISACTIVE(sc->sc_dma)) {
- DMA_INTR(sc->sc_dma);
+ int r = DMA_INTR(sc->sc_dma);
+ if (r == -1) {
+ printf("%s: DMA error; resetting\n",
+ sc->sc_dev.dv_xname);
+ esp_init(sc, 1);
+ }
/* If DMA active here, then go back to work... */
if (DMA_ISACTIVE(sc->sc_dma))
return 1;
}
break;
case DATA_OUT_PHASE:
- ESP_PHASE(("DATA_OUT_PHASE [%d] ", sc->sc_dleft));
+ ESP_PHASE(("DATA_OUT_PHASE [%ld] ",(long)sc->sc_dleft));
ESPCMD(sc, ESPCMD_FLUSH);
size = min(sc->sc_dleft, sc->sc_maxxfer);
DMA_SETUP(sc->sc_dma, &sc->sc_dp, &sc->sc_dleft,
*/
if (sc->sc_state == ESP_CONNECTED)
esp_sched_msgout(SEND_ABORT);
+
+ /*
+ * Reschedule timeout. First, cancel a queued timeout (if any)
+ * in case someone decides to call esp_abort() from elsewhere.
+ */
+ untimeout(esp_timeout, ecb);
+ timeout(esp_timeout, ecb, (ecb->timeout * hz) / 1000);
} else {
esp_dequeue(sc, ecb);
TAILQ_INSERT_HEAD(&sc->ready_list, ecb, chain);
sc_print_addr(sc_link);
printf("%s: timed out [ecb %p (flags 0x%x, dleft %x, stat %x)], "
- "<state %d, nexus %p, phase(c %x, p %x), resid %x, msg(q %x,o %x) %s>",
+ "<state %d, nexus %p, phase(c %x, p %x), resid %lx, msg(q %x,o %x) %s>",
sc->sc_dev.dv_xname,
ecb, ecb->flags, ecb->dleft, ecb->stat,
sc->sc_state, sc->sc_nexus, sc->sc_phase, sc->sc_prevphase,
- sc->sc_dleft, sc->sc_msgpriq, sc->sc_msgout,
+ (long)sc->sc_dleft, sc->sc_msgpriq, sc->sc_msgout,
DMA_ISACTIVE(sc->sc_dma) ? "DMA active" : "");
#if ESP_DEBUG > 0
printf("TRACE: %s.", ecb->trace);
-/* $OpenBSD: espvar.h,v 1.5 1996/10/30 22:41:07 niklas Exp $ */
-/* $NetBSD: espvar.h,v 1.10 1996/10/15 21:31:37 mycroft Exp $ */
+/* $OpenBSD: espvar.h,v 1.6 1997/01/24 19:58:12 niklas Exp $ */
+/* $NetBSD: espvar.h,v 1.12 1996/11/24 04:21:30 cgd Exp $ */
#if defined(__sparc__) && !defined(SPARC_DRIVER)
#define SPARC_DRIVER
nexus_list;
struct esp_ecb *sc_nexus; /* current command */
- struct esp_ecb sc_ecb[16]; /* one per target */
+ struct esp_ecb sc_ecb[3*8]; /* three per target */
struct esp_tinfo sc_tinfo[8];
/* Data about the current nexus (updated for every cmd switch) */
-/* $OpenBSD: ioasic.c,v 1.5 1996/11/23 21:45:00 kstailey Exp $ */
-/* $NetBSD: ioasic.c,v 1.9 1996/10/13 03:00:32 christos Exp $ */
+/* $OpenBSD: ioasic.c,v 1.6 1997/01/24 19:58:13 niklas Exp $ */
+/* $NetBSD: ioasic.c,v 1.10 1996/12/05 01:39:41 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
};
/* Definition of the driver for autoconfig. */
+#ifdef __BROKEN_INDIRECT_CONFIG
int ioasicmatch __P((struct device *, void *, void *));
+#else
+int ioasicmatch __P((struct device *, struct cfdata *, void *));
+#endif
void ioasicattach __P((struct device *, struct device *, void *));
int ioasicprint(void *, const char *);
int
ioasicmatch(parent, cfdata, aux)
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cfdata;
+#endif
void *aux;
{
struct tc_attach_args *ta = aux;
-/* $OpenBSD: mcclock_ioasic.c,v 1.3 1996/10/30 22:41:10 niklas Exp $ */
-/* $NetBSD: mcclock_ioasic.c,v 1.2 1996/04/17 22:22:58 cgd Exp $ */
+/* $OpenBSD: mcclock_ioasic.c,v 1.4 1997/01/24 19:58:14 niklas Exp $ */
+/* $NetBSD: mcclock_ioasic.c,v 1.3 1996/12/05 01:39:42 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
struct mcclock_ioasic_clockdatum *sc_dp;
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int mcclock_ioasic_match __P((struct device *, void *, void *));
+#else
+int mcclock_ioasic_match __P((struct device *, struct cfdata *, void *));
+#endif
void mcclock_ioasic_attach __P((struct device *, struct device *, void *));
struct cfattach mcclock_ioasic_ca = {
int
mcclock_ioasic_match(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct ioasicdev_attach_args *d = aux;
-/* $OpenBSD: scc.c,v 1.6 1996/10/30 22:41:11 niklas Exp $ */
-/* $NetBSD: scc.c,v 1.26 1996/10/16 05:07:57 jonathan Exp $ */
+/* $OpenBSD: scc.c,v 1.7 1997/01/24 19:58:15 niklas Exp $ */
+/* $NetBSD: scc.c,v 1.28 1996/12/05 01:39:43 cgd Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
#include <alpha/tc/ioasicreg.h>
#include <dev/tc/ioasicvar.h>
-extern void ttrstrt __P((void *));
-
#undef SCCDEV
#define SCCDEV 15 /* XXX */
#endif
/* Definition of the driver for autoconfig. */
-static int sccmatch __P((struct device * parent, void *cfdata,
- void *aux));
-static void sccattach __P((struct device *parent, struct device *self,
- void *aux));
+#ifdef __BROKEN_INDIRECT_CONFIG
+int sccmatch __P((struct device *, void *, void *));
+#else
+int sccmatch __P((struct device *, struct cfdata *, void *));
+#endif
+void sccattach __P((struct device *, struct device *, void *));
+
struct cfattach scc_ca = {
sizeof (struct scc_softc), sccmatch, sccattach,
};
NULL, "scc", DV_TTY,
};
-int sccopen __P((dev_t, int, int, struct proc *));
-int sccclose __P((dev_t, int, int, struct proc *));
-int sccread __P((dev_t, struct uio *, int));
-int sccwrite __P((dev_t, struct uio *, int));
-struct tty *scctty __P((dev_t));
-int sccioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-void sccstop __P((struct tty *, int));
-int sccGetc __P((dev_t));
-void sccPutc __P((dev_t, int));
-void sccPollc __P((dev_t, int));
-int sccparam __P((struct tty *, struct termios *));
-void sccstart __P((struct tty *));
-int sccmctl __P((dev_t, int, int));
-static int cold_sccparam __P((struct tty *, struct termios *,
- struct scc_softc *sc));
-
-#ifdef SCC_DEBUG
-static void rr __P((char *, scc_regmap_t *));
-#endif
-static void scc_modem_intr __P((dev_t));
-static void sccreset __P((struct scc_softc *));
+cdev_decl(scc);
+int cold_sccparam __P((struct tty *, struct termios *,
+ struct scc_softc *sc));
+int sccGetc __P((dev_t));
+void sccPollc __P((dev_t, int));
+void sccPutc __P((dev_t, int));
int sccintr __P((void *));
+int sccmctl __P((dev_t, int, int));
+int sccparam __P((struct tty *, struct termios *));
+void sccreset __P((struct scc_softc *));
+void sccstart __P((struct tty *));
void scc_alphaintr __P((int));
-
+void scc_modem_intr __P((dev_t));
+#ifdef SCC_DEBUG
+void scc_rr __P((char *, scc_regmap_t *));
+#endif
/*
* console variables, for using serial console while still cold and
static struct consdev scccons = {
NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0
};
-void scc_consinit __P((dev_t dev, scc_regmap_t *sccaddr));
-void scc_oconsinit __P((struct scc_softc *, dev_t));
+void scc_consinit __P((dev_t dev, scc_regmap_t *sccaddr));
+void scc_oconsinit __P((struct scc_softc *, dev_t));
/*
splx(s);
}
+#ifndef alpha
void
scc_oconsinit(sc, dev)
struct scc_softc *sc;
DELAY(1000);
splx(s);
}
+#endif
/*
* Test to see if device is present.
* Return true if found.
*/
int
+#ifdef __BROKEN_INDIRECT_CONFIG
sccmatch(parent, cfdata, aux)
+#else
+sccmatch(parent, cf, aux)
+#endif
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cf;
+#endif
void *aux;
{
+#ifdef __BROKEN_INDIRECT_CONFIG
struct cfdata *cf = cfdata;
+#endif
struct ioasicdev_attach_args *d = aux;
void *sccaddr;
/*
* Reset the chip.
*/
-static void
+void
sccreset(sc)
register struct scc_softc *sc;
{
/*
* Do what sccparam() (t_param entry point) does, but callable when cold.
*/
-static int
+int
cold_sccparam(tp, t, sc)
register struct tty *tp;
register struct termios *t;
if (rr2 == 6) { /* strange, distinguished value */
SCC_READ_REG(regs, SCC_CHANNEL_A, ZSRR_IPEND, rr3);
if (rr3 == 0)
- return 0; /* XXX */
+ return 1;
}
SCC_WRITE_REG(regs, SCC_CHANNEL_A, SCC_RR0, ZSWR0_CLR_INTR);
* Stop output on a line.
*/
/*ARGSUSED*/
-void
+int
sccstop(tp, flag)
register struct tty *tp;
int flag;
tp->t_state |= TS_FLUSH;
}
splx(s);
+ return 0;
}
int
/*
* Check for carrier transition.
*/
-static void
+void
scc_modem_intr(dev)
dev_t dev;
{
}
#ifdef SCC_DEBUG
-static void
-rr(msg, regs)
+void
+scc_rr(msg, regs)
char *msg;
scc_regmap_t *regs;
{
-/* $OpenBSD: sccvar.h,v 1.3 1996/10/30 22:41:13 niklas Exp $ */
-/* $NetBSD: sccvar.h,v 1.3 1996/07/09 00:55:21 cgd Exp $ */
+/* $OpenBSD: sccvar.h,v 1.4 1997/01/24 19:58:16 niklas Exp $ */
+/* $NetBSD: sccvar.h,v 1.4 1996/11/16 00:40:14 cgd Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995 Carnegie Mellon University
} scc_regmap_t;
#define scc_get_datum(d, v) \
- do { (v) = ((d) >> 8) & 0xff; } while (0)
+ do { (v) = ((d) >> 8) & 0xff; alpha_mb(); DELAY(5); } while (0)
#define scc_set_datum(d, v) \
- do { (d) = (volatile unsigned int)(v) << 8; alpha_mb(); } while (0)
+ do { (d) = (volatile unsigned int)(v) << 8; alpha_mb(); DELAY(5); } while (0)
/*
* Minor device numbers for scc. Weird because B channel comes first and
-/* $OpenBSD: sfb.c,v 1.6 1996/12/08 00:20:56 niklas Exp $ */
-/* $NetBSD: sfb.c,v 1.5 1996/10/13 03:00:35 christos Exp $ */
+/* $OpenBSD: sfb.c,v 1.7 1997/01/24 19:58:17 niklas Exp $ */
+/* $NetBSD: sfb.c,v 1.7 1996/12/05 01:39:44 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <machine/autoconf.h>
#include <machine/pte.h>
+#ifdef __BROKEN_INDIRECT_CONFIG
int sfbmatch __P((struct device *, void *, void *));
+#else
+int sfbmatch __P((struct device *, struct cfdata *, void *));
+#endif
void sfbattach __P((struct device *, struct device *, void *));
int sfbprint __P((void *, const char *));
rcons_eraserows,
};
-int sfbioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
-int sfbmmap __P((struct device *, off_t, int));
+int sfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int sfbmmap __P((void *, off_t, int));
#if 0
void sfb_blank __P((struct sfb_devconfig *));
int
sfbmatch(parent, match, aux)
struct device *parent;
- void *match, *aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
{
struct tc_attach_args *ta = aux;
waa.waa_isconsole = console;
wo = &waa.waa_odev_spec;
- wo->wo_ef = &sfb_emulfuncs;
- wo->wo_efa = &sc->sc_dc->dc_rcons;
+
+ wo->wo_emulfuncs = &sfb_emulfuncs;
+ wo->wo_emulfuncs_cookie = &sc->sc_dc->dc_rcons;
+
+ wo->wo_ioctl = sfbioctl;
+ wo->wo_mmap = sfbmmap;
+ wo->wo_miscfuncs_cookie = sc;
+
wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
wo->wo_crow = 0;
wo->wo_ccol = 0;
- wo->wo_ioctl = sfbioctl;
- wo->wo_mmap = sfbmmap;
config_found(self, &waa, sfbprint);
}
}
int
-sfbioctl(dev, cmd, data, flag, p)
- struct device *dev;
+sfbioctl(v, cmd, data, flag, p)
+ void *v;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{
- struct sfb_softc *sc = (struct sfb_softc *)dev;
+ struct sfb_softc *sc = v;
struct sfb_devconfig *dc = sc->sc_dc;
switch (cmd) {
}
int
-sfbmmap(dev, offset, prot)
- struct device *dev;
+sfbmmap(v, offset, prot)
+ void *v;
off_t offset;
int prot;
{
- struct sfb_softc *sc = (struct sfb_softc *)dev;
+ struct sfb_softc *sc = v;
if (offset > SFB_SIZE)
return -1;
-/* $OpenBSD: tc_3000_500.c,v 1.5 1996/10/30 22:41:18 niklas Exp $ */
-/* $NetBSD: tc_3000_500.c,v 1.11 1996/10/13 03:00:38 christos Exp $ */
+/* $OpenBSD: tc_3000_500.c,v 1.6 1997/01/24 19:58:18 niklas Exp $ */
+/* $NetBSD: tc_3000_500.c,v 1.12 1996/11/15 23:59:00 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
int tc_3000_500_nslots =
sizeof(tc_3000_500_slots) / sizeof(tc_3000_500_slots[0]);
-struct tc_builtin tc_3000_500_builtins[] = {
+struct tc_builtin tc_3000_500_graphics_builtins[] = {
{ "FLAMG-IO", 7, 0x00000000, C(TC_3000_500_DEV_IOASIC), },
{ "PMAGB-BA", 7, 0x02000000, C(TC_3000_500_DEV_CXTURBO), },
{ "PMAZ-DS ", 6, 0x00000000, C(TC_3000_500_DEV_TCDS), },
};
-int tc_3000_500_nbuiltins =
- sizeof(tc_3000_500_builtins) / sizeof(tc_3000_500_builtins[0]);
+int tc_3000_500_graphics_nbuiltins = sizeof(tc_3000_500_graphics_builtins) /
+ sizeof(tc_3000_500_graphics_builtins[0]);
+
+struct tc_builtin tc_3000_500_nographics_builtins[] = {
+ { "FLAMG-IO", 7, 0x00000000, C(TC_3000_500_DEV_IOASIC), },
+ { "PMAZ-DS ", 6, 0x00000000, C(TC_3000_500_DEV_TCDS), },
+};
+int tc_3000_500_nographics_nbuiltins = sizeof(tc_3000_500_nographics_builtins) /
+ sizeof(tc_3000_500_nographics_builtins[0]);
u_int32_t tc_3000_500_intrbits[TC_3000_500_NCOOKIES] = {
TC_3000_500_IR_OPT0,
-/* $OpenBSD: tc_bus_mem.c,v 1.5 1996/12/08 00:20:58 niklas Exp $ */
-/* $NetBSD: tc_bus_mem.c,v 1.9 1996/10/23 04:12:37 cgd Exp $ */
+/* $OpenBSD: tc_bus_mem.c,v 1.6 1997/01/24 19:58:19 niklas Exp $ */
+/* $NetBSD: tc_bus_mem.c,v 1.13 1996/12/02 22:19:34 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
bus_space_handle_t *));
void tc_mem_free __P((void *, bus_space_handle_t, bus_size_t));
+/* barrier */
+inline void tc_mem_barrier __P((void *, bus_space_handle_t,
+ bus_size_t, bus_size_t, int));
+
/* read (single) */
-u_int8_t tc_mem_read_1 __P((void *, bus_space_handle_t, bus_size_t));
-u_int16_t tc_mem_read_2 __P((void *, bus_space_handle_t, bus_size_t));
-u_int32_t tc_mem_read_4 __P((void *, bus_space_handle_t, bus_size_t));
-u_int64_t tc_mem_read_8 __P((void *, bus_space_handle_t, bus_size_t));
+inline u_int8_t tc_mem_read_1 __P((void *, bus_space_handle_t, bus_size_t));
+inline u_int16_t tc_mem_read_2 __P((void *, bus_space_handle_t, bus_size_t));
+inline u_int32_t tc_mem_read_4 __P((void *, bus_space_handle_t, bus_size_t));
+inline u_int64_t tc_mem_read_8 __P((void *, bus_space_handle_t, bus_size_t));
/* read multiple */
void tc_mem_read_multi_1 __P((void *, bus_space_handle_t,
bus_size_t, u_int64_t *, bus_size_t));
/* write (single) */
-void tc_mem_write_1 __P((void *, bus_space_handle_t, bus_size_t,
+inline void tc_mem_write_1 __P((void *, bus_space_handle_t, bus_size_t,
u_int8_t));
-void tc_mem_write_2 __P((void *, bus_space_handle_t, bus_size_t,
+inline void tc_mem_write_2 __P((void *, bus_space_handle_t, bus_size_t,
u_int16_t));
-void tc_mem_write_4 __P((void *, bus_space_handle_t, bus_size_t,
+inline void tc_mem_write_4 __P((void *, bus_space_handle_t, bus_size_t,
u_int32_t));
-void tc_mem_write_8 __P((void *, bus_space_handle_t, bus_size_t,
+inline void tc_mem_write_8 __P((void *, bus_space_handle_t, bus_size_t,
u_int64_t));
/* write multiple */
void tc_mem_write_region_8 __P((void *, bus_space_handle_t,
bus_size_t, const u_int64_t *, bus_size_t));
-/* barrier */
-void tc_mem_barrier __P((void *, bus_space_handle_t,
- bus_size_t, bus_size_t, int));
-
+/* set multiple */
+void tc_mem_set_multi_1 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void tc_mem_set_multi_2 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void tc_mem_set_multi_4 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void tc_mem_set_multi_8 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* set region */
+void tc_mem_set_region_1 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int8_t, bus_size_t));
+void tc_mem_set_region_2 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int16_t, bus_size_t));
+void tc_mem_set_region_4 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int32_t, bus_size_t));
+void tc_mem_set_region_8 __P((void *, bus_space_handle_t,
+ bus_size_t, u_int64_t, bus_size_t));
+
+/* copy */
+void tc_mem_copy_1 __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void tc_mem_copy_2 __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void tc_mem_copy_4 __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
+void tc_mem_copy_8 __P((void *, bus_space_handle_t,
+ bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
static struct alpha_bus_space tc_mem_space = {
/* cookie */
tc_mem_alloc,
tc_mem_free,
+ /* barrier */
+ tc_mem_barrier,
+
/* read (single) */
tc_mem_read_1,
tc_mem_read_2,
tc_mem_read_4,
tc_mem_read_8,
- /* read multi */
+ /* read multiple */
tc_mem_read_multi_1,
tc_mem_read_multi_2,
tc_mem_read_multi_4,
tc_mem_write_4,
tc_mem_write_8,
- /* write multi */
+ /* write multiple */
tc_mem_write_multi_1,
tc_mem_write_multi_2,
tc_mem_write_multi_4,
tc_mem_write_region_4,
tc_mem_write_region_8,
- /* set multi */
- /* XXX IMPLEMENT */
+ /* set multiple */
+ tc_mem_set_multi_1,
+ tc_mem_set_multi_2,
+ tc_mem_set_multi_4,
+ tc_mem_set_multi_8,
/* set region */
- /* XXX IMPLEMENT */
+ tc_mem_set_region_1,
+ tc_mem_set_region_2,
+ tc_mem_set_region_4,
+ tc_mem_set_region_8,
/* copy */
- /* XXX IMPLEMENT */
-
- /* barrier */
- tc_mem_barrier,
+ tc_mem_copy_1,
+ tc_mem_copy_2,
+ tc_mem_copy_4,
+ tc_mem_copy_8,
};
bus_space_tag_t
panic("tc_mem_free unimplemented");
}
-u_int8_t
+inline void
+tc_mem_barrier(v, h, o, l, f)
+ void *v;
+ bus_space_handle_t h;
+ bus_size_t o, l;
+ int f;
+{
+
+ if ((f & BUS_BARRIER_READ) != 0)
+ alpha_mb();
+ else if ((f & BUS_BARRIER_WRITE) != 0)
+ alpha_wmb();
+}
+
+inline u_int8_t
tc_mem_read_1(v, memh, off)
void *v;
bus_space_handle_t memh;
return (*p);
}
-u_int16_t
+inline u_int16_t
tc_mem_read_2(v, memh, off)
void *v;
bus_space_handle_t memh;
return (*p);
}
-u_int32_t
+inline u_int32_t
tc_mem_read_4(v, memh, off)
void *v;
bus_space_handle_t memh;
return (*p);
}
-u_int64_t
+inline u_int64_t
tc_mem_read_8(v, memh, off)
void *v;
bus_space_handle_t memh;
return (*p);
}
-
#define tc_mem_read_multi_N(BYTES,TYPE) \
void \
__abs_c(tc_mem_read_multi_,BYTES)(v, h, o, a, c) \
tc_mem_read_region_N(4,u_int32_t)
tc_mem_read_region_N(8,u_int64_t)
-void
+inline void
tc_mem_write_1(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb(); /* XXX XXX XXX */
}
-void
+inline void
tc_mem_write_2(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb(); /* XXX XXX XXX */
}
-void
+inline void
tc_mem_write_4(v, memh, off, val)
void *v;
bus_space_handle_t memh;
alpha_mb(); /* XXX XXX XXX */
}
-void
+inline void
tc_mem_write_8(v, memh, off, val)
void *v;
bus_space_handle_t memh;
*p = val;
alpha_mb(); /* XXX XXX XXX */
}
+
#define tc_mem_write_multi_N(BYTES,TYPE) \
void \
__abs_c(tc_mem_write_multi_,BYTES)(v, h, o, a, c) \
tc_mem_write_region_N(4,u_int32_t)
tc_mem_write_region_N(8,u_int64_t)
-void
-tc_mem_barrier(v, h, o, l, f)
- void *v;
- bus_space_handle_t h;
- bus_size_t o, l;
- int f;
-{
+#define tc_mem_set_multi_N(BYTES,TYPE) \
+void \
+__abs_c(tc_mem_set_multi_,BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __abs_c(tc_mem_write_,BYTES)(v, h, o, val); \
+ tc_mem_barrier(v, h, o, sizeof val, BUS_BARRIER_WRITE); \
+ } \
+}
+tc_mem_set_multi_N(1,u_int8_t)
+tc_mem_set_multi_N(2,u_int16_t)
+tc_mem_set_multi_N(4,u_int32_t)
+tc_mem_set_multi_N(8,u_int64_t)
- if ((f & BUS_BARRIER_READ) != 0)
- alpha_mb();
- else if ((f & BUS_BARRIER_WRITE) != 0)
- alpha_wmb();
+#define tc_mem_set_region_N(BYTES,TYPE) \
+void \
+__abs_c(tc_mem_set_region_,BYTES)(v, h, o, val, c) \
+ void *v; \
+ bus_space_handle_t h; \
+ bus_size_t o, c; \
+ TYPE val; \
+{ \
+ \
+ while (c-- > 0) { \
+ __abs_c(tc_mem_write_,BYTES)(v, h, o, val); \
+ o += sizeof val; \
+ } \
+}
+tc_mem_set_region_N(1,u_int8_t)
+tc_mem_set_region_N(2,u_int16_t)
+tc_mem_set_region_N(4,u_int32_t)
+tc_mem_set_region_N(8,u_int64_t)
+
+#define tc_mem_copy_N(BYTES) \
+void \
+__abs_c(tc_mem_copy_,BYTES)(v, h1, o1, h2, o2, c) \
+ void *v; \
+ bus_space_handle_t h1, h2; \
+ bus_size_t o1, o2, c; \
+{ \
+ bus_size_t i, o; \
+ \
+ if ((h1 & TC_SPACE_SPARSE) != 0 && \
+ (h2 & TC_SPACE_SPARSE) != 0) { \
+ bcopy((void *)(h1 + o1), (void *)(h2 + o2), c * BYTES); \
+ return; \
+ } \
+ \
+ for (i = 0, o = 0; i < c; i++, o += BYTES) \
+ __abs_c(tc_mem_write_,BYTES)(v, h2, o2 + o, \
+ __abs_c(tc_mem_read_,BYTES)(v, h1, o1 + o)); \
}
+tc_mem_copy_N(1)
+tc_mem_copy_N(2)
+tc_mem_copy_N(4)
+tc_mem_copy_N(8)
-/* $OpenBSD: tc_conf.h,v 1.3 1996/10/30 22:41:22 niklas Exp $ */
-/* $NetBSD: tc_conf.h,v 1.2 1996/07/14 04:06:30 cgd Exp $ */
+/* $OpenBSD: tc_conf.h,v 1.4 1997/01/24 19:58:20 niklas Exp $ */
+/* $NetBSD: tc_conf.h,v 1.3 1996/11/15 23:59:01 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
extern int tc_3000_500_nslots;
extern struct tc_slotdesc tc_3000_500_slots[];
-extern int tc_3000_500_nbuiltins;
-extern struct tc_builtin tc_3000_500_builtins[];
+extern int tc_3000_500_graphics_nbuiltins;
+extern struct tc_builtin tc_3000_500_graphics_builtins[];
+extern int tc_3000_500_nographics_nbuiltins;
+extern struct tc_builtin tc_3000_500_nographics_builtins[];
#endif /* DEC_3000_500 */
#ifdef DEC_3000_300
-/* $OpenBSD: tcasic.c,v 1.6 1996/12/08 00:21:00 niklas Exp $ */
-/* $NetBSD: tcasic.c,v 1.12 1996/10/23 04:12:38 cgd Exp $ */
+/* $OpenBSD: tcasic.c,v 1.7 1997/01/24 19:58:21 niklas Exp $ */
+/* $NetBSD: tcasic.c,v 1.14 1996/12/05 01:39:45 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
#include <alpha/tc/tc_conf.h>
/* Definition of the driver for autoconfig. */
+#ifdef __BROKEN_INDIRECT_CONFIG
int tcasicmatch(struct device *, void *, void *);
+#else
+int tcasicmatch(struct device *, struct cfdata *, void *);
+#endif
void tcasicattach(struct device *, struct device *, void *);
struct cfattach tcasic_ca = {
int
tcasicmatch(parent, cfdata, aux)
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cfdata;
+#endif
void *aux;
{
struct confargs *ca = aux;
tba.tba_speed = TC_SPEED_25_MHZ;
tba.tba_nslots = tc_3000_500_nslots;
tba.tba_slots = tc_3000_500_slots;
- tba.tba_nbuiltins = tc_3000_500_nbuiltins;
- tba.tba_builtins = tc_3000_500_builtins;
+ if (hwrpb->rpb_variation & SV_GRAPHICS) {
+ tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins;
+ tba.tba_builtins = tc_3000_500_graphics_builtins;
+ } else {
+ tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins;
+ tba.tba_builtins = tc_3000_500_nographics_builtins;
+ }
tba.tba_intr_establish = tc_3000_500_intr_establish;
tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
break;
-/* $OpenBSD: tcds.c,v 1.6 1996/11/23 21:45:02 kstailey Exp $ */
-/* $NetBSD: tcds.c,v 1.15 1996/10/13 03:00:41 christos Exp $ */
+/* $OpenBSD: tcds.c,v 1.7 1997/01/24 19:58:22 niklas Exp $ */
+/* $NetBSD: tcds.c,v 1.16 1996/12/05 01:39:45 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
};
/* Definition of the driver for autoconfig. */
+#ifdef __BROKEN_INDIRECT_CONFIG
int tcdsmatch __P((struct device *, void *, void *));
+#else
+int tcdsmatch __P((struct device *, struct cfdata *, void *));
+#endif
void tcdsattach __P((struct device *, struct device *, void *));
int tcdsprint __P((void *, const char *));
int
tcdsmatch(parent, cfdata, aux)
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cfdata;
+#endif
void *aux;
{
struct tc_attach_args *ta = aux;
-/* $OpenBSD: tcds_dma.c,v 1.4 1996/10/30 22:41:28 niklas Exp $ */
-/* $NetBSD: tcds_dma.c,v 1.13 1996/10/13 03:00:43 christos Exp $ */
+/* $OpenBSD: tcds_dma.c,v 1.5 1997/01/24 19:58:23 niklas Exp $ */
+/* $NetBSD: tcds_dma.c,v 1.15 1996/12/04 22:35:08 mycroft Exp $ */
/*
* Copyright (c) 1994 Peter Galbavy. All rights reserved.
{
int x;
- x = tcds_scsi_isintr(sc, 0);
-
- /* Clear the TCDS interrupt bit. */
- (void)tcds_scsi_isintr(sc, 1);
+ x = tcds_scsi_isintr(sc, 1);
/* XXX */
return x;
if (!sc->sc_iswrite &&
(resid = (ESP_READ_REG(sc->sc_esp, ESP_FFLAG) & ESPFIFO_FF)) != 0) {
- printf("empty FIFO of %d ", resid);
ESPCMD(sc->sc_esp, ESPCMD_FLUSH);
DELAY(1);
}
trans = sc->sc_dmasize - resid;
if (trans < 0) { /* transferred < 0 ? */
- printf("tcds_dma %d: xfer (%d) > req (%d)\n",
+ printf("tcds_dma %d: xfer (%d) > req (%ld)\n",
sc->sc_slot, trans, sc->sc_dmasize);
trans = sc->sc_dmasize;
}
if (dud & TCDS_DUD0_VALID11)
dudmask |= TCDS_DUD_BYTE11;
#endif
- ESP_DMA(("dud0 at 0x%lx dudmask 0x%x\n",
+ ESP_DMA(("dud0 at 0x%p dudmask 0x%x\n",
addr, dudmask));
addr = (u_int32_t *)ALPHA_PHYS_TO_K0SEG((vm_offset_t)addr);
*addr = (*addr & ~dudmask) | (dud & dudmask);
if (dud & TCDS_DUD1_VALID11)
panic("tcds_dma: dud1 byte 3 valid");
#endif
- ESP_DMA(("dud1 at 0x%lx dudmask 0x%x\n",
+ ESP_DMA(("dud1 at 0x%p dudmask 0x%x\n",
addr, dudmask));
addr = (u_int32_t *)ALPHA_PHYS_TO_K0SEG((vm_offset_t)addr);
*addr = (*addr & ~dudmask) | (dud & dudmask);
sc->sc_dmalen = len;
sc->sc_iswrite = datain;
- ESP_DMA(("tcds_dma %d: start %d@0x%lx,%d\n", sc->sc_slot, *sc->sc_dmalen, *sc->sc_dmaaddr, sc->sc_iswrite));
+ ESP_DMA(("tcds_dma %d: start %ld@%p,%d\n", sc->sc_slot, *sc->sc_dmalen, *sc->sc_dmaaddr, sc->sc_iswrite));
/*
* the rules say we cannot transfer more than the limit
size = min(*dmasize, DMAMAX((size_t) *sc->sc_dmaaddr));
*dmasize = sc->sc_dmasize = size;
- ESP_DMA(("dma_start: dmasize = %d\n", sc->sc_dmasize));
+ ESP_DMA(("dma_start: dmasize = %ld\n", sc->sc_dmasize));
/* Load address, set/clear unaligned transfer and read/write bits. */
/* XXX PICK AN ADDRESS TYPE, AND STICK TO IT! */
-/* $OpenBSD: tcdsvar.h,v 1.4 1996/10/30 22:41:31 niklas Exp $ */
-/* $NetBSD: tcdsvar.h,v 1.4 1996/09/09 18:10:39 cgd Exp $ */
+/* $OpenBSD: tcdsvar.h,v 1.5 1997/01/24 19:58:24 niklas Exp $ */
+/* $NetBSD: tcdsvar.h,v 1.5 1996/11/13 21:13:38 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
void tcds_intr_disestablish __P((struct device *, void *));
void tcds_dma_enable __P((struct tcds_slotconfig *, int));
void tcds_scsi_enable __P((struct tcds_slotconfig *, int));
+int tcds_scsi_iserr __P((struct tcds_slotconfig *));
int tcds_scsi_isintr __P((struct tcds_slotconfig *, int));
void tcds_scsi_reset __P((struct tcds_slotconfig *));
int tcds_scsi_iserr __P((struct tcds_slotconfig *));
-/* $OpenBSD: kbd.c,v 1.3 1996/10/30 22:41:39 niklas Exp $ */
-/* $NetBSD: kbd.c,v 1.2 1996/09/15 17:15:28 cgd Exp $ */
+/* $OpenBSD: kbd.c,v 1.4 1997/01/24 19:58:25 niklas Exp $ */
+/* $NetBSD: kbd.c,v 1.3 1996/11/13 21:13:39 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/tty.h>
+#include <sys/signalvar.h>
#include <machine/autoconf.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/kbd.h>
+void kbd_repeat __P((void *));
+
struct kbd_softc {
struct device *k_idev; /* the input device */
struct wscons_idev_spec k_ispec; /* the input device information */
-/* $OpenBSD: kbd.h,v 1.1 1996/10/30 22:41:41 niklas Exp $ */
+/* $OpenBSD: kbd.h,v 1.2 1997/01/24 19:58:26 niklas Exp $ */
/*
* Copyright (c) 1996 Niklas Hallqvist
*/
extern void kbdattach __P((struct device *, struct wscons_idev_spec *));
-extern void kbd_repeat __P((void *));
extern void kbd_input __P((int));
-extern int kbdopen __P((dev_t, int, int, struct proc *));
-extern int kbdclose __P((dev_t, int, int, struct proc *p));
-extern int kbdread __P((dev_t, struct uio *, int));
-extern int kbdwrite __P((dev_t, struct uio *, int));
-extern int kbdioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-#ifdef notyet
-extern int kbdpoll __P((dev_t, int, struct proc *));
-#else
-extern int kbdselect __P((dev_t, int, struct proc *));
-#endif
+
+cdev_decl(kbd);
+
extern int kbd_cngetc __P((dev_t));
extern void kbd_cnpollc __P((dev_t, int));
extern void wscons_kbd_bell __P((void));
-/* $OpenBSD: ms.c,v 1.3 1996/10/30 22:41:43 niklas Exp $ */
-/* $NetBSD: ms.c,v 1.2 1996/09/15 17:15:29 cgd Exp $ */
+/* $OpenBSD: ms.c,v 1.4 1997/01/24 19:58:27 niklas Exp $ */
+/* $NetBSD: ms.c,v 1.3 1996/11/13 21:13:40 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
-/* $OpenBSD: ms.h,v 1.1 1996/10/30 22:41:44 niklas Exp $ */
+/* $OpenBSD: ms.h,v 1.2 1997/01/24 19:58:28 niklas Exp $ */
/*
* Copyright (c) 1996 Niklas Hallqvist
extern void msattach __P((struct device *, struct wscons_mdev_spec *));
extern void ms_event __P((char, int, int));
-extern int msopen __P((dev_t, int, int, struct proc *));
-extern int msclose __P((dev_t, int, int, struct proc *));
-extern int msread __P((dev_t, struct uio *, int));
-extern int mswrite __P((dev_t, struct uio *, int));
-extern int msioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-#ifdef notyet
-extern int mspoll __P((dev_t, int, struct proc *));
-#else
-extern int msselect __P((dev_t, int, struct proc *));
-#endif
+
+cdev_decl(ms);
-/* $OpenBSD: wscons.c,v 1.3 1996/10/30 22:41:46 niklas Exp $ */
-/* $NetBSD: wscons.c,v 1.7 1996/10/13 03:00:45 christos Exp $ */
+/* $OpenBSD: wscons.c,v 1.4 1997/01/24 19:58:30 niklas Exp $ */
+/* $NetBSD: wscons.c,v 1.10 1996/12/05 01:39:47 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
struct wscons_emul_data *sc_emul_data;
struct tty *sc_tty;
+ void *sc_fn_cookie;
wscons_ioctl_t sc_ioctl;
wscons_mmap_t sc_mmap;
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int wsconsmatch __P((struct device *, void *, void *));
+#else
+int wsconsmatch __P((struct device *, struct cfdata *, void *));
+#endif
void wsconsattach __P((struct device *, struct device *, void *));
struct cfattach wscons_ca = {
*/
int
+#ifdef __BROKEN_INDIRECT_CONFIG
wsconsmatch(parent, cfdata, aux)
+#else
+wsconsmatch(parent, cf, aux)
+#endif
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cf;
+#endif
void *aux;
{
struct wscons_attach_args *waa = aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
struct cfdata *cf = cfdata;
+#endif
if (waa->waa_isconsole && wscons_console_unit != -1)
panic("wsconsmatch: multiple consoles?");
/*
* Record other relevant information: ioctl and mmap functions.
*/
+ sc->sc_fn_cookie = waa->waa_odev_spec.wo_miscfuncs_cookie;
sc->sc_ioctl = waa->waa_odev_spec.wo_ioctl;
sc->sc_mmap = waa->waa_odev_spec.wo_mmap;
/* then the underlying frame buffer device ioctls */
if (sc->sc_ioctl != NULL)
- error = (*sc->sc_ioctl)(sc->sc_dev.dv_parent, cmd, data,
+ error = (*sc->sc_ioctl)(sc->sc_fn_cookie, cmd, data,
flag, p);
if (error >= 0)
return error;
-/* $OpenBSD: wscons_emul.c,v 1.3 1996/10/30 22:41:47 niklas Exp $ */
-/* $NetBSD: wscons_emul.c,v 1.4 1996/10/13 03:00:47 christos Exp $ */
+/* $OpenBSD: wscons_emul.c,v 1.4 1997/01/24 19:58:31 niklas Exp $ */
+/* $NetBSD: wscons_emul.c,v 1.7 1996/11/19 05:23:13 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/wscons_emul.h>
#include <alpha/wscons/kbd.h>
static __inline int wscons_emul_input_control
__P((struct wscons_emul_data *, char));
+static int wscons_emul_input_normal __P((struct wscons_emul_data *, char));
+static int wscons_emul_input_haveesc __P((struct wscons_emul_data *, char));
+static void wscons_emul_docontrol __P((struct wscons_emul_data *, char));
+static int wscons_emul_input_control __P((struct wscons_emul_data *, char));
+
void
wscons_emul_attach(we, wo)
struct wscons_emul_data *we;
#ifdef DIAGNOSTIC
if (we == NULL || wo == NULL)
panic("wscons_emul_attach: bogus args");
- if (wo->wo_ef == NULL)
+ if (wo->wo_emulfuncs == NULL)
panic("wscons_emul_attach: bogus emul functions");
#endif
- if (wo->wo_nrows < 0 || wo->wo_ncols < 0)
- panic("wscons_emul_attach: bogus size");
+ if (wo->wo_nrows <= 0 || wo->wo_ncols <= 0)
+ panic("wscons_emul_attach: bogus size (%d/%d)",
+ wo->wo_nrows, wo->wo_ncols);
if (wo->wo_crow < 0 || wo->wo_ccol < 0 ||
wo->wo_crow >= wo->wo_nrows || wo->wo_ccol >= wo->wo_ncols)
panic("wscons_emul_attach: bogus location (n: %d/%d, c: %d/%d",
wo->wo_nrows, wo->wo_ncols, wo->wo_crow, wo->wo_ccol);
we->ac_state = ANSICONS_STATE_NORMAL;
- we->ac_ef = wo->wo_ef;
- we->ac_efa = wo->wo_efa;
+ we->ac_ef = wo->wo_emulfuncs;
+ we->ac_efa = wo->wo_emulfuncs_cookie;
we->ac_nrow = wo->wo_nrows;
we->ac_ncol = wo->wo_ncols;
-/* $OpenBSD: wscons_rinit.c,v 1.3 1996/10/30 22:41:54 niklas Exp $ */
-/* $NetBSD: wscons_rinit.c,v 1.2 1996/07/09 00:55:50 cgd Exp $ */
+/* $OpenBSD: wscons_rinit.c,v 1.4 1997/01/24 19:58:32 niklas Exp $ */
+/* $NetBSD: wscons_rinit.c,v 1.3 1996/11/13 21:13:42 cgd Exp $ */
/*
* Copyright (c) 1991, 1993
void rcons_initfont __P((struct rcons *, struct raster_font *));
+void rcons_initfont __P((struct rcons *, struct raster_font *));
+
void
rcons_initfont(rc, fp)
struct rcons *rc;
-/* $OpenBSD: wsconsvar.h,v 1.3 1996/10/30 22:41:56 niklas Exp $ */
-/* $NetBSD: wsconsvar.h,v 1.2 1996/04/12 06:10:36 cgd Exp $ */
+/* $OpenBSD: wsconsvar.h,v 1.4 1997/01/24 19:58:33 niklas Exp $ */
+/* $NetBSD: wsconsvar.h,v 1.4 1996/11/19 05:17:00 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
struct device;
-typedef int (*wscons_ioctl_t) __P((struct device *dev, u_long cmd,
+typedef int (*wscons_ioctl_t) __P((void *v, u_long cmd,
caddr_t data, int flag, struct proc *p));
-typedef int (*wscons_mmap_t) __P((struct device *dev, off_t off,
+typedef int (*wscons_mmap_t) __P((void *v, off_t off,
int prot));
struct wscons_emulfuncs {
};
struct wscons_odev_spec {
- const struct wscons_emulfuncs *wo_ef; /* emulation functions */
- void *wo_efa; /* emulation function cookie */
-
- int wo_nrows, wo_ncols; /* number of rows & cols */
- int wo_crow, wo_ccol; /* current row & col */
+ const struct wscons_emulfuncs *wo_emulfuncs; /* emulation functions */
+ void *wo_emulfuncs_cookie;
wscons_ioctl_t wo_ioctl;
wscons_mmap_t wo_mmap;
+ void *wo_miscfuncs_cookie;
+
+ int wo_nrows, wo_ncols; /* number of rows & cols */
+ int wo_crow, wo_ccol; /* current row & col */
};
struct wsconsio_bell_data;
*/
void wscons_input __P((char *));
+void msattach __P((struct device *, struct wscons_mdev_spec *));
+void ms_event __P((char, int, int));
+
+void kbdattach __P((struct device *, struct wscons_idev_spec *));
+void kbd_input __P((int));
+void wscons_kbd_bell __P((void));
+int kbd_cngetc __P((dev_t));
+void kbd_cnpollc __P((dev_t, int));
+int kbdioctl __P((dev_t dev, u_long cmd, register caddr_t data,
+ int flag, struct proc *p));
+
#endif /* _ALPHA_WSCONS_WSCONSVAR_H_ */
--- /dev/null
+/* $NetBSD: vga_isa.c,v 1.4 1996/12/05 01:39:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+#include <dev/isa/isavar.h>
+
+#include <alpha/common/vgavar.h>
+#include <alpha/isa/vga_isavar.h>
+
+struct vga_isa_softc {
+ struct device sc_dev;
+
+ struct vga_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vga_isa_match __P((struct device *, void *, void *));
+#else
+int vga_isa_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vga_isa_attach __P((struct device *, struct device *, void *));
+
+struct cfattach vga_isa_ca = {
+ sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach,
+};
+
+int vga_isa_console_tag; /* really just a boolean. */
+struct vga_config vga_isa_console_vc;
+
+int
+vga_isa_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ int rv;
+
+ /* If values are hardwired to something that they can't be, punt. */
+ if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */
+ (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xb8000) ||
+ (ia->ia_msize != 0 && ia->ia_msize != 0x8000) ||
+ ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
+ return (0);
+
+ if (vga_isa_console_tag)
+ return (1);
+
+ rv = vga_common_probe(ia->ia_iot, ia->ia_memt);
+
+ if (rv) {
+ ia->ia_iobase = 0x3b0;
+ ia->ia_iosize = 0x30;
+ ia->ia_maddr = 0xb8000;
+ ia->ia_msize = 0x8000;
+ }
+ return (rv);
+}
+
+void
+vga_isa_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ struct vga_isa_softc *sc = (struct vga_isa_softc *)self;
+ struct vga_config *vc;
+ int console;
+
+ console = vga_isa_console_tag;
+ if (console)
+ vc = sc->sc_vc = &vga_isa_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vga_config *)
+ malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(ia->ia_iot, ia->ia_memt, vc);
+ }
+
+ printf("\n");
+
+ vga_wscons_attach(self, vc, console);
+}
+
+int
+vga_isa_console_match(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+
+ return (vga_common_probe(iot, memt));
+}
+
+void
+vga_isa_console_attach(iot, memt)
+ bus_space_tag_t iot, memt;
+{
+ struct vga_config *vc = &vga_isa_console_vc;
+
+ /* for later recognition */
+ vga_isa_console_tag = 1;
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(iot, memt, vc);
+
+ vga_wscons_console(vc);
+}
--- /dev/null
+/* $NetBSD: vga_isavar.h,v 1.2 1996/11/23 06:06:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 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.
+ */
+
+int vga_isa_console_match __P((bus_space_tag_t, bus_space_tag_t));
+void vga_isa_console_attach __P((bus_space_tag_t, bus_space_tag_t));
--- /dev/null
+/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <alpha/common/vgavar.h>
+#include <alpha/pci/vga_pcivar.h>
+
+struct vga_pci_softc {
+ struct device sc_dev;
+
+ pcitag_t sc_pcitag; /* PCI tag, in case we need it. */
+ struct vga_config *sc_vc; /* VGA configuration */
+};
+
+#ifdef __BROKEN_INDIRECT_CONFIG
+int vga_pci_match __P((struct device *, void *, void *));
+#else
+int vga_pci_match __P((struct device *, struct cfdata *, void *));
+#endif
+void vga_pci_attach __P((struct device *, struct device *, void *));
+
+struct cfattach vga_pci_ca = {
+ sizeof(struct vga_pci_softc), vga_pci_match, vga_pci_attach,
+};
+
+pcitag_t vga_pci_console_tag;
+struct vga_config vga_pci_console_vc;
+
+int
+vga_pci_match(parent, match, aux)
+ struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
+ void *match;
+#else
+ struct cfdata *match;
+#endif
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ int potential;
+
+ potential = 0;
+
+ /*
+ * If it's prehistoric/vga or display/vga, we might match.
+ * For the console device, this is jut a sanity check.
+ */
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
+ potential = 1;
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA)
+ potential = 1;
+
+ if (!potential)
+ return (0);
+
+ /* If it's the console, we have a winner! */
+ if (pa->pa_tag == vga_pci_console_tag)
+ return (1);
+
+ /*
+ * If we might match, make sure that the card actually looks OK.
+ */
+ if (!vga_common_probe(pa->pa_iot, pa->pa_memt))
+ return (0);
+
+ return (1);
+}
+
+void
+vga_pci_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ struct vga_pci_softc *sc = (struct vga_pci_softc *)self;
+ struct vga_config *vc;
+ char devinfo[256];
+ int console;
+
+ console = (pa->pa_tag == vga_pci_console_tag);
+ if (console)
+ vc = sc->sc_vc = &vga_pci_console_vc;
+ else {
+ vc = sc->sc_vc = (struct vga_config *)
+ malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(pa->pa_iot, pa->pa_memt, vc);
+ }
+
+ sc->sc_pcitag = pa->pa_tag;
+
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
+ printf(": %s (rev. 0x%02x)\n", devinfo,
+ PCI_REVISION(pa->pa_class));
+
+ vga_wscons_attach(self, vc, console);
+}
+
+void
+vga_pci_console(iot, memt, pc, bus, device, function)
+ bus_space_tag_t iot, memt;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
+{
+ struct vga_config *vc = &vga_pci_console_vc;
+
+ /* for later recognition */
+ vga_pci_console_tag = pci_make_tag(pc, bus, device, function);
+
+ /* set up bus-independent VGA configuration */
+ vga_common_setup(iot, memt, vc);
+
+ vga_wscons_console(vc);
+}
--- /dev/null
+/* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 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.
+ */
+
+#define DEVICE_IS_VGA_PCI(class, id) \
+ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
+ (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
+
+void vga_pci_console __P((bus_space_tag_t, bus_space_tag_t,
+ pci_chipset_tag_t, int, int, int));
-/* $OpenBSD: kbd.c,v 1.3 1996/10/30 22:41:39 niklas Exp $ */
-/* $NetBSD: kbd.c,v 1.2 1996/09/15 17:15:28 cgd Exp $ */
+/* $OpenBSD: kbd.c,v 1.4 1997/01/24 19:58:25 niklas Exp $ */
+/* $NetBSD: kbd.c,v 1.3 1996/11/13 21:13:39 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/tty.h>
+#include <sys/signalvar.h>
#include <machine/autoconf.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/kbd.h>
+void kbd_repeat __P((void *));
+
struct kbd_softc {
struct device *k_idev; /* the input device */
struct wscons_idev_spec k_ispec; /* the input device information */
-/* $OpenBSD: kbd.h,v 1.1 1996/10/30 22:41:41 niklas Exp $ */
+/* $OpenBSD: kbd.h,v 1.2 1997/01/24 19:58:26 niklas Exp $ */
/*
* Copyright (c) 1996 Niklas Hallqvist
*/
extern void kbdattach __P((struct device *, struct wscons_idev_spec *));
-extern void kbd_repeat __P((void *));
extern void kbd_input __P((int));
-extern int kbdopen __P((dev_t, int, int, struct proc *));
-extern int kbdclose __P((dev_t, int, int, struct proc *p));
-extern int kbdread __P((dev_t, struct uio *, int));
-extern int kbdwrite __P((dev_t, struct uio *, int));
-extern int kbdioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-#ifdef notyet
-extern int kbdpoll __P((dev_t, int, struct proc *));
-#else
-extern int kbdselect __P((dev_t, int, struct proc *));
-#endif
+
+cdev_decl(kbd);
+
extern int kbd_cngetc __P((dev_t));
extern void kbd_cnpollc __P((dev_t, int));
extern void wscons_kbd_bell __P((void));
-/* $OpenBSD: ms.c,v 1.3 1996/10/30 22:41:43 niklas Exp $ */
-/* $NetBSD: ms.c,v 1.2 1996/09/15 17:15:29 cgd Exp $ */
+/* $OpenBSD: ms.c,v 1.4 1997/01/24 19:58:27 niklas Exp $ */
+/* $NetBSD: ms.c,v 1.3 1996/11/13 21:13:40 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
-/* $OpenBSD: ms.h,v 1.1 1996/10/30 22:41:44 niklas Exp $ */
+/* $OpenBSD: ms.h,v 1.2 1997/01/24 19:58:28 niklas Exp $ */
/*
* Copyright (c) 1996 Niklas Hallqvist
extern void msattach __P((struct device *, struct wscons_mdev_spec *));
extern void ms_event __P((char, int, int));
-extern int msopen __P((dev_t, int, int, struct proc *));
-extern int msclose __P((dev_t, int, int, struct proc *));
-extern int msread __P((dev_t, struct uio *, int));
-extern int mswrite __P((dev_t, struct uio *, int));
-extern int msioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-#ifdef notyet
-extern int mspoll __P((dev_t, int, struct proc *));
-#else
-extern int msselect __P((dev_t, int, struct proc *));
-#endif
+
+cdev_decl(ms);
-/* $OpenBSD: wscons.c,v 1.3 1996/10/30 22:41:46 niklas Exp $ */
-/* $NetBSD: wscons.c,v 1.7 1996/10/13 03:00:45 christos Exp $ */
+/* $OpenBSD: wscons.c,v 1.4 1997/01/24 19:58:30 niklas Exp $ */
+/* $NetBSD: wscons.c,v 1.10 1996/12/05 01:39:47 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
struct wscons_emul_data *sc_emul_data;
struct tty *sc_tty;
+ void *sc_fn_cookie;
wscons_ioctl_t sc_ioctl;
wscons_mmap_t sc_mmap;
};
+#ifdef __BROKEN_INDIRECT_CONFIG
int wsconsmatch __P((struct device *, void *, void *));
+#else
+int wsconsmatch __P((struct device *, struct cfdata *, void *));
+#endif
void wsconsattach __P((struct device *, struct device *, void *));
struct cfattach wscons_ca = {
*/
int
+#ifdef __BROKEN_INDIRECT_CONFIG
wsconsmatch(parent, cfdata, aux)
+#else
+wsconsmatch(parent, cf, aux)
+#endif
struct device *parent;
+#ifdef __BROKEN_INDIRECT_CONFIG
void *cfdata;
+#else
+ struct cfdata *cf;
+#endif
void *aux;
{
struct wscons_attach_args *waa = aux;
+#ifdef __BROKEN_INDIRECT_CONFIG
struct cfdata *cf = cfdata;
+#endif
if (waa->waa_isconsole && wscons_console_unit != -1)
panic("wsconsmatch: multiple consoles?");
/*
* Record other relevant information: ioctl and mmap functions.
*/
+ sc->sc_fn_cookie = waa->waa_odev_spec.wo_miscfuncs_cookie;
sc->sc_ioctl = waa->waa_odev_spec.wo_ioctl;
sc->sc_mmap = waa->waa_odev_spec.wo_mmap;
/* then the underlying frame buffer device ioctls */
if (sc->sc_ioctl != NULL)
- error = (*sc->sc_ioctl)(sc->sc_dev.dv_parent, cmd, data,
+ error = (*sc->sc_ioctl)(sc->sc_fn_cookie, cmd, data,
flag, p);
if (error >= 0)
return error;
-/* $OpenBSD: wscons_emul.c,v 1.3 1996/10/30 22:41:47 niklas Exp $ */
-/* $NetBSD: wscons_emul.c,v 1.4 1996/10/13 03:00:47 christos Exp $ */
+/* $OpenBSD: wscons_emul.c,v 1.4 1997/01/24 19:58:31 niklas Exp $ */
+/* $NetBSD: wscons_emul.c,v 1.7 1996/11/19 05:23:13 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <alpha/wscons/wsconsvar.h>
#include <alpha/wscons/wscons_emul.h>
#include <alpha/wscons/kbd.h>
static __inline int wscons_emul_input_control
__P((struct wscons_emul_data *, char));
+static int wscons_emul_input_normal __P((struct wscons_emul_data *, char));
+static int wscons_emul_input_haveesc __P((struct wscons_emul_data *, char));
+static void wscons_emul_docontrol __P((struct wscons_emul_data *, char));
+static int wscons_emul_input_control __P((struct wscons_emul_data *, char));
+
void
wscons_emul_attach(we, wo)
struct wscons_emul_data *we;
#ifdef DIAGNOSTIC
if (we == NULL || wo == NULL)
panic("wscons_emul_attach: bogus args");
- if (wo->wo_ef == NULL)
+ if (wo->wo_emulfuncs == NULL)
panic("wscons_emul_attach: bogus emul functions");
#endif
- if (wo->wo_nrows < 0 || wo->wo_ncols < 0)
- panic("wscons_emul_attach: bogus size");
+ if (wo->wo_nrows <= 0 || wo->wo_ncols <= 0)
+ panic("wscons_emul_attach: bogus size (%d/%d)",
+ wo->wo_nrows, wo->wo_ncols);
if (wo->wo_crow < 0 || wo->wo_ccol < 0 ||
wo->wo_crow >= wo->wo_nrows || wo->wo_ccol >= wo->wo_ncols)
panic("wscons_emul_attach: bogus location (n: %d/%d, c: %d/%d",
wo->wo_nrows, wo->wo_ncols, wo->wo_crow, wo->wo_ccol);
we->ac_state = ANSICONS_STATE_NORMAL;
- we->ac_ef = wo->wo_ef;
- we->ac_efa = wo->wo_efa;
+ we->ac_ef = wo->wo_emulfuncs;
+ we->ac_efa = wo->wo_emulfuncs_cookie;
we->ac_nrow = wo->wo_nrows;
we->ac_ncol = wo->wo_ncols;
-/* $OpenBSD: wscons_rinit.c,v 1.3 1996/10/30 22:41:54 niklas Exp $ */
-/* $NetBSD: wscons_rinit.c,v 1.2 1996/07/09 00:55:50 cgd Exp $ */
+/* $OpenBSD: wscons_rinit.c,v 1.4 1997/01/24 19:58:32 niklas Exp $ */
+/* $NetBSD: wscons_rinit.c,v 1.3 1996/11/13 21:13:42 cgd Exp $ */
/*
* Copyright (c) 1991, 1993
void rcons_initfont __P((struct rcons *, struct raster_font *));
+void rcons_initfont __P((struct rcons *, struct raster_font *));
+
void
rcons_initfont(rc, fp)
struct rcons *rc;
-/* $OpenBSD: wsconsvar.h,v 1.3 1996/10/30 22:41:56 niklas Exp $ */
-/* $NetBSD: wsconsvar.h,v 1.2 1996/04/12 06:10:36 cgd Exp $ */
+/* $OpenBSD: wsconsvar.h,v 1.4 1997/01/24 19:58:33 niklas Exp $ */
+/* $NetBSD: wsconsvar.h,v 1.4 1996/11/19 05:17:00 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
struct device;
-typedef int (*wscons_ioctl_t) __P((struct device *dev, u_long cmd,
+typedef int (*wscons_ioctl_t) __P((void *v, u_long cmd,
caddr_t data, int flag, struct proc *p));
-typedef int (*wscons_mmap_t) __P((struct device *dev, off_t off,
+typedef int (*wscons_mmap_t) __P((void *v, off_t off,
int prot));
struct wscons_emulfuncs {
};
struct wscons_odev_spec {
- const struct wscons_emulfuncs *wo_ef; /* emulation functions */
- void *wo_efa; /* emulation function cookie */
-
- int wo_nrows, wo_ncols; /* number of rows & cols */
- int wo_crow, wo_ccol; /* current row & col */
+ const struct wscons_emulfuncs *wo_emulfuncs; /* emulation functions */
+ void *wo_emulfuncs_cookie;
wscons_ioctl_t wo_ioctl;
wscons_mmap_t wo_mmap;
+ void *wo_miscfuncs_cookie;
+
+ int wo_nrows, wo_ncols; /* number of rows & cols */
+ int wo_crow, wo_ccol; /* current row & col */
};
struct wsconsio_bell_data;
*/
void wscons_input __P((char *));
+void msattach __P((struct device *, struct wscons_mdev_spec *));
+void ms_event __P((char, int, int));
+
+void kbdattach __P((struct device *, struct wscons_idev_spec *));
+void kbd_input __P((int));
+void wscons_kbd_bell __P((void));
+int kbd_cngetc __P((dev_t));
+void kbd_cnpollc __P((dev_t, int));
+int kbdioctl __P((dev_t dev, u_long cmd, register caddr_t data,
+ int flag, struct proc *p));
+
#endif /* _ALPHA_WSCONS_WSCONSVAR_H_ */