diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
| commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
| tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /sys/alpha | |
| parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) | |
Diffstat (limited to 'sys/alpha')
67 files changed, 402 insertions, 4399 deletions
diff --git a/sys/alpha/alpha/alpha-gdbstub.c b/sys/alpha/alpha/alpha-gdbstub.c index 0f8e963e4cb8f..d57230dabf3a8 100644 --- a/sys/alpha/alpha/alpha-gdbstub.c +++ b/sys/alpha/alpha/alpha-gdbstub.c @@ -538,11 +538,11 @@ clear_single_step(db_regs_t* regs) * Entries not in integer register set are set to -1. */ static int tf2gdb[FRAME_SIZE] = { -/*0*/ R_V0, R_T0, R_T1, R_T2, R_T3, R_T4, R_T5, R_T6, -/*8*/ R_T7, R_S0, R_S1, R_S2, R_S3, R_S4, R_S5, R_S6, -/*16*/ R_A3, R_A4, R_A5, R_T8, R_T9, R_T10, R_T11, R_RA, -/*24*/ R_T12, R_AT, R_SP, -1, -1, -1, -1, -1, -/*32*/ R_GP, R_A0, R_A1, R_A2, + R_V0, R_T0, R_T1, R_T2, R_T3, R_T4, R_T5, R_T6, + R_T7, R_S0, R_S1, R_S2, R_S3, R_S4, R_S5, R_S6, + R_A3, R_A4, R_A5, R_T8, R_T9, R_T10, R_T11, R_RA, + R_T12, R_AT, R_SP, -1, -1, R_GP, R_A0, R_A1, + R_A2, }; /* diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c index 46aeb3ffb709e..205404f54d7e5 100644 --- a/sys/alpha/alpha/autoconf.c +++ b/sys/alpha/alpha/autoconf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: autoconf.c,v 1.12 1998/10/30 01:36:40 jkh Exp $ + * $Id: autoconf.c,v 1.10 1998/09/26 14:48:19 dfr Exp $ */ #include "opt_bootp.h" @@ -58,17 +58,24 @@ #include <cam/cam_xpt_sim.h> #include <cam/cam_debug.h> +#include "scbus.h" + static void configure __P((void *)); -SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL) +SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL) static void configure_finish __P((void)); static void configure_start __P((void)); device_t isa_bus_device = 0; struct cam_sim *boot_sim = 0; +extern void xpt_init __P((void)); + static void configure_start() { +#if NSCBUS > 0 + xpt_init(); +#endif } static void @@ -210,14 +217,9 @@ cpu_rootconf() { #ifdef MFS_ROOT if (!mountrootfsname) { - extern u_char *mfs_getimage __P((void)); - if (bootverbose) printf("Considering MFS root f/s.\n"); - if (mfs_getimage()) - mountrootfsname = "mfs"; - else if (bootverbose) - printf("No MFS image available as root f/s.\n"); + mountrootfsname = "mfs"; } #endif diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c index 649b8caeddd46..ef32268fa8cca 100644 --- a/sys/alpha/alpha/clock.c +++ b/sys/alpha/alpha/clock.c @@ -1,4 +1,4 @@ -/* $Id: clock.c,v 1.4 1998/10/06 08:40:18 dfr Exp $ */ +/* $Id: clock.c,v 1.3 1998/07/22 08:16:34 dfr Exp $ */ /* $NetBSD: clock.c,v 1.20 1998/01/31 10:32:47 ross Exp $ */ /* @@ -77,7 +77,7 @@ extern int cycles_per_sec; static timecounter_get_t alpha_get_timecount; static timecounter_pps_t alpha_poll_pps; -static struct timecounter alpha_timecounter = { +static struct timecounter alpha_timecounter[3] = { alpha_get_timecount, /* get_timecount */ 0, /* no poll_pps */ ~0u, /* counter_mask */ @@ -86,7 +86,7 @@ static struct timecounter alpha_timecounter = { }; SYSCTL_OPAQUE(_debug, OID_AUTO, alpha_timecounter, CTLFLAG_RD, - &alpha_timecounter, sizeof(alpha_timecounter), "S,timecounter", ""); + alpha_timecounter, sizeof(alpha_timecounter), "S,timecounter", ""); /* Values for timerX_state: */ #define RELEASED 0 @@ -178,8 +178,8 @@ cpu_initclocks() scaled_ticks_per_cycle = ((u_int64_t)hz << FIX_SHIFT) / cycles_per_sec; max_cycles_per_tick = 2*cycles_per_sec / hz; - alpha_timecounter.tc_frequency = cycles_per_sec; - init_timecounter(&alpha_timecounter); + alpha_timecounter[0].tc_frequency = cycles_per_sec; + init_timecounter(alpha_timecounter); platform.clockintr = (void (*) __P((void *))) handleclock; diff --git a/sys/alpha/alpha/clock_if.m b/sys/alpha/alpha/clock_if.m index 75cb78fbf1e6b..cc0d265aea671 100644 --- a/sys/alpha/alpha/clock_if.m +++ b/sys/alpha/alpha/clock_if.m @@ -23,12 +23,12 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Id: clock_if.m,v 1.1 1998/06/14 13:52:33 dfr Exp $ +# $Id$ # #include <machine/clockvar.h> -INTERFACE clock; +INTERFACE clock METHOD void init { device_t dev; diff --git a/sys/alpha/alpha/cons.c b/sys/alpha/alpha/cons.c index ad8465ac3903c..78d114987faa9 100644 --- a/sys/alpha/alpha/cons.c +++ b/sys/alpha/alpha/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.2 1998/06/14 13:44:40 dfr Exp $ + * $Id: cons.c,v 1.1 1998/06/10 10:52:15 dfr Exp $ */ #include "opt_devfs.h" @@ -90,7 +90,7 @@ static struct cdevsw cn_cdevsw = cnpoll, nommap, NULL, "console", NULL, -1 }; static dev_t cn_dev_t; /* seems to be never really used */ -SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, +SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, &cn_dev_t, sizeof cn_dev_t, "T,dev_t", ""); static int cn_mute; diff --git a/sys/alpha/alpha/db_disasm.c b/sys/alpha/alpha/db_disasm.c index 9fc3b1e8b0d73..bec614526a4ad 100644 --- a/sys/alpha/alpha/db_disasm.c +++ b/sys/alpha/alpha/db_disasm.c @@ -201,7 +201,7 @@ pal_opname(op) return (pal_op_tbl[i].name); } - snprintf(unk, sizeof(unk), "0x%x", op); + sprintf(unk, "0x%x", op); return (unk); } @@ -257,7 +257,7 @@ arit_name(op) if (name != NULL) return (name); - snprintf(unk, sizeof(unk), "?arit 0x%x?", op); + sprintf(unk, "?arit 0x%x?", op); return (unk); } @@ -307,7 +307,7 @@ logical_name(op) if (name != NULL) return (name); - snprintf(unk, sizeof(unk), "?logical 0x%x?", op); + sprintf(unk, "?logical 0x%x?", op); return (unk); } @@ -352,7 +352,7 @@ bitop_name(op) if (name != NULL) return (name); - snprintf(unk, sizeof(unk), "?bit 0x%x?", op); + sprintf(unk, "?bit 0x%x?", op); return (unk); } @@ -376,7 +376,7 @@ mul_name(op) if (name != NULL) return (name); - snprintf(unk, sizeof(unk), "?mul 0x%x?", op); + sprintf(unk, "?mul 0x%x?", op); return (unk); } @@ -401,7 +401,7 @@ special_name(op) if (name != NULL) return (name); - snprintf(unk, sizeof(unk), "?special 0x%x?", op); + sprintf(unk, "?special 0x%x?", op); return (unk); } @@ -440,7 +440,7 @@ intmisc_name(op) case op_ftois: return ("ftois"); } - snprintf(unk, sizeof(unk), "?intmisc 0x%x?", op); + sprintf(unk, "?intmisc 0x%x?", op); return (unk); } @@ -460,7 +460,7 @@ float_name(tbl, op, type) return (tbl[i].name); } - snprintf(unk, sizeof(unk), "?%s 0x%x?", type, op); + sprintf(unk, "?%s 0x%x?", type, op); return (unk); } diff --git a/sys/alpha/alpha/dec_2100_a50.c b/sys/alpha/alpha/dec_2100_a50.c index 3d5a74908f447..f7bb8c7841ecd 100644 --- a/sys/alpha/alpha/dec_2100_a50.c +++ b/sys/alpha/alpha/dec_2100_a50.c @@ -58,6 +58,7 @@ static int comcnrate = CONSPEED; void dec_2100_a50_init __P((void)); static void dec_2100_a50_cons_init __P((void)); +static void dec_2100_a50_device_register __P((struct device *, void *)); static void dec_2100_a50_intr_map __P((void *)); void sio_intr_establish __P((int)); void sio_intr_disestablish __P((int)); @@ -148,7 +149,7 @@ dec_2100_a50_cons_init() 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 %ld\n", + panic("consinit: unknown console type %d\n", ctb->ctb_term_type); } } @@ -162,6 +163,7 @@ dec_2100_a50_intr_map(void *arg) u_int32_t pirqreg; int pirq=0; /* gcc -Wuninitialized XXX */ pcicfgregs *cfg = (pcicfgregs *)arg; + static int intr_setup_done=0; /* * Slot->interrupt translation. Taken from NetBSD diff --git a/sys/alpha/alpha/dec_eb164.c b/sys/alpha/alpha/dec_eb164.c index d2a78f491e499..c0553878288b9 100644 --- a/sys/alpha/alpha/dec_eb164.c +++ b/sys/alpha/alpha/dec_eb164.c @@ -1,4 +1,4 @@ -/* $Id: dec_eb164.c,v 1.5 1998/12/05 22:36:31 mjacob Exp $ */ +/* $Id: dec_eb164.c,v 1.3 1998/07/22 08:18:34 dfr Exp $ */ /* $NetBSD: dec_eb164.c,v 1.26 1998/04/17 02:45:19 mjacob Exp $ */ /* @@ -80,7 +80,6 @@ dec_eb164_init() platform.pci_intr_enable = eb164_intr_enable; } -extern int comconsole; /* XXX for forcing comconsole when srm serial console is used */ static void dec_eb164_cons_init() { @@ -106,11 +105,6 @@ dec_eb164_cons_init() */ DELAY(160000000 / comcnrate); - /* - * force a comconsole on com1 if the SRM has a serial - * console - */ - comconsole = 0; if (siocnattach(0x3f8, comcnrate)) panic("can't init serial console"); @@ -132,7 +126,7 @@ dec_eb164_cons_init() printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); panic("consinit: unknown console type %d\n", - (int) ctb->ctb_term_type); + ctb->ctb_term_type); } } diff --git a/sys/alpha/alpha/dec_eb64plus.c b/sys/alpha/alpha/dec_eb64plus.c deleted file mode 100644 index 597415c90769b..0000000000000 --- a/sys/alpha/alpha/dec_eb64plus.c +++ /dev/null @@ -1,187 +0,0 @@ -/* $Id$ */ - -/* - * Copyright (c) 1995, 1996, 1997 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. - */ -/* - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ - -/* - * Port to based on NetBSD/axp by Wilko Bulte <wilko@freebsd.org> - * FreeBSD version based on: - * NetBSD: dec_eb64plus.c,v 1.15 1998/11/19 02:20:07 ross Exp - * - * Some info on the Aspen Alpine as this might be hard to come by: - * - Hardware is close enough to the DEC EB64+ design to allow it to run - * the EB64+ SRM console f/w - * - 3 PCI slots, closest to the SIMMs: Alpine calls this slot C - * the middle one Alpine calls this slot B - * the 3rd one is Alpine calls this slot A - * (A, B, C is silkscreened on the PCB) - * - embedded NCR810, located at PCI slot 5 - * - 3 ISA slots, hanging off an Intel 82378IB PCI-ISA bridge at PCI slot 8 - * - embedded floppy, PC keyboard interface, PS/2 mouse interface, 2x serial - * ports and a parallel port. All of this hiding after the ISA bridge - */ - -#include "opt_ddb.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/termios.h> - -#include <machine/rpb.h> -#include <machine/cpuconf.h> -#include <machine/clock.h> - -#include <pci/pcireg.h> -#include <pci/pcivar.h> -#include <pci/pci_ioctl.h> - -#include <alpha/pci/apecsreg.h> -#include <alpha/pci/apecsvar.h> - -#include "sio.h" -#include "sc.h" - -#ifndef CONSPEED -#define CONSPEED TTYDEF_SPEED -#endif -static int comcnrate = CONSPEED; - -void dec_eb64plus_init __P((void)); -static void dec_eb64plus_cons_init __P((void)); -static void dec_eb64plus_intr_init __P((void)); - -extern void eb64plus_intr_enable(int irq); /* ../pci/pci_eb64plus_intr.s */ -extern void eb64plus_intr_disable(int irq); /* ../pci/pci_eb64plus_intr.s */ - -extern const char * bootdev_protocol(void); -extern int bootdev_boot_dev_type(void); - -extern int siocnattach __P((int, int)); -extern int sccnattach __P((void)); - -const struct alpha_variation_table dec_eb64plus_variations[] = { - { 0, "DEC EB64-plus" }, - { 0, NULL }, -}; - -void -dec_eb64plus_init() -{ - u_int64_t variation; - - platform.family = "EB64+"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_eb64plus_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "apecs"; - platform.cons_init = dec_eb64plus_cons_init; - platform.pci_intr_init = dec_eb64plus_intr_init; - /* SRM handles PCI interrupt mapping */ - platform.pci_intr_map = NULL; - /* see ../pci/pci_eb64plus_intr.s for intr. dis/enable */ - platform.pci_intr_disable = eb64plus_intr_disable; - platform.pci_intr_enable = eb64plus_intr_enable; - -} - -extern int comconsole; /* XXX for forcing comconsole when srm serial console is used */ -/* init the console, serial or graphics */ -static void -dec_eb64plus_cons_init() -{ - struct ctb *ctb; - - apecs_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - /* serial console ... */ - /* XXX */ - { - /* - * Delay to allow PROM putchars to complete. - * FIFO depth * character time, - * character time = (1000000 / (defaultrate / 10)) - */ - DELAY(160000000 / comcnrate); - - /* - * force a comconsole on com1 if the SRM has a serial - * console - */ - comconsole = 0; - if (siocnattach(0x3f8, comcnrate)) - panic("can't init serial console"); - - break; - } - - case 3: -#if NSC > 0 - /* graphics adapter console */ - sccnattach(); -#else - panic("not configured to use display && keyboard console"); -#endif - 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", - (int)ctb->ctb_term_type); - } -} - -/* - * The SRM console may have left some some interrupts enabled. - */ -static void -dec_eb64plus_intr_init() -{ - int i; - - /* disable all PCI interrupts */ - for(i = 0; i <= 32; i++) /* 32 ?? NetBSD sez so */ - eb64plus_intr_disable(i); - - /* Enable ISA-PCI cascade interrupt */ - eb64plus_intr_enable(4); - -} diff --git a/sys/alpha/alpha/dec_kn20aa.c b/sys/alpha/alpha/dec_kn20aa.c index 1f4e6720a9571..2f018fb20691c 100644 --- a/sys/alpha/alpha/dec_kn20aa.c +++ b/sys/alpha/alpha/dec_kn20aa.c @@ -130,20 +130,20 @@ dec_kn20aa_cons_init() case 3: /* display console ... */ /* XXX */ -#if NSC > 0 +#if NPCKBD > 0 sccnattach(); #else panic("not configured to use display && keyboard console"); break; -#endif 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", - (int)ctb->ctb_term_type); + ctb->ctb_term_type); } +#endif } #if 0 static void diff --git a/sys/alpha/alpha/dec_st550.c b/sys/alpha/alpha/dec_st550.c index b7e186a86e879..758b611907cb5 100644 --- a/sys/alpha/alpha/dec_st550.c +++ b/sys/alpha/alpha/dec_st550.c @@ -78,6 +78,7 @@ extern int sccnattach __P((void)); void st550_init() { + int i; platform.family = "Digital Personal Workstation (Miata)"; if ((platform.model = alpha_dsr_sysname()) == NULL) { @@ -140,7 +141,7 @@ st550_cons_init() 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 %ld\n", + panic("consinit: unknown console type %d\n", ctb->ctb_term_type); } } diff --git a/sys/alpha/alpha/diskslice_machdep.c b/sys/alpha/alpha/diskslice_machdep.c index 426df40a32e87..e58dfd5928706 100644 --- a/sys/alpha/alpha/diskslice_machdep.c +++ b/sys/alpha/alpha/diskslice_machdep.c @@ -36,7 +36,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * from: i386/isa Id: diskslice_machdep.c,v 1.31 1998/08/10 07:22:14 phk Exp - * $Id: diskslice_machdep.c,v 1.5 1998/10/16 10:13:09 jkh Exp $ + * $Id: diskslice_machdep.c,v 1.4 1998/10/06 08:38:58 dfr Exp $ */ #include <sys/param.h> @@ -421,7 +421,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset, sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE, RAW_PART, partname); - snprintf(buf, sizeof(buf), "%s", sname); + strcpy(buf, sname); if (strlen(buf) < sizeof buf - 11) strcat(buf, "<extended>"); check_part(buf, dp, base_ext_offset, nsectors, diff --git a/sys/alpha/alpha/elf_machdep.c b/sys/alpha/alpha/elf_machdep.c index 785e2edcfccc8..847ab2a8af88e 100644 --- a/sys/alpha/alpha/elf_machdep.c +++ b/sys/alpha/alpha/elf_machdep.c @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: elf_machdep.c,v 1.2 1998/10/16 03:54:59 peter Exp $ + * $Id: elf_machdep.c,v 1.1 1998/09/11 08:47:02 dfr Exp $ */ #include <sys/param.h> @@ -97,7 +97,7 @@ elf_reloc(linker_file_t lf, const void *data, int type, const char *sym) break; case R_ALPHA_RELATIVE: - addr = relocbase + addend + *where; + addr = relocbase + addend; if (*where != addr) *where = addr; break; @@ -112,7 +112,7 @@ elf_reloc(linker_file_t lf, const void *data, int type, const char *sym) default: printf("kldload: unexpected relocation type %d\n", - (int) rtype); + rtype); return -1; } return(0); diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c deleted file mode 100644 index d6dc1653e3837..0000000000000 --- a/sys/alpha/alpha/fp_emulate.c +++ /dev/null @@ -1,411 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: fp_emulate.c,v 1.1 1998/12/04 10:52:47 dfr Exp $ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/sysent.h> -#include <sys/proc.h> -#include <sys/lock.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_prot.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> -#include <vm/vm_object.h> -#include <vm/vm_pager.h> -#include <sys/user.h> -#include <machine/inst.h> -#include <machine/fpu.h> -#include <machine/reg.h> -#include <alpha/alpha/ieee_float.h> - -#define GETREG(regs, i) (*(fp_register_t*) ®s->fpr_regs[i]) -#define PUTREG(regs, i, v) (*(fp_register_t*) ®s->fpr_regs[i] = v) - -typedef fp_register_t fp_opcode_handler(union alpha_instruction ins, - int src, int rnd, - u_int64_t fp_control, - u_int64_t *status, - struct fpreg *fpregs); - -static fp_register_t fp_add(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_add(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_sub(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_sub(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_mul(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_mul(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_div(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_div(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_cmpun(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmpun(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmpeq(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmpeq(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmplt(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmplt(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmple(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmple(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cvts(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case T_FORMAT: - return ieee_convert_T_S(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - - case Q_FORMAT: - return ieee_convert_Q_S(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_cvtt(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case S_FORMAT: - return ieee_convert_S_T(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - case Q_FORMAT: - return ieee_convert_Q_T(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_cvtq(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case S_FORMAT: - return ieee_convert_S_Q(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - case T_FORMAT: - return ieee_convert_T_Q(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_reserved(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); -} - -static fp_register_t fp_cvtql(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) - -{ - fp_register_t fb = GETREG(fpregs, ins.f_format.fb); - *status |= FPCR_INV; - return ((fb.q & 0xc0000000) << 32 | (fb.q & 0x3fffffff) << 29); -} - -static int fp_emulate(union alpha_instruction ins, struct proc *p) -{ - u_int64_t control = p->p_addr->u_pcb.pcb_fp_control; - struct fpreg *fpregs = &p->p_addr->u_pcb.pcb_fp; - static fp_opcode_handler *ops[16] = { - fp_add, /* 0 */ - fp_sub, /* 1 */ - fp_mul, /* 2 */ - fp_div, /* 3 */ - fp_cmpun, /* 4 */ - fp_cmpeq, /* 5 */ - fp_cmplt, /* 6 */ - fp_cmple, /* 7 */ - fp_reserved, /* 8 */ - fp_reserved, /* 9 */ - fp_reserved, /* 10 */ - fp_reserved, /* 11 */ - fp_cvts, /* 12 */ - fp_reserved, /* 13 */ - fp_cvtt, /* 14 */ - fp_cvtq, /* 15 */ - }; - int src, rnd; - fp_register_t result; - u_int64_t status; - - /* - * Only attempt to emulate ieee instructions & integer overflow - */ - if ((ins.common.opcode != op_flti) && - (ins.f_format.function != fltl_cvtqlsv)){ - printf("fp_emulate: unhandled opcode = 0x%x, fun = 0x%x\n",ins.common.opcode,ins.f_format.function); - return 0; - } - /* - * Dump the float registers into the pcb so we can get at - * them. - */ - if (p == fpcurproc) { - alpha_pal_wrfen(1); - savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); - alpha_pal_wrfen(0); - fpcurproc = NULL; - } - - /* - * Decode and execute the instruction. - */ - src = (ins.f_format.function >> 4) & 3; - rnd = (ins.f_format.function >> 6) & 3; - if (rnd == 3) - rnd = (fpregs->fpr_cr >> FPCR_DYN_SHIFT) & 3; - status = 0; - if (ins.common.opcode == op_fltl - && ins.f_format.function == fltl_cvtqlsv) - result = fp_cvtql(ins, src, rnd, control, &status, - fpregs); - else - result = ops[ins.f_format.function & 0xf](ins, src, rnd, - control, &status, - fpregs); - - /* - * Handle exceptions. - */ - if (status) { - u_int64_t fpcr; - - /* Record the exception in the software control word. */ - control |= (status >> IEEE_STATUS_TO_FPCR_SHIFT); - p->p_addr->u_pcb.pcb_fp_control = control; - - /* Regenerate the control register */ - fpcr = fpregs->fpr_cr & FPCR_DYN_MASK; - fpcr |= ((control & IEEE_STATUS_MASK) - << IEEE_STATUS_TO_FPCR_SHIFT); - if (!(control & IEEE_TRAP_ENABLE_INV)) - fpcr |= FPCR_INVD; - if (!(control & IEEE_TRAP_ENABLE_DZE)) - fpcr |= FPCR_DZED; - if (!(control & IEEE_TRAP_ENABLE_OVF)) - fpcr |= FPCR_OVFD; - if (!(control & IEEE_TRAP_ENABLE_UNF)) - fpcr |= FPCR_UNFD; - if (!(control & IEEE_TRAP_ENABLE_INE)) - fpcr |= FPCR_INED; - if (control & IEEE_STATUS_MASK) - fpcr |= FPCR_SUM; - fpregs->fpr_cr = fpcr; - - /* Check the trap enable */ - if ((control >> IEEE_STATUS_TO_EXCSUM_SHIFT) - & (control & IEEE_TRAP_ENABLE_MASK)) - return 0; - } - - PUTREG(fpregs, ins.f_format.fc, result); - return 1; -} - -/* - * Attempt to complete a floating point instruction which trapped by - * emulating it in software. Return non-zero if the completion was - * successful, otherwise zero. - */ -int fp_software_completion(u_int64_t regmask, struct proc *p) -{ - struct trapframe *frame = p->p_md.md_tf; - u_int64_t pc = frame->tf_regs[FRAME_PC]; - int error; - - /* - * First we must search back through the trap shadow to find which - * instruction was responsible for generating the trap. - */ - pc -= 4; - while (regmask) { - union alpha_instruction ins; - - /* - * Read the instruction and figure out the destination - * register and opcode. - */ - error = copyin((caddr_t) pc, &ins, sizeof(ins)); - if (error) - return 0; - - switch (ins.common.opcode) { - case op_call_pal: - case op_jsr: - case op_br ... op_bgt: - /* - * Condition 6: the trap shadow may not - * include any branch instructions. Also, - * the trap shadow is bounded by EXCB, TRAPB - * and CALL_PAL. - */ - return 0; - - case op_misc: - switch (ins.memory_format.function) { - case misc_trapb: - case misc_excb: - return 0; - } - break; - - case op_inta: - case op_intl: - case op_ints: - /* - * The first 32 bits of the register mask - * represents integer registers which were - * modified in the trap shadow. - */ - regmask &= ~(1LL << ins.o_format.rc); - break; - - case op_fltv: - case op_flti: - case op_fltl: - /* - * The second 32 bits of the register mask - * represents float registers which were - * modified in the trap shadow. - */ - regmask &= ~(1LL << (ins.f_format.fc + 32)); - break; - } - - if (regmask == 0) { - /* - * We have traced back through all the - * instructions in the trap shadow, so this - * must be the one which generated the trap. - */ - if (fp_emulate(ins, p)) { - /* - * Restore pc to the first instruction - * in the trap shadow. - */ - frame->tf_regs[FRAME_PC] = pc + 4; - return 1; - } else - return 0; - } - pc -= 4; - } - return 0; -} diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c index 33febfcfeb611..ca99b6a1b84fe 100644 --- a/sys/alpha/alpha/genassym.c +++ b/sys/alpha/alpha/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.3 1998/07/12 16:08:15 dfr Exp $ + * $Id: genassym.c,v 1.2 1998/06/14 13:44:43 dfr Exp $ */ #include <sys/param.h> @@ -46,7 +46,6 @@ #include <sys/resource.h> #include <sys/resourcevar.h> #include <machine/frame.h> -#include <machine/chipset.h> #include <sys/vmmeter.h> #include <vm/vm.h> #include <vm/vm_param.h> @@ -96,12 +95,7 @@ main() OFF(P_PID, struct proc, p_pid); OFF(P_SWITCHTIME, struct proc, p_switchtime); OFF(P_RUNTIME, struct proc, p_runtime); - OFF(P_MD_FLAGS, struct proc, p_md.md_flags); OFF(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr); - OFF(P_MD_HAE, struct proc, p_md.md_hae); - CONST1(MDP_HAEUSED); - - OFF(CHIPSET_WRITE_HAE, struct alpha_chipset, write_hae); OFF(PH_LINK, struct prochd, ph_link); OFF(PH_RLINK, struct prochd, ph_rlink); diff --git a/sys/alpha/alpha/ieee_float.c b/sys/alpha/alpha/ieee_float.c deleted file mode 100644 index 9e9846cb9153c..0000000000000 --- a/sys/alpha/alpha/ieee_float.c +++ /dev/null @@ -1,1515 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - */ - -/* - * An implementation of IEEE 754 floating point arithmetic supporting - * multiply, divide, addition, subtraction and conversion to and from - * integer. Probably not the fastest floating point code in the world - * but it should be pretty accurate. - * - * A special thanks to John Polstra for pointing out some problems - * with an earlier version of this code and for educating me as to the - * correct use of sticky bits. - */ - -#include <sys/types.h> -#ifdef TEST -#include "../include/fpu.h" -#include "ieee_float.h" -#else -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/sysent.h> -#include <sys/proc.h> -#include <machine/fpu.h> -#include <alpha/alpha/ieee_float.h> -#endif - -/* - * The number of fraction bits in a T format float. - */ -#define T_FRACBITS 52 - -/* - * The number of fraction bits in a S format float. - */ -#define S_FRACBITS 23 - -/* - * Mask the fraction part of a float to contain only those bits which - * should be in single precision number. - */ -#define S_FRACMASK ((1ULL << 52) - (1ULL << 29)) - -/* - * The number of extra zero bits we shift into the fraction part - * to gain accuracy. Two guard bits and one sticky bit are required - * to ensure accurate rounding. - */ -#define FRAC_SHIFT 3 - -/* - * Values for 1.0 and 2.0 fractions (including the extra FRAC_SHIFT - * bits). - */ -#define ONE (1ULL << (T_FRACBITS + FRAC_SHIFT)) -#define TWO (ONE + ONE) - -/* - * The maximum and minimum values for S and T format exponents. - */ -#define T_MAXEXP 0x3ff -#define T_MINEXP -0x3fe -#define S_MAXEXP 0x7f -#define S_MINEXP -0x7e - -/* - * Exponent values in registers are biased by adding this value. - */ -#define BIAS_EXP 0x3ff - -/* - * Exponent value for INF and NaN. - */ -#define NAN_EXP 0x7ff - -/* - * If this bit is set in the fraction part of a NaN, then the number - * is a quiet NaN, i.e. no traps are generated. - */ -#define QNAN_BIT (1ULL << 51) - -/* - * Return true if the number is any kind of NaN. - */ -static __inline int -isNaN(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && f.t.fraction != 0; -} - -/* - * Return true if the number is a quiet NaN. - */ -static __inline int -isQNaN(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && (f.t.fraction & QNAN_BIT); -} - -/* - * Return true if the number is a signalling NaN. - */ -static __inline int -isSNaN(fp_register_t f) -{ - return isNaN(f) && !isQNaN(f); -} - -/* - * Return true if the number is +/- INF. - */ -static __inline int -isINF(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && f.t.fraction == 0; -} - -/* - * Return true if the number is +/- 0. - */ -static __inline int -isZERO(fp_register_t f) -{ - return f.t.exponent == 0 && f.t.fraction == 0; -} - -/* - * Return true if the number is denormalised. - */ -static __inline int -isDENORM(fp_register_t f) -{ - return f.t.exponent == 0 && f.t.fraction != 0; -} - -/* - * Extract the exponent part of a float register. If the exponent is - * zero, the number may be denormalised (if the fraction is nonzero). - * If so, return the minimum exponent for the source datatype. - */ -static __inline int -getexp(fp_register_t f, int src) -{ - int minexp[] = { S_MINEXP, 0, T_MINEXP, 0 }; - if (f.t.exponent == 0) - if (f.t.fraction) - return minexp[src]; - else - return 0; - return f.t.exponent - BIAS_EXP; -} - -/* - * Extract the fraction part of a float register, shift it up a bit - * to give extra accuracy and add in the implicit 1 bit. Must be - * careful to handle denormalised numbers and zero correctly. - */ -static __inline u_int64_t -getfrac(fp_register_t f) -{ - if (f.t.exponent == 0) - return f.t.fraction << FRAC_SHIFT; - else - return (f.t.fraction << FRAC_SHIFT) | ONE; -} - -/* - * Make a float (in register format) from a sign, exponent and - * fraction, normalising and rounding as necessary. - * Return the float and set *status if any traps are generated. - */ -static fp_register_t -makefloat(int sign, int exp, u_int64_t frac, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - fp_register_t f; - int minexp = 0, maxexp = 0, alpha = 0; - u_int64_t epsilon = 0, max = 0; - - if (frac == 0) { - f.t.sign = sign; - f.t.exponent = 0; - f.t.fraction = 0; - return f; - } - - if (frac >= TWO) { - /* - * Fraction is >= 2.0. - * Shift the fraction down, preserving the 'sticky' - * bit. - */ - while (frac >= TWO) { - frac = (frac >> 1) | (frac & 1); - exp++; - } - } else if (frac < ONE) { - /* - * Fraction is < 1.0. Shift it up. - */ - while (frac < ONE) { - frac = (frac << 1) | (frac & 1); - exp--; - } - } - - switch (src) { - case S_FORMAT: - minexp = S_MINEXP; - maxexp = S_MAXEXP; - alpha = 0xc0; - epsilon = (1ULL << (T_FRACBITS - S_FRACBITS + FRAC_SHIFT)); - max = TWO - epsilon; - break; - - case T_FORMAT: - minexp = T_MINEXP; - maxexp = T_MAXEXP; - alpha = 0x600; - epsilon = (1ULL << FRAC_SHIFT); - max = TWO - epsilon; - break; - } - - /* - * Handle underflow before rounding so that denormalised - * numbers are rounded correctly. - */ - if (exp < minexp) { - *status |= FPCR_INE; - if (control & IEEE_TRAP_ENABLE_UNF) { - *status |= FPCR_UNF; - exp += alpha; - } else { - /* denormalise */ - while (exp < minexp) { - exp++; - frac = (frac >> 1) | (frac & 1); - } - exp = minexp - 1; - } - } - - /* - * Round the fraction according to the rounding mode. - */ - if (frac & (epsilon - 1)) { - u_int64_t fraclo, frachi; - u_int64_t difflo, diffhi; - - fraclo = frac & max; - frachi = fraclo + epsilon; - switch (rnd) { - case ROUND_CHOP: - frac = fraclo; - break; - case ROUND_MINUS_INF: - if (f.t.sign) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_NORMAL: - difflo = frac - fraclo; - diffhi = frachi - frac; - if (difflo < diffhi) - frac = fraclo; - else if (diffhi < difflo) - frac = frachi; - else - /* round to even */ - if (fraclo & epsilon) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_PLUS_INF: - if (f.t.sign) - frac = fraclo; - else - frac = frachi; - break; - } - - /* - * Rounding up may take us to TWO if - * fraclo == (TWO - epsilon). Also If fraclo has been - * denormalised to (ONE - epsilon) then there is a - * possibility that we will round to ONE exactly. - */ - if (frac >= TWO) { - frac = (frac >> 1) & ~(epsilon - 1); - exp++; - } else if (exp == minexp - 1 && frac == ONE) { - /* Renormalise to ONE * 2^minexp */ - exp = minexp; - } - - *status |= FPCR_INE; - } - - /* - * Check for overflow and round to the correct INF as needed. - */ - if (exp > maxexp) { - *status |= FPCR_OVF | FPCR_INE; - if (control & IEEE_TRAP_ENABLE_OVF) { - exp -= alpha; - } else { - switch (rnd) { - case ROUND_CHOP: - exp = maxexp; - frac = max; - break; - case ROUND_MINUS_INF: - if (sign) { - exp = maxexp + 1; /* INF */ - frac = 0; - } else { - exp = maxexp; - frac = max; - } - break; - case ROUND_NORMAL: - exp = maxexp + 1; /* INF */ - frac = 0; - break; - case ROUND_PLUS_INF: - if (sign) { - exp = maxexp; - frac = max; - } else { - exp = maxexp + 1; /* INF */ - frac = 0; - } - break; - } - } - } - - f.t.sign = sign; - if (exp > maxexp) /* NaN, INF */ - f.t.exponent = NAN_EXP; - else if (exp < minexp) /* denorm, zero */ - f.t.exponent = 0; - else - f.t.exponent = exp + BIAS_EXP; - f.t.fraction = (frac & ~ONE) >> FRAC_SHIFT; - return f; -} - -/* - * Return the canonical quiet NaN in register format. - */ -static fp_register_t -makeQNaN(void) -{ - fp_register_t f; - f.t.sign = 0; - f.t.exponent = NAN_EXP; - f.t.fraction = QNAN_BIT; - return f; -} - -/* - * Return +/- INF. - */ -static fp_register_t -makeINF(int sign) -{ - fp_register_t f; - f.t.sign = sign; - f.t.exponent = NAN_EXP; - f.t.fraction = 0; - return f; -} - -/* - * Return +/- 0. - */ -static fp_register_t -makeZERO(int sign) -{ - fp_register_t f; - f.t.sign = sign; - f.t.exponent = 0; - f.t.fraction = 0; - return f; -} - -fp_register_t -ieee_add(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int shift; - int expa, expb, exp; - u_int64_t fraca, fracb, frac; - int sign, sticky; - - /* First handle NaNs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) - result = fa; - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle +/- INF */ - if (isINF(fa)) - if (isINF(fb)) - if (fa.t.sign != fb.t.sign) { - /* If adding -INF to +INF, generate a trap. */ - *status |= FPCR_INV; - return makeQNaN(); - } else - return fa; - else - return fa; - else if (isINF(fb)) - return fb; - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca = getfrac(fa); - fracb = getfrac(fb); - shift = expa - expb; - if (shift < 0) { - shift = -shift; - exp = expb; - sticky = (fraca & ((1ULL << shift) - 1)) != 0; - if (shift >= 64) - fraca = sticky; - else - fraca = (fraca >> shift) | sticky; - } else if (shift > 0) { - exp = expa; - sticky = (fracb & ((1ULL << shift) - 1)) != 0; - if (shift >= 64) - fracb = sticky; - else - fracb = (fracb >> shift) | sticky; - } else - exp = expa; - if (fa.t.sign) fraca = -fraca; - if (fb.t.sign) fracb = -fracb; - frac = fraca + fracb; - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* -0 + -0 = -0 */ - if (fa.t.exponent == 0 && fa.t.fraction == 0 - && fb.t.exponent == 0 && fb.t.fraction == 0) - sign = fa.t.sign && fb.t.sign; - - return makefloat(sign, exp, frac, src, rnd, control, status); -} - -fp_register_t -ieee_sub(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - fb.t.sign = !fb.t.sign; - return ieee_add(fa, fb, src, rnd, control, status); -} - -typedef struct { - u_int64_t lo; - u_int64_t hi; -} u_int128_t; - -#define SRL128(x, b) \ -do { \ - x.lo >>= b; \ - x.lo |= x.hi << (64 - b); \ - x.hi >>= b; \ -} while (0) - -#define SLL128(x, b) \ -do { \ - if (b >= 64) { \ - x.hi = x.lo << (b - 64); \ - x.lo = 0; \ - } else { \ - x.hi <<= b; \ - x.hi |= x.lo >> (64 - b); \ - x.lo <<= b; \ - } \ -} while (0) - -#define SUB128(a, b) \ -do { \ - int borrow = a.lo < b.lo; \ - a.lo = a.lo - b.lo; \ - a.hi = a.hi - b.hi - borrow; \ -} while (0) - -#define LESS128(a, b) (a.hi < b.hi || (a.hi == b.hi && a.lo < b.lo)) - -fp_register_t -ieee_mul(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int shift; - int expa, expb, exp; - u_int64_t fraca, fracb, tmp; - u_int128_t frac; - int sign; - - /* First handle NaNs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) - result = fa; - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle INF and 0 */ - if ((isINF(fa) && isZERO(fb)) || (isINF(fa) && isZERO(fb))) { - /* INF * 0 = NaN */ - *status |= FPCR_INV; - return makeQNaN(); - } else - /* If either is INF or zero, get the sign right */ - if (isINF(fa) || isINF(fb)) - return makeINF(fa.t.sign ^ fb.t.sign); - else if (isZERO(fa) || isZERO(fb)) - return makeZERO(fa.t.sign ^ fb.t.sign); - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca = getfrac(fa); - fracb = getfrac(fb); - sign = fa.t.sign ^ fb.t.sign; - -#define LO32(x) ((x) & ((1ULL << 32) - 1)) -#define HI32(x) ((x) >> 32) - - /* - * Calculate the 128bit result of multiplying fraca and fracb. - */ - frac.lo = fraca * fracb; -#ifdef __alpha__ - /* - * The alpha has a handy instruction to find the high word. - */ - __asm__ __volatile__ ("umulh %1,%2,%0" - : "=r"(tmp) - : "r"(fraca), "r"(fracb)); - frac.hi = tmp; -#else - /* - * Do the multiply longhand otherwise. - */ - frac.hi = HI32(LO32(fraca) * HI32(fracb) - + HI32(fraca) * LO32(fracb) - + HI32(LO32(fraca) * LO32(fracb))) - + HI32(fraca) * HI32(fracb); -#endif - exp = expa + expb - (T_FRACBITS + FRAC_SHIFT); - - while (frac.hi > 0) { - int sticky; - exp++; - sticky = frac.lo & 1; - SRL128(frac, 1); - frac.lo |= sticky; - } - - return makefloat(sign, exp, frac.lo, src, rnd, control, status); -} - -static u_int128_t -divide_128(u_int128_t a, u_int128_t b) -{ - u_int128_t result; - u_int64_t bit; - int i; - - /* - * Make a couple of assumptions on the numbers passed in. The - * value in 'a' will have bits set in the upper 64 bits only - * and the number in 'b' will have zeros in the upper 64 bits. - * Also, 'b' will not be zero. - */ -#ifdef TEST - if (a.hi == 0 || b.hi != 0 || b.lo == 0) - abort(); -#endif - - /* - * Find out how many bits of zeros are at the beginning of the divisor. - */ - i = 64; - bit = 1ULL << 63; - while (i < 127) { - if (b.lo & bit) - break; - i++; - bit >>= 1; - } - - /* - * Find out how much to shift the divisor so that its msb - * matches the msb of the dividend. - */ - bit = 1ULL << 63; - while (i) { - if (a.hi & bit) - break; - i--; - bit >>= 1; - } - - result.lo = 0; - result.hi = 0; - SLL128(b, i); - - /* - * Calculate the result in two parts to avoid keeping a 128bit - * value for the result bit. - */ - if (i >= 64) { - bit = 1ULL << (i - 64); - while (bit) { - if (!LESS128(a, b)) { - result.hi |= bit; - SUB128(a, b); - if (!a.lo && !a.hi) - return result; - } - bit >>= 1; - SRL128(b, 1); - } - i = 63; - } - bit = 1ULL << i; - while (bit) { - if (!LESS128(a, b)) { - result.lo |= bit; - SUB128(a, b); - if (!a.lo && !a.hi) - return result; - } - bit >>= 1; - SRL128(b, 1); - } - - return result; -} - -fp_register_t -ieee_div(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int shift; - int expa, expb, exp; - u_int128_t fraca, fracb, frac; - int sign; - - /* First handle NaNs, INFs and ZEROs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) - result = fa; - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle INF and 0 */ - if (isINF(fa) && isINF(fb)) { - *status |= FPCR_INV; - return makeQNaN(); - } else if (isZERO(fb)) - if (isZERO(fa)) { - *status |= FPCR_INV; - return makeQNaN(); - } else { - *status |= FPCR_DZE; - return makeINF(fa.t.sign ^ fb.t.sign); - } - else if (isZERO(fa)) - return makeZERO(fa.t.sign ^ fb.t.sign); - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca.hi = getfrac(fa); - fraca.lo = 0; - fracb.lo = getfrac(fb); - fracb.hi = 0; - sign = fa.t.sign ^ fb.t.sign; - - frac = divide_128(fraca, fracb); - - exp = expa - expb - (64 - T_FRACBITS - FRAC_SHIFT); - while (frac.hi > 0) { - int sticky; - exp++; - sticky = frac.lo & 1; - SRL128(frac, 1); - frac.lo |= sticky; - } - frac.lo |= 1; - - return makefloat(sign, exp, frac.lo, src, rnd, control, status); -} - -#define IEEE_TRUE 0x4000000000000000ULL -#define IEEE_FALSE 0 - -fp_register_t -ieee_cmpun(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_TRUE; - } else - result.q = IEEE_FALSE; - - return result; -} - -fp_register_t -ieee_cmpeq(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_TRUE; - else if (fa.q == fb.q) - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - - return result; -} - -fp_register_t -ieee_cmplt(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_FALSE; - else if (fa.t.sign) { - /* fa is negative */ - if (!fb.t.sign) - /* fb is positive, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent > fb.t.exponent) - /* fa has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction > fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } else { - /* fa is positive */ - if (fb.t.sign) - /* fb is negative, return false */ - result.q = IEEE_FALSE; - else if (fb.t.exponent > fa.t.exponent) - /* fb has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fb.t.exponent == fb.t.exponent - && fa.t.fraction < fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - } - - return result; -} - -fp_register_t -ieee_cmple(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_TRUE; - else if (fa.t.sign) { - /* fa is negative */ - if (!fb.t.sign) - /* fb is positive, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent > fb.t.exponent) - /* fa has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction >= fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } else { - /* fa is positive */ - if (fb.t.sign) - /* fb is negative, return false */ - result.q = IEEE_FALSE; - else if (fb.t.exponent > fa.t.exponent) - /* fb has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fb.t.exponent == fb.t.exponent - && fa.t.fraction <= fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - } - - return result; -} - -fp_register_t -ieee_convert_S_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - f.t.fraction |= QNAN_BIT; - *status |= FPCR_INV; - } - if (isQNaN(f) || isINF(f)) - return f; - - /* - * If the number is a denormalised float, renormalise. - */ - if (isDENORM(f)) - return makefloat(f.t.sign, - getexp(f, S_FORMAT), - getfrac(f), - T_FORMAT, rnd, control, status); - else - return f; -} - -fp_register_t -ieee_convert_T_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - f.t.fraction |= QNAN_BIT; - f.t.fraction &= ~S_FRACMASK; - *status |= FPCR_INV; - } - if (isQNaN(f) || isINF(f)) - return f; - - return makefloat(f.t.sign, - getexp(f, T_FORMAT), - getfrac(f), - S_FORMAT, rnd, control, status); -} - -fp_register_t -ieee_convert_Q_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac = f.q; - int sign, exponent; - - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* - * We shift up one bit to leave the sticky bit clear. This is - * possible unless frac == (1<<63), in which case the sticky - * bit is already clear. - */ - exponent = T_FRACBITS + FRAC_SHIFT; - if (frac < (1ULL << 63)) { - frac <<= 1; - exponent--; - } - - return makefloat(sign, exponent, frac, S_FORMAT, rnd, - control, status); -} - -fp_register_t -ieee_convert_Q_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac = f.q; - int sign, exponent; - - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* - * We shift up one bit to leave the sticky bit clear. This is - * possible unless frac == (1<<63), in which case the sticky - * bit is already clear. - */ - exponent = T_FRACBITS + FRAC_SHIFT; - if (frac < (1ULL << 63)) { - frac <<= 1; - exponent--; - } - - return makefloat(sign, exponent, frac, T_FORMAT, rnd, - control, status); -} - -fp_register_t -ieee_convert_T_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac; - int exp; - - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - if (isSNaN(f)) - *status |= FPCR_INV; - f.q = 0; - return f; - } - if (isINF(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - *status |= FPCR_INV; - f.q = 0; - return f; - } - - exp = getexp(f, T_FORMAT) - (T_FRACBITS + FRAC_SHIFT); - frac = getfrac(f); - - if (exp > 0) { - if (exp > 64 || frac >= (1 << (64 - exp))) - *status |= FPCR_IOV | FPCR_INE; - if (exp < 64) - frac <<= exp; - else - frac = 0; - } else if (exp < 0) { - u_int64_t mask; - u_int64_t fraclo, frachi; - u_int64_t diffhi, difflo; - exp = -exp; - if (exp > 64) { - fraclo = 0; - diffhi = 0; - difflo = 0; - if (frac) { - frachi = 1; - *status |= FPCR_INE; - } else - frachi = 0; - } else if (exp == 64) { - fraclo = 0; - if (frac) { - frachi = 1; - difflo = frac; - diffhi = -frac; - *status |= FPCR_INE; - } else { - frachi = 0; - difflo = 0; - diffhi = 0; - } - } else { - mask = (1 << exp) - 1; - fraclo = frac >> exp; - if (frac & mask) { - frachi = fraclo + 1; - difflo = frac - (fraclo << exp); - diffhi = (frachi << exp) - frac; - *status |= FPCR_INE; - } else { - frachi = fraclo; - difflo = 0; - diffhi = 0; - } - } - switch (rnd) { - case ROUND_CHOP: - frac = fraclo; - break; - case ROUND_MINUS_INF: - if (f.t.sign) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_NORMAL: -#if 0 - /* - * Round to nearest. - */ - if (difflo < diffhi) - frac = fraclo; - else if (diffhi > difflo) - frac = frachi; - else if (fraclo & 1) - frac = frachi; - else - frac = fraclo; -#else - /* - * Round to zero. - */ - frac = fraclo; -#endif - break; - case ROUND_PLUS_INF: - if (f.t.sign) - frac = fraclo; - else - frac = frachi; - break; - } - } - - if (f.t.sign) { - if (frac > (1ULL << 63)) - *status |= FPCR_IOV | FPCR_INE; - frac = -frac; - } else { - if (frac > (1ULL << 63) - 1) - *status |= FPCR_IOV | FPCR_INE; - } - - f.q = frac; - return f; -} - -fp_register_t -ieee_convert_S_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - f = ieee_convert_S_T(f, rnd, control, status); - return ieee_convert_T_Q(f, rnd, control, status); -} - -#ifndef KERNEL - -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -union value { - double d; - fp_register_t r; -}; - - -static double -random_double() -{ - union value a; - int exp; - - a.r.t.fraction = ((long long)random() & (1ULL << 20) - 1) << 32 - | random(); - exp = random() & 0x7ff; -#if 1 - if (exp == 0) - exp = 1; /* no denorms */ - else if (exp == 0x7ff) - exp = 0x7fe; /* no NaNs and INFs */ -#endif - - a.r.t.exponent = exp; - a.r.t.sign = random() & 1; - return a.d; -} - -static float -random_float() -{ - union value a; - int exp; - - a.r.t.fraction = ((long)random() & (1ULL << 23) - 1) << 29; - exp = random() & 0xff; -#if 1 - if (exp == 0) - exp = 1; /* no denorms */ - else if (exp == 0xff) - exp = 0xfe; /* no NaNs and INFs */ -#endif - - /* map exponent from S to T format */ - if (exp == 255) - a.r.t.exponent = 0x7ff; - else if (exp & 0x80) - a.r.t.exponent = 0x400 + (exp & 0x7f); - else if (exp) - a.r.t.exponent = 0x380 + exp; - else - a.r.t.exponent = 0; - a.r.t.sign = random() & 1; - - return a.d; -} - -/* - * Ignore epsilon errors - */ -int -equal_T(union value a, union value b) -{ - if (isZERO(a.r) && isZERO(b.r)) - return 1; - if (a.r.t.sign != b.r.t.sign) - return 0; - if (a.r.t.exponent != b.r.t.exponent) - return 0; - - return a.r.t.fraction == b.r.t.fraction; -} - -int -equal_S(union value a, union value b) -{ - int64_t epsilon = 1ULL << 29; - - if (isZERO(a.r) && isZERO(b.r)) - return 1; - if (a.r.t.sign != b.r.t.sign) - return 0; - if (a.r.t.exponent != b.r.t.exponent) - return 0; - - return ((a.r.t.fraction & ~(epsilon-1)) - == (b.r.t.fraction & ~(epsilon-1))); -} - -#define ITER 1000000 - -static void -test_double_add() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_add(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d + b.d; - if (!equal_T(c, x)) { - printf("bad double add, %g + %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_add(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_add() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { -#if 0 - if (i == 0) { - a.r.q = 0xb33acf292ca49700ULL; - b.r.q = 0xcad3191058a693aeULL; - } -#endif - a.d = random_float(); - b.d = random_float(); - status = 0; - c.r = ieee_add(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d + b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single add, %g + %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_add(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_double_mul() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d * b.d; - if (!equal_T(c, x)) { - printf("bad double mul, %g * %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_mul() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_mul(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d * b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single mul, %g * %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_double_div() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_div(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d / b.d; - if (!equal_T(c, x) && !isZERO(x.r)) { - printf("bad double div, %g / %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_div(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_div() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_div(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d / b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single div, %g / %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_convert_int_to_double() -{ - union value a, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.r.q = (u_int64_t)random() << 32 - | random(); - status = 0; - c.r = ieee_convert_Q_T(a.r, ROUND_NORMAL, 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r)) - continue; - x.d = (double) a.r.q; - if (c.d != x.d) { - printf("bad convert double, (double)%qx = %g (should be %g)\n", - a.r.q, c.d, x.d); - c.r = ieee_convert_Q_T(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -static void -test_convert_int_to_single() -{ - union value a, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.r.q = (unsigned long long)random() << 32 - | random(); - status = 0; - c.r = ieee_convert_Q_S(a.r, ROUND_NORMAL, 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r)) - continue; - xf = (float) a.r.q; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (t.d != x.d) { - printf("bad convert single, (double)%qx = %g (should be %g)\n", - a.r.q, c.d, x.d); - c.r = ieee_convert_Q_S(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -static void -test_convert_double_to_int() -{ - union value a, c; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - status = 0; - c.r = ieee_convert_T_Q(a.r, ROUND_NORMAL, 0, &status); - if ((int)c.r.q != (int)a.d) { - printf("bad convert double, (int)%g = %d (should be %d)\n", - a.d, (int)c.r.q, (int)a.d); - c.r = ieee_convert_T_Q(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -int -main(int argc, char* argv[]) -{ - srandom(0); - - test_double_div(); - test_single_div(); - test_double_add(); - test_single_add(); - test_double_mul(); - test_single_mul(); - test_convert_int_to_double(); - test_convert_int_to_single(); -#if 0 - /* x86 generates SIGFPE on overflows. */ - test_convert_double_to_int(); -#endif - - return 0; -} - -#endif diff --git a/sys/alpha/alpha/ieee_float.h b/sys/alpha/alpha/ieee_float.h deleted file mode 100644 index 1977e910a0e19..0000000000000 --- a/sys/alpha/alpha/ieee_float.h +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - */ - -#define S_FORMAT 0 /* IEEE single */ -#define T_FORMAT 2 /* IEEE double */ -#define Q_FORMAT 3 /* 64 bit fixed */ - -#define ROUND_CHOP 0 /* truncate fraction */ -#define ROUND_MINUS_INF 1 /* round to -INF */ -#define ROUND_NORMAL 2 /* round to nearest */ -#define ROUND_PLUS_INF 3 /* round to +INF */ - -typedef union fp_register { - struct { - u_int64_t fraction: 52; - u_int64_t exponent: 11; - u_int64_t sign: 1; - } t; - u_int64_t q; -} fp_register_t; - -fp_register_t -ieee_add(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_sub(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_mul(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_div(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_cmpun(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmpeq(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmplt(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmple(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_convert_S_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_T_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_Q_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_Q_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_T_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_S_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c index 6010e745d8de9..9390f8fb6b680 100644 --- a/sys/alpha/alpha/interrupt.c +++ b/sys/alpha/alpha/interrupt.c @@ -1,4 +1,4 @@ -/* $Id: interrupt.c,v 1.8 1998/11/28 09:55:15 dfr Exp $ */ +/* $Id: interrupt.c,v 1.4 1998/07/12 16:09:27 dfr Exp $ */ /* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */ /* @@ -50,24 +50,17 @@ #include <machine/bwx.h> #include <machine/intr.h> +#if 0 #ifdef EVCNT_COUNTERS #include <sys/device.h> struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */ #else #include <machine/intrcnt.h> #endif +#endif volatile int mc_expected, mc_received; -static void -dummy_perf(unsigned long vector, struct trapframe *framep) -{ - printf("performance interrupt!\n"); -} - -void (*perf_irq)(unsigned long, struct trapframe *) = dummy_perf; - - void interrupt(a0, a1, a2, framep) unsigned long a0, a1, a2; @@ -81,9 +74,6 @@ interrupt(a0, a1, a2, framep) panic("possible stack overflow\n"); } - framep->tf_regs[FRAME_TRAPARG_A0] = a0; - framep->tf_regs[FRAME_TRAPARG_A1] = a1; - framep->tf_regs[FRAME_TRAPARG_A2] = a2; switch (a0) { case ALPHA_INTR_XPROC: /* interprocessor interrupt */ printf("interprocessor interrupt!\n"); @@ -91,11 +81,13 @@ interrupt(a0, a1, a2, framep) case ALPHA_INTR_CLOCK: /* clock interrupt */ cnt.v_intr++; +#if 0 #ifdef EVCNT_COUNTERS clock_intr_evcnt.ev_count++; #else intrcnt[INTRCNT_CLOCK]++; #endif +#endif if (platform.clockintr) (*platform.clockintr)(framep); break; @@ -115,7 +107,7 @@ interrupt(a0, a1, a2, framep) break; case ALPHA_INTR_PERF: /* interprocessor interrupt */ - perf_irq(a1, framep); + printf("performance interrupt!\n"); break; case ALPHA_INTR_PASSIVE: @@ -285,55 +277,32 @@ badaddr_read(addr, size, rptr) #define HASHVEC(vector) ((vector) % 31) -LIST_HEAD(alpha_intr_list, alpha_intr); - -struct alpha_intr { - LIST_ENTRY(alpha_intr) list; /* chain handlers in this hash bucket */ - int vector; /* vector to match */ - driver_intr_t *intr; /* handler function */ - void *arg; /* argument to handler */ - volatile long *cntp; /* interrupt counter */ -}; - static struct alpha_intr_list alpha_intr_hash[31]; -int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, - void **cookiep, volatile long *cntp) +struct alpha_intr * +alpha_create_intr(int vector, driver_intr_t *intr, void *arg) { - int h = HASHVEC(vector); struct alpha_intr *i; - int s; i = malloc(sizeof(struct alpha_intr), M_DEVBUF, M_NOWAIT); if (!i) - return ENOMEM; + return NULL; i->vector = vector; i->intr = intr; i->arg = arg; - if (cntp) - i->cntp = cntp; - else - i->cntp = NULL; - - s = splhigh(); - LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); - splx(s); - - *cookiep = i; - return 0; - + return i; } -int alpha_teardown_intr(void *cookie) +int +alpha_connect_intr(struct alpha_intr *i) { - struct alpha_intr *i = cookie; + int h = HASHVEC(i->vector); int s; s = splhigh(); - LIST_REMOVE(i, list); + LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); splx(s); - - free(i, M_DEVBUF); + return 0; } @@ -341,13 +310,8 @@ void alpha_dispatch_intr(void *frame, unsigned long vector) { struct alpha_intr *i; - volatile long *cntp; - int h = HASHVEC(vector); for (i = LIST_FIRST(&alpha_intr_hash[h]); i; i = LIST_NEXT(i, list)) - if (i->vector == vector) { - if (cntp = i->cntp) - (*cntp) ++; + if (i->vector == vector) i->intr(i->arg); - } } diff --git a/sys/alpha/alpha/ipl_funcs.c b/sys/alpha/alpha/ipl_funcs.c index 815f7f7edfe1c..ad6670ecbbef7 100644 --- a/sys/alpha/alpha/ipl_funcs.c +++ b/sys/alpha/alpha/ipl_funcs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ipl_funcs.c,v 1.8 1998/09/26 14:25:32 dfr Exp $ + * $Id: ipl_funcs.c,v 1.7 1998/09/19 09:29:40 dfr Exp $ */ #include <sys/types.h> @@ -40,10 +40,12 @@ unsigned int cam_imask; /* XXX */ unsigned int net_imask; /* XXX */ static void swi_net(void); +extern void swi_camnet(void); +extern void swi_cambio(void); void (*netisrs[32]) __P((void)); swihand_t *ihandlers[32] = { /* software interrupts */ - swi_null, swi_net, swi_null, swi_null, + swi_null, swi_net, swi_camnet, swi_cambio, swi_null, softclock, swi_null, swi_null, swi_null, swi_null, swi_null, swi_null, swi_null, swi_null, swi_null, swi_null, diff --git a/sys/alpha/alpha/locore.s b/sys/alpha/alpha/locore.s index 9a3acd6b79a78..1a97de23c5313 100644 --- a/sys/alpha/alpha/locore.s +++ b/sys/alpha/alpha/locore.s @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: locore.s,v 1.5 1998/11/15 00:50:59 dima Exp $ + * $Id: locore.s,v 1.2 1998/06/10 19:59:40 dfr Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -56,11 +56,6 @@ #include <sys/syscall.h> #include <assym.s> -#ifndef EVCNT_COUNTERS -#define _LOCORE -#include <machine/intrcnt.h> -#endif - /* * PTmap is recursive pagemap at top of virtual address space. * Within PTmap, the lev1 and lev0 page tables can be found. @@ -298,20 +293,3 @@ LEAF(restorefpstate, 1) .text -/* XXX: make systat/vmstat happy */ - .data -EXPORT(intrnames) - .asciz "clock" -intr_n = 0 -.rept INTRCNT_COUNT - .ascii "intr " - .byte intr_n / 10 + '0, intr_n % 10 + '0 - .asciz " " # space for platform-specific rewrite - intr_n = intr_n + 1 -.endr -EXPORT(eintrnames) - .align 3 -EXPORT(intrcnt) - .fill INTRCNT_COUNT + 1, 8, 0 -EXPORT(eintrcnt) - .text diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 5211879cf128e..6d35e8a4f3713 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.29 1998/12/30 10:38:58 dfr Exp $ + * $Id: machdep.c,v 1.17 1998/10/14 10:08:35 peter Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -124,7 +124,6 @@ #include <machine/clock.h> #include <machine/md_var.h> #include <machine/reg.h> -#include <machine/fpu.h> #include <machine/pal.h> #include <machine/cpuconf.h> #include <machine/bootinfo.h> @@ -199,8 +198,6 @@ int ncpus; /* number of cpus */ vm_offset_t phys_avail[10]; -SYSCTL_INT(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, ""); - /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2) @@ -214,17 +211,6 @@ extern struct linker_set netisr_set; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) -/* - * Hooked into the shutdown chain; if the system is to be halted, - * unconditionally drop back to the SRM console. - */ -static void -alpha_srm_shutdown(int howto, void *junk) -{ - if (howto & RB_HALT) - alpha_pal_halt(); -} - static void cpu_startup(dummy) void *dummy; @@ -366,12 +352,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); @@ -414,8 +394,7 @@ again: */ bufinit(); vm_pager_bufferinit(); - at_shutdown_pri(alpha_srm_shutdown, 0, SHUTDOWN_FINAL, - SHUTDOWN_PRI_LAST); + } int @@ -490,7 +469,7 @@ alpha_unknown_sysname() { static char s[128]; /* safe size */ - snprintf(s, sizeof(s), "%s family, unknown model variation 0x%lx", + sprintf(s, "%s family, unknown model variation 0x%lx", platform.family, hwrpb->rpb_variation & SV_ST_MASK); return ((const char *)s); } @@ -498,21 +477,6 @@ alpha_unknown_sysname() static void identifycpu(void) { - u_int64_t type, major, minor; - u_int64_t amask; - struct pcs *pcsp; - char *cpuname[] = { - "unknown", /* 0 */ - "EV3", /* 1 */ - "EV4 (21064)", /* 2 */ - "Simulation", /* 3 */ - "LCA Family", /* 4 */ - "EV5 (21164)", /* 5 */ - "EV45 (21064A)", /* 6 */ - "EV56 (21164A)", /* 7 */ - "EV6 (21264)", /* 8 */ - "PCA56 (21164PC)" /* 9 */ - }; /* * print out CPU identification information. @@ -530,32 +494,6 @@ identifycpu(void) printf("variation: 0x%lx, revision 0x%lx\n", hwrpb->rpb_variation, *(long *)hwrpb->rpb_revision); #endif - pcsp = LOCATE_PCS(hwrpb, hwrpb->rpb_primary_cpu_id); - /* cpu type */ - type = pcsp->pcs_proc_type; - major = (type & PCS_PROC_MAJOR) >> PCS_PROC_MAJORSHIFT; - minor = (type & PCS_PROC_MINOR) >> PCS_PROC_MINORSHIFT; - if (major < sizeof(cpuname)/sizeof(char *)) - printf("CPU: %s major=%lu minor=%lu", - cpuname[major], major, minor); - else - printf("CPU: major=%lu minor=%lu\n", major, minor); - /* amask */ - if (major >= PCS_PROC_EV56) { - amask = 0xffffffff; /* 32 bit for printf */ - amask = (~alpha_amask(amask)) & amask; - printf(" extensions=0x%b\n", (u_int32_t) amask, - "\020" - "\001BWX" - "\002FIX" - "\003CIX" - "\011MVI" - "\012PRECISE" - ); - } else - printf("\n"); - /* PAL code */ - printf("OSF PAL rev: 0x%lx\n", pcsp->pcs_palrevisions[PALvar_OSF1]); } extern char kernel_text[], _end[]; @@ -723,7 +661,7 @@ alpha_init(pfn, ptb, bim, bip, biv) /* NOTREACHED */ } cpuinit[cputype].init(cputype); - snprintf(cpu_model, sizeof(cpu_model), "%s", platform.model); + strcpy(cpu_model, platform.model); /* * Initalize the real console, so the the bootstrap console is @@ -1091,22 +1029,10 @@ bzero(void *buf, size_t len) *p++ = 0; len--; } - while (len >= sizeof(u_long) * 8) { - *(u_long*) p = 0; - *((u_long*) p + 1) = 0; - *((u_long*) p + 2) = 0; - *((u_long*) p + 3) = 0; - len -= sizeof(u_long) * 8; - *((u_long*) p + 4) = 0; - *((u_long*) p + 5) = 0; - *((u_long*) p + 6) = 0; - *((u_long*) p + 7) = 0; - p += sizeof(u_long) * 8; - } while (len >= sizeof(u_long)) { *(u_long*) p = 0; - len -= sizeof(u_long); p += sizeof(u_long); + len -= sizeof(u_long); } while (len) { *p++ = 0; @@ -1329,16 +1255,9 @@ sendsig(sig_t catcher, int sig, int mask, u_long code) ksc.sc_ownedfp = p->p_md.md_flags & MDP_FPUSED; bcopy(&p->p_addr->u_pcb.pcb_fp, (struct fpreg *)ksc.sc_fpregs, sizeof(struct fpreg)); - ksc.sc_fp_control = p->p_addr->u_pcb.pcb_fp_control; + ksc.sc_fp_control = 0; /* XXX ? */ bzero(ksc.sc_reserved, sizeof ksc.sc_reserved); /* XXX */ - ksc.sc_xxx1[0] = 0; /* XXX */ - ksc.sc_xxx1[1] = 0; /* XXX */ - ksc.sc_traparg_a0 = frame->tf_regs[FRAME_TRAPARG_A0]; - ksc.sc_traparg_a1 = frame->tf_regs[FRAME_TRAPARG_A1]; - ksc.sc_traparg_a2 = frame->tf_regs[FRAME_TRAPARG_A2]; - ksc.sc_xxx2[0] = 0; /* XXX */ - ksc.sc_xxx2[1] = 0; /* XXX */ - ksc.sc_xxx2[2] = 0; /* XXX */ + bzero(ksc.sc_xxx, sizeof ksc.sc_xxx); /* XXX */ #ifdef COMPAT_OSF1 @@ -1360,7 +1279,8 @@ sendsig(sig_t catcher, int sig, int mask, u_long code) /* * Set up the registers to return to sigcode. */ - frame->tf_regs[FRAME_PC] = PS_STRINGS - (esigcode - sigcode); + frame->tf_regs[FRAME_PC] = + (u_int64_t)PS_STRINGS - (esigcode - sigcode); frame->tf_regs[FRAME_A0] = sig; frame->tf_regs[FRAME_A1] = code; frame->tf_regs[FRAME_A2] = (u_int64_t)scp; @@ -1440,7 +1360,7 @@ sigreturn(struct proc *p, fpcurproc = NULL; bcopy((struct fpreg *)ksc.sc_fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof(struct fpreg)); - p->p_addr->u_pcb.pcb_fp_control = ksc.sc_fp_control; + /* XXX ksc.sc_fp_control ? */ #ifdef DEBUG if (sigdebug & SDB_FOLLOW) @@ -1466,8 +1386,16 @@ cpu_boot(int howto) void cpu_halt(void) { - /*alpha_pal_halt(); */ - prom_halt(1); + alpha_pal_halt(); +} + +/* + * Turn the power off. + */ +void +cpu_power_down(void) +{ + alpha_pal_halt(); /* XXX */ } /* @@ -1480,12 +1408,8 @@ setregs(struct proc *p, u_long entry, u_long stack) bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]); bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp); - p->p_addr->u_pcb.pcb_fp_control = 0; - p->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INVD | FPCR_DZED - | FPCR_OVFD | FPCR_INED - | FPCR_UNFD); - +#define FP_RN 2 /* XXX */ + p->p_addr->u_pcb.pcb_fp.fpr_cr = (long)FP_RN << 58; alpha_pal_wrusp(stack); tfp->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET; tfp->tf_regs[FRAME_PC] = entry & ~3; @@ -1493,7 +1417,7 @@ setregs(struct proc *p, u_long entry, u_long stack) tfp->tf_regs[FRAME_A0] = stack; /* a0 = sp */ tfp->tf_regs[FRAME_A1] = 0; /* a1 = rtld cleanup */ tfp->tf_regs[FRAME_A2] = 0; /* a2 = rtld object */ - tfp->tf_regs[FRAME_A3] = PS_STRINGS; /* a3 = ps_strings */ + tfp->tf_regs[FRAME_A3] = (u_int64_t)PS_STRINGS; /* a3 = ps_strings */ tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */ p->p_md.md_flags &= ~MDP_FPUSED; diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index aa3fcae97094b..f08e7d5b2fc52 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.3 1998/11/08 12:39:01 dfr Exp $ + * $Id: mem.c,v 1.1 1998/06/10 10:52:54 dfr Exp $ */ /* @@ -271,7 +271,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, int prot) +memmmap(dev_t dev, int offset, int prot) { /* * /dev/mem is the only one that makes sense through this @@ -400,22 +400,16 @@ iskmemdev(dev) dev_t dev; { - return (((major(dev) == mem_cdevsw.d_maj) - && (minor(dev) == 0 || minor(dev) == 1)) -/* or the osf/1 mem device */ - ||((major(dev) == 0) - && (minor(dev) == 0x00200002))); + return ((major(dev) == mem_cdevsw.d_maj) + && (minor(dev) == 0 || minor(dev) == 1)); } int iszerodev(dev) dev_t dev; { - return (((major(dev) == mem_cdevsw.d_maj) - && minor(dev) == 12) -/* or the osf/1 zero device */ - ||((major(dev) == 0) - && (minor(dev) == 0x02600000))); + return ((major(dev) == mem_cdevsw.d_maj) + && minor(dev) == 12); } diff --git a/sys/alpha/alpha/pal.s b/sys/alpha/alpha/pal.s index 3d179a53042af..36ecdfb22e1c6 100644 --- a/sys/alpha/alpha/pal.s +++ b/sys/alpha/alpha/pal.s @@ -348,24 +348,3 @@ LEAF(alpha_pal_swpctx,1) call_pal PAL_OSF1_swpctx RET END(alpha_pal_swpctx) - - -/* - * alpha_pal_wrperfmon: Write perf monitor [PRIVILEGED] - * - * Enables / disables performance monitoring hardware - * - * Arguments: - * a0 function type - * - * a1 function parameter - * - * Returns: - * v0 0 (failure) or 1 (success) - */ -LEAF(alpha_pal_wrperfmon,2) - call_pal PAL_OSF1_wrperfmon - RET - END(alpha_pal_wrperfmon) - - diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 0e7aa738c64fc..2f5b4e6bbe056 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -43,7 +43,7 @@ * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 * from: i386 Id: pmap.c,v 1.193 1998/04/19 15:22:48 bde Exp * with some ideas from NetBSD's alpha pmap - * $Id: pmap.c,v 1.11 1998/10/21 11:38:06 dg Exp $ + * $Id: pmap.c,v 1.9 1998/08/23 16:05:55 dfr Exp $ */ /* @@ -1045,7 +1045,7 @@ pmap_dispose_proc(p) *(ptek + i) = 0; pmap_invalidate_page(kernel_pmap, (vm_offset_t)p->p_addr + i * PAGE_SIZE); - vm_page_unwire(m, 0); + vm_page_unwire(m); vm_page_free(m); } } @@ -1069,7 +1069,8 @@ pmap_swapout_proc(p) if ((m = vm_page_lookup(upobj, i)) == NULL) panic("pmap_swapout_proc: upage already missing???"); m->dirty = VM_PAGE_BITS_ALL; - vm_page_unwire(m, 0); + vm_page_unwire(m); + vm_page_deactivate(m); pmap_kremove( (vm_offset_t) p->p_addr + PAGE_SIZE * i); } } @@ -1352,8 +1353,6 @@ pmap_release_free_page(pmap_t pmap, vm_page_t p) } #endif - p->wire_count--; - cnt.v_wire_count--; vm_page_free_zero(p); return 1; } diff --git a/sys/alpha/alpha/support.s b/sys/alpha/alpha/support.s index 5b45b49b9501a..1bf8b45156ad6 100644 --- a/sys/alpha/alpha/support.s +++ b/sys/alpha/alpha/support.s @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.2 1998/12/20 13:21:55 dfr Exp $ + * $Id$ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -64,7 +64,6 @@ */ LEAF(suword, 1) - LDGP(pv) ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ cmpult a0, t0, t1 @@ -84,7 +83,6 @@ END(suword) LEAF(subyte, 1) - LDGP(pv) ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ cmpult a0, t0, t1 @@ -109,7 +107,6 @@ END(subyte) LEAF(fuword, 1) - LDGP(pv) ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ cmpult a0, t0, t1 @@ -128,7 +125,6 @@ END(fuword) LEAF(fubyte, 1) - LDGP(pv) ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ cmpult a0, t0, t1 @@ -144,6 +140,7 @@ stq zero, U_PCB_ONFAULT(t2) /* clean up */ + mov zero, v0 RET END(fubyte) diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s index ab3f996d6f1ee..90d1bcf6ee873 100644 --- a/sys/alpha/alpha/swtch.s +++ b/sys/alpha/alpha/swtch.s @@ -1,4 +1,4 @@ -/* $Id: swtch.s,v 1.6 1998/11/15 18:25:15 dfr Exp $ */ +/* $Id: swtch.s,v 1.4 1998/07/12 16:32:03 dfr Exp $ */ /* $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ */ /* @@ -325,17 +325,6 @@ Lsetfpenable: call_pal PAL_OSF1_wrfen Lrestoreregs: - /* set the hae register if this process has specified a value */ - ldq t0, curproc - beq t0, Lnohae - ldq t1, P_MD_FLAGS(t0) - and t1, MDP_HAEUSED - beq t1, Lnohae - ldq a0, P_MD_HAE(t0) - ldq pv, chipset + CHIPSET_WRITE_HAE - CALL((pv)) -Lnohae: - /* restore the registers, and return */ bsr ra, exception_restore_regs /* jmp/CALL trashes pv/t12 */ ldq ra,(FRAME_RA*8)(sp) diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c index 0d89b8fbba967..e0c55dd9df72e 100644 --- a/sys/alpha/alpha/sys_machdep.c +++ b/sys/alpha/alpha/sys_machdep.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $Id: sys_machdep.c,v 1.2 1998/11/15 18:25:15 dfr Exp $ + * $Id: sys_machdep.c,v 1.34 1998/03/23 19:52:34 jlemon Exp $ * */ @@ -50,12 +50,9 @@ #include <sys/user.h> #include <machine/cpu.h> -#include <machine/sysarch.h> #include <vm/vm_kern.h> /* for kernel_map */ -#include <machine/fpu.h> - #ifndef _SYS_SYSPROTO_H_ struct sysarch_args { int op; @@ -63,10 +60,6 @@ struct sysarch_args { }; #endif -static int alpha_sethae(struct proc *p, char *args); -static int alpha_get_fpmask(struct proc *p, char *args); -static int alpha_set_fpmask(struct proc *p, char *args); - int sysarch(p, uap) struct proc *p; @@ -75,79 +68,9 @@ sysarch(p, uap) int error = 0; switch(SCARG(uap,op)) { - case ALPHA_SETHAE: - error = alpha_sethae(p, uap->parms); - break; - case ALPHA_GET_FPMASK: - error = alpha_get_fpmask(p, uap->parms); - break; - case ALPHA_SET_FPMASK: - error = alpha_set_fpmask(p, uap->parms); - break; - default: error = EINVAL; break; } return (error); } - -struct alpha_sethae_args { - u_int64_t hae; -}; - -static int -alpha_sethae(struct proc *p, char *args) -{ - int error; - struct alpha_sethae_args ua; - - if (error = copyin(args, &ua, sizeof(struct alpha_sethae_args))) - return (error); - - if (securelevel > 0) - return (EPERM); - - if (error = suser(p->p_ucred, &p->p_acflag)) - return error; - - p->p_md.md_flags |= MDP_HAEUSED; - p->p_md.md_hae = ua.hae; - - return (0); -} - -struct alpha_fpmask_args { - u_int64_t mask; -}; - -static int -alpha_get_fpmask(struct proc *p, char *args) -{ - int error; - struct alpha_fpmask_args ua; - - ua.mask = p->p_addr->u_pcb.pcb_fp_control; - error = copyout(&ua, args, sizeof(struct alpha_fpmask_args)); - - return (error); -} - -static int -alpha_set_fpmask(struct proc *p, char *args) -{ - int error; - u_int64_t oldmask, *fp_control; - struct alpha_fpmask_args ua; - - if (error = copyin(args, &ua, sizeof(struct alpha_fpmask_args))) - return (error); - - fp_control = &p->p_addr->u_pcb.pcb_fp_control; - oldmask = *fp_control; - *fp_control = ua.mask & IEEE_TRAP_ENABLE_MASK; - ua.mask = oldmask; - - error = copyout(&ua, args, sizeof(struct alpha_fpmask_args)); - return (error); -} diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 107f1b06a6de9..69442a0cd2e99 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $Id: trap.c,v 1.9 1998/12/16 15:21:50 bde Exp $ */ +/* $Id: trap.c,v 1.4 1998/07/05 12:24:17 dfr Exp $ */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ /* @@ -57,7 +57,6 @@ #include <machine/md_var.h> #include <machine/reg.h> #include <machine/pal.h> -#include <machine/fpu.h> #ifdef DDB #include <ddb/ddb.h> @@ -154,7 +153,7 @@ printtrap(a0, a1, a2, entry, framep, isfatal, user) entryname = "system call"; break; default: - snprintf(ubuf, sizeof(ubuf), "type %lx", entry); + sprintf(ubuf, "type %lx", entry); entryname = (const char *) ubuf; break; } @@ -243,13 +242,11 @@ trap(a0, a1, a2, entry, framep) case ALPHA_KENTRY_ARITH: /* - * If user-land, give a SIGFPE if software completion - * is not requested or if the completion fails. + * If user-land, just give a SIGFPE. Should do + * software completion and IEEE handling, if the + * user has requested that. */ if (user) { - if (a0 & EXCSUM_SWC) - if (fp_software_completion(a1, p)) - goto out; i = SIGFPE; ucode = a0; /* exception summary */ break; @@ -419,7 +416,7 @@ trap(a0, a1, a2, entry, framep) * Grow the stack if necessary */ if ((caddr_t)va > vm->vm_maxsaddr - && va < USRSTACK) { + && (caddr_t)va < (caddr_t)USRSTACK) { if (!grow(p, va)) { rv = KERN_FAILURE; --p->p_lock; @@ -450,8 +447,7 @@ trap(a0, a1, a2, entry, framep) * we need to reflect that as an access error. */ if (map != kernel_map && - (caddr_t)va >= vm->vm_maxsaddr - && (caddr_t)va < (caddr_t)USRSTACK) { + (caddr_t)va >= vm->vm_maxsaddr) { if (rv == KERN_SUCCESS) { unsigned nss; @@ -497,9 +493,6 @@ trap(a0, a1, a2, entry, framep) #ifdef DEBUG printtrap(a0, a1, a2, entry, framep, 1, user); #endif - framep->tf_regs[FRAME_TRAPARG_A0] = a0; - framep->tf_regs[FRAME_TRAPARG_A1] = a1; - framep->tf_regs[FRAME_TRAPARG_A2] = a2; trapsignal(p, i, ucode); out: if (user) { @@ -546,14 +539,10 @@ syscall(code, framep) u_int64_t args[10]; /* XXX */ u_int hidden = 0, nargs; - framep->tf_regs[FRAME_TRAPARG_A0] = 0; - framep->tf_regs[FRAME_TRAPARG_A1] = 0; - framep->tf_regs[FRAME_TRAPARG_A2] = 0; #if notdef /* can't happen, ever. */ - if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) + if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) { panic("syscall"); #endif - cnt.v_syscall++; p = curproc; p->p_md.md_tf = framep; diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 592a089d11c70..95a41d83feeb9 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.6 1998/12/16 15:21:50 bde Exp $ + * $Id: vm_machdep.c,v 1.3 1998/07/12 16:30:58 dfr Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -79,7 +79,6 @@ #include <machine/clock.h> #include <machine/cpu.h> -#include <machine/fpu.h> #include <machine/md_var.h> #include <machine/prom.h> @@ -148,17 +147,6 @@ cpu_fork(p1, p2) p2->p_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp(); /* - * Set the floating point state. - */ - if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) { - p2->p_addr->u_pcb.pcb_fp_control = 0; - p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INVD | FPCR_DZED - | FPCR_OVFD | FPCR_INED - | FPCR_UNFD); - } - - /* * Arrange for a non-local goto when the new process * is started, to resume here, returning nonzero from setjmp. */ @@ -378,10 +366,10 @@ grow(p, sp) caddr_t v; struct vmspace *vm = p->p_vmspace; - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); + if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= (size_t) USRSTACK) + return (1); - nss = roundup(USRSTACK - sp, PAGE_SIZE); + nss = roundup(USRSTACK - (vm_offset_t)sp, PAGE_SIZE); if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) return (0); diff --git a/sys/alpha/conf/GENERIC b/sys/alpha/conf/GENERIC index 6c84ce866ba61..e09424cc1f9c2 100644 --- a/sys/alpha/conf/GENERIC +++ b/sys/alpha/conf/GENERIC @@ -11,7 +11,7 @@ # device lines is present in the ./LINT configuration file. If you are # in doubt as to the purpose or necessity of a line, check first in LINT. # -# $Id: GENERIC,v 1.13 1998/12/29 03:59:49 gpalmer Exp $ +# $Id: GENERIC,v 1.9 1998/10/13 21:38:46 jkh Exp $ machine "alpha" cpu "EV4" @@ -22,7 +22,6 @@ maxusers 10 # Platforms supported options "DEC_AXPPCI_33" # UDB, Multia, AXPpci33, Noname options "DEC_EB164" # EB164, PC164, PC164LX, PC164SX -options "DEC_EB64PLUS" # EB64+, Aspen Alpine, etc options "DEC_2100_A50" # AlphaStation 200, 250, 255, 400 options "DEC_KN20AA" # AlphaStation 500, 600 options "DEC_ST550" # Personal Workstation 433, 500, 600 @@ -89,7 +88,6 @@ device sio1 at isa0 port "IO_COM2" irq 3 flags 0x50 # Right now it appears that the ie0 must be probed before ep0. See # revision 1.20 of this file. device de0 -device fxp0 device le0 pseudo-device loop diff --git a/sys/alpha/conf/Makefile.alpha b/sys/alpha/conf/Makefile.alpha index 99f61697f914a..d9b783c910603 100644 --- a/sys/alpha/conf/Makefile.alpha +++ b/sys/alpha/conf/Makefile.alpha @@ -1,7 +1,7 @@ # Makefile.alpha -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.alpha 7.1 5/10/91 -# $Id: Makefile.alpha,v 1.15 1998/12/17 22:36:21 dfr Exp $ +# $Id: Makefile.alpha,v 1.9 1998/09/16 08:22:09 dfr Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 300009 +%VERSREQ= 300007 BINFORMAT?= elf @@ -41,8 +41,8 @@ INCLUDES+= -I$S/../include .else INCLUDES+= -I/usr/include .endif -COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h -CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} +COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h -U__NetBSD__ +CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mno-fp-regs -Wa,-mev56 LOAD_ADDRESS?= 0xfffffc0000300000 DEFINED_PROF= ${PROF} .if defined(PROF) @@ -78,7 +78,7 @@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ .if ${BINFORMAT} == elf SYSTEM_OBJS= locore.o setdef0.o vnode_if.o \ ${OBJS} ioconf.o param.o config.o \ - setdef1.o hack.So + setdef1.o hack.so SYSTEM_LD= @${LD} --export-dynamic -T$S/alpha/conf/kernel.script -e locorestart \ -o $@ -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ @@ -98,10 +98,6 @@ SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ %CLEAN -.if !exists(.depend) -${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} -.endif - clean: rm -f *.o *.s eddep errs genassym gensetdefs kernel linterrs \ makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ @@ -124,9 +120,9 @@ symbols.sort: ${ALPHA}/alpha/symbols.raw locore.o: ${ALPHA}/alpha/locore.s assym.s ${NORMAL_S} -hack.So: Makefile +hack.so: Makefile echo "void __elf_kld_hack() {}" > hack.c - ${CC} -shared -nostdlib hack.c -o hack.So + ${CC} -shared -nostdlib hack.c -o hack.so rm -f hack.c setdef0.o: ${ALPHA}/alpha/setdef0.c setdefs.h diff --git a/sys/alpha/conf/files.alpha b/sys/alpha/conf/files.alpha index 6c6d2b598bb8c..d38c396d9a2fb 100644 --- a/sys/alpha/conf/files.alpha +++ b/sys/alpha/conf/files.alpha @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.alpha,v 1.14 1998/12/04 10:52:47 dfr Exp $ +# $Id: files.alpha,v 1.10 1998/09/17 09:38:36 dfr Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -19,7 +19,6 @@ alpha/alpha/cpuconf.c standard alpha/alpha/atomic.s standard alpha/alpha/dec_kn8ae.c optional dec_kn8ae alpha/alpha/dec_eb164.c optional dec_eb164 -alpha/alpha/dec_eb64plus.c optional dec_eb64plus alpha/alpha/dec_kn20aa.c optional dec_kn20aa alpha/alpha/dec_2100_a50.c optional dec_2100_a50 alpha/alpha/dec_st550.c optional dec_st550 @@ -44,8 +43,7 @@ alpha/alpha/in_cksum.c optional inet # now normal. # alpha/alpha/locore.s standard alpha/alpha/machdep.c standard -alpha/alpha/fp_emulate.c standard -alpha/alpha/ieee_float.c standard +alpha/alpha/math_emulate.c optional math_emulate alpha/alpha/mem.c standard alpha/alpha/mp_machdep.c optional smp alpha/alpha/perfmon.c optional perfmon profiling-routine @@ -66,13 +64,13 @@ clock_if.o standard \ compile-with "${NORMAL_C}" \ no-implicit-rule local clock_if.c standard \ - dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ - compile-with "perl $S/kern/makedevops.pl -c $S/alpha/alpha/clock_if.m" \ + dependency "$S/kern/makedevops.sh $S/alpha/alpha/clock_if.m" \ + compile-with "sh $S/kern/makedevops.sh -c $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "clock_if.c" clock_if.h standard \ - dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ - compile-with "perl $S/kern/makedevops.pl -h $S/alpha/alpha/clock_if.m" \ + dependency "$S/kern/makedevops.sh $S/alpha/alpha/clock_if.m" \ + compile-with "sh $S/kern/makedevops.sh -h $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend \ clean "clock_if.h" alpha/alpha/diskslice_machdep.c standard @@ -98,23 +96,23 @@ mcclock_if.o standard \ compile-with "${NORMAL_C}" \ no-implicit-rule local mcclock_if.c standard \ - dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ - compile-with "perl $S/kern/makedevops.pl -c $S/dev/dec/mcclock_if.m" \ + dependency "$S/kern/makedevops.sh $S/dev/dec/mcclock_if.m" \ + compile-with "sh $S/kern/makedevops.sh -c $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "mcclock_if.c" mcclock_if.h standard \ - dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ - compile-with "perl $S/kern/makedevops.pl -h $S/dev/dec/mcclock_if.m" \ + dependency "$S/kern/makedevops.sh $S/dev/dec/mcclock_if.m" \ + compile-with "sh $S/kern/makedevops.sh -h $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend \ clean "mcclock_if.h" alpha/pci/cia.c optional cia alpha/pci/pci_eb164_intr.s optional cia +alpha/isa/mcclock_isa.c optional cia alpha/pci/apecs.c optional apecs -alpha/pci/pci_eb64plus_intr.s optional apecs alpha/pci/lca.c optional lca alpha/pci/pcibus.c optional pci alpha/isa/isa.c optional isa -alpha/isa/mcclock_isa.c optional isa +kern/link_elf.c standard alpha/alpha/elf_machdep.c standard libkern/bcd.c standard libkern/bcmp.c standard diff --git a/sys/alpha/conf/majors.alpha b/sys/alpha/conf/majors.alpha index adecadb7ad6ed..7766f077b5262 100644 --- a/sys/alpha/conf/majors.alpha +++ b/sys/alpha/conf/majors.alpha @@ -1,4 +1,4 @@ -$Id: majors.alpha,v 1.6 1999/01/14 03:47:52 msmith Exp $ +$Id: majors.alpha,v 1.1 1998/06/10 10:54:12 dfr Exp $ Hopefully, this list will one day be obsoleted by DEVFS, but for now this is the current allocation of device major numbers. @@ -125,7 +125,7 @@ chrdev name comments 81 rp RocketPort/Steve Gericke <steveg@comtrol.com> 82 ppi Generic Parallel I/O <Nicolas.Souchu@prism.uvsq.fr> 83 can CAN16-2 CAN-PC Interface -84 dtfp Datum Time and Frequency processor (louie@UU.NET) +84 ttxt Unitext teletext decoder (arg@arg1.demon.co.uk) 85 vesa VESA support device (j_mini@efn.org) 86 alog Industrial Computer Source AIO8-P driver 87 wfd ATAPI floppy client of "ata" @@ -140,6 +140,3 @@ chrdev name comments 96 altq alternate queueing (including cbq, red, wfq) 97 prom Alpha PROM console 98 zsc TurboLaser console uart -99 ipr Iprobe on-chip perf. counters (gallatin@freebsd.org) -110 ses SCSI Environmental Services driver (mjacob@feral.com) -112 kbd keyboard diff --git a/sys/alpha/conf/options.alpha b/sys/alpha/conf/options.alpha index 44add990c1fe5..a0a559057dac1 100644 --- a/sys/alpha/conf/options.alpha +++ b/sys/alpha/conf/options.alpha @@ -1,10 +1,9 @@ -# $Id: options.alpha,v 1.7 1998/09/16 08:22:09 dfr Exp $ +# $Id: options.alpha,v 1.6 1998/08/21 23:43:15 gpalmer Exp $ EV5 opt_global.h EV4 opt_global.h DEC_KN8AE opt_cpu.h DEC_EB164 opt_cpu.h -DEC_EB64PLUS opt_cpu.h DEC_KN20AA opt_cpu.h DEC_2100_A50 opt_cpu.h DEC_ST550 opt_cpu.h diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h index 80eb3078a309c..5107274ff18b3 100644 --- a/sys/alpha/include/alpha_cpu.h +++ b/sys/alpha/include/alpha_cpu.h @@ -1,4 +1,4 @@ -/* $Id: alpha_cpu.h,v 1.4 1998/12/23 11:50:50 dfr Exp $ */ +/* $Id: alpha_cpu.h,v 1.2 1998/06/10 10:54:21 dfr Exp $ */ /* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ /* @@ -273,10 +273,8 @@ typedef unsigned long alpha_pt_entry_t; */ #define ALPHA_AMASK_BWX 0x0001 /* byte/word extension */ -#define ALPHA_AMASK_FIX 0x0002 /* sqrt and f <-> i conversion extension */ -#define ALPHA_AMASK_CIX 0x0004 /* count extension */ -#define ALPHA_AMASK_MVI 0x0100 /* multimedia extension */ -#define ALPHA_AMASK_PRECISE 0x0200 /* Precise arithmetic traps */ +#define ALPHA_AMASK_CIX 0x0002 /* count extension */ +#define ALPHA_AMASK_MAX 0x0100 /* multimedia extension */ /* * Chip family IDs returned by implver instruction @@ -326,6 +324,5 @@ void alpha_pal_wrusp __P((unsigned long)); void alpha_pal_wrvptptr __P((unsigned long)); void alpha_pal_wrmces __P((unsigned long)); void alpha_pal_wrval __P((unsigned long)); -unsigned long alpha_pal_wrperfmon __P((unsigned long, unsigned long)); #endif /* __ALPHA_ALPHA_CPU_H__ */ diff --git a/sys/alpha/include/ansi.h b/sys/alpha/include/ansi.h index 09413e7d49f04..aeaba523e6853 100644 --- a/sys/alpha/include/ansi.h +++ b/sys/alpha/include/ansi.h @@ -1,4 +1,4 @@ -/* $Id: ansi.h,v 1.3 1998/10/12 23:57:58 alex Exp $ */ +/* $Id: ansi.h,v 1.2 1998/03/09 05:53:07 jb Exp $ */ /* From: NetBSD: ansi.h,v 1.9 1997/11/23 20:20:53 kleink Exp */ /*- @@ -63,6 +63,9 @@ typedef struct { #define _BSD_TIMER_T_ int /* timer_t */ #define _BSD_SUSECONDS_T_ int /* suseconds_t */ #define _BSD_USECONDS_T_ unsigned int /* useconds_t */ +#define _BSD_UINT8_T_ unsigned char /* uint8_t */ +#define _BSD_UINT16_T_ unsigned short /* uint16_t */ +#define _BSD_UINT32_T_ unsigned int /* uint32_t */ /* * Types which are fundamental to the implementation and must be used @@ -105,20 +108,4 @@ typedef struct { #define _BSD_CLK_TCK_ 100 #define _BSD_CLOCKS_PER_SEC_ 100 -/* - * Internal names for basic integral types. Omit the typedef if - * not possible for a machine/compiler combination. - */ -typedef __signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - -typedef long __intptr_t; -typedef unsigned long __uintptr_t; - #endif /* _ANSI_H_ */ diff --git a/sys/alpha/include/chipset.h b/sys/alpha/include/chipset.h index f7a61be4c1f28..74698c5c5a9ab 100644 --- a/sys/alpha/include/chipset.h +++ b/sys/alpha/include/chipset.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: chipset.h,v 1.5 1998/10/06 14:18:39 dfr Exp $ + * $Id: chipset.h,v 1.4 1998/08/10 07:53:58 dfr Exp $ */ #ifndef _MACHINE_CHIPSET_H_ @@ -54,8 +54,7 @@ typedef void alpha_chipset_cfgwritew_t(u_int, u_int, u_int, u_int, typedef void alpha_chipset_cfgwritel_t(u_int, u_int, u_int, u_int, u_int32_t); typedef vm_offset_t alpha_chipset_addrcvt_t(vm_offset_t); -typedef u_int64_t alpha_chipset_read_hae_t(void); -typedef void alpha_chipset_write_hae_t(u_int64_t); + typedef struct alpha_chipset { /* @@ -92,14 +91,8 @@ typedef struct alpha_chipset { /* * PCI address space translation functions */ - alpha_chipset_addrcvt_t* cvt_to_dense; - alpha_chipset_addrcvt_t* cvt_to_bwx; - - /* - * Access the HAE register - */ - alpha_chipset_read_hae_t* read_hae; - alpha_chipset_write_hae_t* write_hae; + alpha_chipset_addrcvt_t* cvt_to_dense; + alpha_chipset_addrcvt_t* cvt_to_bwx; /* * PCI interrupt device. @@ -111,14 +104,4 @@ typedef struct alpha_chipset { extern alpha_chipset_t chipset; -/* - * Exported sysctl variables describing the PCI chipset. - */ -extern char chipset_type[10]; -extern int chipset_bwx; -extern long chipset_ports; -extern long chipset_memory; -extern long chipset_dense; -extern long chipset_hae_mask; - #endif /* !_MACHINE_CHIPSET_H_ */ diff --git a/sys/alpha/include/console.h b/sys/alpha/include/console.h index 52ef8d1649df8..d74797622648f 100644 --- a/sys/alpha/include/console.h +++ b/sys/alpha/include/console.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: console.h,v 1.40 1998/09/17 09:38:36 dfr Exp $ + * $Id: console.h,v 1.39 1998/08/06 09:15:52 dfr Exp $ * from: i386/include console.h,v 1.39 */ @@ -304,7 +304,7 @@ struct video_info { int vi_flags; #define V_INFO_COLOR (1<<0) #define V_INFO_GRAPHICS (1<<1) -#define V_INFO_LINEAR (1<<2) +#define V_INFO_LENEAR (1<<2) #define V_INFO_VESA (1<<3) int vi_width; int vi_height; diff --git a/sys/alpha/include/fpu.h b/sys/alpha/include/fpu.h deleted file mode 100644 index c9efceed02930..0000000000000 --- a/sys/alpha/include/fpu.h +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: fpu.h,v 1.1 1998/12/04 10:52:48 dfr Exp $ - */ - -#ifndef _MACHINE_FPU_H_ -#define _MACHINE_FPU_H_ - -/* - * Floating point control register bits. - * - * From Alpha AXP Architecture Reference Manual, Instruction - * Descriptions (I) PP 4-69. - */ - -#define FPCR_INVD (1LL << 49) /* Invalid Operation DIsable */ -#define FPCR_DZED (1LL << 50) /* Division by Zero Disable */ -#define FPCR_OVFD (1LL << 51) /* Overflow Disable */ -#define FPCR_INV (1LL << 52) /* Invalid Operation */ -#define FPCR_DZE (1LL << 53) /* Division by Zero */ -#define FPCR_OVF (1LL << 54) /* Overflow */ -#define FPCR_UNF (1LL << 55) /* Underflow */ -#define FPCR_INE (1LL << 56) /* Inexact Result */ -#define FPCR_IOV (1LL << 57) /* Integer Overflow */ -#define FPCR_DYN_CHOPPED (0LL << 58) /* Chopped rounding mode */ -#define FPCR_DYN_MINUS (1LL << 58) /* Minus infinity */ -#define FPCR_DYN_NORMAL (2LL << 58) /* Normal rounding */ -#define FPCR_DYN_PLUS (3LL << 58) /* Plus infinity */ -#define FPCR_DYN_MASK (3LL << 58) /* Rounding mode mask */ -#define FPCR_DYN_SHIFT 58 -#define FPCR_UNDZ (1LL << 60) /* Underflow to Zero */ -#define FPCR_UNFD (1LL << 61) /* Underflow Disable */ -#define FPCR_INED (1LL << 62) /* Inexact Disable */ -#define FPCR_SUM (1LL << 63) /* Summary Bit */ -#define FPCR_MASK (~0LL << 49) - -/* - * Exception summary bits. - * - * From Alpha AXP Architecture Reference Manual, DEC OSF/1 Exceptions - * and Interrupts (II-B) PP 5-5. - */ - -#define EXCSUM_SWC (1LL << 0) /* Software completion */ -#define EXCSUM_INV (1LL << 1) /* Invalid operation */ -#define EXCSUM_DZE (1LL << 2) /* Division by zero */ -#define EXCSUM_OVF (1LL << 3) /* Overflow */ -#define EXCSUM_UNF (1LL << 4) /* Underflow */ -#define EXCSUM_INE (1LL << 5) /* Inexact result */ -#define EXCSUM_IOV (1LL << 6) /* Integer overflow */ - -/* - * Definitions for IEEE trap enables. These are implemented in - * software and should be compatible with OSF/1 and Linux. - */ - -/* read/write flags */ -#define IEEE_TRAP_ENABLE_INV (1LL << 1) /* Invalid operation */ -#define IEEE_TRAP_ENABLE_DZE (1LL << 2) /* Division by zero */ -#define IEEE_TRAP_ENABLE_OVF (1LL << 3) /* Overflow */ -#define IEEE_TRAP_ENABLE_UNF (1LL << 4) /* Underflow */ -#define IEEE_TRAP_ENABLE_INE (1LL << 5) /* Inexact result */ -#define IEEE_TRAP_ENABLE_MASK (IEEE_TRAP_ENABLE_INV \ - | IEEE_TRAP_ENABLE_DZE \ - | IEEE_TRAP_ENABLE_OVF \ - | IEEE_TRAP_ENABLE_UNF \ - | IEEE_TRAP_ENABLE_INE) - -/* read only flags */ -#define IEEE_STATUS_INV (1LL << 17) /* Invalid operation */ -#define IEEE_STATUS_DZE (1LL << 18) /* Division by zero */ -#define IEEE_STATUS_OVF (1LL << 19) /* Overflow */ -#define IEEE_STATUS_UNF (1LL << 20) /* Underflow */ -#define IEEE_STATUS_INE (1LL << 21) /* Inexact result */ -#define IEEE_STATUS_MASK (IEEE_STATUS_INV \ - | IEEE_STATUS_DZE \ - | IEEE_STATUS_OVF \ - | IEEE_STATUS_UNF \ - | IEEE_STATUS_INE) -#define IEEE_STATUS_TO_EXCSUM_SHIFT 16 /* convert to excsum */ -#define IEEE_STATUS_TO_FPCR_SHIFT 35 /* convert to fpcr */ - -#define IEEE_INHERIT (1LL << 63) /* inherit on fork */ - -/* read and write floating point control register */ -#define GET_FPCR(x) \ - __asm__("trapb"); \ - __asm__("mf_fpcr %0" : "=f" (x)); \ - __asm__("trapb") -#define SET_FPCR(x) \ - __asm__("trapb"); \ - __asm__("mt_fpcr %0" : : "f" (x)); \ - __asm__("trapb") - -#ifdef KERNEL - -extern int fp_software_completion(u_int64_t regmask, struct proc *p); - -#endif - -#endif /* ! _MACHINE_FPU_H_ */ diff --git a/sys/alpha/include/frame.h b/sys/alpha/include/frame.h index 8af1d71625176..19aaef68ea8db 100644 --- a/sys/alpha/include/frame.h +++ b/sys/alpha/include/frame.h @@ -1,4 +1,4 @@ -/* $Id: frame.h,v 1.1 1998/01/10 10:13:14 jb Exp $ */ +/* $Id$ */ /* From: NetBSD: frame.h,v 1.4 1997/04/06 08:47:27 cgd Exp */ /* @@ -47,39 +47,35 @@ */ /* Quadword offsets of the registers to be saved. */ -#define FRAME_V0 0 -#define FRAME_T0 1 -#define FRAME_T1 2 -#define FRAME_T2 3 -#define FRAME_T3 4 -#define FRAME_T4 5 -#define FRAME_T5 6 -#define FRAME_T6 7 -#define FRAME_T7 8 -#define FRAME_S0 9 -#define FRAME_S1 10 -#define FRAME_S2 11 -#define FRAME_S3 12 -#define FRAME_S4 13 -#define FRAME_S5 14 -#define FRAME_S6 15 -#define FRAME_A3 16 -#define FRAME_A4 17 -#define FRAME_A5 18 -#define FRAME_T8 19 -#define FRAME_T9 20 -#define FRAME_T10 21 -#define FRAME_T11 22 -#define FRAME_RA 23 -#define FRAME_T12 24 -#define FRAME_AT 25 -#define FRAME_SP 26 -/* The following are set only when a signal is to be delivered to a process. */ -#define FRAME_TRAPARG_A0 27 -#define FRAME_TRAPARG_A1 28 -#define FRAME_TRAPARG_A2 29 +#define FRAME_V0 0 +#define FRAME_T0 1 +#define FRAME_T1 2 +#define FRAME_T2 3 +#define FRAME_T3 4 +#define FRAME_T4 5 +#define FRAME_T5 6 +#define FRAME_T6 7 +#define FRAME_T7 8 +#define FRAME_S0 9 +#define FRAME_S1 10 +#define FRAME_S2 11 +#define FRAME_S3 12 +#define FRAME_S4 13 +#define FRAME_S5 14 +#define FRAME_S6 15 +#define FRAME_A3 16 +#define FRAME_A4 17 +#define FRAME_A5 18 +#define FRAME_T8 19 +#define FRAME_T9 20 +#define FRAME_T10 21 +#define FRAME_T11 22 +#define FRAME_RA 23 +#define FRAME_T12 24 +#define FRAME_AT 25 +#define FRAME_SP 26 -#define FRAME_SW_SIZE (FRAME_TRAPARG_A2 + 1) +#define FRAME_SW_SIZE (FRAME_SP + 1) #define FRAME_HW_OFFSET FRAME_SW_SIZE #define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS) diff --git a/sys/alpha/include/ieeefp.h b/sys/alpha/include/ieeefp.h index a838e98919553..c0f4c2f4035c8 100644 --- a/sys/alpha/include/ieeefp.h +++ b/sys/alpha/include/ieeefp.h @@ -1,4 +1,4 @@ -/* $Id: ieeefp.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ +/* $Id$ */ /* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */ /* @@ -10,14 +10,12 @@ #define _ALPHA_IEEEFP_H_ typedef int fp_except; -#define FP_X_INV (1LL << 1) /* invalid operation exception */ -#define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ -#define FP_X_OFL (1LL << 3) /* overflow exception */ -#define FP_X_UFL (1LL << 4) /* underflow exception */ -#define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */ -#if 0 -#define FP_X_IOV (1LL << 6) /* integer overflow XXX? */ -#endif +#define FP_X_INV 0x01 /* invalid operation exception */ +#define FP_X_DZ 0x02 /* divide-by-zero exception */ +#define FP_X_OFL 0x04 /* overflow exception */ +#define FP_X_UFL 0x08 /* underflow exception */ +#define FP_X_IMP 0x10 /* imprecise (loss of precision; "inexact") */ +#define FP_X_IOV 0x20 /* integer overflow XXX? */ typedef enum { FP_RZ=0, /* round to zero (truncate) */ diff --git a/sys/alpha/include/inst.h b/sys/alpha/include/inst.h deleted file mode 100644 index 27011848b1757..0000000000000 --- a/sys/alpha/include/inst.h +++ /dev/null @@ -1,462 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - */ - -#ifndef _MACHINE_INST_H_ -#define _MACHINE_INST_H_ - -union alpha_instruction { - u_int32_t word; - struct { - u_int32_t argument : 26; - u_int32_t opcode : 6; -#define op_call_pal 0x00 -#define op_lda 0x08 -#define op_ldah 0x09 -#define op_ldbu 0x0a -#define op_unop 0x0b -#define op_ldq_u 0x0b -#define op_ldwu 0x0c -#define op_stw 0x0d -#define op_stb 0x0e -#define op_stq_u 0x0f -#define op_inta 0x10 -#define inta_addl 0x00 -#define inta_s4addl 0x02 -#define inta_subl 0x09 -#define inta_s4subl 0x0b -#define inta_cmpbge 0x0f -#define inta_s8addl 0x12 -#define inta_s8subl 0x1b -#define inta_cmpult 0x1d -#define inta_addq 0x20 -#define inta_s4addq 0x22 -#define inta_subq 0x29 -#define inta_s4subq 0x2b -#define inta_cmpeq 0x2d -#define inta_s8addq 0x32 -#define inta_s8subq 0x3b -#define inta_cmpule 0x3d -#define inta_addlv 0x40 -#define inta_sublv 0x49 -#define inta_cmplt 0x4d -#define inta_addqv 0x60 -#define inta_subqv 0x69 -#define inta_cmple 0x6d -#define op_intl 0x11 -#define intl_and 0x00 -#define intl_andnot 0x08 -#define intl_bic 0x08 -#define intl_cmovlbs 0x14 -#define intl_cmovlbc 0x16 -#define intl_or 0x20 -#define intl_bis 0x20 -#define intl_cmoveq 0x24 -#define intl_cmovne 0x26 -#define intl_ornot 0x28 -#define intl_xor 0x40 -#define intl_cmovlt 0x44 -#define intl_cmovge 0x46 -#define intl_eqv 0x48 -#define intl_amask 0x61 -#define intl_cmovle 0x64 -#define intl_cmovgt 0x66 -#define intl_implver 0x6c -#define op_ints 0x12 -#define ints_mskbl 0x02 -#define ints_extbl 0x06 -#define ints_insbl 0x0b -#define ints_mskwl 0x12 -#define ints_extwl 0x16 -#define ints_inswl 0x1b -#define ints_mskll 0x22 -#define ints_extll 0x26 -#define ints_insll 0x2b -#define ints_zap 0x30 -#define ints_zapnot 0x31 -#define ints_mskql 0x32 -#define ints_srl 0x34 -#define ints_extql 0x36 -#define ints_sll 0x39 -#define ints_insql 0x3b -#define ints_sra 0x3c -#define ints_mskwh 0x52 -#define ints_inswh 0x57 -#define ints_extwh 0x5a -#define ints_msklh 0x62 -#define ints_inslh 0x67 -#define ints_extlh 0x6a -#define ints_mskqh 0x72 -#define ints_insqh 0x77 -#define ints_extqh 0x7a -#define op_intm 0x13 -#define intm_mull 0x00 -#define intm_mulq 0x20 -#define intm_umulh 0x30 -#define intm_mullv 0x40 -#define intm_mulqv 0x60 -#define op_opc14 0x14 -#define op_fltv 0x15 -#define op_flti 0x16 -#define flti_addsc 0x000 -#define flti_subsc 0x001 -#define flti_mulsc 0x002 -#define flti_divsc 0x003 -#define flti_addtc 0x020 -#define flti_subtc 0x021 -#define flti_multc 0x022 -#define flti_divtc 0x023 -#define flti_cvttsc 0x02c -#define flti_cvttqc 0x02f -#define flti_cvtqsc 0x03c -#define flti_cvtqtc 0x03e - -#define flti_addsm 0x040 -#define flti_subsm 0x041 -#define flti_mulsm 0x042 -#define flti_divsm 0x043 -#define flti_addtm 0x060 -#define flti_subtm 0x061 -#define flti_multm 0x062 -#define flti_divtm 0x063 -#define flti_cvttsm 0x06c -#define flti_cvttqm 0x06f -#define flti_cvtqsm 0x07c -#define flti_cvtqtm 0x07e - -#define flti_adds 0x080 -#define flti_subs 0x081 -#define flti_muls 0x082 -#define flti_divs 0x083 - -#define flti_addt 0x0a0 -#define flti_subt 0x0a1 -#define flti_mult 0x0a2 -#define flti_divt 0x0a3 -#define flti_cmptun 0x0a4 -#define flti_cmpteq 0x0a5 -#define flti_cmptlt 0x0a6 -#define flti_cmptle 0x0a7 -#define flti_cvtts 0x0ac -#define flti_cvttq 0x0af -#define flti_cvtqs 0x0bc -#define flti_cvtqt 0x0be - -#define flti_addsd 0x0c0 -#define flti_subsd 0x0c1 -#define flti_mulsd 0x0c2 -#define flti_divsd 0x0c3 -#define flti_addtd 0x0e0 -#define flti_subtd 0x0e1 -#define flti_multd 0x0e2 -#define flti_divtd 0x0e3 -#define flti_cvttsd 0x0ec -#define flti_cvttqd 0x0ef -#define flti_cvtqsd 0x0fc -#define flti_cvtqtd 0x0fe - -#define flti_addsuc 0x100 -#define flti_subsuc 0x101 -#define flti_mulsuc 0x102 -#define flti_divsuc 0x103 -#define flti_addtuc 0x120 -#define flti_subtuc 0x121 -#define flti_multuc 0x122 -#define flti_divtuc 0x123 -#define flti_cvttsuc 0x12c -#define flti_cvttqvc 0x12f - -#define flti_addsum 0x140 -#define flti_subsum 0x141 -#define flti_mulsum 0x142 -#define flti_divsum 0x143 -#define flti_addtum 0x160 -#define flti_subtum 0x161 -#define flti_multum 0x162 -#define flti_divtum 0x163 -#define flti_cvttsum 0x16c -#define flti_cvttqvm 0x16f - -#define flti_addsu 0x180 -#define flti_subsu 0x181 -#define flti_mulsu 0x182 -#define flti_divsu 0x183 -#define flti_addtu 0x1a0 -#define flti_subtu 0x1a1 -#define flti_multu 0x1a2 -#define flti_divtu 0x1a3 -#define flti_cvttsu 0x1ac -#define flti_cvttqv 0x1af - -#define flti_addsud 0x1c0 -#define flti_subsud 0x1c1 -#define flti_mulsud 0x1c2 -#define flti_divsud 0x1c3 -#define flti_addtud 0x1e0 -#define flti_subtud 0x1e1 -#define flti_multud 0x1e2 -#define flti_divtud 0x1e3 -#define flti_cvttsud 0x1ec -#define flti_cvttqvd 0x1ef - -#define flti_cvtst 0x2ac - -#define flti_addssuc 0x500 -#define flti_subssuc 0x501 -#define flti_mulssuc 0x502 -#define flti_divssuc 0x503 -#define flti_addtsuc 0x520 -#define flti_subtsuc 0x521 -#define flti_multsuc 0x522 -#define flti_divtsuc 0x523 -#define flti_cvttssuc 0x52c -#define flti_cvttqsvc 0x52f - -#define flti_addssum 0x540 -#define flti_subssum 0x541 -#define flti_mulssum 0x542 -#define flti_divssum 0x543 -#define flti_addtsum 0x560 -#define flti_subtsum 0x561 -#define flti_multsum 0x562 -#define flti_divtsum 0x563 -#define flti_cvttssum 0x56c -#define flti_cvttqsvm 0x56f - -#define flti_addssu 0x580 -#define flti_subssu 0x581 -#define flti_mulssu 0x582 -#define flti_divssu 0x583 -#define flti_addtsu 0x5a0 -#define flti_subtsu 0x5a1 -#define flti_multsu 0x5a2 -#define flti_divtsu 0x5a3 -#define flti_cmptunsu 0x5a4 -#define flti_cmpteqsu 0x5a5 -#define flti_cmptltsu 0x5a6 -#define flti_cmptlesu 0x5a7 -#define flti_cvttssu 0x5ac -#define flti_cvttqsv 0x5af - -#define flti_addssud 0x5c0 -#define flti_subssud 0x5c1 -#define flti_mulssud 0x5c2 -#define flti_divssud 0x5c3 -#define flti_addtsud 0x5e0 -#define flti_subtsud 0x5e1 -#define flti_multsud 0x5e2 -#define flti_divtsud 0x5e3 -#define flti_cvttssud 0x5ec -#define flti_cvttqsvd 0x5ef - -#define flti_cvtsts 0x6ac - -#define flti_addssuic 0x700 -#define flti_subssuic 0x701 -#define flti_mulssuic 0x702 -#define flti_divssuic 0x703 -#define flti_addtsuic 0x720 -#define flti_subtsuic 0x721 -#define flti_multsuic 0x722 -#define flti_divtsuic 0x723 -#define flti_cvttssuic 0x72c -#define flti_cvttqsvic 0x72f -#define flti_cvtqssuic 0x73c -#define flti_cvtqtsuic 0x73e - -#define flti_addssuim 0x740 -#define flti_subssuim 0x741 -#define flti_mulssuim 0x742 -#define flti_divssuim 0x743 -#define flti_addtsuim 0x760 -#define flti_subtsuim 0x761 -#define flti_multsuim 0x762 -#define flti_divtsuim 0x763 -#define flti_cvttssuim 0x76c -#define flti_cvttqsvim 0x76f -#define flti_cvtqssuim 0x77c -#define flti_cvtqtsuim 0x77e - -#define flti_addssui 0x780 -#define flti_subssui 0x781 -#define flti_mulssui 0x782 -#define flti_divssui 0x783 -#define flti_addtsui 0x7a0 -#define flti_subtsui 0x7a1 -#define flti_multsui 0x7a2 -#define flti_divtsui 0x7a3 -#define flti_cmptunsui 0x7a4 -#define flti_cmpteqsui 0x7a5 -#define flti_cmptltsui 0x7a6 -#define flti_cmptlesui 0x7a7 -#define flti_cvttssui 0x7ac -#define flti_cvttqsvi 0x7af -#define flti_cvtqssui 0x7bc -#define flti_cvtqtsui 0x7bc - -#define flti_addssuid 0x7c0 -#define flti_subssuid 0x7c1 -#define flti_mulssuid 0x7c2 -#define flti_divssuid 0x7c3 -#define flti_addtsuid 0x7e0 -#define flti_subtsuid 0x7e1 -#define flti_multsuid 0x7e2 -#define flti_divtsuid 0x7e3 -#define flti_cvttssuid 0x7ec -#define flti_cvttqsvid 0x7ef -#define flti_cvtqssuid 0x7fc -#define flti_cvtqtsuid 0x7fc - -#define op_fltl 0x17 -#define fltl_cvtlq 0x010 -#define fltl_cpys 0x020 -#define fltl_cpysn 0x021 -#define fltl_cpyse 0x022 -#define fltl_mt_fpcr 0x024 -#define fltl_mf_fpcr 0x025 -#define fltl_fcmoveq 0x02a -#define fltl_fcmovne 0x02b -#define fltl_fcmovlt 0x02c -#define fltl_fcmovge 0x02d -#define fltl_fcmovle 0x02e -#define fltl_fcmovgt 0x02f -#define fltl_cvtql 0x030 -#define fltl_cvtqlv 0x130 -#define fltl_cvtqlsv 0x530 - -#define op_misc 0x18 -#define misc_trapb 0x0000 -#define misc_excb 0x0400 -#define misc_mb 0x4000 -#define misc_wmb 0x4400 -#define misc_fetch 0x8000 -#define misc_fetch_m 0xa000 -#define misc_rpcc 0xc000 -#define misc_rc 0xe000 -#define misc_ecb 0xe800 -#define misc_rs 0xf000 -#define misc_wh64 0xf800 - -#define op_pal19 0x19 -#define op_jsr 0x1a -#define op_pal1b 0x1b -#define op_pal1c 0x1c -#define op_pal1d 0x1d -#define op_pal1e 0x1e -#define op_pal1f 0x1f -#define op_ldf 0x20 -#define op_ldg 0x21 -#define op_lds 0x22 -#define op_ldt 0x23 -#define op_stf 0x24 -#define op_stg 0x25 -#define op_sts 0x26 -#define op_stt 0x27 -#define op_ldl 0x28 -#define op_ldq 0x29 -#define op_ldl_l 0x2a -#define op_ldq_l 0x2b -#define op_stl 0x2c -#define op_stq 0x2d -#define op_stl_c 0x2e -#define op_stq_c 0x2f -#define op_br 0x30 -#define op_fbeq 0x31 -#define op_fblt 0x32 -#define op_fble 0x33 -#define op_bsr 0x34 -#define op_fbne 0x35 -#define op_fbge 0x36 -#define op_fbgt 0x37 -#define op_blbc 0x38 -#define op_beq 0x39 -#define op_blt 0x3a -#define op_ble 0x3b -#define op_blbs 0x3c -#define op_bne 0x3d -#define op_bge 0x3e -#define op_bgt 0x3f - } common; - struct { - u_int32_t function : 16; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } memory_format; - struct { - u_int32_t hint : 14; - u_int32_t function : 2; -#define jsr_jmp 0 -#define jsr_jsr 1 -#define jsr_ret 2 -#define jsr_jsr_coroutine 3 - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } j_format; - struct { - int32_t memory_displacement : 16; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } m_format; - struct { - u_int32_t rc : 5; - u_int32_t function : 7; - u_int32_t form : 1; - u_int32_t sbz : 3; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } o_format; - struct { - u_int32_t rc : 5; - u_int32_t function : 7; - u_int32_t form : 1; - u_int32_t literal : 8; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } l_format; - struct { - u_int32_t fc : 5; - u_int32_t function : 11; - u_int32_t fb : 5; - u_int32_t fa : 5; - u_int32_t opcode : 6; - } f_format; - struct { - u_int32_t function : 26; - u_int32_t opcode : 6; - } pal_format; - struct { - int32_t branch_displacement : 21; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } b_format; -}; - -#endif /* _MACHINE_INST_H_ */ diff --git a/sys/alpha/include/intr.h b/sys/alpha/include/intr.h index ea5408920b881..79af6fd9fa6dd 100644 --- a/sys/alpha/include/intr.h +++ b/sys/alpha/include/intr.h @@ -23,15 +23,24 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: intr.h,v 1.4 1998/11/15 18:25:16 dfr Exp $ + * $Id: intr.h,v 1.2 1998/07/12 16:09:30 dfr Exp $ */ #ifndef _MACHINE_INTR_H_ #define _MACHINE_INTR_H_ -int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, - void **cookiep, volatile long *cntp); -int alpha_teardown_intr(void *cookie); +LIST_HEAD(alpha_intr_list, alpha_intr); + +struct alpha_intr { + LIST_ENTRY(alpha_intr) list; /* chain handlers in this hash bucket */ + int vector; /* vector to match */ + driver_intr_t *intr; /* handler function */ + void *arg; /* argument to handler */ +}; + +struct alpha_intr *alpha_create_intr(int vector, + driver_intr_t *intr, void *arg); +int alpha_connect_intr(struct alpha_intr *i); void alpha_dispatch_intr(void *frame, unsigned long vector); #endif /* !_MACHINE_INTR_H_ */ diff --git a/sys/alpha/include/intrcnt.h b/sys/alpha/include/intrcnt.h deleted file mode 100644 index cd9e70173156d..0000000000000 --- a/sys/alpha/include/intrcnt.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $Id$ */ -/* $NetBSD: intrcnt.h,v 1.17 1998/11/19 01:48:04 ross 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 INTRCNT_CLOCK 0 -#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1) -#define INTRCNT_ISA_IRQ_LEN 16 -#define INTRCNT_OTHER_BASE (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN) -#define INTRCNT_OTHER_LEN 48 -#define INTRCNT_COUNT (INTRCNT_OTHER_BASE + INTRCNT_OTHER_LEN) - -#define INTRCNT_A12_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000A_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_2100_A500_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_550_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB164_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB64PLUS_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB66_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_IOASIC INTRCNT_OTHER_BASE -#define INTRCNT_KN15 INTRCNT_OTHER_BASE -#define INTRCNT_KN16 INTRCNT_OTHER_BASE -#define INTRCNT_KN20AA_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN300_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN8AE_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_TCDS INTRCNT_OTHER_BASE - -#define INTRCNT_A12_IRQ_LEN 10 -#define INTRCNT_DEC_1000A_IRQ_LEN 32 -#define INTRCNT_DEC_1000_IRQ_LEN 16 -#define INTRCNT_DEC_2100_A500_IRQ_LEN 16 -#define INTRCNT_DEC_550_IRQ_LEN 48 -#define INTRCNT_EB164_IRQ_LEN 24 -#define INTRCNT_EB64PLUS_IRQ_LEN 32 -#define INTRCNT_EB66_IRQ_LEN 32 -#define INTRCNT_IOASIC_LEN 4 -#define INTRCNT_ISA_IRQ_LEN 16 -#define INTRCNT_KN15_LEN 9 -#define INTRCNT_KN16_LEN 5 -#define INTRCNT_KN20AA_IRQ_LEN 32 -#define INTRCNT_KN300_LEN 19 -#define INTRCNT_KN8AE_IRQ_LEN 2 -#define INTRCNT_TCDS_LEN 2 - -# define INTRCNT_KN300_NCR810 INTRCNT_KN300_IRQ + 16 -# define INTRCNT_KN300_I2C_CTRL INTRCNT_KN300_IRQ + 17 -# define INTRCNT_KN300_I2C_BUS INTRCNT_KN300_IRQ + 18 - -#ifdef KERNEL -#ifndef _LOCORE -extern volatile long intrcnt[]; -#endif -#endif diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h index c8db0523ed918..b3925f7474c4c 100644 --- a/sys/alpha/include/md_var.h +++ b/sys/alpha/include/md_var.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: md_var.h,v 1.4 1998/09/26 12:22:53 dfr Exp $ + * $Id: md_var.h,v 1.3 1998/09/14 22:43:24 jdp Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -44,6 +44,7 @@ struct proc; struct reg; struct cam_sim; +void cpu_power_down __P((void)); void cpu_halt __P((void)); void cpu_reset __P((void)); int is_physical_memory __P((vm_offset_t addr)); diff --git a/sys/alpha/include/mouse.h b/sys/alpha/include/mouse.h index 2abce2cd01c92..3e63ba760f129 100644 --- a/sys/alpha/include/mouse.h +++ b/sys/alpha/include/mouse.h @@ -20,7 +20,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mouse.h,v 1.11 1998/08/06 09:15:52 dfr Exp $ + * $Id$ * from: i386/include mouse.h,v 1.10 */ @@ -114,7 +114,6 @@ typedef struct mousehw { #define MOUSE_MODEL_THINK 5 #define MOUSE_MODEL_EASYSCROLL 6 #define MOUSE_MODEL_MOUSEMANPLUS 7 -#define MOUSE_MODEL_KIDSPAD 8 typedef struct mousemode { int protocol; /* MOUSE_PROTO_XXX */ @@ -142,7 +141,6 @@ typedef struct mousemode { #define MOUSE_PROTO_THINK 11 /* Kensignton Thinking Mouse, 3/4 bytes */ #define MOUSE_PROTO_SYSMOUSE 12 /* /dev/sysmouse */ #define MOUSE_PROTO_X10MOUSEREM 13 /* X10 MouseRemote, 3 bytes */ -#define MOUSE_PROTO_KIDSPAD 14 /* Genius Kidspad */ #define MOUSE_RES_UNKNOWN (-1) #define MOUSE_RES_DEFAULT 0 diff --git a/sys/alpha/include/pcb.h b/sys/alpha/include/pcb.h index a6d4a18bde20a..445617ea71dcc 100644 --- a/sys/alpha/include/pcb.h +++ b/sys/alpha/include/pcb.h @@ -1,4 +1,4 @@ -/* $Id: pcb.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ +/* $Id$ */ /* From: NetBSD: pcb.h,v 1.6 1997/04/06 08:47:33 cgd Exp */ /* @@ -50,7 +50,6 @@ struct pcb { struct alpha_pcb pcb_hw; /* PALcode defined */ unsigned long pcb_context[9]; /* s[0-6], ra, ps [SW] */ struct fpreg pcb_fp; /* FP registers [SW] */ - u_int64_t pcb_fp_control; /* IEEE control word [SW] */ unsigned long pcb_onfault; /* for copy faults [SW] */ unsigned long pcb_accessaddr; /* for [fs]uswintr [SW] */ }; diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h index 68add90c72556..6a1af705706e3 100644 --- a/sys/alpha/include/proc.h +++ b/sys/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $Id: proc.h,v 1.4 1998/11/15 18:25:16 dfr Exp $ */ +/* $Id: proc.h,v 1.2 1998/06/10 10:55:17 dfr Exp $ */ /* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */ /* @@ -38,15 +38,12 @@ struct mdbpt { }; struct mdproc { - u_long md_flags; + u_long md_flags; struct trapframe *md_tf; /* trap/syscall registers */ - struct pcb *md_pcbpaddr; /* phys addr of the pcb */ - struct mdbpt md_sstep[2]; /* two single step breakpoints */ - u_int64_t md_hae; /* user HAE register value */ - void *osf_sigtramp; /* user-level signal trampoline */ + struct pcb *md_pcbpaddr; /* phys addr of the pcb */ + struct mdbpt md_sstep[2]; /* two single step breakpoints */ }; #define MDP_FPUSED 0x0001 /* Process used the FPU */ #define MDP_STEP1 0x0002 /* Single step normal instruction */ #define MDP_STEP2 0x0004 /* Single step branch instruction */ -#define MDP_HAEUSED 0x0008 /* Process used the HAE */ diff --git a/sys/alpha/include/resource.h b/sys/alpha/include/resource.h deleted file mode 100644 index 44763783d9ab4..0000000000000 --- a/sys/alpha/include/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $Id$ */ -/* - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. 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. - */ - -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 - -/* - * Definitions of resource types for Intel Architecture machines - * with support for legacy ISA devices and drivers. - */ - -#define SYS_RES_IRQ 1 -#define SYS_RES_DRQ 2 -#define SYS_RES_MEMORY 3 -#define SYS_RES_IOPORT 4 - -#endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/alpha/include/signal.h b/sys/alpha/include/signal.h index eb335c0639811..32f14c210aa4f 100644 --- a/sys/alpha/include/signal.h +++ b/sys/alpha/include/signal.h @@ -1,4 +1,4 @@ -/* $Id: signal.h,v 1.1 1998/01/10 10:13:16 jb Exp $ */ +/* $Id$ */ /* From: NetBSD: signal.h,v 1.3 1997/04/06 08:47:43 cgd Exp */ /* @@ -56,11 +56,7 @@ struct sigcontext { unsigned long sc_fpcr; /* FP control register (see above) */ unsigned long sc_fp_control; /* FP software control word */ long sc_reserved[2]; /* XXX */ - long sc_xxx1[2]; /* sc_ssize, sc_sbase on DUX */ - unsigned long sc_traparg_a0; /* a0 argument to trap at exception */ - unsigned long sc_traparg_a1; /* a1 argument to trap at exception */ - unsigned long sc_traparg_a2; /* a2 argument to trap at exception */ - long sc_xxx2[3]; /* sc_fp_trap_pc, sc_fp_trigger_sum, sc_fp_trigger_inst */ + long sc_xxx[8]; /* XXX */ }; #endif /* !_ANSI_SOURCE */ diff --git a/sys/alpha/include/sysarch.h b/sys/alpha/include/sysarch.h deleted file mode 100644 index e0e0a6b9b6178..0000000000000 --- a/sys/alpha/include/sysarch.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: sysarch.h,v 1.1 1998/11/17 10:40:07 dfr Exp $ - */ - -/* - * Architecture specific syscalls (alpha) - */ -#ifndef _MACHINE_SYSARCH_H_ -#define _MACHINE_SYSARCH_H_ - -#define ALPHA_SETHAE 0 -#define ALPHA_GET_FPMASK 1 -#define ALPHA_SET_FPMASK 2 - -#ifndef KERNEL -#include <sys/cdefs.h> - -union descriptor; - -__BEGIN_DECLS -int alpha_sethae __P((u_int64_t)); -__END_DECLS -#endif /* !KERNEL */ - -#endif /* !_MACHINE_SYSARCH_H_ */ diff --git a/sys/alpha/include/types.h b/sys/alpha/include/types.h index f293bc5268dad..1bf185c651937 100644 --- a/sys/alpha/include/types.h +++ b/sys/alpha/include/types.h @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.8 1998/07/14 05:09:42 bde Exp $ */ +/* $Id: types.h,v 1.7 1998/07/10 02:34:50 bde Exp $ */ /* From: NetBSD: types.h,v 1.8 1997/04/06 08:47:45 cgd Exp */ /*- @@ -56,16 +56,34 @@ typedef long vm_ooffset_t; typedef unsigned long vm_pindex_t; typedef unsigned long vm_size_t; +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#define __BIT_TYPES_DEFINED__ +typedef __signed char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long int64_t; +typedef unsigned long u_int64_t; + +typedef int64_t register_t; -typedef __int64_t register_t; +typedef int32_t ufs_daddr_t; #ifdef KERNEL typedef long intfptr_t; typedef unsigned long uintfptr_t; +typedef long intptr_t; +typedef unsigned long uintptr_t; +typedef unsigned long uoff_t; #endif /* Interrupt mask (spl, xxx_imask, etc) */ -typedef __uint32_t intrmask_t; +typedef u_int32_t intrmask_t; /* Interrupt handler function type - arg should be "void *" one day */ typedef void inthand2_t(int _unit); diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h index 04c62a65a5460..fead056e3d0c4 100644 --- a/sys/alpha/include/vmparam.h +++ b/sys/alpha/include/vmparam.h @@ -1,4 +1,4 @@ -/* $Id: vmparam.h,v 1.3 1998/06/14 13:45:15 dfr Exp $ */ +/* $Id: vmparam.h,v 1.2 1998/06/10 10:55:30 dfr Exp $ */ /* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */ #ifndef _ALPHA_VMPARAM_H #define _ALPHA_VMPARAM_H @@ -54,15 +54,7 @@ * kernel stack. */ #define USRTEXT CLBYTES -/* #define USRSTACK VM_MAXUSER_ADDRESS */ - -/* - * This stack location is suitable for OSF1 emulation. Some OSF - * programs are built as 32bit and assume that the stack is reachable - * with a 32bit value. OSF1 manages to have a variable location for - * the user stack which we should probably also support. - */ -#define USRSTACK (0x12000000LL - (UPAGES*PAGE_SIZE)) +#define USRSTACK VM_MAXUSER_ADDRESS /* * Virtual memory related constants, all in bytes diff --git a/sys/alpha/isa/isa.c b/sys/alpha/isa/isa.c index 32894e6144489..1437a2a879791 100644 --- a/sys/alpha/isa/isa.c +++ b/sys/alpha/isa/isa.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: isa.c,v 1.7 1998/11/18 23:53:11 dfr Exp $ + * $Id: isa.c,v 1.3 1998/08/10 07:53:59 dfr Exp $ */ #include <sys/param.h> @@ -32,37 +32,24 @@ #include <sys/module.h> #include <sys/bus.h> #include <sys/malloc.h> -#include <sys/rman.h> #include <isa/isareg.h> #include <isa/isavar.h> #include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/resource.h> - -MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device"); /* * The structure used to attach devices to the Isa. */ struct isa_device { - u_short id_port[ISA_NPORT_IVARS]; - u_short id_portsize[ISA_NPORT_IVARS]; - vm_offset_t id_maddr[ISA_NMEM_IVARS]; - vm_size_t id_msize[ISA_NMEM_IVARS]; - int id_irq[ISA_NIRQ_IVARS]; - int id_drq[ISA_NDRQ_IVARS]; + int id_port; + int id_portsize; int id_flags; - struct resource *id_portres[ISA_NPORT_IVARS]; - struct resource *id_memres[ISA_NMEM_IVARS]; - struct resource *id_irqres[ISA_NIRQ_IVARS]; - struct resource *id_drqres[ISA_NDRQ_IVARS]; + int id_irq; }; #define DEVTOISA(dev) ((struct isa_device*) device_get_ivars(dev)) static devclass_t isa_devclass; -static struct rman isa_irq_rman; /* * Device methods @@ -72,16 +59,9 @@ static int isa_attach(device_t dev); static void isa_print_child(device_t dev, device_t child); static int isa_read_ivar(device_t dev, device_t child, int which, u_long *result); static int isa_write_ivar(device_t dev, device_t child, int which, u_long result); -static struct resource *isa_alloc_resource(device_t bus, device_t child, - int type, int *rid, - u_long start, u_long end, - u_long count, u_int flags); -static int isa_release_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); -static int isa_setup_intr(device_t dev, device_t child, struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep); -static int isa_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); +static void *isa_create_intr(device_t dev, device_t child, int irq, + driver_intr_t *intr, void *arg); +static int isa_connect_intr(device_t dev, void *ih); static device_method_t isa_methods[] = { /* Device interface */ @@ -94,12 +74,8 @@ static device_method_t isa_methods[] = { DEVMETHOD(bus_print_child, isa_print_child), DEVMETHOD(bus_read_ivar, isa_read_ivar), DEVMETHOD(bus_write_ivar, isa_write_ivar), - DEVMETHOD(bus_alloc_resource, isa_alloc_resource), - DEVMETHOD(bus_release_resource, isa_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, isa_setup_intr), - DEVMETHOD(bus_teardown_intr, isa_teardown_intr), + DEVMETHOD(bus_create_intr, isa_create_intr), + DEVMETHOD(bus_connect_intr, isa_connect_intr), { 0, 0 } }; @@ -114,69 +90,34 @@ static driver_t isa_driver = { static void isa_add_device(device_t dev, const char *name, int unit) { - struct isa_device *idev; - device_t child; - int sensitive, t; - static device_t last_sensitive; - - if (resource_int_value(name, unit, "sensitive", &sensitive) != 0) - sensitive = 0; + struct isa_device *idev; + device_t child; + int t; - idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT); + idev = malloc(sizeof(struct isa_device), M_DEVBUF, M_NOWAIT); if (!idev) return; - bzero(idev, sizeof *idev); if (resource_int_value(name, unit, "port", &t) == 0) - idev->id_port[0] = t; + idev->id_port = t; else - idev->id_port[0] = 0; - idev->id_port[1] = 0; - + idev->id_port = 0; if (resource_int_value(name, unit, "portsize", &t) == 0) - idev->id_portsize[0] = t; - else - idev->id_portsize[0] = 0; - idev->id_portsize[1] = 0; - - if (resource_int_value(name, unit, "iomem", &t) == 0) - idev->id_maddr[0] = t; + idev->id_portsize = t; else - idev->id_maddr[0] = 0; - idev->id_maddr[1] = 0; - - if (resource_int_value(name, unit, "msize", &t) == 0) - idev->id_msize[0] = t; - else - idev->id_msize[0] = 0; - idev->id_msize[1] = 0; - + idev->id_portsize = 0; if (resource_int_value(name, unit, "flags", &t) == 0) idev->id_flags = t; else idev->id_flags = 0; - if (resource_int_value(name, unit, "irq", &t) == 0) - idev->id_irq[0] = t; + idev->id_irq = t; else - idev->id_irq[0] = -1; - idev->id_irq[1] = -1; + idev->id_irq = -1; - if (resource_int_value(name, unit, "drq", &t) == 0) - idev->id_drq[0] = t; - else - idev->id_drq[0] = -1; - idev->id_drq[1] = -1; - - if (sensitive) - child = device_add_child_after(dev, last_sensitive, name, - unit, idev); - else - child = device_add_child(dev, name, unit, idev); - if (child == 0) + child = device_add_child(dev, name, unit, idev); + if (!child) return; - else if (sensitive) - last_sensitive = child; if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0) device_disable(child); @@ -189,7 +130,7 @@ isa_intr_enable(int irq) if (irq < 8) outb(IO_ICU1+1, inb(IO_ICU1+1) & ~(1 << irq)); else - outb(IO_ICU2+1, inb(IO_ICU2+1) & ~(1 << (irq - 8))); + outb(IO_ICU2+1, inb(IO_ICU2+1) & ~(1 << irq)); splx(s); } @@ -200,7 +141,7 @@ isa_intr_disable(int irq) if (irq < 8) outb(IO_ICU1+1, inb(IO_ICU1+1) | (1 << irq)); else - outb(IO_ICU2+1, inb(IO_ICU2+1) | (1 << (irq - 8))); + outb(IO_ICU2+1, inb(IO_ICU2+1) | (1 << irq)); splx(s); } @@ -246,15 +187,6 @@ isa_probe(device_t dev) resource_query_unit(i)); } - isa_irq_rman.rm_start = 0; - isa_irq_rman.rm_end = 15; - isa_irq_rman.rm_type = RMAN_ARRAY; - isa_irq_rman.rm_descr = "ISA Interrupt request lines"; - if (rman_init(&isa_irq_rman) - || rman_manage_region(&isa_irq_rman, 0, 1) - || rman_manage_region(&isa_irq_rman, 3, 15)) - panic("isa_probe isa_irq_rman"); - return 0; } @@ -283,69 +215,15 @@ isa_attach(device_t dev) static void isa_print_child(device_t bus, device_t dev) { - struct isa_device *id = DEVTOISA(dev); - - if (id->id_port[0] > 0 || id->id_port[1] - || id->id_maddr[0] > 0 || id->id_maddr[1] - || id->id_irq[0] >= 0 || id->id_irq[1] >= 0 - || id->id_drq[0] >= 0 || id->id_drq[1] >= 0) - printf(" at"); - if (id->id_port[0] && id->id_port[1]) { - printf(" ports %#x", (u_int)id->id_port[0]); - if (id->id_portsize[0]) - printf("-%#x", (u_int)(id->id_port[0] - + id->id_portsize[0] - 1)); - printf(" and %#x", (u_int)id->id_port[1]); - if (id->id_portsize[1]) - printf("-%#x", (u_int)(id->id_port[1] - + id->id_portsize[1] - 1)); - } else if (id->id_port[0]) { - printf(" port %#x", (u_int)id->id_port[0]); - if (id->id_portsize[0]) - printf("-%#x", (u_int)(id->id_port[0] - + id->id_portsize[0] - 1)); - } else if (id->id_port[1]) { - printf(" port %#x", (u_int)id->id_port[1]); - if (id->id_portsize[1]) - printf("-%#x", (u_int)(id->id_port[1] - + id->id_portsize[1] - 1)); - } - if (id->id_maddr[0] && id->id_maddr[1]) { - printf(" iomem %#x", (u_int)id->id_maddr[0]); - if (id->id_msize[0]) - printf("-%#x", (u_int)(id->id_maddr[0] - + id->id_msize[0] - 1)); - printf(" and %#x", (u_int)id->id_maddr[1]); - if (id->id_msize[1]) - printf("-%#x", (u_int)(id->id_maddr[1] - + id->id_msize[1] - 1)); - } else if (id->id_maddr[0]) { - printf(" iomem %#x", (u_int)id->id_maddr[0]); - if (id->id_msize[0]) - printf("-%#x", (u_int)(id->id_maddr[0] - + id->id_msize[0] - 1)); - } else if (id->id_maddr[1]) { - printf(" iomem %#x", (u_int)id->id_maddr[1]); - if (id->id_msize[1]) - printf("-%#x", (u_int)(id->id_maddr[1] - + id->id_msize[1] - 1)); - } - if (id->id_irq[0] >= 0 && id->id_irq[1] >= 0) - printf(" irqs %d and %d", id->id_irq[0], id->id_irq[1]); - else if (id->id_irq[0] >= 0) - printf(" irq %d", id->id_irq[0]); - else if (id->id_irq[1] >= 0) - printf(" irq %d", id->id_irq[1]); - if (id->id_drq[0] >= 0 && id->id_drq[1] >= 0) - printf(" drqs %d and %d", id->id_drq[0], id->id_drq[1]); - else if (id->id_drq[0] >= 0) - printf(" drq %d", id->id_drq[0]); - else if (id->id_drq[1] >= 0) - printf(" drq %d", id->id_drq[1]); - - if (id->id_flags) - printf(" flags %#x", id->id_flags); + struct isa_device* idev = DEVTOISA(dev); + printf(" at"); + if (idev->id_port) + printf(" 0x%x", idev->id_port); + if (idev->id_portsize > 0) + printf("-0x%x", idev->id_port + idev->id_portsize - 1); + if (idev->id_irq >= 0) + printf(" irq %d", idev->id_irq); printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); } @@ -357,45 +235,18 @@ isa_read_ivar(device_t bus, device_t dev, struct isa_device* idev = DEVTOISA(dev); switch (index) { - case ISA_IVAR_PORT_0: - *result = idev->id_port[0]; - break; - case ISA_IVAR_PORT_1: - *result = idev->id_port[1]; - break; - case ISA_IVAR_PORTSIZE_0: - *result = idev->id_portsize[0]; + case ISA_IVAR_PORT: + *result = idev->id_port; break; - case ISA_IVAR_PORTSIZE_1: - *result = idev->id_portsize[1]; - break; - case ISA_IVAR_MADDR_0: - *result = idev->id_maddr[0]; - break; - case ISA_IVAR_MADDR_1: - *result = idev->id_maddr[1]; - break; - case ISA_IVAR_MSIZE_0: - *result = idev->id_msize[0]; - break; - case ISA_IVAR_MSIZE_1: - *result = idev->id_msize[1]; - break; - case ISA_IVAR_IRQ_0: - *result = idev->id_irq[0]; - break; - case ISA_IVAR_IRQ_1: - *result = idev->id_irq[1]; - break; - case ISA_IVAR_DRQ_0: - *result = idev->id_drq[0]; - break; - case ISA_IVAR_DRQ_1: - *result = idev->id_drq[1]; + case ISA_IVAR_PORTSIZE: + *result = idev->id_portsize; break; case ISA_IVAR_FLAGS: *result = idev->id_flags; break; + case ISA_IVAR_IRQ: + *result = idev->id_irq; + break; } return ENOENT; } @@ -407,207 +258,20 @@ isa_write_ivar(device_t bus, device_t dev, struct isa_device* idev = DEVTOISA(dev); switch (index) { - case ISA_IVAR_PORT_0: - idev->id_port[0] = value; - break; - case ISA_IVAR_PORT_1: - idev->id_port[1] = value; - break; - case ISA_IVAR_PORTSIZE_0: - idev->id_portsize[0] = value; - break; - case ISA_IVAR_PORTSIZE_1: - idev->id_portsize[1] = value; - break; - case ISA_IVAR_MADDR_0: - idev->id_maddr[0] = value; - break; - case ISA_IVAR_MADDR_1: - idev->id_maddr[1] = value; - break; - case ISA_IVAR_MSIZE_0: - idev->id_msize[0] = value; - break; - case ISA_IVAR_MSIZE_1: - idev->id_msize[1] = value; - break; - case ISA_IVAR_IRQ_0: - idev->id_irq[0] = value; - break; - case ISA_IVAR_IRQ_1: - idev->id_irq[1] = value; + case ISA_IVAR_PORT: + idev->id_port = value; break; - case ISA_IVAR_DRQ_0: - idev->id_drq[0] = value; - break; - case ISA_IVAR_DRQ_1: - idev->id_drq[1] = value; + case ISA_IVAR_PORTSIZE: + idev->id_portsize = value; break; case ISA_IVAR_FLAGS: idev->id_flags = value; break; - default: - return (ENOENT); - } - return (0); -} - -/* - * This implementation simply passes the request up to the parent - * bus, which in our case is the pci chipset device, substituting any - * configured values if the caller defaulted. We can get away with - * this because there is no special mapping for ISA resources on this - * platform. When porting this code to another architecture, it may be - * necessary to interpose a mapping layer here. - * - * We manage our own interrupt resources since ISA interrupts go through - * the ISA PIC, not the PCI interrupt controller. - */ -static struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - int isdefault; - struct resource *rv, **rvp; - struct isa_device *id; - - if (child) - id = DEVTOISA(child); - else - id = NULL; - isdefault = (start == 0UL && end == ~0UL && *rid == 0); - if (*rid > 1) - return 0; - - switch (type) { - case SYS_RES_IRQ: - /* - * The hack implementation of intr_create() passes a - * NULL child device. - */ - if (isdefault && (id == NULL || id->id_irq[0] >= 0)) { - start = id->id_irq[0]; - end = id->id_irq[0]; - count = 1; - } - rv = rman_reserve_resource(&isa_irq_rman, - start, end, count, - 0, child); - if (!rv) - return 0; - if (id) { - id->id_irqres[*rid] = rv; - id->id_irq[*rid] = rv->r_start; - } - return rv; - - case SYS_RES_MEMORY: - if (isdefault && id->id_maddr[0]) { - start = id->id_maddr[0]; - count = max(count, (u_long)id->id_msize[0]); - end = id->id_maddr[0] + count; - } - rvp = &id->id_memres[*rid]; - break; - - case SYS_RES_IOPORT: - if (isdefault && id->id_port[0]) { - start = id->id_port[0]; - count = max(count, (u_long)id->id_portsize[0]); - end = id->id_port[0] + count; - } - rvp = &id->id_portres[*rid]; + case ISA_IVAR_IRQ: + idev->id_irq = value; break; - - default: - return 0; } - - /* - * If the client attempts to reallocate a resource without - * releasing what was there previously, die horribly so that - * he knows how he !@#$ed up. - */ - if (*rvp != 0) - panic("%s%d: (%d, %d) not free for %s%d\n", - device_get_name(bus), device_get_unit(bus), - type, *rid, - device_get_name(child), device_get_unit(child)); - - /* - * nexus_alloc_resource had better not change *rid... - */ - rv = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, - start, end, count, flags); - if ((*rvp = rv) != 0) { - switch (type) { - case SYS_RES_MEMORY: - id->id_maddr[*rid] = rv->r_start; - id->id_msize[*rid] = count; - break; - case SYS_RES_IOPORT: - id->id_port[*rid] = rv->r_start; - id->id_portsize[*rid] = count; - break; - } - } - return rv; -} - -static int -isa_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - int rv; - struct resource **rp; - struct isa_device *id = DEVTOISA(child); - - if (rid > 1) - return EINVAL; - - switch (type) { - case SYS_RES_IRQ: - return (rman_release_resource(r)); - case SYS_RES_DRQ: - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - break; - default: - return (ENOENT); - } - - rv = BUS_RELEASE_RESOURCE(device_get_parent(bus), child, type, rid, r); - - if (rv) { - switch (type) { - case SYS_RES_IRQ: - id->id_irqres[rid] = 0; - id->id_irq[rid] = -1; - break; - - case SYS_RES_DRQ: - id->id_drqres[rid] = 0; - id->id_drq[rid] = -1; - break; - - case SYS_RES_MEMORY: - id->id_memres[rid] = 0; - id->id_maddr[rid] = 0; - id->id_msize[rid] = 0; - break; - - case SYS_RES_IOPORT: - id->id_portres[rid] = 0; - id->id_port[rid] = 0; - id->id_portsize[rid] = 0; - break; - - default: - return ENOENT; - } - } - - return rv; + return ENOENT; } struct isa_intr { @@ -635,48 +299,37 @@ isa_handle_intr(void *arg) outb(IO_ICU1, 0x20 | (irq > 7 ? 2 : irq)); } -static int -isa_setup_intr(device_t dev, device_t child, - struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep) +static void * +isa_create_intr(device_t dev, device_t child, int irq, + driver_intr_t *intr, void *arg) { struct isa_intr *ii; - int error; - - error = rman_activate_resource(irq); - if (error) - return error; + if (irq == 2) irq = 9; ii = malloc(sizeof(struct isa_intr), M_DEVBUF, M_NOWAIT); if (!ii) - return ENOMEM; + return NULL; ii->intr = intr; ii->arg = arg; - ii->irq = irq->r_start; - - error = alpha_setup_intr(0x800 + (irq->r_start << 4), - isa_handle_intr, ii, &ii->ih, - &intrcnt[INTRCNT_ISA_IRQ + irq->r_start]); - if (error) { + ii->irq = irq; + ii->ih = alpha_create_intr(0x800 + (irq << 4), isa_handle_intr, ii); + + if (!ii->ih) { free(ii, M_DEVBUF); - return error; + return NULL; } - isa_intr_enable(irq->r_start); - *cookiep = ii; - return 0; + return ii; } static int -isa_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) +isa_connect_intr(device_t dev, void *ih) { - struct isa_intr *ii = cookie; + struct isa_intr *ii = ih; + struct alpha_intr *i = ii->ih; - alpha_teardown_intr(ii->ih); - isa_intr_disable(irq->r_start); - - return 0; + isa_intr_enable(ii->irq); + return alpha_connect_intr(i); } DRIVER_MODULE(isa, cia, isa_driver, isa_devclass, 0, 0); diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index 66bedcfcf03d7..433410225271f 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: apecs.c,v 1.4 1998/12/04 22:54:42 archie Exp $ + * $Id: apecs.c,v 1.1 1998/08/10 07:53:59 dfr Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -60,16 +60,12 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> -#include <sys/rman.h> #include <alpha/pci/apecsreg.h> #include <alpha/pci/apecsvar.h> -#include <alpha/pci/pcibus.h> #include <machine/intr.h> -#include <machine/intrcnt.h> #include <machine/cpuconf.h> #include <machine/swiz.h> -#include <machine/rpb.h> #define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) @@ -107,8 +103,6 @@ static alpha_chipset_cfgwriteb_t apecs_swiz_cfgwriteb; static alpha_chipset_cfgwritew_t apecs_swiz_cfgwritew; static alpha_chipset_cfgwritel_t apecs_swiz_cfgwritel; static alpha_chipset_addrcvt_t apecs_cvt_dense; -static alpha_chipset_read_hae_t apecs_read_hae; -static alpha_chipset_write_hae_t apecs_write_hae; static alpha_chipset_t apecs_swiz_chipset = { apecs_swiz_inb, @@ -132,8 +126,6 @@ static alpha_chipset_t apecs_swiz_chipset = { apecs_swiz_cfgwritel, apecs_cvt_dense, NULL, - apecs_read_hae, - apecs_write_hae, }; static int @@ -427,37 +419,18 @@ apecs_cvt_dense(vm_offset_t addr) } -static u_int64_t -apecs_read_hae(void) -{ - return apecs_hae_mem & 0xf8000000; -} - -static void -apecs_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - apecs_swiz_set_hae_mem(&pa); -} static int apecs_probe(device_t dev); static int apecs_attach(device_t dev); -static int apecs_setup_intr(device_t dev, device_t child, struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep); -static int apecs_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); +static void *apecs_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); +static int apecs_connect_intr(device_t dev, void* ih); + static device_method_t apecs_methods[] = { /* Device interface */ DEVMETHOD(device_probe, apecs_probe), DEVMETHOD(device_attach, apecs_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, apecs_setup_intr), - DEVMETHOD(bus_teardown_intr, apecs_teardown_intr), { 0, 0 } }; @@ -498,8 +471,6 @@ apecs_probe(device_t dev) } apecs_hae_mem = REGVAL(EPIC_HAXR1); - pci_init_resources(); - isa0 = device_add_child(dev, "isa", 0, 0); return 0; @@ -512,15 +483,7 @@ apecs_attach(device_t dev) { struct apecs_softc* sc = APECS_SOFTC(dev); apecs_init(); - - /* - * the avanti routes interrupts through the isa interrupt - * controller, so we need to special case it - */ - if(hwrpb->rpb_type == ST_DEC_2100_A50) - chipset.intrdev = isa0; - else - chipset.intrdev = apecs0; + chipset.intrdev = isa0; sc->dmem_base = APECS_PCI_DENSE; sc->smem_base = APECS_PCI_SPARSE; @@ -530,46 +493,9 @@ apecs_attach(device_t dev) set_iointr(alpha_dispatch_intr); - snprintf(chipset_type, sizeof(chipset_type), "apecs"); - chipset_bwx = 0; - chipset_ports = APECS_PCI_SIO; - chipset_memory = APECS_PCI_SPARSE; - chipset_dense = APECS_PCI_DENSE; - chipset_hae_mask = EPIC_HAXR1_EADDR; - bus_generic_attach(dev); return 0; } -static int -apecs_setup_intr(device_t dev, device_t child, - struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep) -{ - int error; - - error = rman_activate_resource(irq); - if (error) - return error; - - error = alpha_setup_intr(0x900 + (irq->r_start << 4), - intr, arg, cookiep, - &intrcnt[INTRCNT_EB64PLUS_IRQ + irq->r_start]); - if (error) - return error; - - /* Enable PCI interrupt */ - platform.pci_intr_enable(irq->r_start); - return 0; -} - -static int -apecs_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); -} - DRIVER_MODULE(apecs, root, apecs_driver, apecs_devclass, 0, 0); diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c index c68ef57720ffc..065c42065954e 100644 --- a/sys/alpha/pci/cia.c +++ b/sys/alpha/pci/cia.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cia.c,v 1.13 1998/12/02 09:33:27 dfr Exp $ + * $Id: cia.c,v 1.9 1998/09/16 08:24:30 dfr Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -96,18 +96,14 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> -#include <sys/rman.h> #include <alpha/pci/ciareg.h> #include <alpha/pci/ciavar.h> -#include <alpha/pci/pcibus.h> #include <machine/bwx.h> #include <machine/swiz.h> #include <machine/intr.h> -#include <machine/intrcnt.h> #include <machine/cpuconf.h> #include <machine/rpb.h> -#include <machine/resource.h> #define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) @@ -142,8 +138,6 @@ static alpha_chipset_cfgwriteb_t cia_bwx_cfgwriteb, cia_swiz_cfgwriteb; static alpha_chipset_cfgwritew_t cia_bwx_cfgwritew, cia_swiz_cfgwritew; static alpha_chipset_cfgwritel_t cia_bwx_cfgwritel, cia_swiz_cfgwritel; static alpha_chipset_addrcvt_t cia_cvt_dense, cia_cvt_bwx; -static alpha_chipset_read_hae_t cia_read_hae; -static alpha_chipset_write_hae_t cia_write_hae; static alpha_chipset_t cia_bwx_chipset = { cia_bwx_inb, @@ -167,8 +161,6 @@ static alpha_chipset_t cia_bwx_chipset = { cia_bwx_cfgwritel, cia_cvt_dense, cia_cvt_bwx, - cia_read_hae, - cia_write_hae, }; static alpha_chipset_t cia_swiz_chipset = { cia_swiz_inb, @@ -192,8 +184,6 @@ static alpha_chipset_t cia_swiz_chipset = { cia_swiz_cfgwritel, cia_cvt_dense, NULL, - cia_read_hae, - cia_write_hae, }; static u_int8_t @@ -449,30 +439,28 @@ cia_swiz_outl(u_int32_t port, u_int32_t data) } static __inline void -cia_swiz_set_hae_mem(u_int32_t *pa) +cia_swiz_set_hae_mem(u_int32_t pa) { - /* Only bother with region 1 */ + /* Only bother with region 1 */ #define REG1 (7 << 29) - if ((cia_hae_mem & REG1) != (*pa & REG1)) { - /* - * Seems fairly paranoid but this is what Linux does... - */ - u_int32_t msb = *pa & REG1; - int s = splhigh(); - cia_hae_mem = (cia_hae_mem & ~REG1) | msb; - REGVAL(CIA_CSR_HAE_MEM) = cia_hae_mem; - alpha_mb(); - cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); - splx(s); - *pa -= msb; - } + if ((cia_hae_mem & REG1) != (pa & REG1)) { + /* + * Seems fairly paranoid but this is what Linux does... + */ + int s = splhigh(); + cia_hae_mem = (cia_hae_mem & ~REG1) | (pa & REG1); + REGVAL(CIA_CSR_HAE_MEM) = cia_hae_mem; + alpha_mb(); + cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); + splx(s); + } } static u_int8_t cia_swiz_readb(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); return SPARSE_READ_BYTE(KV(CIA_PCI_SMEM1), pa); } @@ -480,7 +468,7 @@ static u_int16_t cia_swiz_readw(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); return SPARSE_READ_WORD(KV(CIA_PCI_SMEM1), pa); } @@ -488,14 +476,14 @@ static u_int32_t cia_swiz_readl(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); return SPARSE_READ_LONG(KV(CIA_PCI_SMEM1), pa); } static void cia_swiz_writeb(u_int32_t pa, u_int8_t data) { - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); SPARSE_WRITE_BYTE(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -503,7 +491,7 @@ cia_swiz_writeb(u_int32_t pa, u_int8_t data) static void cia_swiz_writew(u_int32_t pa, u_int16_t data) { - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); SPARSE_WRITE_WORD(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -511,7 +499,7 @@ cia_swiz_writew(u_int32_t pa, u_int16_t data) static void cia_swiz_writel(u_int32_t pa, u_int32_t data) { - cia_swiz_set_hae_mem(&pa); + cia_swiz_set_hae_mem(pa); SPARSE_WRITE_LONG(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -628,35 +616,12 @@ cia_cvt_bwx(vm_offset_t addr) return (addr |= CIA_EV56_BWMEM); } -static u_int64_t -cia_read_hae(void) -{ - return cia_hae_mem & REG1; -} -static void -cia_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - cia_swiz_set_hae_mem(&pa); -} static int cia_probe(device_t dev); static int cia_attach(device_t dev); -static struct resource *cia_alloc_resource(device_t bus, device_t child, - int type, int *rid, - u_long start, u_long end, - u_long count, u_int flags); -static int cia_activate_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); -static int cia_deactivate_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); -static int cia_release_resource(device_t bus, device_t child, - int type, int rid, struct resource *r); -static int cia_setup_intr(device_t dev, device_t child, struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep); -static int cia_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); +static void *cia_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); +static int cia_connect_intr(device_t dev, void* ih); static device_method_t cia_methods[] = { /* Device interface */ @@ -664,12 +629,8 @@ static device_method_t cia_methods[] = { DEVMETHOD(device_attach, cia_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, cia_setup_intr), - DEVMETHOD(bus_teardown_intr, cia_teardown_intr), + DEVMETHOD(bus_create_intr, cia_create_intr), + DEVMETHOD(bus_connect_intr, cia_connect_intr), { 0, 0 } }; @@ -721,7 +682,6 @@ cia_init() #if 0 chipset = cia_swiz_chipset; /* XXX */ - cia_ispyxis = 0; #endif if (platform.pci_intr_init) @@ -736,8 +696,6 @@ cia_probe(device_t dev) cia0 = dev; device_set_desc(dev, "2117x PCI adapter"); /* XXX */ - pci_init_resources(); - device_add_child(dev, "isa", 0, 0); return 0; @@ -803,54 +761,29 @@ cia_attach(device_t dev) if (!platform.iointr) /* XXX */ set_iointr(alpha_dispatch_intr); - if (cia_ispyxis) { - snprintf(chipset_type, sizeof(chipset_type), "pyxis"); - chipset_bwx = 1; - chipset_ports = CIA_EV56_BWIO; - chipset_memory = CIA_EV56_BWMEM; - chipset_dense = CIA_PCI_DENSE; - } else { - snprintf(chipset_type, sizeof(chipset_type), "cia"); - chipset_bwx = 0; - chipset_ports = CIA_PCI_SIO1; - chipset_memory = CIA_PCI_SMEM1; - chipset_dense = CIA_PCI_DENSE; - chipset_hae_mask = 7L << 29; - } - bus_generic_attach(dev); return 0; } -static int -cia_setup_intr(device_t dev, device_t child, - struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep) +static void * +cia_create_intr(device_t dev, device_t child, + int irq, driver_intr_t *intr, void *arg) { - int error; - - error = rman_activate_resource(irq); - if (error) - return error; - - error = alpha_setup_intr(0x900 + (irq->r_start << 4), - intr, arg, cookiep, - &intrcnt[INTRCNT_EB164_IRQ + irq->r_start]); - if (error) - return error; - - /* Enable PCI interrupt */ - platform.pci_intr_enable(irq->r_start); - - return 0; + return alpha_create_intr(0x900 + (irq << 4), intr, arg); } static int -cia_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); +cia_connect_intr(device_t dev, void* ih) +{ + struct alpha_intr *i = ih; + int s = splhigh(); + int error = alpha_connect_intr(i); + if (!error) { + /* Enable PCI interrupt */ + platform.pci_intr_enable((i->vector - 0x900) >> 4); + } + splx(s); + return error; } DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0); diff --git a/sys/alpha/pci/lca.c b/sys/alpha/pci/lca.c index f3b194da6332a..58f873f3ff74f 100644 --- a/sys/alpha/pci/lca.c +++ b/sys/alpha/pci/lca.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lca.c,v 1.4 1998/11/15 18:25:16 dfr Exp $ + * $Id: lca.c,v 1.2 1998/09/23 21:23:51 msmith Exp $ */ #include <sys/param.h> @@ -34,7 +34,6 @@ #include <alpha/pci/lcareg.h> #include <alpha/pci/lcavar.h> -#include <alpha/pci/pcibus.h> #include <machine/swiz.h> #include <machine/intr.h> #include <machine/cpuconf.h> @@ -71,8 +70,6 @@ static alpha_chipset_cfgwriteb_t lca_cfgwriteb; static alpha_chipset_cfgwritew_t lca_cfgwritew; static alpha_chipset_cfgwritel_t lca_cfgwritel; static alpha_chipset_addrcvt_t lca_cvt_dense; -static alpha_chipset_read_hae_t lca_read_hae; -static alpha_chipset_write_hae_t lca_write_hae; static alpha_chipset_t lca_chipset = { lca_inb, @@ -95,9 +92,6 @@ static alpha_chipset_t lca_chipset = { lca_cfgwritew, lca_cfgwritel, lca_cvt_dense, - NULL, - lca_read_hae, - lca_write_hae, }; static u_int8_t @@ -318,18 +312,6 @@ lca_cvt_dense(vm_offset_t addr) } -static u_int64_t -lca_read_hae(void) -{ - return lca_hae_mem & 0xf8000000; -} - -static void -lca_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - lca_set_hae_mem(&pa); -} static int lca_probe(device_t dev); static int lca_attach(device_t dev); @@ -342,10 +324,6 @@ static device_method_t lca_methods[] = { DEVMETHOD(device_attach, lca_attach), /* Bus interface */ - DEVMETHOD(bus_alloc_resource, pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), { 0, 0 } }; @@ -397,13 +375,6 @@ lca_attach(device_t dev) set_iointr(alpha_dispatch_intr); - snprintf(chipset_type, sizeof(chipset_type), "lca"); - chipset_bwx = 0; - chipset_ports = LCA_PCI_SIO; - chipset_memory = LCA_PCI_SPARSE; - chipset_dense = LCA_PCI_DENSE; - chipset_hae_mask = IOC_HAE_ADDREXT; - bus_generic_attach(dev); return 0; } diff --git a/sys/alpha/pci/pci_eb64plus_intr.s b/sys/alpha/pci/pci_eb64plus_intr.s deleted file mode 100644 index 472d741631aa3..0000000000000 --- a/sys/alpha/pci/pci_eb64plus_intr.s +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: pci_eb64plus_intr.s,v 1.2 1997/09/02 13:19:43 thorpej 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. - */ - -/* - * This file hacked from pci_eb164_intr.s - * - * These functions were written by disassembling a Digital UNIX kernel's - * eb64p_intrdsabl and eb64p_intrenabl functions (because they had - * interesting names, and looked like the eb164 versions which were - * known to already work), and then playing with them to see how to call - * them correctly. - * - * It looks like the right thing to do is to call them with the interrupt - * request that you want to enable or disable (presumably in the range - * 0 -> 23, since there are 3 8-bit interrupt-enable bits in the - * interrupt mask PLD). - */ - -#include <machine/asm.h> - -__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus_intr.s,v 1.2 1997/09/02 13:19:43 thorpej Exp $"); - - .text -LEAF(eb64plus_intr_enable,1) - mov a0, a1 - ldiq a0, 0x34 - call_pal PAL_cserve - RET - END(eb64plus_intr_enable) - - .text -LEAF(eb64plus_intr_disable,1) - mov a0, a1 - ldiq a0, 0x35 - call_pal PAL_cserve - RET - END(eb64plus_intr_enable) diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c index 697373cec37d5..0cafff2d77387 100644 --- a/sys/alpha/pci/pcibus.c +++ b/sys/alpha/pci/pcibus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.7 1998/11/18 23:53:12 dfr Exp $ + * $Id: pcibus.c,v 1.4 1998/08/10 07:53:59 dfr Exp $ * */ @@ -33,34 +33,13 @@ #include <sys/module.h> #include <sys/bus.h> #include <sys/interrupt.h> -#include <sys/sysctl.h> -#include <sys/rman.h> #include <pci/pcivar.h> #include <machine/chipset.h> #include <machine/cpuconf.h> -#include <machine/resource.h> -char chipset_type[10]; -int chipset_bwx = 0; -long chipset_ports = 0; -long chipset_memory = 0; -long chipset_dense = 0; -long chipset_hae_mask = 0; - -SYSCTL_NODE(_hw, OID_AUTO, chipset, CTLFLAG_RW, 0, "PCI chipset information"); -SYSCTL_STRING(_hw_chipset, OID_AUTO, type, CTLFLAG_RD, chipset_type, 0, - "PCI chipset type"); -SYSCTL_INT(_hw_chipset, OID_AUTO, bwx, CTLFLAG_RD, &chipset_bwx, 0, - "PCI chipset supports BWX access"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports, - "PCI chipset port address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory, - "PCI chipset memory address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, - "PCI chipset dense memory address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, - "PCI chipset mask for HAE register"); +static int cfgmech; +static int devmax; #ifdef notyet @@ -137,27 +116,22 @@ struct intrec * intr_create(void *dev_instance, int irq, inthand2_t handler, void *arg, intrmask_t *maskptr, int flags) { - struct resource *res; device_t pcib = chipset.intrdev; - int zero = 0; - void *cookie; - - res = BUS_ALLOC_RESOURCE(pcib, NULL, SYS_RES_IRQ, &zero, - irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); - if (BUS_SETUP_INTR(pcib, pcib, res, (driver_intr_t *)handler, arg, &cookie)) + if (pcib) + return BUS_CREATE_INTR(pcib, pcib, irq, + (driver_intr_t*) handler, arg); + else return 0; - - return (struct intrec *)cookie; } int intr_connect(struct intrec *idesc) { - /* - * intr_create has already connected it (doesn't matter for the - * only consumer of this interface (pci). - */ - return 0; + device_t pcib = chipset.intrdev; + if (pcib) + return BUS_CONNECT_INTR(pcib, idesc); + else + return EINVAL; } void @@ -167,86 +141,6 @@ alpha_platform_assign_pciintr(pcicfgregs *cfg) platform.pci_intr_map((void *)cfg); } -static struct rman irq_rman, port_rman, mem_rman; - -void pci_init_resources() -{ - irq_rman.rm_start = 0; - irq_rman.rm_end = 32; - irq_rman.rm_type = RMAN_ARRAY; - irq_rman.rm_descr = "PCI Interrupt request lines"; - if (rman_init(&irq_rman) - || rman_manage_region(&irq_rman, 0, 31)) - panic("cia_probe irq_rman"); - - port_rman.rm_start = 0; - port_rman.rm_end = 0xffff; - port_rman.rm_type = RMAN_ARRAY; - port_rman.rm_descr = "I/O ports"; - if (rman_init(&port_rman) - || rman_manage_region(&port_rman, 0, 0xffff)) - panic("cia_probe port_rman"); - - mem_rman.rm_start = 0; - mem_rman.rm_end = ~0u; - mem_rman.rm_type = RMAN_ARRAY; - mem_rman.rm_descr = "I/O memory addresses"; - if (rman_init(&mem_rman) - || rman_manage_region(&mem_rman, 0x0, (1L << 32))) - panic("cia_probe mem_rman"); -} - -/* - * Allocate a resource on behalf of child. NB: child is usually going to be a - * child of one of our descendants, not a direct child of the pci chipset. - */ -struct resource * -pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct rman *rm; - - switch (type) { - case SYS_RES_IRQ: - rm = &irq_rman; - break; - - case SYS_RES_IOPORT: - rm = &port_rman; - break; - - case SYS_RES_MEMORY: - rm = &mem_rman; - break; - - default: - return 0; - } - - return rman_reserve_resource(rm, start, end, count, flags, child); -} - -int -pci_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_activate_resource(r)); -} - -int -pci_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_deactivate_resource(r)); -} - -int -pci_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_release_resource(r)); -} - void memcpy_fromio(void *d, u_int32_t s, size_t size) { diff --git a/sys/alpha/pci/pcibus.h b/sys/alpha/pci/pcibus.h index 38b51b772e9cf..eb56cec1e2d86 100644 --- a/sys/alpha/pci/pcibus.h +++ b/sys/alpha/pci/pcibus.h @@ -23,17 +23,19 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pcibus.h,v 1.1 1998/06/10 10:55:38 dfr Exp $ + * $Id$ */ -void pci_init_resources(void); -struct resource *pci_alloc_resource(device_t bus, device_t child, - int type, int *rid, - u_long start, u_long end, u_long count, - u_int flags); -int pci_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); -int pci_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); -int pci_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); +typedef int alpha_pci_maxdevs_t(pcicfgregs*); +typedef int alpha_pci_cfgread_t(pcicfgregs*, int, int); +typedef void alpha_pci_cfgwrite_t(pcicfgregs*, int, int, int); + +struct alpha_pci_ops { + alpha_pci_maxdevs_t* maxdevs; + alpha_pci_cfgread_t* cfgread; + alpha_pci_cfgwrite_t* cfgwrite; +}; + +struct alpha_pci_softc { + struct alpha_pci_ops* ops; +}; diff --git a/sys/alpha/tc/am7990.c b/sys/alpha/tc/am7990.c index d734c155c3223..6c65f8248d467 100644 --- a/sys/alpha/tc/am7990.c +++ b/sys/alpha/tc/am7990.c @@ -1,4 +1,4 @@ -/* $Id: am7990.c,v 1.1 1998/08/20 08:27:10 dfr Exp $ */ +/* $Id$ */ /* $NetBSD: am7990.c,v 1.43 1998/03/29 22:36:42 mycroft Exp $ */ /*- @@ -194,8 +194,7 @@ am7990_config(sc) /* Make sure the chip is stopped. */ am7990_stop(sc); /* Initialize ifnet structure. */ - snprintf(sc->sc_dev.dv_xname, - sizeof(sc->sc_dev.dv_xname), "le%d", sc->unit); + sprintf(sc->sc_dev.dv_xname, "le%d", sc->unit); ifp->if_unit = sc->unit; ifp->if_name = "le"; ifp->if_softc = sc; diff --git a/sys/alpha/tc/espvar.h b/sys/alpha/tc/espvar.h index b64b774026855..ad5d139ff6584 100644 --- a/sys/alpha/tc/espvar.h +++ b/sys/alpha/tc/espvar.h @@ -1,4 +1,4 @@ -/* $Id: espvar.h,v 1.1 1998/08/20 08:27:10 dfr Exp $ */ +/* $Id$ */ /* $NetBSD: espvar.h,v 1.3.4.1 1996/09/10 17:28:18 cgd Exp $ */ /* @@ -74,7 +74,8 @@ struct ecb { #define ECB_TRACE(ecb, msg, a, b) do { \ const char *f = "[" msg "]"; \ int n = strlen((ecb)->trace); \ - snprintf((ecb)->trace + n, sizeof((ecb)->trace) - n, f, a, b); \ + if (n < (sizeof((ecb)->trace)-100)) \ + sprintf((ecb)->trace + n, f, a, b); \ } while(0) #else #define ECB_TRACE(ecb, msg, a, b) diff --git a/sys/alpha/tlsb/dwlpx.c b/sys/alpha/tlsb/dwlpx.c index bb80abf255766..7db56ce21960a 100644 --- a/sys/alpha/tlsb/dwlpx.c +++ b/sys/alpha/tlsb/dwlpx.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwlpx.c,v 1.6 1998/09/04 08:01:26 dfr Exp $ + * $Id: dwlpx.c,v 1.5 1998/08/10 07:53:59 dfr Exp $ */ #include "opt_simos.h" @@ -288,8 +288,6 @@ dwlpx_attach(device_t dev) struct dwlpx_softc* sc = DWLPX_SOFTC(dev); device_t parent = device_get_parent(dev); vm_offset_t regs; - void *intr; - dwlpx0 = dev; chipset = dwlpx_chipset; @@ -303,7 +301,9 @@ dwlpx_attach(device_t dev) *(u_int32_t*) (regs + PCIA_CTL(0)) = 1; /* Type1 config cycles */ - return BUS_SETUP_INTR(parent, dev, NULL, dwlpx_intr, 0, &intr); + BUS_CONNECT_INTR(parent, + BUS_CREATE_INTR(parent, dev, + 0, dwlpx_intr, 0)); return 0; } diff --git a/sys/alpha/tlsb/gbus.c b/sys/alpha/tlsb/gbus.c index f98a3bd4f24f4..9894889cc1d06 100644 --- a/sys/alpha/tlsb/gbus.c +++ b/sys/alpha/tlsb/gbus.c @@ -92,8 +92,8 @@ static device_method_t gbus_methods[] = { DEVMETHOD(bus_print_child, gbus_print_child), DEVMETHOD(bus_read_ivar, gbus_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_create_intr, bus_generic_create_intr), + DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), { 0, 0 } }; @@ -134,7 +134,7 @@ gbus_print_child(device_t bus, device_t dev) { struct gbus_device* gdev = DEVTOGBUS(dev); - printf(" at %s%d offset 0x%x", + printf(" at %s%d offset 0x%lx", device_get_name(bus), device_get_unit(bus), gdev->gd_offset); } diff --git a/sys/alpha/tlsb/kftxx.c b/sys/alpha/tlsb/kftxx.c index d85b202a4a1e9..6f9f89a903ce4 100644 --- a/sys/alpha/tlsb/kftxx.c +++ b/sys/alpha/tlsb/kftxx.c @@ -1,4 +1,4 @@ -/* $Id: kftxx.c,v 1.3 1998/07/12 16:23:17 dfr Exp $ */ +/* $Id: kftxx.c,v 1.2 1998/06/14 13:45:24 dfr Exp $ */ /* $NetBSD: kftxx.c,v 1.9 1998/05/14 00:01:32 thorpej Exp $ */ /* @@ -89,8 +89,8 @@ static device_method_t kft_methods[] = { DEVMETHOD(bus_print_child, kft_print_child), DEVMETHOD(bus_read_ivar, kft_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_create_intr, bus_generic_create_intr), + DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), { 0, 0 } }; diff --git a/sys/alpha/tlsb/tlsb.c b/sys/alpha/tlsb/tlsb.c index 00aff9adf87ae..6e618a3a11e14 100644 --- a/sys/alpha/tlsb/tlsb.c +++ b/sys/alpha/tlsb/tlsb.c @@ -95,11 +95,8 @@ static devclass_t tlsb_devclass; static int tlsb_probe(device_t dev); static void tlsb_print_child(device_t dev, device_t child); static int tlsb_read_ivar(device_t dev, device_t child, int which, u_long* result); -static int tlsb_setup_intr(device_t dev, device_t child, - struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep); -static int tlsb_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); +static void *tlsb_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); +static int tlsb_connect_intr(device_t dev, void* ih); static device_method_t tlsb_methods[] = { /* Device interface */ @@ -112,8 +109,8 @@ static device_method_t tlsb_methods[] = { DEVMETHOD(bus_print_child, tlsb_print_child), DEVMETHOD(bus_read_ivar, tlsb_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, tlsb_setup_intr), - DEVMETHOD(bus_teardown_intr, tlsb_teardown_intr), + DEVMETHOD(bus_create_intr, tlsb_create_intr), + DEVMETHOD(bus_connect_intr, tlsb_connect_intr), { 0, 0 } }; @@ -268,32 +265,27 @@ tlsb_read_ivar(device_t dev, device_t child, return ENOENT; } -static int -tlsb_setup_intr(device_t dev, device_t child, - struct resource *irq, - driver_intr_t *intr, void *arg, void **cookiep) +static void * +tlsb_create_intr(device_t dev, device_t child, + int irq, driver_intr_t *intr, void *arg) { struct tlsb_softc* sc = device_get_softc(dev); struct intr_mapping* i; i = malloc(sizeof(struct intr_mapping), M_DEVBUF, M_NOWAIT); if (!i) - return ENOMEM; + return NULL; i->intr = intr; i->arg = arg; - STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue); - *cookiep = i; - return 0; + return i; } static int -tlsb_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) +tlsb_connect_intr(device_t dev, void *ih) { struct tlsb_softc* sc = device_get_softc(dev); - struct intr_mapping* i = cookie; + struct intr_mapping* i = ih; - STAILQ_REMOVE(&sc->intr_handlers, i, intr_mapping, queue); - free(i, M_DEVBUF); + STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue); return 0; } @@ -343,8 +335,7 @@ tlsb_node_type_str(u_int32_t dtype) default: bzero(tlsb_line, sizeof(tlsb_line)); - snprintf(tlsb_line, sizeof(tlsb_line), - "unknown, dtype 0x%x", dtype); + sprintf(tlsb_line, "unknown, dtype 0x%x", dtype); return (tlsb_line); } /* NOTREACHED */ diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index e88b8b104cc80..f5e7032b176d2 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.5 1998/07/31 09:20:01 dfr Exp $ + * $Id: zs_tlsb.c,v 1.4 1998/07/12 16:23:19 dfr Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -385,7 +385,6 @@ struct zsc_softc { caddr_t base; struct zs_softc* sc_a; struct zs_softc* sc_b; - void *intr; }; static int zsc_tlsb_probe(device_t dev); @@ -405,8 +404,8 @@ static device_method_t zsc_tlsb_methods[] = { DEVMETHOD(bus_print_child, zsc_tlsb_print_child), DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_create_intr, bus_generic_create_intr), + DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), { 0, 0 } }; @@ -456,7 +455,6 @@ zsc_tlsb_attach(device_t dev) { struct zsc_softc* sc = device_get_softc(dev); device_t parent = device_get_parent(dev); - void *ih; bus_generic_attach(dev); @@ -464,9 +462,9 @@ zsc_tlsb_attach(device_t dev) sc->sc_a = ZS_SOFTC(0); sc->sc_b = ZS_SOFTC(1); - /* XXX should use resource argument to communicate vector */ - return BUS_SETUP_INTR(parent, dev, NULL, zsc_tlsb_intr, sc, - &sc->intr); + BUS_CONNECT_INTR(parent, + BUS_CREATE_INTR(parent, dev, + 1, zsc_tlsb_intr, sc)); return 0; } |
