From 3a630e3f5de3bef31e4e8da599de955c4101a679 Mon Sep 17 00:00:00 2001 From: niklas Date: Fri, 24 Jan 1997 19:56:15 +0000 Subject: [PATCH] Sync with NetBSD 961207 --- sys/arch/alpha/STATUS | 9 +- sys/arch/alpha/alpha/autoconf.c | 12 +- sys/arch/alpha/alpha/clock.c | 27 +- sys/arch/alpha/alpha/cpu.c | 203 ++++++-- sys/arch/alpha/alpha/cpuconf.c | 114 +++++ sys/arch/alpha/alpha/dec_2100_a50.c | 33 +- sys/arch/alpha/alpha/dec_2100_a50.h | 34 +- sys/arch/alpha/alpha/dec_3000_300.c | 22 +- sys/arch/alpha/alpha/dec_3000_300.h | 34 +- sys/arch/alpha/alpha/dec_3000_500.c | 22 +- sys/arch/alpha/alpha/dec_3000_500.h | 34 +- sys/arch/alpha/alpha/dec_axppci_33.c | 33 +- sys/arch/alpha/alpha/dec_axppci_33.h | 34 +- sys/arch/alpha/alpha/dec_eb164.c | 245 ++++++++++ sys/arch/alpha/alpha/dec_kn20aa.c | 33 +- sys/arch/alpha/alpha/dec_kn20aa.h | 34 +- sys/arch/alpha/alpha/disksubr.c | 6 +- sys/arch/alpha/alpha/in_cksum.c | 8 +- sys/arch/alpha/alpha/interrupt.c | 14 +- sys/arch/alpha/alpha/locore.s | 10 +- sys/arch/alpha/alpha/machdep.c | 256 ++++------ sys/arch/alpha/alpha/mainbus.c | 31 +- sys/arch/alpha/alpha/mem.c | 15 +- sys/arch/alpha/alpha/pmap.old.c | 84 ++-- sys/arch/alpha/alpha/prom.c | 31 +- sys/arch/alpha/alpha/promcons.c | 6 +- sys/arch/alpha/alpha/support.c | 7 +- sys/arch/alpha/alpha/sys_machdep.c | 6 +- sys/arch/alpha/alpha/trap.c | 94 +++- sys/arch/alpha/alpha/vm_machdep.c | 4 +- sys/arch/alpha/common/shared_intr.c | 241 ++++++++++ sys/arch/alpha/common/vga.c | 356 ++++++++++++++ sys/arch/alpha/common/vgavar.h | 52 ++ sys/arch/alpha/conf/ALPHA | 42 +- sys/arch/alpha/conf/BUNNY | 24 +- sys/arch/alpha/conf/GENERIC | 36 +- sys/arch/alpha/conf/GENERIC.PROF | 39 +- sys/arch/alpha/conf/JURA | 10 +- sys/arch/alpha/conf/Makefile.alpha | 5 +- sys/arch/alpha/conf/NOSY | 5 +- sys/arch/alpha/conf/OPAL | 13 +- sys/arch/alpha/conf/RAMDISK | 38 +- sys/arch/alpha/conf/files.alpha | 74 ++- sys/arch/alpha/conf/std.alpha | 20 +- sys/arch/alpha/include/alpha_cpu.h | 6 +- sys/arch/alpha/include/ansi.h | 6 +- sys/arch/alpha/include/asm.h | 6 +- sys/arch/alpha/include/autoconf.h | 7 +- sys/arch/alpha/include/bus.h | 106 +++- sys/arch/alpha/include/cpu.h | 56 ++- sys/arch/alpha/include/cpuconf.h | 73 +++ sys/arch/alpha/include/intr.h | 45 +- sys/arch/alpha/include/intrcnt.h | 35 +- sys/arch/alpha/include/param.h | 5 +- sys/arch/alpha/include/pcb.h | 6 +- sys/arch/alpha/include/pmap.old.h | 8 +- sys/arch/alpha/include/proc.h | 3 +- sys/arch/alpha/include/profile.h | 6 +- sys/arch/alpha/include/prom.h | 36 +- sys/arch/alpha/include/pte.h | 6 +- sys/arch/alpha/include/rpb.h | 52 +- sys/arch/alpha/include/types.h | 6 +- sys/arch/alpha/isa/isa_machdep.c | 70 +++ sys/arch/alpha/isa/isa_machdep.h | 10 +- sys/arch/alpha/isa/mcclock_isa.c | 31 +- sys/arch/alpha/isa/pckbd.c | 418 ++++++++-------- sys/arch/alpha/isa/pcppi.c | 194 ++++++++ sys/arch/alpha/isa/pcppivar.h | 44 ++ sys/arch/alpha/isa/pms.c | 85 ++-- sys/arch/alpha/isa/vga_isa.c | 145 ++++++ sys/arch/alpha/isa/vga_isavar.h | 31 ++ sys/arch/alpha/pci/apecs.c | 39 +- sys/arch/alpha/pci/apecs_bus_io.c | 63 +++ sys/arch/alpha/pci/apecs_bus_mem.c | 73 +++ sys/arch/alpha/pci/apecs_pci.c | 14 +- sys/arch/alpha/pci/apecsvar.h | 17 +- sys/arch/alpha/pci/cia.c | 49 +- sys/arch/alpha/pci/cia_bus_io.c | 31 +- sys/arch/alpha/pci/cia_bus_mem.c | 52 +- sys/arch/alpha/pci/cia_pci.c | 51 +- sys/arch/alpha/pci/ciareg.h | 48 +- sys/arch/alpha/pci/ciavar.h | 15 +- sys/arch/alpha/pci/lca.c | 54 ++- sys/arch/alpha/pci/lca_bus_io.c | 53 ++ sys/arch/alpha/pci/lca_bus_mem.c | 73 +++ sys/arch/alpha/pci/lca_pci.c | 12 +- sys/arch/alpha/pci/lcareg.h | 9 +- sys/arch/alpha/pci/lcavar.h | 17 +- sys/arch/alpha/pci/pci_2100_a50.c | 27 +- sys/arch/alpha/pci/pci_axppci_33.c | 26 +- sys/arch/alpha/pci/pci_eb164.c | 317 ++++++++++++ sys/arch/alpha/pci/pci_eb164.h | 34 ++ sys/arch/alpha/pci/pci_eb164_intr.s | 62 +++ sys/arch/alpha/pci/pci_kn20aa.c | 140 ++---- sys/arch/alpha/pci/pci_machdep.c | 16 +- sys/arch/alpha/pci/pci_machdep.h | 11 +- sys/arch/alpha/pci/pcivgavar.h | 63 +-- sys/arch/alpha/pci/pcs_bus_io_common.c | 327 ++++++++++--- sys/arch/alpha/pci/pcs_bus_mem_common.c | 614 +++++++++++++++++++----- sys/arch/alpha/pci/sio.c | 85 ++-- sys/arch/alpha/pci/sio_pic.c | 160 ++---- sys/arch/alpha/pci/tga.c | 52 +- sys/arch/alpha/pci/tga_bt485.c | 4 +- sys/arch/alpha/pci/vga_pci.c | 155 ++++++ sys/arch/alpha/pci/vga_pcivar.h | 37 ++ sys/arch/alpha/stand/installboot.8 | 144 ++++++ sys/arch/alpha/stand/prom.c | 6 +- sys/arch/alpha/tc/cfb.c | 43 +- sys/arch/alpha/tc/esp.c | 59 ++- sys/arch/alpha/tc/espvar.h | 6 +- sys/arch/alpha/tc/ioasic.c | 12 +- sys/arch/alpha/tc/mcclock_ioasic.c | 15 +- sys/arch/alpha/tc/scc.c | 84 ++-- sys/arch/alpha/tc/sccvar.h | 8 +- sys/arch/alpha/tc/sfb.c | 43 +- sys/arch/alpha/tc/tc_3000_500.c | 17 +- sys/arch/alpha/tc/tc_bus_mem.c | 186 +++++-- sys/arch/alpha/tc/tc_conf.h | 10 +- sys/arch/alpha/tc/tcasic.c | 21 +- sys/arch/alpha/tc/tcds.c | 12 +- sys/arch/alpha/tc/tcds_dma.c | 20 +- sys/arch/alpha/tc/tcdsvar.h | 5 +- sys/arch/alpha/wscons/kbd.c | 7 +- sys/arch/alpha/wscons/kbd.h | 16 +- sys/arch/alpha/wscons/ms.c | 4 +- sys/arch/alpha/wscons/ms.h | 14 +- sys/arch/alpha/wscons/wscons.c | 22 +- sys/arch/alpha/wscons/wscons_emul.c | 21 +- sys/arch/alpha/wscons/wscons_rinit.c | 6 +- sys/arch/alpha/wscons/wsconsvar.h | 30 +- sys/dev/isa/vga_isa.c | 145 ++++++ sys/dev/isa/vga_isavar.h | 31 ++ sys/dev/pci/vga_pci.c | 155 ++++++ sys/dev/pci/vga_pcivar.h | 37 ++ sys/dev/wscons/kbd.c | 7 +- sys/dev/wscons/kbd.h | 16 +- sys/dev/wscons/ms.c | 4 +- sys/dev/wscons/ms.h | 14 +- sys/dev/wscons/wscons.c | 22 +- sys/dev/wscons/wscons_emul.c | 21 +- sys/dev/wscons/wscons_rinit.c | 6 +- sys/dev/wscons/wsconsvar.h | 30 +- 142 files changed, 6066 insertions(+), 1979 deletions(-) create mode 100644 sys/arch/alpha/alpha/cpuconf.c create mode 100644 sys/arch/alpha/alpha/dec_eb164.c create mode 100644 sys/arch/alpha/common/shared_intr.c create mode 100644 sys/arch/alpha/common/vga.c create mode 100644 sys/arch/alpha/common/vgavar.h create mode 100644 sys/arch/alpha/include/cpuconf.h create mode 100644 sys/arch/alpha/isa/isa_machdep.c create mode 100644 sys/arch/alpha/isa/pcppi.c create mode 100644 sys/arch/alpha/isa/pcppivar.h create mode 100644 sys/arch/alpha/isa/vga_isa.c create mode 100644 sys/arch/alpha/isa/vga_isavar.h create mode 100644 sys/arch/alpha/pci/apecs_bus_io.c create mode 100644 sys/arch/alpha/pci/apecs_bus_mem.c create mode 100644 sys/arch/alpha/pci/lca_bus_io.c create mode 100644 sys/arch/alpha/pci/lca_bus_mem.c create mode 100644 sys/arch/alpha/pci/pci_eb164.c create mode 100644 sys/arch/alpha/pci/pci_eb164.h create mode 100644 sys/arch/alpha/pci/pci_eb164_intr.s create mode 100644 sys/arch/alpha/pci/vga_pci.c create mode 100644 sys/arch/alpha/pci/vga_pcivar.h create mode 100644 sys/arch/alpha/stand/installboot.8 create mode 100644 sys/dev/isa/vga_isa.c create mode 100644 sys/dev/isa/vga_isavar.h create mode 100644 sys/dev/pci/vga_pci.c create mode 100644 sys/dev/pci/vga_pcivar.h diff --git a/sys/arch/alpha/STATUS b/sys/arch/alpha/STATUS index 62539c2ea7d..a98fa20350b 100644 --- a/sys/arch/alpha/STATUS +++ b/sys/arch/alpha/STATUS @@ -1,5 +1,5 @@ -$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 @@ -66,6 +66,9 @@ Supported hardware: 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 @@ -86,7 +89,7 @@ console, do the following depending on the model: 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. diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c index d33678ae26f..558256b20a4 100644 --- a/sys/arch/alpha/alpha/autoconf.c +++ b/sys/arch/alpha/alpha/autoconf.c @@ -1,5 +1,5 @@ -/* $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 @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -86,7 +87,6 @@ static int getstr __P((char *cp, int size)); void configure() { - extern int cold; parse_prom_bootdev(); @@ -310,7 +310,7 @@ setroot() buf[--len] = '\0'; dv = getdisk(buf, len, 1, &nrootdev); if (dv != NULL) { - rootdv = dv; + rootdv = swapdv = dv; nswapdev = nrootdev; goto gotswap; } @@ -596,7 +596,7 @@ device_register(dev, aux) 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) { /* @@ -606,5 +606,5 @@ device_register(dev, aux) return; } - (*cpu_device_register)(dev, aux); + (*cpu_fn_switch->device_register)(dev, aux); } diff --git a/sys/arch/alpha/alpha/clock.c b/sys/arch/alpha/alpha/clock.c index 3b69e90b6b2..dae8824b4d3 100644 --- a/sys/arch/alpha/alpha/clock.c +++ b/sys/arch/alpha/alpha/clock.c @@ -1,5 +1,5 @@ -/* $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. @@ -71,18 +71,17 @@ clockattach(dev, fns) { /* - * 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 } /* @@ -121,6 +120,20 @@ cpu_initclocks() 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. */ diff --git a/sys/arch/alpha/alpha/cpu.c b/sys/arch/alpha/alpha/cpu.c index ccace66662d..dccffa17760 100644 --- a/sys/arch/alpha/alpha/cpu.c +++ b/sys/arch/alpha/alpha/cpu.c @@ -1,5 +1,5 @@ -/* $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. @@ -36,7 +36,11 @@ #include /* 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 = { @@ -50,7 +54,11 @@ struct cfdriver cpu_cd = { 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; @@ -69,66 +77,171 @@ cpuattach(parent, dev, 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); @@ -152,7 +265,7 @@ cpuattach(parent, dev, aux) } /* - * 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. diff --git a/sys/arch/alpha/alpha/cpuconf.c b/sys/arch/alpha/alpha/cpuconf.c new file mode 100644 index 00000000000..0aa986ce2fe --- /dev/null +++ b/sys/arch/alpha/alpha/cpuconf.c @@ -0,0 +1,114 @@ +/* $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 +#include +#include + +#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]); diff --git a/sys/arch/alpha/alpha/dec_2100_a50.c b/sys/arch/alpha/alpha/dec_2100_a50.c index 7ea2ad426a0..7f1e1cc7f01 100644 --- a/sys/arch/alpha/alpha/dec_2100_a50.c +++ b/sys/arch/alpha/alpha/dec_2100_a50.c @@ -1,5 +1,5 @@ -/* $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. @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -46,13 +47,13 @@ #include #include -#include - #include #include -char * -dec_2100_a50_modelname() +cpu_decl(dec_2100_a50); + +const char * +dec_2100_a50_model_name() { static char s[80]; @@ -84,14 +85,14 @@ dec_2100_a50_modelname() } 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); @@ -123,9 +124,12 @@ dec_2100_a50_consinit() 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: @@ -137,6 +141,13 @@ dec_2100_a50_consinit() } } +const char * +dec_2100_a50_iobus_name() +{ + + return ("apecs"); +} + void dec_2100_a50_device_register(dev, aux) struct device *dev; diff --git a/sys/arch/alpha/alpha/dec_2100_a50.h b/sys/arch/alpha/alpha/dec_2100_a50.h index 69ffc6a1e30..b1f6f46f3cf 100644 --- a/sys/arch/alpha/alpha/dec_2100_a50.h +++ b/sys/arch/alpha/alpha/dec_2100_a50.h @@ -1,33 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/alpha/dec_3000_300.c b/sys/arch/alpha/alpha/dec_3000_300.c index 0947428fb98..7b2ee0de67a 100644 --- a/sys/arch/alpha/alpha/dec_3000_300.c +++ b/sys/arch/alpha/alpha/dec_3000_300.c @@ -1,5 +1,5 @@ -/* $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. @@ -34,6 +34,7 @@ #include #include +#include #include @@ -43,11 +44,14 @@ #include 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) { @@ -71,8 +75,14 @@ dec_3000_300_modelname() } void -dec_3000_300_consinit() +dec_3000_300_cons_init() +{ +} + +const char * +dec_3000_300_iobus_name() { + return ("tcasic"); } void diff --git a/sys/arch/alpha/alpha/dec_3000_300.h b/sys/arch/alpha/alpha/dec_3000_300.h index c7d9c27b7c7..420cf78c32f 100644 --- a/sys/arch/alpha/alpha/dec_3000_300.h +++ b/sys/arch/alpha/alpha/dec_3000_300.h @@ -1,33 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/alpha/dec_3000_500.c b/sys/arch/alpha/alpha/dec_3000_500.c index c1c08d08fd5..1479933f501 100644 --- a/sys/arch/alpha/alpha/dec_3000_500.c +++ b/sys/arch/alpha/alpha/dec_3000_500.c @@ -1,5 +1,5 @@ -/* $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. @@ -34,6 +34,7 @@ #include #include +#include #include @@ -43,11 +44,14 @@ #include 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) { @@ -89,8 +93,14 @@ systype_flamingo: } void -dec_3000_500_consinit() +dec_3000_500_cons_init() +{ +} + +const char * +dec_3000_500_iobus_name() { + return ("tcasic"); } void diff --git a/sys/arch/alpha/alpha/dec_3000_500.h b/sys/arch/alpha/alpha/dec_3000_500.h index c4e68b30b97..7554f1fb346 100644 --- a/sys/arch/alpha/alpha/dec_3000_500.h +++ b/sys/arch/alpha/alpha/dec_3000_500.h @@ -1,33 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/alpha/dec_axppci_33.c b/sys/arch/alpha/alpha/dec_axppci_33.c index be789b3dc52..29b2fad7f88 100644 --- a/sys/arch/alpha/alpha/dec_axppci_33.c +++ b/sys/arch/alpha/alpha/dec_axppci_33.c @@ -1,5 +1,5 @@ -/* $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. @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -46,13 +47,13 @@ #include #include -#include - #include #include -char * -dec_axppci_33_modelname() +cpu_decl(dec_axppci_33); + +const char * +dec_axppci_33_model_name() { switch (hwrpb->rpb_variation & SV_ST_MASK) { @@ -67,14 +68,14 @@ dec_axppci_33_modelname() } 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); @@ -106,9 +107,12 @@ dec_axppci_33_consinit() 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: @@ -120,6 +124,13 @@ dec_axppci_33_consinit() } } +const char * +dec_axppci_33_iobus_name() +{ + + return ("lca"); +} + void dec_axppci_33_device_register(dev, aux) struct device *dev; diff --git a/sys/arch/alpha/alpha/dec_axppci_33.h b/sys/arch/alpha/alpha/dec_axppci_33.h index dbf4ffd4df2..841385525ed 100644 --- a/sys/arch/alpha/alpha/dec_axppci_33.h +++ b/sys/arch/alpha/alpha/dec_axppci_33.h @@ -1,33 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c new file mode 100644 index 00000000000..c80d24d73e0 --- /dev/null +++ b/sys/arch/alpha/alpha/dec_eb164.c @@ -0,0 +1,245 @@ +/* $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 +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +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; + } + } +} diff --git a/sys/arch/alpha/alpha/dec_kn20aa.c b/sys/arch/alpha/alpha/dec_kn20aa.c index d514562de34..91c568d789e 100644 --- a/sys/arch/alpha/alpha/dec_kn20aa.c +++ b/sys/arch/alpha/alpha/dec_kn20aa.c @@ -1,5 +1,5 @@ -/* $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. @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -46,13 +47,13 @@ #include #include -#include - #include #include -char * -dec_kn20aa_modelname() +cpu_decl(dec_kn20aa); + +const char * +dec_kn20aa_model_name() { switch (hwrpb->rpb_variation & SV_ST_MASK) { @@ -67,14 +68,14 @@ dec_kn20aa_modelname() } 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); @@ -106,9 +107,12 @@ dec_kn20aa_consinit() 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: @@ -120,6 +124,13 @@ dec_kn20aa_consinit() } } +const char * +dec_kn20aa_iobus_name() +{ + + return ("cia"); +} + void dec_kn20aa_device_register(dev, aux) struct device *dev; diff --git a/sys/arch/alpha/alpha/dec_kn20aa.h b/sys/arch/alpha/alpha/dec_kn20aa.h index ae165766657..60bbc2dc903 100644 --- a/sys/arch/alpha/alpha/dec_kn20aa.h +++ b/sys/arch/alpha/alpha/dec_kn20aa.h @@ -1,33 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 769c5a5fd0f..dca301906d4 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,5 +1,5 @@ -/* $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. @@ -77,7 +77,7 @@ dk_establish(dk, dev) 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; { diff --git a/sys/arch/alpha/alpha/in_cksum.c b/sys/arch/alpha/alpha/in_cksum.c index 5b303da7f00..7faa6826301 100644 --- a/sys/arch/alpha/alpha/in_cksum.c +++ b/sys/arch/alpha/alpha/in_cksum.c @@ -1,5 +1,5 @@ -/* $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 @@ -85,6 +85,8 @@ union q_util { 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; @@ -177,8 +179,8 @@ in_cksum(m, len) 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) diff --git a/sys/arch/alpha/alpha/interrupt.c b/sys/arch/alpha/alpha/interrupt.c index 8c112198e24..361856531e7 100644 --- a/sys/arch/alpha/alpha/interrupt.c +++ b/sys/arch/alpha/alpha/interrupt.c @@ -1,8 +1,8 @@ -/* $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 @@ -50,10 +50,10 @@ struct logout { /* 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; diff --git a/sys/arch/alpha/alpha/locore.s b/sys/arch/alpha/alpha/locore.s index c0fe8306db3..c5303fe8f4d 100644 --- a/sys/arch/alpha/alpha/locore.s +++ b/sys/arch/alpha/alpha/locore.s @@ -1,5 +1,5 @@ -/* $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. @@ -184,9 +184,7 @@ Ler1: LDGP(pv) 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*/ @@ -276,9 +274,7 @@ LEAF(exception_restore_regs, 0) 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) /**************************************************************************/ diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 4a31d9652e7..92c2efb6955 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,5 +1,5 @@ -/* $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. @@ -78,25 +78,7 @@ #include #include #include - -#ifdef DEC_3000_500 -#include -#endif -#ifdef DEC_3000_300 -#include -#endif -#ifdef DEC_2100_A50 -#include -#endif -#ifdef DEC_KN20AA -#include -#endif -#ifdef DEC_AXPPCI_33 -#include -#endif -#ifdef DEC_21000 -#include -#endif +#include #include #include @@ -113,6 +95,14 @@ #include #include #endif +#ifdef CCITT +#include +#include +#include +#endif +#ifdef NATM +#include +#endif #include "ppp.h" #if NPPP > 0 #include @@ -123,13 +113,15 @@ 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. @@ -167,27 +159,7 @@ u_int32_t no_optimize; /* 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; @@ -197,20 +169,11 @@ u_int64_t cycles_per_usec; /* 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]; @@ -218,10 +181,7 @@ int alpha_unaligned_print = 1; /* warn about unaligned accesses */ 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 */ @@ -403,84 +363,42 @@ alpha_init(pfn, ptb) * 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 @@ -603,11 +521,17 @@ alpha_init(pfn, ptb) /* * 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 @@ -668,15 +592,13 @@ alpha_init(pfn, ptb) if ((pcsp->pcs_flags & PCS_PP) != 0) ncpus++; } - - return (0); } void consinit() { - (*cpu_consinit)(); + (*cpu_fn_switch->cons_init)(); pmap_unmap_prom(); } @@ -795,7 +717,7 @@ cpu_startup() * Note that bootstrapping is finished, and set the HWRPB up * to do restarts. */ - hwrbp_restart_setup(); + hwrpb_restart_setup(); } void @@ -1449,6 +1371,9 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) 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); } @@ -1466,8 +1391,10 @@ setregs(p, pack, stack, retval) register_t *retval; { struct trapframe *tfp = p->p_md.md_tf; - int i; extern struct proc *fpcurproc; +#ifdef DEBUG + int i; +#endif #ifdef DEBUG /* @@ -1543,27 +1470,35 @@ netintr() 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)); } @@ -1669,6 +1604,9 @@ delay(n) } #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; diff --git a/sys/arch/alpha/alpha/mainbus.c b/sys/arch/alpha/alpha/mainbus.c index 10f06b0b6ae..811435e5348 100644 --- a/sys/arch/alpha/alpha/mainbus.c +++ b/sys/arch/alpha/alpha/mainbus.c @@ -1,5 +1,5 @@ -/* $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. @@ -35,6 +35,7 @@ #include #include +#include struct mainbus_softc { struct device sc_dv; @@ -42,7 +43,11 @@ struct mainbus_softc { }; /* 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 *)); @@ -60,12 +65,22 @@ caddr_t mb_cvtaddr __P((struct confargs *)); 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... @@ -88,8 +103,9 @@ mbattach(parent, self, aux) 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"); @@ -105,8 +121,6 @@ mbattach(parent, self, aux) */ 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) @@ -123,8 +137,11 @@ mbattach(parent, self, aux) 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; diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index 46e0a555cd4..01d10b782e9 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,5 +1,5 @@ -/* $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. @@ -56,14 +56,13 @@ #include +#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) @@ -190,7 +189,7 @@ kmemphys: int mmmmap(dev, off, prot) dev_t dev; - vm_offset_t off; + int off; /* XXX */ int prot; { /* diff --git a/sys/arch/alpha/alpha/pmap.old.c b/sys/arch/alpha/alpha/pmap.old.c index 28335634806..239297c18fe 100644 --- a/sys/arch/alpha/alpha/pmap.old.c +++ b/sys/arch/alpha/alpha/pmap.old.c @@ -1,5 +1,5 @@ -/* $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 @@ -485,7 +485,7 @@ pmap_bootstrap_alloc(size) #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"); @@ -512,7 +512,7 @@ pmap_init(phys_start, phys_end) #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 */ @@ -558,7 +558,7 @@ pmap_map(virt, start, end, prot) { #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); @@ -618,7 +618,7 @@ pmap_pinit(pmap) #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 @@ -646,7 +646,7 @@ pmap_destroy(pmap) #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_destroy(%lx)\n", pmap); + printf("pmap_destroy(%p)\n", pmap); #endif if (pmap == NULL) return; @@ -672,7 +672,7 @@ pmap_release(pmap) #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... */ @@ -697,7 +697,7 @@ pmap_reference(pmap) { #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); @@ -724,7 +724,7 @@ pmap_remove(pmap, sva, eva) #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) @@ -784,7 +784,7 @@ pmap_page_protect(pa, prot) #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; @@ -844,7 +844,7 @@ pmap_protect(pmap, sva, eva, prot) #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) @@ -931,7 +931,7 @@ pmap_enter(pmap, va, pa, prot, wired) #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) @@ -960,7 +960,7 @@ pmap_enter(pmap, va, pa, prot, wired) 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 /* @@ -979,7 +979,7 @@ pmap_enter(pmap, va, pa, prot, wired) 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++; @@ -1043,7 +1043,7 @@ pmap_enter(pmap, va, pa, prot, wired) 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 /* @@ -1152,7 +1152,7 @@ pmap_change_wiring(pmap, va, wired) #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; @@ -1209,7 +1209,7 @@ pmap_extract(pmap, va) #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)) { @@ -1241,7 +1241,7 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) { #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 } @@ -1286,14 +1286,14 @@ pmap_collect(pmap) #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++; @@ -1333,7 +1333,7 @@ ok: #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; @@ -1378,11 +1378,11 @@ ok: 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 } @@ -1397,7 +1397,7 @@ pmap_activate(pmap) #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; @@ -1467,7 +1467,7 @@ pmap_pageable(pmap, sva, eva, pageable) { #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 /* @@ -1484,7 +1484,7 @@ pmap_pageable(pmap, sva, eva, pageable) #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)) @@ -1497,7 +1497,7 @@ pmap_pageable(pmap, sva, eva, pageable) 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; } @@ -1508,7 +1508,7 @@ pmap_pageable(pmap, sva, eva, pageable) 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; } @@ -1682,7 +1682,7 @@ pmap_remove_mapping(pmap, va, pte, flags) 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 @@ -1713,7 +1713,7 @@ pmap_remove_mapping(pmap, va, pte, flags) */ #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)) @@ -1793,7 +1793,7 @@ pmap_remove_mapping(pmap, va, pte, flags) #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; @@ -1805,7 +1805,7 @@ pmap_remove_mapping(pmap, va, pte, flags) 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)) @@ -1814,7 +1814,7 @@ pmap_remove_mapping(pmap, va, pte, flags) 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, @@ -1952,7 +1952,7 @@ pmap_enter_ptpage(pmap, va) #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++; @@ -1977,7 +1977,7 @@ pmap_enter_ptpage(pmap, va) 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 } @@ -2079,7 +2079,7 @@ pmap_enter_ptpage(pmap, va) 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 /* @@ -2095,7 +2095,7 @@ pmap_enter_ptpage(pmap, va) 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 } @@ -2128,7 +2128,7 @@ pmap_emulate_reference(p, v, user, write) #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 @@ -2150,7 +2150,7 @@ pmap_emulate_reference(p, v, user, write) } #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { - printf("\tpte = 0x%lx, ", pte); + printf("\tpte = %p, ", pte); printf("*pte = 0x%lx\n", *pte); } #endif @@ -2184,7 +2184,7 @@ pmap_emulate_reference(p, v, user, write) #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 /* @@ -2226,7 +2226,7 @@ pmap_pvdump(pa) 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"); diff --git a/sys/arch/alpha/alpha/prom.c b/sys/arch/alpha/alpha/prom.c index f3df0cb78a7..cf1e127b0e2 100644 --- a/sys/arch/alpha/alpha/prom.c +++ b/sys/arch/alpha/alpha/prom.c @@ -1,5 +1,5 @@ -/* $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 @@ -27,9 +27,9 @@ */ #include +#include #include #include -#include #include #include @@ -40,12 +40,9 @@ #include -/* 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 }; @@ -70,7 +67,7 @@ init_prom_interface() 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'; @@ -112,7 +109,7 @@ promcnputc(dev, c) *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 */ @@ -146,7 +143,7 @@ promcngetc(dev) *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 */ @@ -181,7 +178,7 @@ promcnlookc(dev, cp) *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 */ @@ -214,7 +211,7 @@ prom_getenv(id, buf, len) *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 */ @@ -273,10 +270,8 @@ hwrpb_checksum() return (sum); } -void XentRestart __P((void)); - void -hwrbp_restart_setup() +hwrpb_restart_setup() { struct pcs *p; @@ -289,12 +284,12 @@ hwrbp_restart_setup() 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 @@ -303,7 +298,7 @@ hwrbp_restart_setup() p->pcs_flags |= (PCS_RC | PCS_CV); } -long +u_int64_t console_restart(ra, ai, pv) u_int64_t ra, ai, pv; { diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c index 60382a24814..222f9b9f4a3 100644 --- a/sys/arch/alpha/alpha/promcons.c +++ b/sys/arch/alpha/alpha/promcons.c @@ -1,8 +1,8 @@ -/* $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 diff --git a/sys/arch/alpha/alpha/support.c b/sys/arch/alpha/alpha/support.c index 51a0cae1ce1..9a234bc1fb3 100644 --- a/sys/arch/alpha/alpha/support.c +++ b/sys/arch/alpha/alpha/support.c @@ -1,8 +1,8 @@ -/* $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 @@ -32,6 +32,7 @@ * Some C support functions that aren't (yet) in libkern or assembly. */ #include +#include #include struct qelem { diff --git a/sys/arch/alpha/alpha/sys_machdep.c b/sys/arch/alpha/alpha/sys_machdep.c index eabe550b2ec..5a2bc9f6f28 100644 --- a/sys/arch/alpha/alpha/sys_machdep.c +++ b/sys/arch/alpha/alpha/sys_machdep.c @@ -1,8 +1,8 @@ -/* $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 diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c index ce38dec1827..47620f99514 100644 --- a/sys/arch/alpha/alpha/trap.c +++ b/sys/arch/alpha/alpha/trap.c @@ -1,8 +1,8 @@ -/* $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 @@ -58,11 +58,25 @@ u_long Tfloat_reg_cvt __P((u_long)); 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; @@ -125,12 +139,15 @@ trap(a0, a1, a2, entry, framep) 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: @@ -268,7 +285,6 @@ panic("foo"); 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 @@ -322,6 +338,10 @@ panic("foo"); 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); @@ -394,20 +414,48 @@ out: 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 */ diff --git a/sys/arch/alpha/alpha/vm_machdep.c b/sys/arch/alpha/alpha/vm_machdep.c index 2e92985a491..f822a4f2c5b 100644 --- a/sys/arch/alpha/alpha/vm_machdep.c +++ b/sys/arch/alpha/alpha/vm_machdep.c @@ -1,5 +1,5 @@ -/* $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. diff --git a/sys/arch/alpha/common/shared_intr.c b/sys/arch/alpha/common/shared_intr.c new file mode 100644 index 00000000000..9acd3d52599 --- /dev/null +++ b/sys/arch/alpha/common/shared_intr.c @@ -0,0 +1,241 @@ +/* $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 +#include +#include +#include +#include + +#include + +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" : ""); +} diff --git a/sys/arch/alpha/common/vga.c b/sys/arch/alpha/common/vga.c new file mode 100644 index 00000000000..12c538bc69f --- /dev/null +++ b/sys/arch/alpha/common/vga.c @@ -0,0 +1,356 @@ +/* $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 +#include +#include +#include +#include + +#include +#include + +#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); +} diff --git a/sys/arch/alpha/common/vgavar.h b/sys/arch/alpha/common/vgavar.h new file mode 100644 index 00000000000..3c5353a83b0 --- /dev/null +++ b/sys/arch/alpha/common/vgavar.h @@ -0,0 +1,52 @@ +/* $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 *)); diff --git a/sys/arch/alpha/conf/ALPHA b/sys/arch/alpha/conf/ALPHA index c02d1012167..2c396e97ff5 100644 --- a/sys/arch/alpha/conf/ALPHA +++ b/sys/arch/alpha/conf/ALPHA @@ -1,5 +1,5 @@ -# $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. @@ -13,6 +13,7 @@ options DEC_3000_300 # Pelican etc: 3000/300* 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 @@ -20,7 +21,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -83,6 +83,7 @@ options LKM # 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 @@ -102,8 +103,8 @@ tcasic* at mainbus0 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 ? @@ -135,7 +136,7 @@ fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards 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 @@ -146,13 +147,15 @@ eisa* at pceb? 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 @@ -162,13 +165,16 @@ scsibus* at esp? 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? @@ -176,8 +182,8 @@ pseudo-device bpfilter 16 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 diff --git a/sys/arch/alpha/conf/BUNNY b/sys/arch/alpha/conf/BUNNY index 1ba7650e2ee..048560029a7 100644 --- a/sys/arch/alpha/conf/BUNNY +++ b/sys/arch/alpha/conf/BUNNY @@ -1,5 +1,5 @@ -# $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. # @@ -21,7 +21,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -68,7 +67,7 @@ pci* at apecs? # PCI devices de* at pci? ncr* at pci? -pcivga* at pci? +vga* at pci? sio* at pci? tga* at pci? @@ -76,13 +75,14 @@ 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? @@ -93,7 +93,7 @@ st* at scsibus? target ? lun ? cd* at scsibus? target ? lun ? # Workstation Console attachments -wscons* at pcivga? +wscons* at vga? wscons* at tga? pseudo-device bpfilter 16 diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC index c2728c4f66b..77c97cbd6bb 100644 --- a/sys/arch/alpha/conf/GENERIC +++ b/sys/arch/alpha/conf/GENERIC @@ -1,5 +1,5 @@ -# $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. @@ -13,6 +13,7 @@ options DEC_3000_300 # Pelican etc: 3000/300* 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 @@ -20,7 +21,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -72,8 +72,8 @@ tcasic* at mainbus0 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 ? @@ -105,7 +105,7 @@ fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards 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 @@ -116,13 +116,15 @@ eisa* at pceb? 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 @@ -132,21 +134,21 @@ scsibus* at esp? 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 diff --git a/sys/arch/alpha/conf/GENERIC.PROF b/sys/arch/alpha/conf/GENERIC.PROF index 5de20fc93c8..d0af501b6ca 100644 --- a/sys/arch/alpha/conf/GENERIC.PROF +++ b/sys/arch/alpha/conf/GENERIC.PROF @@ -1,5 +1,5 @@ -# $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. @@ -17,6 +17,7 @@ options DEC_3000_300 # Pelican etc: 3000/300* 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 @@ -24,7 +25,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -76,8 +76,8 @@ tcasic* at mainbus0 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 ? @@ -109,7 +109,7 @@ fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards 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 @@ -120,13 +120,15 @@ eisa* at pceb? 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 @@ -136,18 +138,21 @@ scsibus* at esp? 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 diff --git a/sys/arch/alpha/conf/JURA b/sys/arch/alpha/conf/JURA index fd66de8e82d..c7caa6c8c75 100644 --- a/sys/arch/alpha/conf/JURA +++ b/sys/arch/alpha/conf/JURA @@ -1,5 +1,5 @@ -# $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. # @@ -19,7 +19,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -54,8 +53,9 @@ jcombo* at ibus? # the VLSI combo chip 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 diff --git a/sys/arch/alpha/conf/Makefile.alpha b/sys/arch/alpha/conf/Makefile.alpha index 5f3eb7aeb4f..e6ec43d6a2f 100644 --- a/sys/arch/alpha/conf/Makefile.alpha +++ b/sys/arch/alpha/conf/Makefile.alpha @@ -1,5 +1,5 @@ -# $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 # @@ -26,6 +26,7 @@ CC?= cc LD?= ld MKDEP?= mkdep STRIP?= strip +COPTS?= -O2 # source tree is located via $S relative to the compilation directory .ifndef S diff --git a/sys/arch/alpha/conf/NOSY b/sys/arch/alpha/conf/NOSY index 61eddd751eb..b2a48304b5b 100644 --- a/sys/arch/alpha/conf/NOSY +++ b/sys/arch/alpha/conf/NOSY @@ -1,5 +1,5 @@ -# $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... # @@ -16,7 +16,6 @@ options TIMEZONE="8*60" # Minutes west of GMT (for param.c) 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 diff --git a/sys/arch/alpha/conf/OPAL b/sys/arch/alpha/conf/OPAL index 43440918adb..9f3ecbb73d0 100644 --- a/sys/arch/alpha/conf/OPAL +++ b/sys/arch/alpha/conf/OPAL @@ -1,4 +1,4 @@ -# $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 @@ -14,10 +14,10 @@ option TIMEZONE="-1*60" # Minutes west of GMT (for param.c) 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) @@ -102,7 +102,7 @@ de* at pci? le* at pci? ncr* at pci? pceb* at pci? -pcivga* at pci? +vga* at pci? ppb* at pci? sio* at pci? tga* at pci? @@ -116,8 +116,9 @@ isa* at sio? # 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 @@ -143,7 +144,7 @@ uk* at scsibus? target ? lun ? # Workstation Console attachments wscons* at cfb? -wscons* at pcivga? +wscons* at vga? wscons* at sfb? wscons* at tga? diff --git a/sys/arch/alpha/conf/RAMDISK b/sys/arch/alpha/conf/RAMDISK index 115116e2ad4..889529aee36 100644 --- a/sys/arch/alpha/conf/RAMDISK +++ b/sys/arch/alpha/conf/RAMDISK @@ -1,5 +1,5 @@ -# $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. @@ -13,6 +13,7 @@ options DEC_3000_300 # Pelican etc: 3000/300* 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. @@ -24,7 +25,6 @@ options TIMEZONE="5*60" # Minutes west of GMT (for param.c) 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 @@ -76,8 +76,8 @@ tcasic* at mainbus0 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 ? @@ -109,7 +109,7 @@ fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards 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 @@ -120,13 +120,15 @@ eisa* at pceb? 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 @@ -136,19 +138,19 @@ scsibus* at esp? 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 diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index 4fa2d3f237c..404a5430d30 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,5 +1,5 @@ -# $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 @@ -8,15 +8,26 @@ maxpartitions 8 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 @@ -49,7 +60,6 @@ file arch/alpha/wscons/wscons_rops.c raster # # "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 @@ -59,7 +69,6 @@ file arch/alpha/wscons/event.c wscons file arch/alpha/wscons/kbd.c wscons file arch/alpha/wscons/ms.c wscons - # # TurboChannel Devices # @@ -137,13 +146,22 @@ include "dev/isa/files.isa" #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 @@ -161,16 +179,17 @@ include "dev/eisa/files.eisa" 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 @@ -179,8 +198,10 @@ file arch/alpha/pci/cia_bus_mem.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 # @@ -189,7 +210,7 @@ file arch/alpha/pci/pci_axppci_33.c dec_axppci_33 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 @@ -204,9 +225,8 @@ file arch/alpha/pci/tga_bt463.c tga 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 # @@ -255,12 +275,14 @@ file netns/ns_cksum.c ns 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" diff --git a/sys/arch/alpha/conf/std.alpha b/sys/arch/alpha/conf/std.alpha index b780edc31b9..6d043a81666 100644 --- a/sys/arch/alpha/conf/std.alpha +++ b/sys/arch/alpha/conf/std.alpha @@ -1,14 +1,20 @@ -# $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 diff --git a/sys/arch/alpha/include/alpha_cpu.h b/sys/arch/alpha/include/alpha_cpu.h index 0c695e1612f..30612925b24 100644 --- a/sys/arch/alpha/include/alpha_cpu.h +++ b/sys/arch/alpha/include/alpha_cpu.h @@ -1,5 +1,5 @@ -/* $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. @@ -183,7 +183,7 @@ struct alpha_logout_area { #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 diff --git a/sys/arch/alpha/include/ansi.h b/sys/arch/alpha/include/ansi.h index 7e529f40e07..53be898c720 100644 --- a/sys/arch/alpha/include/ansi.h +++ b/sys/arch/alpha/include/ansi.h @@ -1,5 +1,5 @@ -/* $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 @@ -59,6 +59,8 @@ typedef struct { 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 diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h index 0dbea2e046f..7783b3b963e 100644 --- a/sys/arch/alpha/include/asm.h +++ b/sys/arch/alpha/include/asm.h @@ -1,5 +1,5 @@ -/* $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 @@ -215,7 +215,7 @@ * MCOUNT */ -#ifndef PROF +#ifndef GPROF #define MCOUNT /* nothing */ #else #define MCOUNT \ diff --git a/sys/arch/alpha/include/autoconf.h b/sys/arch/alpha/include/autoconf.h index 517d0f2fc5f..47566f2798f 100644 --- a/sys/arch/alpha/include/autoconf.h +++ b/sys/arch/alpha/include/autoconf.h @@ -1,5 +1,5 @@ -/* $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. @@ -81,9 +81,6 @@ struct bootdev_data { 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)); diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index 3ff76eb6ee1..854d055589b 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,5 +1,5 @@ -/* $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. @@ -62,6 +62,10 @@ struct alpha_bus_space { 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)); @@ -72,7 +76,7 @@ struct alpha_bus_space { 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, @@ -102,7 +106,7 @@ struct alpha_bus_space { 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, @@ -122,18 +126,35 @@ struct alpha_bus_space { 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)); }; @@ -147,8 +168,22 @@ struct alpha_bus_space { (*(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) /* @@ -172,6 +207,16 @@ struct alpha_bus_space { (*(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. */ @@ -245,28 +290,39 @@ struct alpha_bus_space { /* * 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_ */ diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h index cb08112157d..1ae32845eb4 100644 --- a/sys/arch/alpha/include/cpu.h +++ b/sys/arch/alpha/include/cpu.h @@ -1,5 +1,5 @@ -/* $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. @@ -110,7 +110,8 @@ u_int64_t want_resched; /* resched() was called */ #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 }, \ @@ -119,6 +120,55 @@ u_int64_t want_resched; /* resched() was called */ { "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_ */ diff --git a/sys/arch/alpha/include/cpuconf.h b/sys/arch/alpha/include/cpuconf.h new file mode 100644 index 00000000000..0147acd5956 --- /dev/null +++ b/sys/arch/alpha/include/cpuconf.h @@ -0,0 +1,73 @@ +/* $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 diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h index e638077e95d..6100a7ff0c1 100644 --- a/sys/arch/alpha/include/intr.h +++ b/sys/arch/alpha/include/intr.h @@ -1,5 +1,5 @@ -/* $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. @@ -31,6 +31,8 @@ #ifndef _ALPHA_INTR_H_ #define _ALPHA_INTR_H_ +#include + #define IPL_NONE 0 /* disable only this interrupt */ #define IPL_BIO 1 /* disable block I/O interrupts */ #define IPL_NET 2 /* disable network interrupts */ @@ -38,6 +40,7 @@ #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 */ @@ -64,8 +67,44 @@ extern u_int64_t ssir; #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 diff --git a/sys/arch/alpha/include/intrcnt.h b/sys/arch/alpha/include/intrcnt.h index 50a451798ff..6be9bdbe3e1 100644 --- a/sys/arch/alpha/include/intrcnt.h +++ b/sys/arch/alpha/include/intrcnt.h @@ -1,5 +1,5 @@ -/* $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. @@ -97,14 +97,39 @@ 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) @@ -119,6 +144,8 @@ #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[]; diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h index 1f23fee3227..dbffda59fd1 100644 --- a/sys/arch/alpha/include/param.h +++ b/sys/arch/alpha/include/param.h @@ -1,5 +1,5 @@ -/* $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. @@ -53,6 +53,7 @@ #define MID_MACHINE MID_ALPHA #include +#include /* * Round p (pointer or byte index) up to a correctly-aligned value for all diff --git a/sys/arch/alpha/include/pcb.h b/sys/arch/alpha/include/pcb.h index bd7530fb65a..13062ee998c 100644 --- a/sys/arch/alpha/include/pcb.h +++ b/sys/arch/alpha/include/pcb.h @@ -1,8 +1,8 @@ -/* $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 diff --git a/sys/arch/alpha/include/pmap.old.h b/sys/arch/alpha/include/pmap.old.h index c60dfc9c485..f70bd18d318 100644 --- a/sys/arch/alpha/include/pmap.old.h +++ b/sys/arch/alpha/include/pmap.old.h @@ -1,5 +1,5 @@ -/* $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 @@ -123,9 +123,9 @@ extern char *vmmap; /* map for mem, dumps, etc. */ /* 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_ */ diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h index 5794e0244de..1738d1bb5c9 100644 --- a/sys/arch/alpha/include/proc.h +++ b/sys/arch/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -42,5 +42,4 @@ struct mdproc { #ifdef _KERNEL void switch_exit __P((struct proc *)); -void switch_trampoline __P((void (*) __P((struct proc *)), void *)); #endif diff --git a/sys/arch/alpha/include/profile.h b/sys/arch/alpha/include/profile.h index 34b748366d4..fd8bf8cf968 100644 --- a/sys/arch/alpha/include/profile.h +++ b/sys/arch/alpha/include/profile.h @@ -1,8 +1,8 @@ -/* $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 diff --git a/sys/arch/alpha/include/prom.h b/sys/arch/alpha/include/prom.h index ad96e534891..f8d26ee4093 100644 --- a/sys/arch/alpha/include/prom.h +++ b/sys/arch/alpha/include/prom.h @@ -1,8 +1,8 @@ -/* $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 @@ -58,8 +58,6 @@ int prom_getenv __P((int, char *, int)); 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. */ @@ -83,8 +81,26 @@ int promcnlookc __P((dev_t, char *)); * 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 */ diff --git a/sys/arch/alpha/include/pte.h b/sys/arch/alpha/include/pte.h index 6fcec6de1b9..57438dca065 100644 --- a/sys/arch/alpha/include/pte.h +++ b/sys/arch/alpha/include/pte.h @@ -1,8 +1,8 @@ -/* $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 diff --git a/sys/arch/alpha/include/rpb.h b/sys/arch/alpha/include/rpb.h index cbe4b76eccf..b6290296590 100644 --- a/sys/arch/alpha/include/rpb.h +++ b/sys/arch/alpha/include/rpb.h @@ -1,8 +1,8 @@ -/* $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 @@ -58,12 +58,20 @@ struct rpb { #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: */ @@ -136,16 +144,12 @@ struct rpb { 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 */ @@ -155,10 +159,6 @@ struct rpb { u_int64_t rpb_tbhint[8]; /* 149: TB hint block */ }; -#ifdef _KERNEL -extern struct rpb *hwrpb; -#endif - /* * PCS: Per-CPU information. */ @@ -213,19 +213,21 @@ struct pcs { #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. */ @@ -316,8 +318,8 @@ struct ctb { * CRD: Console Routine Descriptor */ struct crd { - int64_t descriptor; - int (*code) __P((struct crd *)); + int64_t descriptor; + int (*entry_va) __P((struct crd *)); }; /* diff --git a/sys/arch/alpha/include/types.h b/sys/arch/alpha/include/types.h index a068d7920fb..ce7e4bb61ca 100644 --- a/sys/arch/alpha/include/types.h +++ b/sys/arch/alpha/include/types.h @@ -1,5 +1,5 @@ -/* $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 @@ -70,4 +70,6 @@ typedef unsigned long u_int64_t; typedef int64_t register_t; +#define __BROKEN_INDIRECT_CONFIG + #endif /* _MACHTYPES_H_ */ diff --git a/sys/arch/alpha/isa/isa_machdep.c b/sys/arch/alpha/isa/isa_machdep.c new file mode 100644 index 00000000000..a758abd46b5 --- /dev/null +++ b/sys/arch/alpha/isa/isa_machdep.c @@ -0,0 +1,70 @@ +/* $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 +#include +#include +#include +#include +#include +#include + +#include + +#include "vga_isa.h" +#if NVGA_ISA +#include +#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; + } +} diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h index 75d6cbe4020..4fa25b19952 100644 --- a/sys/arch/alpha/isa/isa_machdep.h +++ b/sys/arch/alpha/isa/isa_machdep.h @@ -1,5 +1,5 @@ -/* $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. @@ -52,3 +52,9 @@ struct alpha_isa_chipset { (*(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)); diff --git a/sys/arch/alpha/isa/mcclock_isa.c b/sys/arch/alpha/isa/mcclock_isa.c index ef6b8acc696..392a63842b6 100644 --- a/sys/arch/alpha/isa/mcclock_isa.c +++ b/sys/arch/alpha/isa/mcclock_isa.c @@ -1,5 +1,5 @@ -/* $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. @@ -47,7 +47,11 @@ struct mcclock_isa_softc { 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 = { @@ -65,16 +69,29 @@ const struct mcclock_busfns mcclock_isa_busfns = { 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); } diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c index f255e2b82e1..b23ee96cb32 100644 --- a/sys/arch/alpha/isa/pckbd.c +++ b/sys/arch/alpha/isa/pckbd.c @@ -1,5 +1,5 @@ -/* $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. @@ -62,11 +62,23 @@ #include #include #include +#include #include #include #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 */ @@ -77,12 +89,8 @@ 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 { @@ -93,7 +101,11 @@ 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 *)); @@ -108,9 +120,8 @@ struct cfdriver pckbd_cd = { 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 @@ -126,12 +137,15 @@ struct wscons_idev_spec pckbd_wscons_idev = { #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)); @@ -165,7 +179,7 @@ kbd_wait_output() 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; @@ -179,7 +193,7 @@ kbd_wait_input() 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; @@ -193,11 +207,11 @@ kbd_flush_input() 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); } } @@ -211,10 +225,10 @@ kbc_get8042cmd() 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 @@ -228,10 +242,10 @@ kbc_put8042cmd(val) 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; } @@ -250,16 +264,16 @@ kbd_cmd(val, polling) 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; @@ -277,7 +291,7 @@ kbd_cmd(val, polling) 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) @@ -295,28 +309,34 @@ kbd_cmd(val, polling) 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(); @@ -326,12 +346,12 @@ pckbdprobe(parent, match, aux) 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; @@ -382,9 +402,7 @@ lose: */ #endif - ia->ia_iobase = 16; - ia->ia_iosize = 0; - return 1; + return rv; } void @@ -393,21 +411,16 @@ pckbdattach(parent, self, aux) 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; @@ -431,13 +444,13 @@ pckbdintr(arg) 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: @@ -456,15 +469,15 @@ pckbdintr(arg) #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; @@ -489,24 +502,21 @@ do_async_update(vp) 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; @@ -592,138 +602,136 @@ typedef struct { 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. */ @@ -863,18 +871,18 @@ int 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; @@ -953,8 +961,8 @@ pckbd_bell(dev, wbd) 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); } @@ -972,8 +980,8 @@ pckbd_bell_stop(arg) /* 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); } diff --git a/sys/arch/alpha/isa/pcppi.c b/sys/arch/alpha/isa/pcppi.c new file mode 100644 index 00000000000..e00b4d24118 --- /dev/null +++ b/sys/arch/alpha/isa/pcppi.c @@ -0,0 +1,194 @@ +/* $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 +#include +#include +#include +#include + +#include + +#include +#include +#include + +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); +} diff --git a/sys/arch/alpha/isa/pcppivar.h b/sys/arch/alpha/isa/pcppivar.h new file mode 100644 index 00000000000..3d87996776e --- /dev/null +++ b/sys/arch/alpha/isa/pcppivar.h @@ -0,0 +1,44 @@ +/* $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 diff --git a/sys/arch/alpha/isa/pms.c b/sys/arch/alpha/isa/pms.c index abeb21fc768..a011a2a0022 100644 --- a/sys/arch/alpha/isa/pms.c +++ b/sys/arch/alpha/isa/pms.c @@ -1,5 +1,5 @@ -/* $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. @@ -32,15 +32,11 @@ * 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 #include #include #include +#include #include #include #include @@ -54,10 +50,11 @@ #include #include #include +#include -#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 */ @@ -100,12 +97,14 @@ struct pms_softc { /* driver status information */ }; 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 *)); @@ -137,12 +136,13 @@ pms_flush() { 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); } } @@ -152,9 +152,9 @@ pms_dev_cmd(value) { 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 @@ -163,7 +163,7 @@ pms_aux_cmd(value) { 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 @@ -172,38 +172,38 @@ pms_pit_cmd(value) { 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; } @@ -213,16 +213,11 @@ pmsattach(parent, self, aux) 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); @@ -231,8 +226,8 @@ pmsattach(parent, self, aux) /* 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 @@ -304,20 +299,20 @@ pmsintr(arg) 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; diff --git a/sys/arch/alpha/isa/vga_isa.c b/sys/arch/alpha/isa/vga_isa.c new file mode 100644 index 00000000000..615f16590a5 --- /dev/null +++ b/sys/arch/alpha/isa/vga_isa.c @@ -0,0 +1,145 @@ +/* $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 +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +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); +} diff --git a/sys/arch/alpha/isa/vga_isavar.h b/sys/arch/alpha/isa/vga_isavar.h new file mode 100644 index 00000000000..618eb26b51b --- /dev/null +++ b/sys/arch/alpha/isa/vga_isavar.h @@ -0,0 +1,31 @@ +/* $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)); diff --git a/sys/arch/alpha/pci/apecs.c b/sys/arch/alpha/pci/apecs.c index 516164eec5d..c4ee4f99b73 100644 --- a/sys/arch/alpha/pci/apecs.c +++ b/sys/arch/alpha/pci/apecs.c @@ -1,5 +1,5 @@ -/* $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. @@ -49,7 +49,11 @@ #include #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 = { @@ -69,7 +73,12 @@ struct apecs_config apecs_configuration; 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; @@ -87,10 +96,10 @@ apecsmatch(parent, match, 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 = @@ -98,12 +107,21 @@ apecs_init(acp) 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. */ @@ -118,6 +136,8 @@ apecs_init(acp) alpha_XXX_dmamap_or = 0x40000000; /* XXX */ } /* XXX */ /* XXX XXX END XXX XXX */ + + acp->ac_initted = 1; } void @@ -137,7 +157,7 @@ apecsattach(parent, self, aux) * (maybe), but doesn't hurt to do twice. */ acp = sc->sc_acp = &apecs_configuration; - apecs_init(acp); + apecs_init(acp, 1); /* XXX SGMAP FOO */ @@ -158,6 +178,7 @@ apecsattach(parent, self, aux) pci_2100_a50_pickintr(acp); break; #endif + default: panic("apecsattach: shouldn't be here, really..."); } @@ -175,7 +196,7 @@ apecsprint(aux, pnp) 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) diff --git a/sys/arch/alpha/pci/apecs_bus_io.c b/sys/arch/alpha/pci/apecs_bus_io.c new file mode 100644 index 00000000000..4469938b47a --- /dev/null +++ b/sys/arch/alpha/pci/apecs_bus_io.c @@ -0,0 +1,63 @@ +/* $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 +#include +#include +#include +#include +#include + +#include + +#include +#include + +#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" diff --git a/sys/arch/alpha/pci/apecs_bus_mem.c b/sys/arch/alpha/pci/apecs_bus_mem.c new file mode 100644 index 00000000000..c355cb18e41 --- /dev/null +++ b/sys/arch/alpha/pci/apecs_bus_mem.c @@ -0,0 +1,73 @@ +/* $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 +#include +#include +#include +#include +#include + +#include + +#include +#include + +#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" diff --git a/sys/arch/alpha/pci/apecs_pci.c b/sys/arch/alpha/pci/apecs_pci.c index c61fed79b98..6fd68da1cdd 100644 --- a/sys/arch/alpha/pci/apecs_pci.c +++ b/sys/arch/alpha/pci/apecs_pci.c @@ -1,5 +1,5 @@ -/* $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. @@ -116,6 +116,11 @@ apecs_conf_read(cpv, tag, offset) 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) { @@ -162,6 +167,11 @@ apecs_conf_write(cpv, tag, offset, data) 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) { diff --git a/sys/arch/alpha/pci/apecsvar.h b/sys/arch/alpha/pci/apecsvar.h index d43c23d0b97..a9653702ee5 100644 --- a/sys/arch/alpha/pci/apecsvar.h +++ b/sys/arch/alpha/pci/apecsvar.h @@ -1,5 +1,5 @@ -/* $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. @@ -38,12 +38,19 @@ * 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 { @@ -52,8 +59,8 @@ 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 *)); diff --git a/sys/arch/alpha/pci/cia.c b/sys/arch/alpha/pci/cia.c index 2a8731824de..556058a511e 100644 --- a/sys/arch/alpha/pci/cia.c +++ b/sys/arch/alpha/pci/cia.c @@ -1,5 +1,5 @@ -/* $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. @@ -48,8 +48,15 @@ #if defined(DEC_KN20AA) #include #endif +#if defined(DEC_EB164) +#include +#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 = { @@ -69,7 +76,12 @@ struct cia_config cia_configuration; 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; @@ -87,27 +99,36 @@ ciamatch(parent, match, 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 @@ -127,7 +148,7 @@ ciaattach(parent, self, aux) * (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"); @@ -141,6 +162,16 @@ ciaattach(parent, self, aux) #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..."); } diff --git a/sys/arch/alpha/pci/cia_bus_io.c b/sys/arch/alpha/pci/cia_bus_io.c index b0352ddea0f..ea36a7382bf 100644 --- a/sys/arch/alpha/pci/cia_bus_io.c +++ b/sys/arch/alpha/pci/cia_bus_io.c @@ -1,5 +1,5 @@ -/* $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. @@ -42,24 +42,27 @@ #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" diff --git a/sys/arch/alpha/pci/cia_bus_mem.c b/sys/arch/alpha/pci/cia_bus_mem.c index e69819e946f..38b5956e659 100644 --- a/sys/arch/alpha/pci/cia_bus_mem.c +++ b/sys/arch/alpha/pci/cia_bus_mem.c @@ -1,5 +1,5 @@ -/* $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. @@ -42,40 +42,44 @@ #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" diff --git a/sys/arch/alpha/pci/cia_pci.c b/sys/arch/alpha/pci/cia_pci.c index ac66d48a0ea..353c5615a21 100644 --- a/sys/arch/alpha/pci/cia_pci.c +++ b/sys/arch/alpha/pci/cia_pci.c @@ -1,5 +1,5 @@ -/* $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. @@ -41,6 +41,9 @@ #include #include +#include /* 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)); @@ -115,6 +118,34 @@ cia_conf_read(cpv, tag, offset) 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); @@ -142,6 +173,17 @@ cia_conf_read(cpv, tag, offset) 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)" : ""); @@ -162,6 +204,11 @@ cia_conf_write(cpv, tag, offset, data) 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) { diff --git a/sys/arch/alpha/pci/ciareg.h b/sys/arch/alpha/pci/ciareg.h index aa33bf767ae..442e8008820 100644 --- a/sys/arch/alpha/pci/ciareg.h +++ b/sys/arch/alpha/pci/ciareg.h @@ -1,5 +1,5 @@ -/* $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. @@ -39,17 +39,17 @@ /* * 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 @@ -57,16 +57,18 @@ #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) diff --git a/sys/arch/alpha/pci/ciavar.h b/sys/arch/alpha/pci/ciavar.h index 37ae618659d..0a5aea714a8 100644 --- a/sys/arch/alpha/pci/ciavar.h +++ b/sys/arch/alpha/pci/ciavar.h @@ -1,5 +1,5 @@ -/* $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. @@ -38,11 +38,16 @@ * 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 { @@ -52,8 +57,8 @@ 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 *)); diff --git a/sys/arch/alpha/pci/lca.c b/sys/arch/alpha/pci/lca.c index 8ef53fda822..469bbb115e1 100644 --- a/sys/arch/alpha/pci/lca.c +++ b/sys/arch/alpha/pci/lca.c @@ -1,5 +1,5 @@ -/* $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. @@ -49,7 +49,11 @@ #include #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 = { @@ -69,7 +73,12 @@ struct lca_config lca_configuration; 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; @@ -87,16 +96,30 @@ lcamatch(parent, match, 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); /* @@ -135,6 +158,8 @@ lca_init(lcp) alpha_XXX_dmamap_or = 0x40000000; /* XXX */ } /* XXX */ /* XXX XXX END XXX XXX */ + + lcp->lc_initted = 1; } #ifdef notdef @@ -152,14 +177,14 @@ lca_init_sgmap(lcp) /* 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 @@ -181,7 +206,7 @@ lcaattach(parent, self, aux) * (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 @@ -195,6 +220,7 @@ lcaattach(parent, self, aux) pci_axppci_33_pickintr(lcp); break; #endif + default: panic("lcaattach: shouldn't be here, really..."); } @@ -212,7 +238,7 @@ lcaprint(aux, pnp) 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) diff --git a/sys/arch/alpha/pci/lca_bus_io.c b/sys/arch/alpha/pci/lca_bus_io.c new file mode 100644 index 00000000000..0ccf7d9953d --- /dev/null +++ b/sys/arch/alpha/pci/lca_bus_io.c @@ -0,0 +1,53 @@ +/* $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 +#include +#include +#include +#include +#include + +#include + +#include +#include + +#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" diff --git a/sys/arch/alpha/pci/lca_bus_mem.c b/sys/arch/alpha/pci/lca_bus_mem.c new file mode 100644 index 00000000000..53fd0f689a8 --- /dev/null +++ b/sys/arch/alpha/pci/lca_bus_mem.c @@ -0,0 +1,73 @@ +/* $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 +#include +#include +#include +#include +#include + +#include + +#include +#include + +#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" diff --git a/sys/arch/alpha/pci/lca_pci.c b/sys/arch/alpha/pci/lca_pci.c index 837fbec97be..e166c228a01 100644 --- a/sys/arch/alpha/pci/lca_pci.c +++ b/sys/arch/alpha/pci/lca_pci.c @@ -1,5 +1,5 @@ -/* $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. @@ -118,6 +118,10 @@ lca_conf_read(cpv, tag, offset) 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) { @@ -170,6 +174,10 @@ lca_conf_write(cpv, tag, offset, data) 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) { diff --git a/sys/arch/alpha/pci/lcareg.h b/sys/arch/alpha/pci/lcareg.h index d9e9bffd448..d8fc88d3f46 100644 --- a/sys/arch/alpha/pci/lcareg.h +++ b/sys/arch/alpha/pci/lcareg.h @@ -1,5 +1,5 @@ -/* $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. @@ -33,6 +33,7 @@ */ #define REGVAL(r) (*(int32_t *)ALPHA_PHYS_TO_K0SEG(r)) +#define REGVAL64(r) (*(int64_t *)ALPHA_PHYS_TO_K0SEG(r)) /* * Base addresses @@ -43,7 +44,9 @@ #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 */ diff --git a/sys/arch/alpha/pci/lcavar.h b/sys/arch/alpha/pci/lcavar.h index d09596a0d5d..597e783eb34 100644 --- a/sys/arch/alpha/pci/lcavar.h +++ b/sys/arch/alpha/pci/lcavar.h @@ -1,5 +1,5 @@ -/* $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. @@ -38,8 +38,15 @@ * 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 { @@ -48,8 +55,8 @@ 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 *)); diff --git a/sys/arch/alpha/pci/pci_2100_a50.c b/sys/arch/alpha/pci/pci_2100_a50.c index e4be2215526..0deeac43f6a 100644 --- a/sys/arch/alpha/pci/pci_2100_a50.c +++ b/sys/arch/alpha/pci/pci_2100_a50.c @@ -1,5 +1,5 @@ -/* $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. @@ -109,7 +109,8 @@ dec_2100_a50_intr_map(acv, bustag, buspin, line, ihp) 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; } @@ -133,6 +134,11 @@ dec_2100_a50_intr_map(acv, bustag, buspin, line, ihp) 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; @@ -148,6 +154,11 @@ dec_2100_a50_intr_map(acv, bustag, buspin, line, ihp) 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; @@ -163,8 +174,18 @@ dec_2100_a50_intr_map(acv, bustag, buspin, line, ihp) 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), diff --git a/sys/arch/alpha/pci/pci_axppci_33.c b/sys/arch/alpha/pci/pci_axppci_33.c index 27bd21b0d8a..07bb01096db 100644 --- a/sys/arch/alpha/pci/pci_axppci_33.c +++ b/sys/arch/alpha/pci/pci_axppci_33.c @@ -1,5 +1,5 @@ -/* $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. @@ -133,6 +133,11 @@ dec_axppci_33_intr_map(lcv, bustag, buspin, line, ihp) 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; @@ -148,6 +153,11 @@ dec_axppci_33_intr_map(lcv, bustag, buspin, line, ihp) 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; @@ -163,12 +173,18 @@ dec_axppci_33_intr_map(lcv, bustag, buspin, line, ihp) 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), diff --git a/sys/arch/alpha/pci/pci_eb164.c b/sys/arch/alpha/pci/pci_eb164.c new file mode 100644 index 00000000000..90c9e6c2661 --- /dev/null +++ b/sys/arch/alpha/pci/pci_eb164.c @@ -0,0 +1,317 @@ +/* $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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include + +#include + +#ifndef EVCNT_COUNTERS +#include +#endif + +#include "sio.h" +#if NSIO +#include +#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 diff --git a/sys/arch/alpha/pci/pci_eb164.h b/sys/arch/alpha/pci/pci_eb164.h new file mode 100644 index 00000000000..dd1700753e7 --- /dev/null +++ b/sys/arch/alpha/pci/pci_eb164.h @@ -0,0 +1,34 @@ +/* $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 diff --git a/sys/arch/alpha/pci/pci_eb164_intr.s b/sys/arch/alpha/pci/pci_eb164_intr.s new file mode 100644 index 00000000000..83fa4979b79 --- /dev/null +++ b/sys/arch/alpha/pci/pci_eb164_intr.s @@ -0,0 +1,62 @@ +/* $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 + + .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) diff --git a/sys/arch/alpha/pci/pci_kn20aa.c b/sys/arch/alpha/pci/pci_kn20aa.c index ab9683c31fa..1f46fb45ca4 100644 --- a/sys/arch/alpha/pci/pci_kn20aa.c +++ b/sys/arch/alpha/pci/pci_kn20aa.c @@ -1,5 +1,5 @@ -/* $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. @@ -69,27 +69,14 @@ void dec_kn20aa_intr_disestablish __P((void *, void *)); #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) @@ -99,27 +86,23 @@ 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 @@ -174,14 +157,9 @@ dec_kn20aa_intr_map(ccv, bustag, buspin, line, ihp) 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; @@ -200,17 +178,10 @@ dec_kn20aa_intr_string(ccv, ih) { 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); } @@ -224,28 +195,16 @@ dec_kn20aa_intr_establish(ccv, ih, level, func, arg, name) { 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); } @@ -256,30 +215,12 @@ dec_kn20aa_intr_disestablish(ccv, 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)) @@ -294,25 +235,21 @@ kn20aa_iointr(framep, vec) 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); } @@ -341,24 +278,3 @@ kn20aa_disable_intr(irq) 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); -} diff --git a/sys/arch/alpha/pci/pci_machdep.c b/sys/arch/alpha/pci/pci_machdep.c index 128fcc2676e..f24271a68c3 100644 --- a/sys/arch/alpha/pci/pci_machdep.c +++ b/sys/arch/alpha/pci/pci_machdep.c @@ -1,5 +1,5 @@ -/* $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. @@ -45,9 +45,9 @@ #include #include -#include "pcivga.h" -#if NPCIVGA -#include +#include "vga_pci.h" +#if NVGA_PCI +#include #endif #include "tga.h" @@ -77,11 +77,11 @@ pci_display_console(iot, memt, pc, bus, device, function) 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 diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h index d706b1c2e92..2fbd929e9d7 100644 --- a/sys/arch/alpha/pci/pci_machdep.h +++ b/sys/arch/alpha/pci/pci_machdep.h @@ -1,5 +1,5 @@ -/* $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. @@ -87,6 +87,13 @@ struct alpha_pci_chipset { #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)); diff --git a/sys/arch/alpha/pci/pcivgavar.h b/sys/arch/alpha/pci/pcivgavar.h index 4783a47cc14..b909a0ab412 100644 --- a/sys/arch/alpha/pci/pcivgavar.h +++ b/sys/arch/alpha/pci/pcivgavar.h @@ -1,62 +1 @@ -/* $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 $ */ diff --git a/sys/arch/alpha/pci/pcs_bus_io_common.c b/sys/arch/alpha/pci/pcs_bus_io_common.c index bec40a2f12e..89cc1418cd1 100644 --- a/sys/arch/alpha/pci/pcs_bus_io_common.c +++ b/sys/arch/alpha/pci/pcs_bus_io_common.c @@ -1,5 +1,5 @@ -/* $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. @@ -37,6 +37,8 @@ * CHIP_IO_BASE Sparse I/O space base to use. */ +#include + #define __C(A,B) __CONCAT(A,B) #define __S(S) __STRING(S) @@ -55,14 +57,18 @@ int __C(CHIP,_io_alloc) __P((void *, bus_addr_t, bus_addr_t, 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 */ @@ -86,13 +92,13 @@ void __C(CHIP,_io_read_region_8) __P((void *, bus_space_handle_t, 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 */ @@ -115,9 +121,38 @@ void __C(CHIP,_io_write_region_4) __P((void *, bus_space_handle_t, 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 */ @@ -131,6 +166,9 @@ static struct alpha_bus_space __C(CHIP,_io_space) = { /* allocation/deallocation */ __C(CHIP,_io_alloc), __C(CHIP,_io_free), + + /* barrier */ + __C(CHIP,_io_barrier), /* read (single) */ __C(CHIP,_io_read_1), @@ -138,7 +176,7 @@ static struct alpha_bus_space __C(CHIP,_io_space) = { __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), @@ -156,7 +194,7 @@ static struct alpha_bus_space __C(CHIP,_io_space) = { __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), @@ -168,27 +206,63 @@ static struct alpha_bus_space __C(CHIP,_io_space) = { __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 @@ -199,38 +273,51 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp) 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); } @@ -240,9 +327,58 @@ __C(CHIP,_io_unmap)(v, ioh, iosize) 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 @@ -281,7 +417,21 @@ __C(CHIP,_io_free)(v, bsh, size) 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; @@ -303,7 +453,7 @@ __C(CHIP,_io_read_1)(v, ioh, off) return rval; } -u_int16_t +inline u_int16_t __C(CHIP,_io_read_2)(v, ioh, off) void *v; bus_space_handle_t ioh; @@ -325,7 +475,7 @@ __C(CHIP,_io_read_2)(v, ioh, off) return rval; } -u_int32_t +inline u_int32_t __C(CHIP,_io_read_4)(v, ioh, off) void *v; bus_space_handle_t ioh; @@ -351,7 +501,7 @@ __C(CHIP,_io_read_4)(v, ioh, off) return rval; } -u_int64_t +inline u_int64_t __C(CHIP,_io_read_8)(v, ioh, off) void *v; bus_space_handle_t ioh; @@ -401,7 +551,7 @@ CHIP_io_read_region_N(2,u_int16_t) 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; @@ -420,7 +570,7 @@ __C(CHIP,_io_write_1)(v, ioh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_io_write_2)(v, ioh, off, val) void *v; bus_space_handle_t ioh; @@ -439,7 +589,7 @@ __C(CHIP,_io_write_2)(v, ioh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_io_write_4)(v, ioh, off, val) void *v; bus_space_handle_t ioh; @@ -458,7 +608,7 @@ __C(CHIP,_io_write_4)(v, ioh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_io_write_8)(v, ioh, off, val) void *v; bus_space_handle_t ioh; @@ -510,16 +660,59 @@ CHIP_io_write_region_N(2,u_int16_t) 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) diff --git a/sys/arch/alpha/pci/pcs_bus_mem_common.c b/sys/arch/alpha/pci/pcs_bus_mem_common.c index fa7e953e80c..44d0c90cf2f 100644 --- a/sys/arch/alpha/pci/pcs_bus_mem_common.c +++ b/sys/arch/alpha/pci/pcs_bus_mem_common.c @@ -1,5 +1,5 @@ -/* $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. @@ -38,6 +38,8 @@ * CHIP_S_MEM_BASE Sparse Mem space base to use. */ +#include + #define __C(A,B) __CONCAT(A,B) #define __S(S) __STRING(S) @@ -56,14 +58,18 @@ int __C(CHIP,_mem_alloc) __P((void *, bus_addr_t, bus_addr_t, 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 */ @@ -87,13 +93,13 @@ void __C(CHIP,_mem_read_region_8) __P((void *, bus_space_handle_t, 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 */ @@ -116,9 +122,40 @@ void __C(CHIP,_mem_write_region_4) __P((void *, bus_space_handle_t, 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 */ @@ -132,6 +169,9 @@ static struct alpha_bus_space __C(CHIP,_mem_space) = { /* allocation/deallocation */ __C(CHIP,_mem_alloc), __C(CHIP,_mem_free), + + /* barrier */ + __C(CHIP,_mem_barrier), /* read (single) */ __C(CHIP,_mem_read_1), @@ -139,7 +179,7 @@ static struct alpha_bus_space __C(CHIP,_mem_space) = { __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), @@ -157,7 +197,7 @@ static struct alpha_bus_space __C(CHIP,_mem_space) = { __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), @@ -169,27 +209,231 @@ static struct alpha_bus_space __C(CHIP,_mem_space) = { __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 @@ -200,71 +444,106 @@ __C(CHIP,_mem_map)(v, memaddr, memsize, cacheable, memhp) 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 @@ -273,9 +552,64 @@ __C(CHIP,_mem_unmap)(v, memh, memsize) 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 @@ -314,7 +648,21 @@ __C(CHIP,_mem_free)(v, bsh, size) 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; @@ -339,7 +687,7 @@ __C(CHIP,_mem_read_1)(v, memh, off) return rval; } -u_int16_t +inline u_int16_t __C(CHIP,_mem_read_2)(v, memh, off) void *v; bus_space_handle_t memh; @@ -364,7 +712,7 @@ __C(CHIP,_mem_read_2)(v, memh, off) return rval; } -u_int32_t +inline u_int32_t __C(CHIP,_mem_read_4)(v, memh, off) void *v; bus_space_handle_t memh; @@ -393,7 +741,7 @@ __C(CHIP,_mem_read_4)(v, memh, off) return rval; } -u_int64_t +inline u_int64_t __C(CHIP,_mem_read_8)(v, memh, off) void *v; bus_space_handle_t memh; @@ -448,7 +796,7 @@ CHIP_mem_read_region_N(2,u_int16_t) 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; @@ -471,7 +819,7 @@ __C(CHIP,_mem_write_1)(v, memh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_mem_write_2)(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -494,7 +842,7 @@ __C(CHIP,_mem_write_2)(v, memh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_mem_write_4)(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -517,7 +865,7 @@ __C(CHIP,_mem_write_4)(v, memh, off, val) alpha_mb(); } -void +inline void __C(CHIP,_mem_write_8)(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -574,16 +922,64 @@ CHIP_mem_write_region_N(2,u_int16_t) 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) diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c index 9b4e45c7aa0..414d6b27ccc 100644 --- a/sys/arch/alpha/pci/sio.c +++ b/sys/arch/alpha/pci/sio.c @@ -1,5 +1,5 @@ -/* $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. @@ -45,18 +45,33 @@ #include +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, @@ -80,10 +95,17 @@ void sio_eisa_attach_hook __P((struct device *, struct device *, 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; @@ -97,7 +119,12 @@ siomatch(parent, match, 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; @@ -113,35 +140,35 @@ sioattach(parent, self, 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; @@ -151,10 +178,10 @@ sioattach(parent, self, aux) 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; @@ -163,10 +190,10 @@ sioattach(parent, self, aux) 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 diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c index 037707f5e85..84e3b616c19 100644 --- a/sys/arch/alpha/pci/sio_pic.c +++ b/sys/arch/alpha/pci/sio_pic.c @@ -1,5 +1,5 @@ -/* $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. @@ -60,29 +60,12 @@ /* * 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 @@ -117,6 +100,8 @@ u_int8_t initial_elcr[2]; void sio_setirqstat __P((int, int, int)); +void sio_setirqstat __P((int, int, int)); + void sio_setirqstat(irq, enabled, type) int irq, enabled; @@ -130,8 +115,6 @@ sio_setirqstat(irq, enabled, type) enabled ? "enabled" : "disabled", isa_intr_typename(type)); #endif - sio_intrsharetype[irq] = type; - icu = irq / 8; bit = irq % 8; @@ -217,10 +200,14 @@ sio_intr_setup(iot) #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: @@ -233,6 +220,8 @@ sio_intr_setup(iot) 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: @@ -245,6 +234,8 @@ sio_intr_setup(iot) 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: @@ -255,6 +246,9 @@ sio_intr_setup(iot) 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; } } @@ -268,75 +262,34 @@ sio_intr_string(v, irq) 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 @@ -345,45 +298,19 @@ sio_intr_disestablish(v, cookie) 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 @@ -394,36 +321,15 @@ sio_iointr(framep, vec) #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 diff --git a/sys/arch/alpha/pci/tga.c b/sys/arch/alpha/pci/tga.c index e8c52fc1b4f..b22c9f5f8f1 100644 --- a/sys/arch/alpha/pci/tga.c +++ b/sys/arch/alpha/pci/tga.c @@ -1,5 +1,5 @@ -/* $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. @@ -55,7 +55,11 @@ #include #include +#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 *)); @@ -83,8 +87,8 @@ struct wscons_emulfuncs tga_emulfuncs = { 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 *)); @@ -92,7 +96,12 @@ 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; @@ -296,15 +305,20 @@ tgaattach(parent, self, 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); } @@ -321,14 +335,14 @@ tgaprint(aux, pnp) } 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; @@ -383,12 +397,12 @@ tgaioctl(dev, cmd, data, flag, p) } 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; @@ -421,13 +435,15 @@ tga_console(iot, memt, pc, bus, device, function) */ (*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); } diff --git a/sys/arch/alpha/pci/tga_bt485.c b/sys/arch/alpha/pci/tga_bt485.c index cefd7d05ed1..ead6223af5a 100644 --- a/sys/arch/alpha/pci/tga_bt485.c +++ b/sys/arch/alpha/pci/tga_bt485.c @@ -1,5 +1,5 @@ -/* $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. diff --git a/sys/arch/alpha/pci/vga_pci.c b/sys/arch/alpha/pci/vga_pci.c new file mode 100644 index 00000000000..4cb4ca703cf --- /dev/null +++ b/sys/arch/alpha/pci/vga_pci.c @@ -0,0 +1,155 @@ +/* $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 +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +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); +} diff --git a/sys/arch/alpha/pci/vga_pcivar.h b/sys/arch/alpha/pci/vga_pcivar.h new file mode 100644 index 00000000000..29e258c862d --- /dev/null +++ b/sys/arch/alpha/pci/vga_pcivar.h @@ -0,0 +1,37 @@ +/* $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)); diff --git a/sys/arch/alpha/stand/installboot.8 b/sys/arch/alpha/stand/installboot.8 new file mode 100644 index 00000000000..fe6352cb42f --- /dev/null +++ b/sys/arch/alpha/stand/installboot.8 @@ -0,0 +1,144 @@ +.\" $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 . diff --git a/sys/arch/alpha/stand/prom.c b/sys/arch/alpha/stand/prom.c index 86c229945d3..7c7ed64672d 100644 --- a/sys/arch/alpha/stand/prom.c +++ b/sys/arch/alpha/stand/prom.c @@ -1,5 +1,5 @@ -/* $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 @@ -46,7 +46,7 @@ init_prom_calls() 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); diff --git a/sys/arch/alpha/tc/cfb.c b/sys/arch/alpha/tc/cfb.c index 134259df4f6..7a1176f5bba 100644 --- a/sys/arch/alpha/tc/cfb.c +++ b/sys/arch/alpha/tc/cfb.c @@ -1,5 +1,5 @@ -/* $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. @@ -55,7 +55,11 @@ #include #include +#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 *)); @@ -79,15 +83,20 @@ struct wscons_emulfuncs cfb_emulfuncs = { 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; @@ -191,14 +200,18 @@ cfbattach(parent, self, 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); } @@ -215,14 +228,14 @@ cfbprint(aux, pnp) } 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) { @@ -282,12 +295,12 @@ cfbioctl(dev, cmd, data, flag, p) } 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; diff --git a/sys/arch/alpha/tc/esp.c b/sys/arch/alpha/tc/esp.c index 8ef09391a31..e6d7aece4d1 100644 --- a/sys/arch/alpha/tc/esp.c +++ b/sys/arch/alpha/tc/esp.c @@ -1,5 +1,5 @@ -/* $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 @@ -108,9 +108,15 @@ 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 *)); @@ -119,7 +125,8 @@ int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/ /*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 *)); @@ -172,12 +179,23 @@ espprint(aux, name) } 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; @@ -243,7 +261,7 @@ espattach(parent, self, aux) 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 @@ -1134,7 +1152,7 @@ esp_msgin(sc) { 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", @@ -1214,7 +1232,6 @@ gotit: */ switch (sc->sc_state) { struct esp_ecb *ecb; - struct scsi_link *sc_link; struct esp_tinfo *ti; case ESP_CONNECTED: @@ -1225,9 +1242,9 @@ gotit: 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; } @@ -1626,7 +1643,12 @@ espintr(sc) * 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; @@ -2011,7 +2033,7 @@ if (sc->sc_flags & ESP_ICCS) printf("[[esp: BUMMER]]"); } 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, @@ -2098,6 +2120,13 @@ esp_abort(sc, ecb) */ 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); @@ -2118,11 +2147,11 @@ esp_timeout(arg) sc_print_addr(sc_link); printf("%s: timed out [ecb %p (flags 0x%x, dleft %x, stat %x)], " - "", + "", 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); diff --git a/sys/arch/alpha/tc/espvar.h b/sys/arch/alpha/tc/espvar.h index c21eb0d92c9..70c0ddf9879 100644 --- a/sys/arch/alpha/tc/espvar.h +++ b/sys/arch/alpha/tc/espvar.h @@ -1,5 +1,5 @@ -/* $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 @@ -184,7 +184,7 @@ struct esp_softc { 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) */ diff --git a/sys/arch/alpha/tc/ioasic.c b/sys/arch/alpha/tc/ioasic.c index d7a6aae03f2..96e49ffb553 100644 --- a/sys/arch/alpha/tc/ioasic.c +++ b/sys/arch/alpha/tc/ioasic.c @@ -1,5 +1,5 @@ -/* $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. @@ -52,7 +52,11 @@ struct ioasic_softc { }; /* 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 *); @@ -108,7 +112,11 @@ extern int cputype; 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; diff --git a/sys/arch/alpha/tc/mcclock_ioasic.c b/sys/arch/alpha/tc/mcclock_ioasic.c index 235fff4e901..2a5582895fb 100644 --- a/sys/arch/alpha/tc/mcclock_ioasic.c +++ b/sys/arch/alpha/tc/mcclock_ioasic.c @@ -1,5 +1,5 @@ -/* $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. @@ -51,7 +51,11 @@ struct mcclock_ioasic_softc { 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 = { @@ -69,7 +73,12 @@ const struct mcclock_busfns mcclock_ioasic_busfns = { 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; diff --git a/sys/arch/alpha/tc/scc.c b/sys/arch/alpha/tc/scc.c index bfa713ad8d0..c3058f6911a 100644 --- a/sys/arch/alpha/tc/scc.c +++ b/sys/arch/alpha/tc/scc.c @@ -1,5 +1,5 @@ -/* $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 @@ -108,8 +108,6 @@ #include #include -extern void ttrstrt __P((void *)); - #undef SCCDEV #define SCCDEV 15 /* XXX */ @@ -197,10 +195,13 @@ struct speedtab sccspeedtab[] = { #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, }; @@ -209,31 +210,23 @@ struct cfdriver scc_cd = { 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 @@ -245,8 +238,8 @@ static struct scc_softc coldcons_softc; 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)); /* @@ -300,6 +293,7 @@ scc_consinit(dev, sccaddr) splx(s); } +#ifndef alpha void scc_oconsinit(sc, dev) struct scc_softc *sc; @@ -321,18 +315,29 @@ scc_oconsinit(sc, dev) 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; @@ -526,7 +531,7 @@ sccattach(parent, self, aux) /* * Reset the chip. */ -static void +void sccreset(sc) register struct scc_softc *sc; { @@ -805,7 +810,7 @@ sccparam(tp, t) /* * 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; @@ -993,7 +998,7 @@ sccintr(xxxsc) 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); @@ -1191,7 +1196,7 @@ out: * Stop output on a line. */ /*ARGSUSED*/ -void +int sccstop(tp, flag) register struct tty *tp; int flag; @@ -1209,6 +1214,7 @@ sccstop(tp, flag) tp->t_state |= TS_FLUSH; } splx(s); + return 0; } int @@ -1275,7 +1281,7 @@ sccmctl(dev, bits, how) /* * Check for carrier transition. */ -static void +void scc_modem_intr(dev) dev_t dev; { @@ -1425,8 +1431,8 @@ sccPollc(dev, on) } #ifdef SCC_DEBUG -static void -rr(msg, regs) +void +scc_rr(msg, regs) char *msg; scc_regmap_t *regs; { diff --git a/sys/arch/alpha/tc/sccvar.h b/sys/arch/alpha/tc/sccvar.h index c0c8285fb35..b1fae134466 100644 --- a/sys/arch/alpha/tc/sccvar.h +++ b/sys/arch/alpha/tc/sccvar.h @@ -1,5 +1,5 @@ -/* $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 @@ -96,9 +96,9 @@ typedef struct { } 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 diff --git a/sys/arch/alpha/tc/sfb.c b/sys/arch/alpha/tc/sfb.c index 0dd93e9a981..0bbff844adf 100644 --- a/sys/arch/alpha/tc/sfb.c +++ b/sys/arch/alpha/tc/sfb.c @@ -1,5 +1,5 @@ -/* $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. @@ -55,7 +55,11 @@ #include #include +#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 *)); @@ -79,8 +83,8 @@ struct wscons_emulfuncs sfb_emulfuncs = { 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 *)); @@ -90,7 +94,12 @@ void sfb_unblank __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; @@ -236,14 +245,18 @@ sfbattach(parent, self, 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); } @@ -260,14 +273,14 @@ sfbprint(aux, pnp) } 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) { @@ -327,12 +340,12 @@ sfbioctl(dev, cmd, data, flag, p) } 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; diff --git a/sys/arch/alpha/tc/tc_3000_500.c b/sys/arch/alpha/tc/tc_3000_500.c index 9e8133619b2..61cfdc95128 100644 --- a/sys/arch/alpha/tc/tc_3000_500.c +++ b/sys/arch/alpha/tc/tc_3000_500.c @@ -1,5 +1,5 @@ -/* $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. @@ -66,13 +66,20 @@ struct tc_slotdesc tc_3000_500_slots[] = { 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, diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index 5c44ec56efd..4d901513410 100644 --- a/sys/arch/alpha/tc/tc_bus_mem.c +++ b/sys/arch/alpha/tc/tc_bus_mem.c @@ -1,5 +1,5 @@ -/* $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. @@ -55,11 +55,15 @@ int tc_mem_alloc __P((void *, bus_addr_t, bus_addr_t, bus_size_t, 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, @@ -82,13 +86,13 @@ void tc_mem_read_region_8 __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 */ @@ -111,10 +115,35 @@ void tc_mem_write_region_4 __P((void *, bus_space_handle_t, 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 */ @@ -129,13 +158,16 @@ static struct alpha_bus_space tc_mem_space = { 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, @@ -153,7 +185,7 @@ static struct alpha_bus_space tc_mem_space = { 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, @@ -165,17 +197,23 @@ static struct alpha_bus_space tc_mem_space = { 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 @@ -259,7 +297,21 @@ tc_mem_free(v, bsh, size) 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; @@ -276,7 +328,7 @@ tc_mem_read_1(v, memh, off) return (*p); } -u_int16_t +inline u_int16_t tc_mem_read_2(v, memh, off) void *v; bus_space_handle_t memh; @@ -293,7 +345,7 @@ tc_mem_read_2(v, memh, off) return (*p); } -u_int32_t +inline u_int32_t tc_mem_read_4(v, memh, off) void *v; bus_space_handle_t memh; @@ -311,7 +363,7 @@ tc_mem_read_4(v, memh, off) return (*p); } -u_int64_t +inline u_int64_t tc_mem_read_8(v, memh, off) void *v; bus_space_handle_t memh; @@ -328,7 +380,6 @@ tc_mem_read_8(v, memh, off) return (*p); } - #define tc_mem_read_multi_N(BYTES,TYPE) \ void \ __abs_c(tc_mem_read_multi_,BYTES)(v, h, o, a, c) \ @@ -367,7 +418,7 @@ tc_mem_read_region_N(2,u_int16_t) 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; @@ -397,7 +448,7 @@ tc_mem_write_1(v, memh, off, val) alpha_mb(); /* XXX XXX XXX */ } -void +inline void tc_mem_write_2(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -427,7 +478,7 @@ tc_mem_write_2(v, memh, off, val) alpha_mb(); /* XXX XXX XXX */ } -void +inline void tc_mem_write_4(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -445,7 +496,7 @@ tc_mem_write_4(v, memh, off, val) alpha_mb(); /* XXX XXX XXX */ } -void +inline void tc_mem_write_8(v, memh, off, val) void *v; bus_space_handle_t memh; @@ -461,6 +512,7 @@ tc_mem_write_8(v, memh, off, val) *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) \ @@ -499,16 +551,64 @@ tc_mem_write_region_N(2,u_int16_t) 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) diff --git a/sys/arch/alpha/tc/tc_conf.h b/sys/arch/alpha/tc/tc_conf.h index 479cea7eb6b..28f7a11c045 100644 --- a/sys/arch/alpha/tc/tc_conf.h +++ b/sys/arch/alpha/tc/tc_conf.h @@ -1,5 +1,5 @@ -/* $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. @@ -42,8 +42,10 @@ extern void tc_3000_500_intr_disestablish __P((struct device *, void *)); 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 diff --git a/sys/arch/alpha/tc/tcasic.c b/sys/arch/alpha/tc/tcasic.c index a8b31851edf..e917edbcca3 100644 --- a/sys/arch/alpha/tc/tcasic.c +++ b/sys/arch/alpha/tc/tcasic.c @@ -1,5 +1,5 @@ -/* $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. @@ -39,7 +39,11 @@ #include /* 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 = { @@ -60,7 +64,11 @@ int tcasicfound; 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; @@ -103,8 +111,13 @@ tcasicattach(parent, self, 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; diff --git a/sys/arch/alpha/tc/tcds.c b/sys/arch/alpha/tc/tcds.c index da676fed240..1ff43839c7c 100644 --- a/sys/arch/alpha/tc/tcds.c +++ b/sys/arch/alpha/tc/tcds.c @@ -1,5 +1,5 @@ -/* $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. @@ -56,7 +56,11 @@ struct tcds_softc { }; /* 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 *)); @@ -74,7 +78,11 @@ struct cfdriver tcds_cd = { 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; diff --git a/sys/arch/alpha/tc/tcds_dma.c b/sys/arch/alpha/tc/tcds_dma.c index b7173fdc931..00e9a22db79 100644 --- a/sys/arch/alpha/tc/tcds_dma.c +++ b/sys/arch/alpha/tc/tcds_dma.c @@ -1,5 +1,5 @@ -/* $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. @@ -67,10 +67,7 @@ tcds_dma_isintr(sc) { 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; @@ -116,7 +113,6 @@ tcds_dma_intr(sc) 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); } @@ -134,7 +130,7 @@ tcds_dma_intr(sc) 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; } @@ -162,7 +158,7 @@ tcds_dma_intr(sc) 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); @@ -183,7 +179,7 @@ tcds_dma_intr(sc) 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); @@ -225,7 +221,7 @@ tcds_dma_setup(sc, addr, len, datain, dmasize) 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 @@ -235,7 +231,7 @@ tcds_dma_setup(sc, addr, len, datain, dmasize) 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! */ diff --git a/sys/arch/alpha/tc/tcdsvar.h b/sys/arch/alpha/tc/tcdsvar.h index a877de2dc7f..13d2b9c8378 100644 --- a/sys/arch/alpha/tc/tcdsvar.h +++ b/sys/arch/alpha/tc/tcdsvar.h @@ -1,5 +1,5 @@ -/* $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. @@ -89,6 +89,7 @@ void tcds_intr_establish __P((struct device *, void *, tc_intrlevel_t, 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 *)); diff --git a/sys/arch/alpha/wscons/kbd.c b/sys/arch/alpha/wscons/kbd.c index c2782435e2b..05e43d07eea 100644 --- a/sys/arch/alpha/wscons/kbd.c +++ b/sys/arch/alpha/wscons/kbd.c @@ -1,5 +1,5 @@ -/* $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 @@ -61,6 +61,7 @@ #include #include #include +#include #include @@ -71,6 +72,8 @@ #include #include +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 */ diff --git a/sys/arch/alpha/wscons/kbd.h b/sys/arch/alpha/wscons/kbd.h index e2bcf6ed5af..a0bd8205746 100644 --- a/sys/arch/alpha/wscons/kbd.h +++ b/sys/arch/alpha/wscons/kbd.h @@ -1,4 +1,4 @@ -/* $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 @@ -32,18 +32,10 @@ */ 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)); diff --git a/sys/arch/alpha/wscons/ms.c b/sys/arch/alpha/wscons/ms.c index 938cffd4b8d..76a72d67721 100644 --- a/sys/arch/alpha/wscons/ms.c +++ b/sys/arch/alpha/wscons/ms.c @@ -1,5 +1,5 @@ -/* $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 diff --git a/sys/arch/alpha/wscons/ms.h b/sys/arch/alpha/wscons/ms.h index cedfd65f73b..fa69749e73c 100644 --- a/sys/arch/alpha/wscons/ms.h +++ b/sys/arch/alpha/wscons/ms.h @@ -1,4 +1,4 @@ -/* $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 @@ -33,13 +33,5 @@ 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); diff --git a/sys/arch/alpha/wscons/wscons.c b/sys/arch/alpha/wscons/wscons.c index c86feeea15e..1bc38095b02 100644 --- a/sys/arch/alpha/wscons/wscons.c +++ b/sys/arch/alpha/wscons/wscons.c @@ -1,5 +1,5 @@ -/* $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. @@ -61,11 +61,16 @@ struct wscons_softc { 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 = { @@ -110,13 +115,23 @@ int wsconsparam __P((struct tty *, struct termios *)); */ 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?"); @@ -182,6 +197,7 @@ wsconsattach(parent, self, aux) /* * 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; @@ -347,7 +363,7 @@ wsconsioctl(dev, cmd, data, flag, p) /* 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; diff --git a/sys/arch/alpha/wscons/wscons_emul.c b/sys/arch/alpha/wscons/wscons_emul.c index 0fd4450c4a3..fc40d12638c 100644 --- a/sys/arch/alpha/wscons/wscons_emul.c +++ b/sys/arch/alpha/wscons/wscons_emul.c @@ -1,5 +1,5 @@ -/* $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. @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,11 @@ static __inline void wscons_emul_docontrol 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; @@ -58,19 +64,20 @@ wscons_emul_attach(we, wo) #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; diff --git a/sys/arch/alpha/wscons/wscons_rinit.c b/sys/arch/alpha/wscons/wscons_rinit.c index 3556c285800..f6911f17118 100644 --- a/sys/arch/alpha/wscons/wscons_rinit.c +++ b/sys/arch/alpha/wscons/wscons_rinit.c @@ -1,5 +1,5 @@ -/* $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 @@ -56,6 +56,8 @@ 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; diff --git a/sys/arch/alpha/wscons/wsconsvar.h b/sys/arch/alpha/wscons/wsconsvar.h index 27db5939d40..27a14d3f96d 100644 --- a/sys/arch/alpha/wscons/wsconsvar.h +++ b/sys/arch/alpha/wscons/wsconsvar.h @@ -1,5 +1,5 @@ -/* $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. @@ -33,9 +33,9 @@ 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 { @@ -54,14 +54,15 @@ 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; @@ -109,4 +110,15 @@ void wscons_attach_input __P((struct device *, */ 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_ */ diff --git a/sys/dev/isa/vga_isa.c b/sys/dev/isa/vga_isa.c new file mode 100644 index 00000000000..615f16590a5 --- /dev/null +++ b/sys/dev/isa/vga_isa.c @@ -0,0 +1,145 @@ +/* $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 +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +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); +} diff --git a/sys/dev/isa/vga_isavar.h b/sys/dev/isa/vga_isavar.h new file mode 100644 index 00000000000..618eb26b51b --- /dev/null +++ b/sys/dev/isa/vga_isavar.h @@ -0,0 +1,31 @@ +/* $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)); diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c new file mode 100644 index 00000000000..4cb4ca703cf --- /dev/null +++ b/sys/dev/pci/vga_pci.c @@ -0,0 +1,155 @@ +/* $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 +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +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); +} diff --git a/sys/dev/pci/vga_pcivar.h b/sys/dev/pci/vga_pcivar.h new file mode 100644 index 00000000000..29e258c862d --- /dev/null +++ b/sys/dev/pci/vga_pcivar.h @@ -0,0 +1,37 @@ +/* $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)); diff --git a/sys/dev/wscons/kbd.c b/sys/dev/wscons/kbd.c index c2782435e2b..05e43d07eea 100644 --- a/sys/dev/wscons/kbd.c +++ b/sys/dev/wscons/kbd.c @@ -1,5 +1,5 @@ -/* $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 @@ -61,6 +61,7 @@ #include #include #include +#include #include @@ -71,6 +72,8 @@ #include #include +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 */ diff --git a/sys/dev/wscons/kbd.h b/sys/dev/wscons/kbd.h index e2bcf6ed5af..a0bd8205746 100644 --- a/sys/dev/wscons/kbd.h +++ b/sys/dev/wscons/kbd.h @@ -1,4 +1,4 @@ -/* $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 @@ -32,18 +32,10 @@ */ 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)); diff --git a/sys/dev/wscons/ms.c b/sys/dev/wscons/ms.c index 938cffd4b8d..76a72d67721 100644 --- a/sys/dev/wscons/ms.c +++ b/sys/dev/wscons/ms.c @@ -1,5 +1,5 @@ -/* $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 diff --git a/sys/dev/wscons/ms.h b/sys/dev/wscons/ms.h index cedfd65f73b..fa69749e73c 100644 --- a/sys/dev/wscons/ms.h +++ b/sys/dev/wscons/ms.h @@ -1,4 +1,4 @@ -/* $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 @@ -33,13 +33,5 @@ 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); diff --git a/sys/dev/wscons/wscons.c b/sys/dev/wscons/wscons.c index c86feeea15e..1bc38095b02 100644 --- a/sys/dev/wscons/wscons.c +++ b/sys/dev/wscons/wscons.c @@ -1,5 +1,5 @@ -/* $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. @@ -61,11 +61,16 @@ struct wscons_softc { 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 = { @@ -110,13 +115,23 @@ int wsconsparam __P((struct tty *, struct termios *)); */ 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?"); @@ -182,6 +197,7 @@ wsconsattach(parent, self, aux) /* * 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; @@ -347,7 +363,7 @@ wsconsioctl(dev, cmd, data, flag, p) /* 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; diff --git a/sys/dev/wscons/wscons_emul.c b/sys/dev/wscons/wscons_emul.c index 0fd4450c4a3..fc40d12638c 100644 --- a/sys/dev/wscons/wscons_emul.c +++ b/sys/dev/wscons/wscons_emul.c @@ -1,5 +1,5 @@ -/* $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. @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,11 @@ static __inline void wscons_emul_docontrol 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; @@ -58,19 +64,20 @@ wscons_emul_attach(we, wo) #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; diff --git a/sys/dev/wscons/wscons_rinit.c b/sys/dev/wscons/wscons_rinit.c index 3556c285800..f6911f17118 100644 --- a/sys/dev/wscons/wscons_rinit.c +++ b/sys/dev/wscons/wscons_rinit.c @@ -1,5 +1,5 @@ -/* $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 @@ -56,6 +56,8 @@ 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; diff --git a/sys/dev/wscons/wsconsvar.h b/sys/dev/wscons/wsconsvar.h index 27db5939d40..27a14d3f96d 100644 --- a/sys/dev/wscons/wsconsvar.h +++ b/sys/dev/wscons/wsconsvar.h @@ -1,5 +1,5 @@ -/* $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. @@ -33,9 +33,9 @@ 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 { @@ -54,14 +54,15 @@ 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; @@ -109,4 +110,15 @@ void wscons_attach_input __P((struct device *, */ 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_ */ -- 2.20.1