From: pefo Date: Sat, 19 Apr 1997 17:19:36 +0000 (+0000) Subject: -Wall cleanup. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1f802eae026644cc078c14fc36b7175b9668ecc8;p=openbsd -Wall cleanup. Change to new MI assym.h file generation. (genassym.cf) --- diff --git a/sys/arch/arc/algor/algor.h b/sys/arch/arc/algor/algor.h index c1c68d51f1e..c5fc4604120 100644 --- a/sys/arch/arc/algor/algor.h +++ b/sys/arch/arc/algor/algor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: algor.h,v 1.2 1997/03/23 11:34:25 pefo Exp $ */ +/* $OpenBSD: algor.h,v 1.3 1997/04/19 17:19:36 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -107,6 +107,9 @@ struct algor_int_desc { int spl_mask; /* Spl mask for interrupt */ }; -int algor_intrnull __P((void *)); +int algor_intrnull __P((void *)); +void *algor_pci_intr_establish __P((int, int, intr_handler_t, void *, void *)); +void algor_pci_intr_disestablish __P((void *)); + #endif /* _ALGOR_H_ */ diff --git a/sys/arch/arc/algor/algorbus.c b/sys/arch/arc/algor/algorbus.c index d4da9705fb1..5de45b8ade8 100644 --- a/sys/arch/arc/algor/algorbus.c +++ b/sys/arch/arc/algor/algorbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: algorbus.c,v 1.2 1997/03/23 11:34:26 pefo Exp $ */ +/* $OpenBSD: algorbus.c,v 1.3 1997/04/19 17:19:37 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -33,8 +33,12 @@ */ #include +#include +#include +#include #include +#include #include #include #include @@ -265,6 +269,7 @@ algor_intr_establish(ca, handler, arg) void * algor_pci_intr_establish(ih, level, handler, arg, name) + int ih; int level; intr_handler_t handler; void *arg; @@ -282,7 +287,7 @@ algor_pci_intr_establish(ih, level, handler, arg, name) } imask = (0x1000 << ih); - route = (0x30000 << ih+ih); + route = (0x30000 << (ih+ih)); slot = NUM_INT_SLOTS; while(slot > 0) { @@ -316,8 +321,6 @@ void algor_intr_disestablish(ca) struct confargs *ca; { - struct algor_softc *sc = algor_cd.cd_devs[0]; - int slot; slot = ca->ca_slot; @@ -325,9 +328,7 @@ algor_intr_disestablish(ca) outb(P4032_IMR, p4032_imask); outb(P4032_PCIIMR, p4032_imask >> 8); - if(slot = 0) { /* Slot 0 is special, clock */ - } - else { + if(slot != 0) { /* Slot 0 is special, clock */ int_table[slot].int_mask = 0; int_table[slot].int_hand = algor_intrnull; int_table[slot].param = (void *)NULL; @@ -395,8 +396,6 @@ algor_clkintr(mask, cf) unsigned mask; struct clockframe *cf; { - int temp; - /* Ack clock interrupt */ outb(P4032_CLOCK, MC_REGC); (void) inb(P4032_CLOCK + 4); diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c index 17a755731ab..defd56eb6e9 100644 --- a/sys/arch/arc/arc/arcbios.c +++ b/sys/arch/arc/arc/arcbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.c,v 1.6 1997/03/23 11:34:26 pefo Exp $ */ +/* $OpenBSD: arcbios.c,v 1.7 1997/04/19 17:19:38 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * Copyright (c) 1996 Per Fogelstrom. All rights reserved. @@ -28,8 +28,10 @@ * SUCH DAMAGE. */ -#include #include +#include +#include +#include #include #include #include @@ -42,6 +44,16 @@ arc_param_blk_t *bios_base = (arc_param_blk_t *) 0x80001000; extern int cputype; /* Mother board type */ extern int physmem; /* Total physical memory size */ +int Bios_Read __P((int, char *, int, int *)); +int Bios_Write __P((int, char *, int, int *)); +arc_mem_t *Bios_GetMemoryDescriptor __P((arc_mem_t *)); +arc_sid_t *Bios_GetSystemId __P((void)); +arc_config_t *Bios_GetChild __P((arc_config_t *)); +arc_dsp_stat_t *Bios_GetDisplayStatus __P((int)); + +static void bios_configure_memory __P((void)); +static int get_cpu_type __P((void)); + char buf[100]; /*XXX*/ arc_dsp_stat_t displayinfo; /* Save area for display status info. */ @@ -117,16 +129,18 @@ ARC_Call(Bios_GetDisplayStatus, 0x90); * Simple getchar/putchar interface. */ +int bios_getchar() { char buf[4]; int cnt; - if(Bios_Read(0, &buf, 1, &cnt) != 0) + if(Bios_Read(0, &buf[0], 1, &cnt) != 0) return(-1); return(buf[0] & 255); } +void bios_putchar(c) char c; { @@ -144,11 +158,10 @@ char c; buf[0] = c; cnt = 1; } - if(Bios_Write(1, &buf, cnt, &cnt) != 0) - return(-1); - return(0); + Bios_Write(1, &buf[0], cnt, &cnt); } +void bios_putstring(s) char *s; { @@ -165,6 +178,7 @@ char *s; * * Concatenate obvious adjecent segments. */ +static void bios_configure_memory() { arc_mem_t *descr = 0; @@ -237,7 +251,7 @@ bios_configure_memory() /* * Find out system type. */ -int +static int get_cpu_type() { arc_config_t *cf; diff --git a/sys/arch/arc/arc/arcbios.h b/sys/arch/arc/arc/arcbios.h index 42134936152..9fb004ee156 100644 --- a/sys/arch/arc/arc/arcbios.h +++ b/sys/arch/arc/arc/arcbios.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.h,v 1.2 1996/09/14 15:58:12 pefo Exp $ */ +/* $OpenBSD: arcbios.h,v 1.3 1997/04/19 17:19:38 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * @@ -289,9 +289,9 @@ typedef struct arc_calls char *, /* Variable */ char *); /* Value */ - arc_status_t (*get_file_info)(); /* GetFileInformation 33 */ + arc_status_t (*get_file_info)(void); /* GetFileInformation 33 */ - arc_status_t (*set_file_info)(); /* SetFileInformation 34 */ + arc_status_t (*set_file_info)(void); /* SetFileInformation 34 */ void (*flush_all_caches)(void); /* FlushAllCaches 35 */ @@ -328,4 +328,11 @@ typedef struct arc_param_blk #define ArcBiosBase ((arc_param_blk_t *) 0x80001000) #define ArcBios (ArcBiosBase->firmware_vect) -extern void arcbios_ident(void); + +int bios_getchar __P((void)); +void bios_putchar __P((char)); +void bios_putstring __P((char *)); +void bios_ident __P((void)); +void bios_display_info __P((int *, int *, int *, int *)); + + diff --git a/sys/arch/arc/arc/autoconf.c b/sys/arch/arc/arc/autoconf.c index 77eb3af4b50..07a78650cd1 100644 --- a/sys/arch/arc/arc/autoconf.c +++ b/sys/arch/arc/arc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.7 1997/04/13 11:53:26 pefo Exp $ */ +/* $OpenBSD: autoconf.c,v 1.8 1997/04/19 17:19:39 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -41,7 +41,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.7 1997/04/13 11:53:26 pefo Exp $ + * $Id: autoconf.c,v 1.8 1997/04/19 17:19:39 pefo Exp $ */ /* @@ -64,6 +64,14 @@ struct device *parsedisk __P((char *, int, int, dev_t *)); void setroot __P((void)); +void configure __P((void)); +void swapconf __P((void)); +extern void dumpconf __P((void)); +static int findblkmajor __P((struct device *)); +static struct device * getdisk __P((char *, int, int, dev_t *)); +struct device * getdevunit __P((char *, int)); +void makebootdev __P((char *cp)); +int getpno __P((char **)); /* * The following several variables are related to @@ -79,6 +87,7 @@ struct device *bootdv = NULL; * Configure all devices found that we know about. * This is done at boot time. */ +void configure() { (void)splhigh(); /* To be really sure.. */ @@ -94,6 +103,7 @@ configure() /* * Configure swap space and related parameters. */ +void swapconf() { register struct swdevt *swp; @@ -171,7 +181,7 @@ parsedisk(str, len, defpart, devp) { register struct device *dv; register char *cp, c; - int majdev, mindev, part; + int majdev, part; if (len == 0) return (NULL); @@ -461,6 +471,7 @@ makebootdev(cp) sprintf(bootdev, "%s%d%c", dp->dev, ctrl*16 + unit, 'a' + part); } +int getpno(cp) char **cp; { diff --git a/sys/arch/arc/arc/clock.c b/sys/arch/arc/arc/clock.c index 604cff9a977..4520fa2379b 100644 --- a/sys/arch/arc/arc/clock.c +++ b/sys/arch/arc/arc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.4 1997/03/12 19:16:38 pefo Exp $ */ +/* $OpenBSD: clock.c,v 1.5 1997/04/19 17:19:39 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: clock.c 1.18 91/01/21 * * from: @(#)clock.c 8.1 (Berkeley) 6/10/93 - * $Id: clock.c,v 1.4 1997/03/12 19:16:38 pefo Exp $ + * $Id: clock.c,v 1.5 1997/04/19 17:19:39 pefo Exp $ */ #include @@ -80,6 +80,7 @@ struct cfattach clock_algor_ca = { }; void mcclock_attach __P((struct device *, struct device *, void *)); +int clockintr __P((void *)); #define SECMIN ((unsigned)60) /* seconds per minute */ #define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */ @@ -242,7 +243,7 @@ inittodr(base) struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0]; register int days, yr; long deltat; - int badbase, s; + int badbase; if (base < 5*SECYR) { printf("WARNING: preposterous time in file system"); @@ -311,7 +312,6 @@ resettodr() struct tod_time c; struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0]; register int t, t2; - int s; if(!csc->sc_initted) return; diff --git a/sys/arch/arc/arc/clock_mc.c b/sys/arch/arc/arc/clock_mc.c index e9ceed3d18c..7515d07af3f 100644 --- a/sys/arch/arc/arc/clock_mc.c +++ b/sys/arch/arc/arc/clock_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock_mc.c,v 1.6 1997/03/23 11:34:27 pefo Exp $ */ +/* $OpenBSD: clock_mc.c,v 1.7 1997/04/19 17:19:40 pefo Exp $ */ /* $NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp $ */ /* @@ -112,9 +112,6 @@ mcclock_attach(parent, self, aux) { struct clock_softc *csc = (struct clock_softc *)self; - register volatile struct chiptime *c; - struct confargs *ca = aux; - printf(": mc146818 or compatible"); csc->sc_get = mcclock_get; @@ -246,7 +243,7 @@ mc_write_pica(csc, reg, datum) struct clock_softc *csc; u_int reg, datum; { - int i,as; + int as; as = in32(PICA_SYS_ISA_AS) & 0x80; out32(PICA_SYS_ISA_AS, as | reg); diff --git a/sys/arch/arc/arc/conf.c b/sys/arch/arc/arc/conf.c index f9a99023e3f..f9b78dcc762 100644 --- a/sys/arch/arc/arc/conf.c +++ b/sys/arch/arc/arc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.13 1997/03/23 11:34:27 pefo Exp $ */ +/* $OpenBSD: conf.c,v 1.14 1997/04/19 17:19:40 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)conf.c 8.2 (Berkeley) 11/14/93 - * $Id: conf.c,v 1.13 1997/03/23 11:34:27 pefo Exp $ + * $Id: conf.c,v 1.14 1997/04/19 17:19:40 pefo Exp $ */ #include @@ -216,6 +216,7 @@ dev_t swapdev = makedev(1, 0); * * A minimal stub routine can always return 0. */ +int iskmemdev(dev) dev_t dev; { @@ -232,6 +233,7 @@ iskmemdev(dev) /* * Returns true if def is /dev/zero */ +int iszerodev(dev) dev_t dev; { @@ -309,6 +311,7 @@ static int chrtoblktbl[MAXDEV] = { * * A minimal stub routine can always return NODEV. */ +dev_t chrtoblk(dev) dev_t dev; { diff --git a/sys/arch/arc/arc/cpu.c b/sys/arch/arc/arc/cpu.c index 9db015785d2..05fa55cb105 100644 --- a/sys/arch/arc/arc/cpu.c +++ b/sys/arch/arc/arc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.7 1997/04/10 16:29:04 pefo Exp $ */ +/* $OpenBSD: cpu.c,v 1.8 1997/04/19 17:19:41 pefo Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -33,8 +33,12 @@ */ #include +#include +#include +#include #include +#include #include #include @@ -50,15 +54,12 @@ struct cfdriver cpu_cd = { NULL, "cpu", DV_DULL, NULL, 0 }; -static int cpuprint __P((void *, const char *pnp)); - static int cpumatch(parent, cfdata, aux) struct device *parent; void *cfdata; void *aux; { - struct cfdata *cf = cfdata; struct confargs *ca = aux; /* make sure that we're looking for a CPU. */ @@ -74,8 +75,6 @@ cpuattach(parent, dev, aux) struct device *dev; void *aux; { - struct pcs *p; - int needcomma, needrev, i; printf(": "); @@ -199,5 +198,10 @@ cpuattach(parent, dev, aux) printf(" Two way set associative.\n"); else printf(" Direct mapped.\n"); + + if(l2cache_is_snooping) + printf("No L2 cache or Snooping L2 cache.\n"); + else + printf("No Snooping L2 cache!.\n"); } diff --git a/sys/arch/arc/arc/cpu_exec.c b/sys/arch/arc/arc/cpu_exec.c index 0b12677528f..8d7087e349d 100644 --- a/sys/arch/arc/arc/cpu_exec.c +++ b/sys/arch/arc/arc/cpu_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu_exec.c,v 1.3 1997/03/23 11:34:28 pefo Exp $ */ +/* $OpenBSD: cpu_exec.c,v 1.4 1997/04/19 17:19:41 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -50,6 +50,10 @@ #include #include +#if defined(_KERN_DO_ECOFF) +void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, + u_long, register_t *)); +#endif /* * cpu_exec_aout_makecmds(): * cpu-dependent a.out format hook for execve(). diff --git a/sys/arch/arc/arc/genassym.c b/sys/arch/arc/arc/genassym.c deleted file mode 100644 index 5f605da65de..00000000000 --- a/sys/arch/arc/arc/genassym.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: genassym.c,v 1.1.1.1 1996/06/24 09:07:20 pefo Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * 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. - * - * from: @(#)genassym.c 8.2 (Berkeley) 9/23/93 - * $Id: genassym.c,v 1.1.1.1 1996/06/24 09:07:20 pefo Exp $ - */ - - -#include -#include -#include -#include -#include -#include - -#include - -main() -{ - register struct proc *p = (struct proc *)0; - register struct user *up = (struct user *)0; - register struct vmmeter *vm = (struct vmmeter *)0; - register int size, s, n; - - printf("#define\tP_FORW %d\n", &p->p_forw); - printf("#define\tP_BACK %d\n", &p->p_back); - printf("#define\tP_PRIORITY %d\n", &p->p_priority); - printf("#define\tP_ADDR %d\n", &p->p_addr); - printf("#define\tP_UPTE %d\n", p->p_md.md_upte); - printf("#define\tU_PCB_REGS %d\n", up->u_pcb.pcb_regs); - printf("#define\tU_PCB_FPREGS %d\n", &up->u_pcb.pcb_regs[F0]); - printf("#define\tU_PCB_CONTEXT %d\n", &up->u_pcb.pcb_context); - printf("#define\tU_PCB_ONFAULT %d\n", &up->u_pcb.pcb_onfault); - printf("#define\tU_PCB_SEGTAB %d\n", &up->u_pcb.pcb_segtab); - printf("#define\tVM_MIN_ADDRESS 0x%x\n", VM_MIN_ADDRESS); - printf("#define\tVM_MIN_KERNEL_ADDRESS 0x%x\n", VM_MIN_KERNEL_ADDRESS); - printf("#define\tV_SWTCH %d\n", &vm->v_swtch); - printf("#define\tSIGILL %d\n", SIGILL); - printf("#define\tSIGFPE %d\n", SIGFPE); - exit(0); -} diff --git a/sys/arch/arc/arc/genassym.cf b/sys/arch/arc/arc/genassym.cf new file mode 100644 index 00000000000..09c1dc46315 --- /dev/null +++ b/sys/arch/arc/arc/genassym.cf @@ -0,0 +1,57 @@ +# $OpenBSD: genassym.cf,v 1.1 1997/04/19 17:19:42 pefo Exp $ */ +# +# Copyright (c) 1997 Per Fogelstrom / Opsycon AB +# +# 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 under OpenBSD by +# Per Fogelstrom. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + + +include +include +include +include +include +include + +include + + +define P_FORW offsetof(struct proc, p_forw) +define P_BACK offsetof(struct proc, p_back) +define P_PRIORITY offsetof(struct proc, p_priority) +define P_ADDR offsetof(struct proc, p_addr) +define P_UPTE offsetof(struct proc, p_md.md_upte) +define U_PCB_REGS offsetof(struct user, u_pcb.pcb_regs[ZERO]) +define U_PCB_FPREGS offsetof(struct user, u_pcb.pcb_regs[F0]) +define U_PCB_CONTEXT offsetof(struct user, u_pcb.pcb_context) +define U_PCB_ONFAULT offsetof(struct user, u_pcb.pcb_onfault) +define U_PCB_SEGTAB offsetof(struct user, u_pcb.pcb_segtab) +define V_SWTCH offsetof(struct vmmeter, v_swtch) + +define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS +define SIGFPE SIGFPE diff --git a/sys/arch/arc/arc/locore.S b/sys/arch/arc/arc/locore.S index 89dab508a0e..d6a27529e40 100644 --- a/sys/arch/arc/arc/locore.S +++ b/sys/arch/arc/arc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.11 1997/04/10 16:29:06 pefo Exp $ */ +/* $OpenBSD: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -50,7 +50,7 @@ * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL) * * from: @(#)locore.s 8.5 (Berkeley) 1/4/94 - * $Id: locore.S,v 1.11 1997/04/10 16:29:06 pefo Exp $ + * $Id: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ */ /* @@ -78,8 +78,8 @@ #define START_FRAME ((4 * 4) + 4 + 4) .globl start - .globl _C_LABEL(kernel_start) - _C_LABEL(kernel_start) = start + .globl kernel_start +kernel_start = start start: mtc0 zero, COP_0_STATUS_REG # Disable interrupts mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts @@ -267,6 +267,21 @@ LEAF(fillw) nop END(fillw) +/* + * Optimized memory zero code. + * mem_zero_page(addr); + */ +LEAF(mem_zero_page) + li v0, NBPG +1: + subu v0, 8 + sd zero, 0(a0) + bne zero, v0, 1b + addu a0, 8 + jr ra + nop +END(mem_zero_page) + /* * Block I/O routines mainly used by I/O drivers. * @@ -1545,7 +1560,7 @@ END(MachUserIntr) NLEAF(MachTLBInvalidException) .set noat dmfc0 k0, COP_0_BAD_VADDR # get the fault address - li k1, VM_MIN_KERNEL_ADDRESS # compute index + li k1, (VM_MIN_KERNEL_ADDRESS) # compute index subu k0, k0, k1 lw k1, Sysmapsize # index within range? srl k0, k0, PGSHIFT @@ -1633,7 +1648,7 @@ END(MachTLBInvalidException) NLEAF(MachTLBMissException) .set noat dmfc0 k0, COP_0_BAD_VADDR # get the fault address - li k1, VM_MIN_KERNEL_ADDRESS # compute index + li k1, (VM_MIN_KERNEL_ADDRESS) # compute index subu k0, k0, k1 lw k1, Sysmapsize # index within range? srl k0, k0, PGSHIFT diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index 3c63278c3a6..79ed721e337 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.24 1997/04/10 16:29:08 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.25 1997/04/19 17:19:44 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.24 1997/04/10 16:29:08 pefo Exp $ + * $Id: machdep.c,v 1.25 1997/04/19 17:19:44 pefo Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -74,14 +74,17 @@ #ifdef SYSVMSG #include #endif +#ifdef MFS +#include +#endif #include +#include #include #include #include #include -#include #include #include #include @@ -98,6 +101,10 @@ extern struct consdev *cn_tab; extern char kernel_start[]; +extern void makebootdev __P((char *)); +extern void stacktrace __P((void)); +extern void configure __P((void)); +extern void pmap_bootstrap __P((vm_offset_t)); /* the following is used externally (sysctl_hw) */ char machine[] = "arc"; /* cpu "architecture" */ @@ -122,6 +129,7 @@ int bufpages = 0; int msgbufmapped = 0; /* set when safe to use msgbuf */ int physmem; /* max supported memory, changes to actual */ int cpucfg; /* Value of processor config register */ +int l2cache_is_snooping; /* Set if L2 cache snoops uncached writes */ int cputype; /* Mother board type */ int num_tlbentries = 48; /* Size of the CPU tlb */ int ncpu = 1; /* At least one cpu in the system */ @@ -133,21 +141,26 @@ char eth_hw_addr[6]; /* HW ether addr not stored elsewhere */ struct mem_descriptor mem_layout[MAXMEMSEGS]; -extern int Mach_spl0(), Mach_spl1(), Mach_spl2(), Mach_spl3(); -extern int Mach_spl4(), Mach_spl5(), splhigh(); -int (*Mach_splnet)() = splhigh; -int (*Mach_splbio)() = splhigh; -int (*Mach_splimp)() = splhigh; -int (*Mach_spltty)() = splhigh; -int (*Mach_splclock)() = splhigh; -int (*Mach_splstatclock)() = splhigh; +extern int Mach_spl0 __P((void)), Mach_spl1 __P((void)), Mach_spl2 __P((void)); +extern int Mach_spl3 __P((void)), Mach_spl4 __P((void)), Mach_spl5 __P((void)); +int (*Mach_splnet)(void) = splhigh; +int (*Mach_splbio)(void) = splhigh; +int (*Mach_splimp)(void) = splhigh; +int (*Mach_spltty)(void) = splhigh; +int (*Mach_splclock)(void) = splhigh; +int (*Mach_splstatclock)(void) = splhigh; -static void tlb_init_pica(); -static void tlb_init_tyne(); -static int get_simm_size(int *fadr, int max); -static char *getenv(char *env); -static void get_eth_hw_addr(char *); -static int atoi(char *s, int b); +void mips_init __P((int, char *[], char *[])); +void initcpu __P((void)); +void dumpsys __P((void)); +void dumpconf __P((void)); + +static void tlb_init_pica __P((void)); +static void tlb_init_tyne __P((void)); +static int get_simm_size __P((int *, int)); +static char *getenv __P((char *env)); +static void get_eth_hw_addr __P((char *)); +static int atoi __P((char *, int)); /* @@ -165,6 +178,7 @@ struct proc nullproc; /* for use by swtch_exit() */ * Reset mapping and set up mapping to hardware and init "wired" reg. * Return the first page address following the system. */ +void mips_init(argc, argv, envv) int argc; char *argv[]; @@ -371,7 +385,7 @@ mips_init(argc, argv, envv) /* * Init mapping for u page(s) for proc[0], pm_tlbpid 1. */ - sysend = (caddr_t)((int)sysend + 3 & -4); + sysend = (caddr_t)(((int)sysend + 3) & -4); start = sysend; curproc->p_addr = proc0paddr = (struct user *)sysend; curproc->p_md.md_regs = proc0paddr->u_pcb.pcb_regs; @@ -387,7 +401,7 @@ mips_init(argc, argv, envv) firstaddr += NBPG * 2; } sysend += UPAGES * NBPG; - sysend = (caddr_t)((int)sysend+3 & -4); + sysend = (caddr_t)(((int)sysend + 3) & -4); R4K_SetPID(1); /* @@ -424,6 +438,14 @@ mips_init(argc, argv, envv) */ R4K_FlushCache(); + i = *(volatile u_int32_t *)0x80000300; /* Read and cache */ + R4K_FlushCache(); /* Flush */ + *(volatile u_int32_t *)0xa0000300 = ~i; /* Write uncached */ + l2cache_is_snooping = (~i == *(volatile u_int32_t *)0x80000300); + *(volatile u_int32_t *)0x80000300 = i; /* Write uncached */ + R4K_FlushCache(); /* Flush */ + + /* * Initialize error message buffer. */ @@ -713,7 +735,6 @@ void cpu_startup() { register unsigned i; - register caddr_t v; int base, residual; vm_offset_t minaddr, maxaddr; vm_size_t size; @@ -829,6 +850,7 @@ cpu_startup() /* * machine dependent system variables. */ +int cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; @@ -876,7 +898,7 @@ setregs(p, pack, stack, retval) p->p_md.md_regs[PC] = pack->ep_entry & ~3; p->p_md.md_regs[T9] = pack->ep_entry & ~3; /* abicall req */ p->p_md.md_regs[PS] = PSL_USERSET; - p->p_md.md_flags & ~MDP_FPUSED; + p->p_md.md_flags &= ~MDP_FPUSED; if (machFPCurProcPtr == p) machFPCurProcPtr = (struct proc *)0; p->p_md.md_ss_addr = 0; @@ -946,7 +968,7 @@ sendsig(catcher, sig, mask, code, type, val) (void)grow(p, (unsigned)fp); #ifdef DEBUG if ((sigdebug & SDB_FOLLOW) || - (sigdebug & SDB_KSTACK) && p->p_pid == sigpid) + ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid))) printf("sendsig(%d): sig %d ssp %x usp %x scp %x\n", p->p_pid, sig, &oonstack, fp, &fp->sf_sc); #endif @@ -1011,7 +1033,7 @@ bail: regs[RA] = (int)PS_STRINGS - (esigcode - sigcode); #ifdef DEBUG if ((sigdebug & SDB_FOLLOW) || - (sigdebug & SDB_KSTACK) && p->p_pid == sigpid) + ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid))) printf("sendsig(%d): sig %d returns\n", p->p_pid, sig); #endif @@ -1028,6 +1050,7 @@ bail: * a machine fault. */ /* ARGSUSED */ +int sys_sigreturn(p, v, retval) struct proc *p; void *v; @@ -1138,6 +1161,7 @@ int dumpmag = (int)0x8fca0101; /* magic number for savecore */ int dumpsize = 0; /* also for savecore */ long dumplo = 0; +void dumpconf() { int nblks; @@ -1163,9 +1187,9 @@ dumpconf() * getting on the dump stack, either when called above, or by * the auto-restart code. */ +void dumpsys() { - int error; msgbufmapped = 0; if (dumpdev == NODEV) @@ -1179,8 +1203,9 @@ dumpsys() if (dumplo < 0) return; printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo); - printf("dump "); - switch (error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev)) { + printf("dump not yet implemented"); +#if 0 /* XXX HAVE TO FIX XXX */ + switch (error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev, dumplo,)) { case ENXIO: printf("device bad\n"); @@ -1205,6 +1230,7 @@ dumpsys() case 0: printf("succeeded\n"); } +#endif } /* @@ -1238,6 +1264,7 @@ microtime(tvp) splx(s); } +void initcpu() { diff --git a/sys/arch/arc/arc/mainbus.c b/sys/arch/arc/arc/mainbus.c index f3fe9db3f8b..ffc636175da 100644 --- a/sys/arch/arc/arc/mainbus.c +++ b/sys/arch/arc/arc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.5 1997/03/12 19:16:44 pefo Exp $ */ +/* $OpenBSD: mainbus.c,v 1.6 1997/04/19 17:19:45 pefo Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -85,7 +85,7 @@ mbattach(parent, self, aux) { struct mainbus_softc *sc = (struct mainbus_softc *)self; struct confargs nca; - extern int cputype, ncpus; + extern int cputype; printf("\n"); diff --git a/sys/arch/arc/arc/mem.c b/sys/arch/arc/arc/mem.c index d03d98b8bb6..15207b8bff2 100644 --- a/sys/arch/arc/arc/mem.c +++ b/sys/arch/arc/arc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.2 1997/03/23 11:34:30 pefo Exp $ */ +/* $OpenBSD: mem.c,v 1.3 1997/04/19 17:19:45 pefo Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -48,11 +48,14 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -60,6 +63,11 @@ extern vm_offset_t avail_end; caddr_t zeropage; +int mmopen __P((dev_t, int, int)); +int mmclose __P((dev_t, int, int)); +int mmrw __P((dev_t, struct uio *uio, int)); +int mmmmap __P((dev_t, int, int)); + /*ARGSUSED*/ int mmopen(dev, flag, mode) @@ -87,7 +95,7 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - register vm_offset_t o, v; + register vm_offset_t v; register int c; register struct iovec *iov; int error = 0; @@ -163,6 +171,7 @@ mmrw(dev, uio, flags) return (error); } +/*ARGSUSED*/ int mmmmap(dev, off, prot) dev_t dev; diff --git a/sys/arch/arc/arc/minidebug.c b/sys/arch/arc/arc/minidebug.c index af0878ad06d..565f6c930f2 100644 --- a/sys/arch/arc/arc/minidebug.c +++ b/sys/arch/arc/arc/minidebug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: minidebug.c,v 1.4 1997/03/12 19:16:45 pefo Exp $ */ +/* $OpenBSD: minidebug.c,v 1.5 1997/04/19 17:19:46 pefo Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -35,20 +35,24 @@ * SUCH DAMAGE. * * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93 - * $Id: minidebug.c,v 1.4 1997/03/12 19:16:45 pefo Exp $ + * $Id: minidebug.c,v 1.5 1997/04/19 17:19:46 pefo Exp $ */ /* * Define machine dependent primitives for mdb. */ -#include +#include +#include +#include +#include +#include #include #include #undef SP #include #include -#include +#include #include #include @@ -57,7 +61,6 @@ #define FALSE 0 #endif -void arc_dump_tlb(int, int); static char *op_name[64] = { /* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz", @@ -133,7 +136,22 @@ static char *c0_reg[32] = { "c0r24","c0r25","ecc","cacheerr","taglo","taghi","errepc","c0r31" }; +extern u_int mdbpeek __P((int)); +extern void mdbpoke __P((int, int)); +extern void trapDump __P((char *)); +extern void stacktrace __P((void)); +extern u_int MachEmulateBranch __P((int *, int, int, u_int)); extern char *trap_type[]; +extern int num_tlbentries; +static void arc_dump_tlb __P((int,int)); +static void prt_break __P((void)); +static int mdbprintins __P((int, int)); +static void mdbsetsstep __P((void)); +static int mdbclrsstep __P((int)); +static void print_regs __P((void)); +static void break_insert __P((void)); +static void break_restore __P((void)); +static int break_find __P((int)); struct pcb mdbpcb; int mdbmkfault; @@ -147,7 +165,8 @@ struct brk { /* * Mini debugger for kernel. */ -int gethex(u_int *val, u_int dotval) +static int +gethex(u_int *val, u_int dotval) { u_int c; @@ -179,6 +198,7 @@ int gethex(u_int *val, u_int dotval) return(c); } +static void dump(u_int *addr, u_int size) { int cnt; @@ -193,7 +213,8 @@ void dump(u_int *addr, u_int size) } } -void print_regs() +static void +print_regs() { printf("\n"); printf("T0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n", @@ -219,7 +240,8 @@ void print_regs() mdbpcb.pcb_regs[RA],mdbpcb.pcb_regs[SR]); } -set_break(va) +void +set_break(int va) { int i; @@ -234,7 +256,8 @@ set_break(va) printf(" Break table full!!"); } -del_break(va) +void +del_break(int va) { int i; @@ -248,6 +271,7 @@ del_break(va) printf(" Break to remove not found!!"); } +static void break_insert() { int i; @@ -262,6 +286,7 @@ break_insert() } } +static void break_restore() { int i; @@ -275,7 +300,9 @@ break_restore() } } +static int break_find(va) + int va; { int i; @@ -287,6 +314,7 @@ break_find(va) return(-1); } +void prt_break() { int i; @@ -298,7 +326,9 @@ prt_break() } } } -mdb(causeReg, vadr, p, kernelmode) + +int +mdb(int causeReg, int vadr, int p, int kernelmode) { int c; int newaddr; @@ -353,7 +383,8 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */ ssandrun = 0; break_restore(); - while(c = cngetc()) { + while(1) { + c = cngetc(); switch(c) { case 'T': trapDump("Debugger"); @@ -527,7 +558,7 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */ switch(c) { case 't': printf("tlb"); - R4K_TLBFlush(); + R4K_TLBFlush(num_tlbentries); break; case 'c': @@ -548,11 +579,11 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */ u_int mdb_ss_addr; u_int mdb_ss_instr; +static void mdbsetsstep() { register u_int va; register int *locr0 = mdbpcb.pcb_regs; - int i; /* compute next address after current location */ if(mdbpeek(locr0[PC]) != 0) { @@ -571,15 +602,15 @@ mdbsetsstep() if ((int)va < 0) { /* kernel address */ mdb_ss_instr = mdbpeek(va); - mdbpoke((caddr_t)va, BREAK_SSTEP); + mdbpoke(va, BREAK_SSTEP); R4K_FlushDCache(va,4); R4K_FlushICache(va,4); return; } } -mdbclrsstep(cr) - int cr; +static int +mdbclrsstep(int cr) { register u_int pc, va; u_int instr; @@ -601,7 +632,7 @@ mdbclrsstep(cr) if ((int)va < 0) { /* kernel address */ - mdbpoke((caddr_t)va, mdb_ss_instr); + mdbpoke(va, mdb_ss_instr); R4K_FlushDCache(va,4); R4K_FlushICache(va,4); mdb_ss_addr = 0; @@ -613,29 +644,10 @@ mdbclrsstep(cr) return(FALSE); } -void -mdbreadc(lp) - char *lp; -{ - int c; - - c = cngetc(); - if (c == '\r') - c = '\n'; - *lp = c; -} - -void -mdbwrite(lp, len) - char *lp; - int len; -{ - while (len-- > 0) - cnputc(*lp++); -} /* ARGSUSED */ -mdbprintins(ins, mdbdot) +static int +mdbprintins(int ins, int mdbdot) { InstFmt i; int delay = 0; @@ -906,187 +918,12 @@ mdbprintins(ins, mdbdot) return(delay); } -#define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */ - -#if 0 -/* - * Print a stack backtrace. - */ -void -mdbstacktrace(printlocals) - int printlocals; -{ - u_int pc, sp, ra, va, subr; - int a0, a1, a2, a3; - u_int instr, mask; - InstFmt i; - int more, stksize; - extern MachKernGenException(); - extern MachUserGenException(); - extern MachKernIntr(); - extern MachUserIntr(); - extern setsoftclock(); - - /* get initial values from the exception frame */ - sp = mdbpcb.pcb_regs[SP]; - pc = mdbpcb.pcb_regs[PC]; - ra = mdbpcb.pcb_regs[RA]; - a0 = mdbpcb.pcb_regs[A0]; - a1 = mdbpcb.pcb_regs[A1]; - a2 = mdbpcb.pcb_regs[A2]; - a3 = mdbpcb.pcb_regs[A3]; - -loop: - /* check for current PC in the kernel interrupt handler code */ - if (pc >= (u_int)MachKernIntr && pc < (u_int)MachUserIntr) { - /* NOTE: the offsets depend on the code in locore.s */ - printf("interupt\n"); - a0 = mdbchkget(sp + 36, DSP); - a1 = mdbchkget(sp + 40, DSP); - a2 = mdbchkget(sp + 44, DSP); - a3 = mdbchkget(sp + 48, DSP); - pc = mdbchkget(sp + 20, DSP); - ra = mdbchkget(sp + 92, DSP); - sp = mdbchkget(sp + 100, DSP); - } - - /* check for current PC in the exception handler code */ - if (pc >= 0x80000000 && pc < (u_int)setsoftclock) { - ra = 0; - subr = 0; - goto done; - } - /* - * Find the beginning of the current subroutine by scanning backwards - * from the current PC for the end of the previous subroutine. - */ - va = pc - sizeof(int); - while ((instr = mdbchkget(va, ISP)) != MIPS_JR_RA) - va -= sizeof(int); - va += 2 * sizeof(int); /* skip back over branch & delay slot */ - /* skip over nulls which might separate .o files */ - while ((instr = mdbchkget(va, ISP)) == 0) - va += sizeof(int); - subr = va; - - /* scan forwards to find stack size and any saved registers */ - stksize = 0; - more = 3; - mask = 0; - for (; more; va += sizeof(int), more = (more == 3) ? 3 : more - 1) { - /* stop if hit our current position */ - if (va >= pc) - break; - instr = mdbchkget(va, ISP); - i.word = instr; - switch (i.JType.op) { - case OP_SPECIAL: - switch (i.RType.func) { - case OP_JR: - case OP_JALR: - more = 2; /* stop after next instruction */ - break; - - case OP_SYSCALL: - case OP_BREAK: - more = 1; /* stop now */ - }; - break; - - case OP_BCOND: - case OP_J: - case OP_JAL: - case OP_BEQ: - case OP_BNE: - case OP_BLEZ: - case OP_BGTZ: - more = 2; /* stop after next instruction */ - break; - - case OP_COP0: - case OP_COP1: - case OP_COP2: - case OP_COP3: - switch (i.RType.rs) { - case OP_BCx: - case OP_BCy: - more = 2; /* stop after next instruction */ - }; - break; - - case OP_SW: - /* look for saved registers on the stack */ - if (i.IType.rs != 29) - break; - /* only restore the first one */ - if (mask & (1 << i.IType.rt)) - break; - mask |= 1 << i.IType.rt; - switch (i.IType.rt) { - case 4: /* a0 */ - a0 = mdbchkget(sp + (short)i.IType.imm, DSP); - break; - - case 5: /* a1 */ - a1 = mdbchkget(sp + (short)i.IType.imm, DSP); - break; - - case 6: /* a2 */ - a2 = mdbchkget(sp + (short)i.IType.imm, DSP); - break; - - case 7: /* a3 */ - a3 = mdbchkget(sp + (short)i.IType.imm, DSP); - break; - - case 31: /* ra */ - ra = mdbchkget(sp + (short)i.IType.imm, DSP); - } - break; - - case OP_ADDI: - case OP_ADDIU: - /* look for stack pointer adjustment */ - if (i.IType.rs != 29 && i.IType.rt != 29) - break; - stksize = (short)i.IType.imm; - } - } - -done: - printf("%x+%x ", subr, pc - subr); /* XXX */ - printf("(%x,%x,%x,%x)\n", a0, a1, a2, a3); - - if (ra) { - pc = ra; - sp -= stksize; - goto loop; - } -} -#endif - -/* - * Very simple memory allocator for mdb. - */ -char * -mdbmalloc(size) - int size; -{ - static char buffer[4096]; - static char *bufp = buffer; - char *p; - - /* round size up to sizeof(int) */ - size = (size + sizeof(int) - 1) & ~(sizeof(int) - 1); - p = bufp; - bufp = p + size; - return (p); -} /* * Dump TLB contents. */ -void arc_dump_tlb(int first,int last) +static void +arc_dump_tlb(int first,int last) { int tlbno; struct tlb tlb; diff --git a/sys/arch/arc/arc/pmap.c b/sys/arch/arc/arc/pmap.c index 8d9799d5337..df9b40e1065 100644 --- a/sys/arch/arc/arc/pmap.c +++ b/sys/arch/arc/arc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.8 1997/03/12 19:16:46 pefo Exp $ */ +/* $OpenBSD: pmap.c,v 1.9 1997/04/19 17:19:46 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 8.4 (Berkeley) 1/26/94 - * $Id: pmap.c,v 1.8 1997/03/12 19:16:46 pefo Exp $ + * $Id: pmap.c,v 1.9 1997/04/19 17:19:46 pefo Exp $ */ /* @@ -79,8 +79,8 @@ #include #include -#include #include +#include #include #include @@ -109,7 +109,8 @@ typedef struct pv_entry { #define PG_WIRED 0x80000000 pv_entry_t pv_table; /* array of entries, one per page */ -int pmap_remove_pv(); + +void mem_zero_page __P((vm_offset_t)); #ifdef MACHINE_NONCONTIG static vm_offset_t avail_next; @@ -205,7 +206,6 @@ pmap_bootstrap(firstaddr) vm_offset_t start = firstaddr; extern int physmem; -/*XXX*/ char pbuf[100]; #define valloc(name, type, num) \ (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num)) @@ -284,9 +284,6 @@ pmap_bootstrap(firstaddr) pseg->first_page = nextpage; nextpage += (pseg->end - pseg->start) / NBPG; avail_remaining += (pseg->end - pseg->start) / NBPG; -#if 0 -/*XXX*/ sprintf(pbuf,"segment = %d start 0x%x end 0x%x avail %d page %d\n", i, pseg->start, pseg->end, avail_remaining, nextpage); printf(pbuf); -#endif pseg++; } @@ -337,7 +334,7 @@ pmap_bootstrap_alloc(size) size = round_page(size); avail_start += size; - blkclr((caddr_t)val, size); + bzero((caddr_t)val, size); return ((void *)val); } @@ -483,7 +480,6 @@ pmap_pinit(pmap) } else { register struct segtab *stp; vm_page_t mem; - void pmap_zero_page(); do { mem = vm_page_alloc1(); @@ -492,6 +488,7 @@ pmap_pinit(pmap) } /* XXX Deadlock situations? */ } while (mem == NULL); + /* Do zero via cached if No L2 or Snooping L2 */ pmap_zero_page(VM_PAGE_TO_PHYS(mem)); pmap->pm_segtab = stp = (struct segtab *) PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem)); @@ -584,7 +581,7 @@ pmap_release(pmap) panic("pmap_release: segmap not empty"); } #endif - R4K_HitFlushDCache(pte, PAGE_SIZE); + R4K_HitFlushDCache((vm_offset_t)pte, PAGE_SIZE); vm_page_free1( PHYS_TO_VM_PAGE(CACHED_TO_PHYS(pte))); pmap->pm_segtab->seg_tab[i] = NULL; @@ -630,7 +627,6 @@ pmap_remove(pmap, sva, eva) register vm_offset_t nssva; register pt_entry_t *pte; unsigned entry; - int flush; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT)) @@ -740,7 +736,7 @@ pmap_page_protect(pa, prot) #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) || - prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)) + ((prot == VM_PROT_NONE) && (pmapdebug & PDB_REMOVE))) printf("pmap_page_protect(%x, %x)\n", pa, prot); #endif if (!IS_VM_PHYSADDR(pa)) @@ -894,6 +890,32 @@ pmap_is_page_ro(pmap, va, entry) return(entry & PG_RO); } +/* + * Return page mapping status. + */ +int +pmap_is_pa_mapped(pa) + vm_offset_t pa; +{ + pv_entry_t pv; + + pv = pa_to_pvh(pa); + return(pv->pv_pmap != NULL); +} + +/* + * Return page mapping status. + */ +vm_offset_t +pmap_pa_to_va(pa) + vm_offset_t pa; +{ + pv_entry_t pv; + + pv = pa_to_pvh(pa); + return(pv->pv_va); +} + /* * pmap_page_cache: * @@ -902,12 +924,12 @@ pmap_is_page_ro(pmap, va, entry) void pmap_page_cache(pa,mode) vm_offset_t pa; + int mode; { - register pv_entry_t pv; - register pt_entry_t *pte; - register vm_offset_t va; - register unsigned entry; - register unsigned newmode; + pv_entry_t pv; + pt_entry_t *pte; + unsigned entry; + unsigned newmode; int s; #ifdef DEBUG @@ -935,7 +957,7 @@ pmap_page_cache(pa,mode) } } else { - if (pte = pmap_segmap(pv->pv_pmap, pv->pv_va)) { + if ((pte = pmap_segmap(pv->pv_pmap, pv->pv_va))) { pte += (pv->pv_va >> PGSHIFT) & (NPTEPG - 1); entry = pte->pt_entry; if (entry & PG_V) { @@ -975,7 +997,7 @@ pmap_enter(pmap, va, pa, prot, wired) { register pt_entry_t *pte; register u_int npte; - register int i, j; + register int i; vm_page_t mem; #ifdef DEBUG @@ -1177,7 +1199,7 @@ pmap_enter(pmap, va, pa, prot, wired) /* * Update the same virtual address entry. */ - j = R4K_TLBUpdate(va, npte); + R4K_TLBUpdate(va, npte); pte->pt_entry = npte; return; } @@ -1190,6 +1212,7 @@ pmap_enter(pmap, va, pa, prot, wired) } /* XXX Deadlock situations? */ } while (mem == NULL); + /* Do zero via cached if No L2 or Snooping L2 */ pmap_zero_page(VM_PAGE_TO_PHYS(mem)); pmap_segmap(pmap, va) = pte = (pt_entry_t *) PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem)); @@ -1235,7 +1258,7 @@ pmap_enter(pmap, va, pa, prot, wired) } pte->pt_entry = npte; if (pmap->pm_tlbgen == tlbpid_gen) - j = R4K_TLBUpdate(va | (pmap->pm_tlbpid << + R4K_TLBUpdate(va | (pmap->pm_tlbpid << VMTLB_PID_SHIFT), npte); } @@ -1254,7 +1277,6 @@ pmap_change_wiring(pmap, va, wired) { register pt_entry_t *pte; u_int p; - register int i; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_WIRING)) @@ -1405,25 +1427,26 @@ void pmap_zero_page(phys) vm_offset_t phys; { - register int *p, *end; + register vm_offset_t p; #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) printf("pmap_zero_page(%x)\n", phys); #endif -/*XXX FIXME Not very sophisticated */ - R4K_FlushCache(); - p = (int *)PHYS_TO_CACHED(phys); - end = p + PAGE_SIZE / sizeof(int); - do { - p[0] = 0; - p[1] = 0; - p[2] = 0; - p[3] = 0; - p += 4; - } while (p != end); -/*XXX FIXME Not very sophisticated */ - R4K_FlushCache(); + if(l2cache_is_snooping && !pmap_is_pa_mapped(phys)) { + mem_zero_page((vm_offset_t)PHYS_TO_UNCACHED(phys)); + } + else if(!pmap_is_pa_mapped(phys)) { + p = (vm_offset_t)PHYS_TO_CACHED(phys); + mem_zero_page(p); + R4K_HitFlushDCache(p, PAGE_SIZE); + } + else { /* Page is mapped or non snooping */ + R4K_FlushDCache((vm_offset_t)PHYS_TO_CACHED(pmap_pa_to_va(phys) & CpuCacheAliasMask), PAGE_SIZE); + p = (vm_offset_t)PHYS_TO_CACHED(phys); + mem_zero_page(p); + R4K_HitFlushDCache(p, PAGE_SIZE); + } } /* @@ -1587,10 +1610,10 @@ pmap_phys_address(ppn) */ int pmap_alloc_tlbpid(p) - register struct proc *p; + struct proc *p; { - register pmap_t pmap; - register int id; + pmap_t pmap; + int id; pmap = &p->p_vmspace->vm_pmap; if (pmap->pm_tlbgen != tlbpid_gen) { diff --git a/sys/arch/arc/arc/process_machdep.c b/sys/arch/arc/arc/process_machdep.c index af188276ef9..494bcf769fd 100644 --- a/sys/arch/arc/arc/process_machdep.c +++ b/sys/arch/arc/arc/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.1.1.1 1996/06/24 09:07:21 pefo Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.2 1997/04/19 17:19:47 pefo Exp $ */ /* * Copyright (c) 1994 Adam Glass * Copyright (c) 1993 The Regents of the University of California. @@ -39,7 +39,7 @@ * From: * Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel * - * $Id: process_machdep.c,v 1.1.1.1 1996/06/24 09:07:21 pefo Exp $ + * $Id: process_machdep.c,v 1.2 1997/04/19 17:19:47 pefo Exp $ */ /* @@ -72,9 +72,11 @@ #include #include #include +#include #include #include +extern void cpu_singlestep __P((struct proc *)); int process_read_regs(p, regs) struct proc *p; diff --git a/sys/arch/arc/arc/sys_machdep.c b/sys/arch/arc/arc/sys_machdep.c index f3700f1580c..9ed89e266d4 100644 --- a/sys/arch/arc/arc/sys_machdep.c +++ b/sys/arch/arc/arc/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.2 1997/03/23 11:34:31 pefo Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.3 1997/04/19 17:19:47 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -109,6 +109,7 @@ vdoualarm(arg) } #endif +int sys_sysarch(p, v, retval) struct proc *p; void *v; diff --git a/sys/arch/arc/arc/trap.c b/sys/arch/arc/arc/trap.c index b4d0827447e..209ba90c4b2 100644 --- a/sys/arch/arc/arc/trap.c +++ b/sys/arch/arc/arc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.10 1997/03/12 19:16:47 pefo Exp $ */ +/* $OpenBSD: trap.c,v 1.11 1997/04/19 17:19:48 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,9 +39,11 @@ * from: Utah Hdr: trap.c 1.32 91/04/06 * * from: @(#)trap.c 8.5 (Berkeley) 1/11/94 - * $Id: trap.c,v 1.10 1997/03/12 19:16:47 pefo Exp $ + * $Id: trap.c,v 1.11 1997/04/19 17:19:48 pefo Exp $ */ +#include "ppp.h" + #include #include #include @@ -55,12 +57,14 @@ #include #endif #include +#include #include #include #include #include #include +#include #include #include #include @@ -78,15 +82,14 @@ struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */ -extern void MachKernGenException(); -extern void MachUserGenException(); -extern void MachKernIntr(); -extern void MachUserIntr(); -extern void MachTLBModException(); -extern void MachTLBInvalidException(); -extern unsigned MachEmulateBranch(); +extern void MachKernGenException __P((void)); +extern void MachUserGenException __P((void)); +extern void MachKernIntr __P((void)); +extern void MachUserIntr __P((void)); +extern void MachTLBModException __P((void)); +extern void MachTLBInvalidException __P((void)); -void (*machExceptionTable[])() = { +void (*machExceptionTable[])(void) = { /* * The kernel exception handlers. */ @@ -196,7 +199,7 @@ char *trap_type[] = { struct { int int_mask; - int (*int_hand)(); + int (*int_hand)(u_int, struct clockframe *); } cpu_int_tab[8]; int cpu_int_mask; /* External cpu interrupt mask */ @@ -212,22 +215,35 @@ struct trapdebug { /* trap history buffer for debugging */ u_int sp; u_int code; } trapdebug[TRAPSIZE], *trp = trapdebug; + +void trapDump __P((char *)); #endif /* DEBUG */ #ifdef DEBUG /* stack trace code, also useful for DDB one day */ -extern void stacktrace(); -extern void logstacktrace(); +void stacktrace __P((int, int, int, int)); +void logstacktrace __P((int, int, int, int)); /* extern functions printed by name in stack backtraces */ -extern void idle(), cpu_switch(), splx(), wbflush(); -extern void MachTLBMiss(); +extern void idle __P((void)); +extern void MachTLBMiss __P((void)); +extern u_int mdbpeek __P((int)); +extern int mdb __P((u_int, u_int, struct proc *, int)); #endif /* DEBUG */ -static void arc_errintr(); extern const struct callback *callv; -extern volatile struct chiptime *Mach_clock_addr; extern u_long intrcnt[]; extern u_int cputype; +extern void MachSwitchFPState __P((struct proc *, int *)); +extern void MachFPTrap __P((u_int, u_int, u_int)); +extern void arpintr __P((void)); +extern void ipintr __P((void)); +extern void pppintr __P((void)); + +u_int trap __P((u_int, u_int, u_int, u_int, u_int)); +void interrupt __P((u_int, u_int, u_int, u_int, u_int)); +void softintr __P((u_int, u_int)); +int cpu_singlestep __P((struct proc *)); +u_int MachEmulateBranch __P((int *, int, int, u_int)); /* * Handle an exception. @@ -236,12 +252,13 @@ extern u_int cputype; * In the case of a kernel trap, we return the pc where to resume if * ((struct pcb *)UADDR)->pcb_onfault is set, otherwise, return old pc. */ -unsigned +u_int trap(statusReg, causeReg, vadr, pc, args) - unsigned statusReg; /* status register at time of the exception */ - unsigned causeReg; /* cause register at time of exception */ - unsigned vadr; /* address (if any) the fault occured on */ - unsigned pc; /* program counter where to continue */ + u_int statusReg; /* status register at time of the exception */ + u_int causeReg; /* cause register at time of exception */ + u_int vadr; /* address (if any) the fault occured on */ + u_int pc; /* program counter where to continue */ + u_int args; { register int type, i; unsigned ucode = 0; @@ -328,7 +345,7 @@ trap(statusReg, causeReg, vadr, pc, args) panic("trap: utlbmod: invalid pte"); } #endif - if (pmap_is_page_ro(pmap, mips_trunc_page(vadr), entry)) { + if (pmap_is_page_ro(pmap, (vm_offset_t)mips_trunc_page(vadr), entry)) { /* write to read only page */ ftype = VM_PROT_WRITE; goto dofault; @@ -364,7 +381,7 @@ trap(statusReg, causeReg, vadr, pc, args) rv = vm_fault(kernel_map, va, ftype, FALSE); if (rv == KERN_SUCCESS) return (pc); - if (i = ((struct pcb *)UADDR)->pcb_onfault) { + if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) { ((struct pcb *)UADDR)->pcb_onfault = 0; return (onfault_table[i]); } @@ -425,7 +442,7 @@ trap(statusReg, causeReg, vadr, pc, args) goto out; } if (!USERMODE(statusReg)) { - if (i = ((struct pcb *)UADDR)->pcb_onfault) { + if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) { ((struct pcb *)UADDR)->pcb_onfault = 0; return (onfault_table[i]); } @@ -726,7 +743,7 @@ trap(statusReg, causeReg, vadr, pc, args) case T_ADDR_ERR_LD: /* misaligned access */ case T_ADDR_ERR_ST: /* misaligned access */ case T_BUS_ERR_LD_ST: /* BERR asserted to cpu */ - if (i = ((struct pcb *)UADDR)->pcb_onfault) { + if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) { ((struct pcb *)UADDR)->pcb_onfault = 0; return (onfault_table[i]); } @@ -828,10 +845,13 @@ out: * Called from MachKernIntr() or MachUserIntr() * Note: curproc might be NULL. */ +void interrupt(statusReg, causeReg, pc, what, args) - unsigned statusReg; /* status register at time of the exception */ - unsigned causeReg; /* cause register at time of exception */ - unsigned pc; /* program counter where to continue */ + u_int statusReg; /* status register at time of the exception */ + u_int causeReg; /* cause register at time of exception */ + u_int pc; /* program counter where to continue */ + u_int what; + u_int args; { register unsigned mask; register int i; @@ -880,7 +900,7 @@ interrupt(statusReg, causeReg, pc, what, args) * Process network interrupt if we trapped or will very soon */ if ((mask & SOFT_INT_MASK_1) || - netisr && (statusReg & SOFT_INT_MASK_1)) { + (netisr && (statusReg & SOFT_INT_MASK_1))) { clearsoftnet(); cnt.v_soft++; intrcnt[1]++; @@ -906,7 +926,6 @@ interrupt(statusReg, causeReg, pc, what, args) clnlintr(); } #endif -#include "ppp.h" #if NPPP > 0 if(netisr & (1 << NETISR_PPP)) { netisr &= ~(1 << NETISR_PPP); @@ -929,7 +948,7 @@ interrupt(statusReg, causeReg, pc, what, args) void set_intr(mask, int_hand, prio) int mask; - int (*int_hand)(); + int (*int_hand)(u_int, struct clockframe *); int prio; { if(prio > 5) @@ -966,6 +985,7 @@ set_intr(mask, int_hand, prio) * This is called from MachUserIntr() if astpending is set. * This is very similar to the tail of trap(). */ +void softintr(statusReg, pc) unsigned statusReg; /* status register at time of the exception */ unsigned pc; /* program counter where to continue */ @@ -1006,6 +1026,7 @@ softintr(statusReg, pc) } #ifdef DEBUG +void trapDump(msg) char *msg; { @@ -1031,6 +1052,7 @@ trapDump(msg) } #endif +#if 0 /* *---------------------------------------------------------------------- * @@ -1050,7 +1072,6 @@ trapDump(msg) static void arc_errintr() { -#if 0 volatile u_short *sysCSRPtr = (u_short *)PHYS_TO_UNCACHED(KN01_SYS_CSR); u_short csr; @@ -1063,19 +1084,19 @@ arc_errintr() panic("Mem error interrupt"); } *sysCSRPtr = (csr & ~KN01_CSR_MBZ) | 0xff; -#endif } +#endif /* * Return the resulting PC as if the branch was executed. */ unsigned -MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch) - unsigned *regsPtr; - unsigned instPC; - unsigned fpcCSR; - int allowNonBranch; +MachEmulateBranch(regsPtr, instPC, fpcCSR, instptr) + int *regsPtr; + int instPC; + int fpcCSR; + u_int instptr; { InstFmt inst; unsigned retAddr; @@ -1085,11 +1106,11 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch) ((unsigned)InstPtr + 4 + ((short)inst.IType.imm << 2)) - if(allowNonBranch == 0) { - inst = *(InstFmt *)instPC; + if(instptr) { + inst = *(InstFmt *)&instptr; } else { - inst = *(InstFmt *)&allowNonBranch; + inst = *(InstFmt *)instPC; } #if 0 printf("regsPtr=%x PC=%x Inst=%x fpcCsr=%x\n", regsPtr, instPC, @@ -1104,8 +1125,6 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch) break; default: - if (!allowNonBranch) - panic("MachEmulateBranch: Non-branch"); retAddr = instPC + 4; break; } @@ -1191,20 +1210,13 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch) break; default: - if (!allowNonBranch) - panic("MachEmulateBranch: Bad coproc branch instruction"); retAddr = instPC + 4; } break; default: - if (!allowNonBranch) - panic("MachEmulateBranch: Non-branch instruction"); retAddr = instPC + 4; } -#if 0 - printf("Target addr=%x\n", retAddr); /* XXX */ -#endif return (retAddr); } @@ -1213,6 +1225,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch) * We do this by storing a break instruction after the current instruction, * resuming execution, and then restoring the old instruction. */ +int cpu_singlestep(p) register struct proc *p; { @@ -1290,17 +1303,6 @@ cpu_singlestep(p) return (0); } -#ifdef DEBUG -kdbpeek(addr) -{ - if (addr & 3) { - printf("kdbpeek: unaligned address %x\n", addr); - return (-1); - } - return (*(int *)addr); -} -#endif - #ifdef DEBUG #define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */ @@ -1335,8 +1337,8 @@ stacktrace_subr(a0, a1, a2, a3, printfn) InstFmt i; int more, stksize; int regs[3]; - extern setsoftclock(); - extern char start[], edata[]; + extern char edata[]; + extern cpu_getregs __P((int *)); unsigned int frames = 0; cpu_getregs(regs); @@ -1374,13 +1376,13 @@ specialframe: /* NOTE: the offsets depend on the code in locore.s */ (*printfn)("MachKernIntr+%x: (%x, %x ,%x) -------\n", pc-(unsigned)MachKernIntr, a0, a1, a2); - a0 = kdbpeek(sp + 36); - a1 = kdbpeek(sp + 40); - a2 = kdbpeek(sp + 44); - a3 = kdbpeek(sp + 48); + a0 = mdbpeek(sp + 36); + a1 = mdbpeek(sp + 40); + a2 = mdbpeek(sp + 44); + a3 = mdbpeek(sp + 48); - pc = kdbpeek(sp + 20); /* exc_pc - pc at time of exception */ - ra = kdbpeek(sp + 92); /* ra at time of exception */ + pc = mdbpeek(sp + 20); /* exc_pc - pc at time of exception */ + ra = mdbpeek(sp + 92); /* ra at time of exception */ sp = sp + 108; goto specialframe; } @@ -1431,11 +1433,11 @@ specialframe: */ if (!subr) { va = pc - sizeof(int); - while ((instr = kdbpeek(va)) != MIPS_JR_RA) + while ((instr = mdbpeek(va)) != MIPS_JR_RA) va -= sizeof(int); va += 2 * sizeof(int); /* skip back over branch & delay slot */ /* skip over nulls which might separate .o files */ - while ((instr = kdbpeek(va)) == 0) + while ((instr = mdbpeek(va)) == 0) va += sizeof(int); subr = va; } @@ -1444,7 +1446,6 @@ specialframe: * Jump here for locore entry pointsn for which the preceding * function doesn't end in "j ra" */ -stackscan: /* scan forwards to find stack size and any saved registers */ stksize = 0; more = 3; @@ -1454,7 +1455,7 @@ stackscan: /* stop if hit our current position */ if (va >= pc) break; - instr = kdbpeek(va); + instr = mdbpeek(va); i.word = instr; switch (i.JType.op) { case OP_SPECIAL: @@ -1501,27 +1502,27 @@ stackscan: mask |= (1 << i.IType.rt); switch (i.IType.rt) { case 4: /* a0 */ - a0 = kdbpeek(sp + (short)i.IType.imm); + a0 = mdbpeek(sp + (short)i.IType.imm); break; case 5: /* a1 */ - a1 = kdbpeek(sp + (short)i.IType.imm); + a1 = mdbpeek(sp + (short)i.IType.imm); break; case 6: /* a2 */ - a2 = kdbpeek(sp + (short)i.IType.imm); + a2 = mdbpeek(sp + (short)i.IType.imm); break; case 7: /* a3 */ - a3 = kdbpeek(sp + (short)i.IType.imm); + a3 = mdbpeek(sp + (short)i.IType.imm); break; case 30: /* fp */ - fp = kdbpeek(sp + (short)i.IType.imm); + fp = mdbpeek(sp + (short)i.IType.imm); break; case 31: /* ra */ - ra = kdbpeek(sp + (short)i.IType.imm); + ra = mdbpeek(sp + (short)i.IType.imm); } break; diff --git a/sys/arch/arc/arc/vm_machdep.c b/sys/arch/arc/arc/vm_machdep.c index de2a2aa0d22..73860b0bfa6 100644 --- a/sys/arch/arc/arc/vm_machdep.c +++ b/sys/arch/arc/arc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.4 1997/03/23 11:34:31 pefo Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.5 1997/04/19 17:19:48 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 * * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 - * $Id: vm_machdep.c,v 1.4 1997/03/23 11:34:31 pefo Exp $ + * $Id: vm_machdep.c,v 1.5 1997/04/19 17:19:48 pefo Exp $ */ #include @@ -59,7 +59,11 @@ #include #include -vm_offset_t kmem_alloc_wait_align(); +vm_offset_t kmem_alloc_wait_align __P((vm_map_t, vm_size_t, vm_size_t)); +static int vm_map_findspace_align __P((vm_map_t map, vm_offset_t, vm_size_t, + vm_offset_t *, vm_size_t)); +int vm_map_find_U __P((vm_map_t, vm_object_t, vm_offset_t, vm_offset_t *, + vm_size_t, boolean_t)); /* * Finish a fork operation, with process p2 nearly set up. @@ -70,12 +74,13 @@ vm_offset_t kmem_alloc_wait_align(); * address in each process; in the future we will probably relocate * the frame pointers on the stack after copying. */ +int cpu_fork(p1, p2) register struct proc *p1, *p2; { - register struct user *up = p2->p_addr; - register pt_entry_t *pte; - register int i; + struct user *up = p2->p_addr; + pt_entry_t *pte; + int i; extern struct proc *machFPCurProcPtr; p2->p_md.md_regs = up->u_pcb.pcb_regs; @@ -159,7 +164,8 @@ cpu_swapin(p) * pcb and stack and never returns. We block memory allocation * until switch_exit has made things safe again. */ -void cpu_exit(p) +void +cpu_exit(p) struct proc *p; { extern struct proc *machFPCurProcPtr; @@ -178,6 +184,7 @@ void cpu_exit(p) /* * Dump the machine specific header information at the start of a core dump. */ +int cpu_coredump(p, vp, cred, chdr) struct proc *p; struct vnode *vp; @@ -231,21 +238,21 @@ cpu_coredump(p, vp, cred, chdr) */ void pagemove(from, to, size) - register caddr_t from, to; + caddr_t from, to; size_t size; { - register pt_entry_t *fpte, *tpte; + pt_entry_t *fpte, *tpte; if (size % CLBYTES) panic("pagemove"); fpte = kvtopte(from); tpte = kvtopte(to); if(((int)from & CpuCacheAliasMask) != ((int)to & CpuCacheAliasMask)) { - R4K_HitFlushDCache(from, size); + R4K_HitFlushDCache((vm_offset_t)from, size); } while (size > 0) { - R4K_TLBFlushAddr(from); - R4K_TLBUpdate(to, *fpte); + R4K_TLBFlushAddr((vm_offset_t)from); + R4K_TLBUpdate((vm_offset_t)to, fpte->pt_entry); *tpte++ = *fpte; fpte->pt_entry = PG_NV | PG_G; fpte++; @@ -407,10 +414,10 @@ vm_map_find_U(map, object, offset, addr, length, find_space) * Find sufficient space for `length' bytes in the given map, starting at * `start'. The map must be locked. Returns 0 on success, 1 on no space. */ -int +static int vm_map_findspace_align(map, start, length, addr, align) - register vm_map_t map; - register vm_offset_t start; + vm_map_t map; + vm_offset_t start; vm_size_t length; vm_offset_t *addr; vm_size_t align; diff --git a/sys/arch/arc/conf/Makefile.arc b/sys/arch/arc/conf/Makefile.arc index 50cb27c99e6..3b7a1285408 100644 --- a/sys/arch/arc/conf/Makefile.arc +++ b/sys/arch/arc/conf/Makefile.arc @@ -1,17 +1,17 @@ -# $OpenBSD: Makefile.arc,v 1.6 1996/09/24 20:04:45 pefo Exp $ +# $OpenBSD: Makefile.arc,v 1.7 1997/04/19 17:19:49 pefo Exp $ # @(#)Makefile.arc 8.2 (Berkeley) 2/16/94 # # Makefile for 4.4 BSD # # This makefile is constructed from a machine description: -# config machineid +# config ``machineid'' # Most changes should be made in the machine description -# /sys/arch/MACHINE/conf/``machineid'' +# /sys/arch/arc/conf/``machineid'' # after which you should do -# config machineid +# config ``machineid'' # Machine generic makefile changes should be made in -# /sys/arch/MACHINE/conf/Makefile.``machinetype'' +# /sys/arch/arc/conf/Makefile.``machinetype'' # after which config should be rerun for all machines of that type. # # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE @@ -23,6 +23,7 @@ # DEBUG is set to -g by config if debugging is requested (config -g). # PROF is set to -pg by config if profiling is requested (config -p). + AS?= as CC?= cc CPP?= cpp @@ -36,7 +37,10 @@ ARC= ../.. INCLUDES= -I. -I$S/arch -I$S CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Darc -CFLAGS= ${DEBUG} -O2 -Werror -mno-abicalls -mips2 -mcpu=r4000 +CDIAGFLAGS= -Werror -Wall -Wstrict-prototypes -Wno-uninitialized \ + -Wno-format + +CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} -mno-abicalls -mips2 -mcpu=r4000 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE ### find out what to use for libkern @@ -110,7 +114,7 @@ newvers: clean:: rm -f eddep bsd bsd.gdb bsd.ecoff tags *.o locore.i [a-z]*.s \ - Errs errs linterrs makelinks genassym + Errs errs linterrs makelinks lint: /tmp param.c @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ @@ -138,14 +142,12 @@ uipc_domain.o uipc_proto.o vfs_conf.o: Makefile if_tun.o if_loop.o if_ethersubr.o: Makefile in_proto.o: Makefile -assym.h: genassym - ./genassym >assym.h -genassym: genassym.o - ${HOSTCC} -o $@ genassym.o +assym.h: $S/kern/genassym.sh ${ARC}/arc/genassym.cf + sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ + ${PARAM} < ${ARC}/arc/genassym.cf > assym.h.tmp && \ + mv -f assym.h.tmp assym.h -genassym.o: ${ARC}/arc/genassym.c - ${HOSTCC} ${INCLUDES} ${IDENT} -D_KERNEL -Darc -c $< links: egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ diff --git a/sys/arch/arc/dev/asc.c b/sys/arch/arc/dev/asc.c index 240285177d1..fb10dca8c3e 100644 --- a/sys/arch/arc/dev/asc.c +++ b/sys/arch/arc/dev/asc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc.c,v 1.4 1996/11/23 21:45:29 kstailey Exp $ */ +/* $OpenBSD: asc.c,v 1.5 1997/04/19 17:19:50 pefo Exp $ */ /* $NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp $ */ /*- @@ -190,8 +190,9 @@ int asc_to_scsi_period[] = { /* * Internal forward declarations. */ -static void asc_reset(); -static void asc_startcmd(); +struct asc_softc; +static void asc_reset __P((struct asc_softc *, asc_regmap_t *)); +static void asc_startcmd __P((struct asc_softc *, int)); #ifdef DEBUG int asc_debug = 1; @@ -225,7 +226,8 @@ struct asc_log { */ typedef struct script { int condition; /* expected state at interrupt time */ - int (*action)(); /* extra operations */ + int (*action)(struct asc_softc *, int, int, int); + /* extra operations */ int command; /* command to the chip */ struct script *next; /* index into asc_scripts for next state */ } script_t; @@ -233,22 +235,38 @@ typedef struct script { /* Matching on the condition value */ #define SCRIPT_MATCH(ir, csr) ((ir) | (((csr) & 0x67) << 8)) + /* forward decls of script actions */ -static int script_nop(); /* when nothing needed */ -static int asc_end(); /* all come to an end */ -static int asc_get_status(); /* get status from target */ -static int asc_dma_in(); /* start reading data from target */ -static int asc_last_dma_in(); /* cleanup after all data is read */ -static int asc_resume_in(); /* resume data in after a message */ -static int asc_resume_dma_in(); /* resume DMA after a disconnect */ -static int asc_dma_out(); /* send data to target via dma */ -static int asc_last_dma_out(); /* cleanup after all data is written */ -static int asc_resume_out(); /* resume data out after a message */ -static int asc_resume_dma_out(); /* resume DMA after a disconnect */ -static int asc_sendsync(); /* negotiate sync xfer */ -static int asc_replysync(); /* negotiate sync xfer */ -static int asc_msg_in(); /* process a message byte */ -static int asc_disconnect(); /* process an expected disconnect */ + /* when nothing needed */ +static int script_nop __P((struct asc_softc *, int, int, int)); + /* all come to an end */ +static int asc_end __P((struct asc_softc *, int, int, int)); + /* get status from target */ +static int asc_get_status __P((struct asc_softc *, int, int, int)); + /* start reading data from target */ +static int asc_dma_in __P((struct asc_softc *, int, int, int)); + /* cleanup after all data is read */ +static int asc_last_dma_in __P((struct asc_softc *, int, int, int)); + /* resume data in after a message */ +static int asc_resume_in __P((struct asc_softc *, int, int, int)); + /* resume DMA after a disconnect */ +static int asc_resume_dma_in __P((struct asc_softc *, int, int, int)); + /* send data to target via dma */ +static int asc_dma_out __P((struct asc_softc *, int, int, int)); + /* cleanup after all data is written */ +static int asc_last_dma_out __P((struct asc_softc *, int, int, int)); + /* resume data out after a message */ +static int asc_resume_out __P((struct asc_softc *, int, int, int)); + /* resume DMA after a disconnect */ +static int asc_resume_dma_out __P((struct asc_softc *, int, int, int)); + /* negotiate sync xfer */ +static int asc_sendsync __P((struct asc_softc *, int, int, int)); + /* negotiate sync xfer */ +static int asc_replysync __P((struct asc_softc *, int, int, int)); + /* process a message byte */ +static int asc_msg_in __P((struct asc_softc *, int, int, int)); + /* process an expected disconnect */ +static int asc_disconnect __P((struct asc_softc *, int, int, int)); /* Define the index into asc_scripts for various state transitions */ #define SCRIPT_DATA_IN 0 @@ -471,9 +489,9 @@ struct scsi_device asc_dev = { /*XXX*/ NULL, /* Use default 'done' routine */ }; -static int asc_probe(); -static void asc_start(); -static int asc_intr(); +static int asc_intr __P((void *)); +static int asc_poll __P((struct asc_softc *, int)); +static void asc_DumpLog __P((char *)); /* * Match driver based on name @@ -484,7 +502,6 @@ ascmatch(parent, match, aux) void *match; void *aux; { - struct cfdata *cf = match; struct confargs *ca = aux; if(!BUS_MATCHNAME(ca, "asc")) @@ -633,7 +650,6 @@ asc_scsi_cmd(xs) { struct scsi_link *sc_link = xs->sc_link; struct asc_softc *asc = sc_link->adapter_softc; - State *state = &asc->st[sc_link->target]; int flags, s; @@ -643,7 +659,7 @@ asc_scsi_cmd(xs) * Flush caches for any data buffer */ if(xs->datalen != 0) { - R4K_HitFlushDCache(xs->data, xs->datalen); + R4K_HitFlushDCache((vm_offset_t)xs->data, xs->datalen); } /* * The hack on the next few lines are to avoid buffers @@ -902,7 +918,7 @@ asc_intr(sc) ss = regs->asc_ss; if ((status & ASC_CSR_INT) == 0) /* Make shure it's a real interrupt */ - return; + return(0); ir = regs->asc_intr; /* this resets the previous two */ scpt = asc->script; @@ -1022,8 +1038,6 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo); len += fifo; /* Bytes dma'ed but not sent */ } else if (state->flags & DMA_IN) { - u_char *cp; - printf("asc_intr: IN: dmalen %d len %d fifo %d\n", state->dmalen, len, fifo); /* XXX */ } @@ -1150,7 +1164,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo); asc->st[i].flags = 0; } asc->target = -1; - return; + return(1); } /* check for command errors */ @@ -1190,7 +1204,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo); } asc->cmd[asc->target]->error = XS_DRIVER_STUFFUP; asc_end(asc, status, ss, ir); - return; + return(1); } /* FALLTHROUGH */ @@ -1211,7 +1225,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo); state->flags |= DISCONN; regs->asc_cmd = ASC_CMD_ENABLE_SEL; readback(regs->asc_cmd); - return; + return(1); } } @@ -1265,17 +1279,14 @@ done: * dispatcher (which we are returning to) will catch it * before returning to the interrupted code. */ - return; + return(1); abort: #ifdef DEBUG asc_DumpLog("asc_intr"); #endif -#if 0 panic("asc_intr"); -#else - boot(4); /* XXX */ -#endif + return(1); } /* @@ -1286,8 +1297,8 @@ abort: /* ARGSUSED */ static int script_nop(asc, status, ss, ir) - register asc_softc_t asc; - register int status, ss, ir; + asc_softc_t asc; + int status, ss, ir; { return (1); } @@ -1344,8 +1355,8 @@ asc_get_status(asc, status, ss, ir) /* ARGSUSED */ static int asc_end(asc, status, ss, ir) - register asc_softc_t asc; - register int status, ss, ir; + asc_softc_t asc; + int status, ss, ir; { struct scsi_xfer *scsicmd; struct scsi_link *sc_link; @@ -2026,10 +2037,10 @@ done: /* ARGSUSED */ static int asc_disconnect(asc, status, ss, ir) - register asc_softc_t asc; - register int status, ss, ir; + asc_softc_t asc; + int status, ss, ir; { - register State *state = &asc->st[asc->target]; + State *state = &asc->st[asc->target]; #ifdef DIAGNOSTIC if (!(state->flags & DISCONN)) { @@ -2046,6 +2057,7 @@ asc_disconnect(asc, status, ss, ir) /* * Dump the log buffer. */ +static void asc_DumpLog(str) char *str; { diff --git a/sys/arch/arc/dev/dma.c b/sys/arch/arc/dev/dma.c index 085ec063793..bb6170dd537 100644 --- a/sys/arch/arc/dev/dma.c +++ b/sys/arch/arc/dev/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.3 1996/08/26 11:11:59 pefo Exp $ */ +/* $OpenBSD: dma.c,v 1.4 1997/04/19 17:19:51 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)rz.c 8.1 (Berkeley) 7/29/93 - * $Id: dma.c,v 1.3 1996/08/26 11:11:59 pefo Exp $ + * $Id: dma.c,v 1.4 1997/04/19 17:19:51 pefo Exp $ */ /* @@ -52,9 +52,9 @@ #include #include +#include #include #include -#include #include #include @@ -71,6 +71,7 @@ extern vm_map_t phys_map; dma_pte_t *free_dma_pte; /* Pointer to free dma pte list */ dma_pte_t *first_dma_pte; /* Pointer to first dma pte */ + /* * Initialize the dma mapping register area and pool. */ @@ -182,6 +183,7 @@ picaDmaTLBFree(dma_softc_t *dma) * the dma control structure and invalidate dma TLB cache. */ +void picaDmaTLBMap(dma_softc_t *sc) { vm_offset_t pa; @@ -221,7 +223,6 @@ picaDmaStart(sc, addr, size, datain) size_t size; int datain; { - int mode; pDmaReg regs = sc->dma_reg; /* Halt DMA */ @@ -328,8 +329,6 @@ picaDmaEnd(dma_softc_t *sc) void picaDmaNull(dma_softc_t *sc) { - pDmaReg regs = sc->dma_reg; - printf("picaDmaNull called\n"); } @@ -338,14 +337,15 @@ picaDmaNull(dma_softc_t *sc) * Called from asc to set up dma */ void -asc_dma_init(dma_softc_t *sc) +asc_dma_init(sc) + dma_softc_t *sc; { sc->reset = picaDmaReset; sc->enintr = picaDmaNull; sc->start = picaDmaStart; sc->map = picaDmaMap; - sc->isintr = (int(*)())picaDmaNull; - sc->intr = (int(*)())picaDmaNull; + sc->isintr = (int(*)(struct dma_softc *))picaDmaNull; + sc->intr = (int(*)(struct dma_softc *))picaDmaNull; sc->end = picaDmaEnd; sc->dma_reg = (pDmaReg)R4030_SYS_DMA0_REGS; @@ -364,8 +364,8 @@ fdc_dma_init(dma_softc_t *sc) sc->enintr = picaDmaNull; sc->start = picaDmaStart; sc->map = picaDmaMap; - sc->isintr = (int(*)())picaDmaNull; - sc->intr = (int(*)())picaDmaNull; + sc->isintr = (int(*)(struct dma_softc *))picaDmaNull; + sc->intr = (int(*)(struct dma_softc *))picaDmaNull; sc->end = picaDmaEnd; sc->dma_reg = (pDmaReg)R4030_SYS_DMA1_REGS; @@ -384,9 +384,9 @@ sn_dma_init(dma_softc_t *sc, int pages) sc->enintr = picaDmaNull; sc->start = picaDmaFlush; sc->map = picaDmaMap; - sc->isintr = (int(*)())picaDmaNull; - sc->intr = (int(*)())picaDmaNull; - sc->end = (int(*)())picaDmaNull; + sc->isintr = (int(*)(struct dma_softc *))picaDmaNull; + sc->intr = (int(*)(struct dma_softc *))picaDmaNull; + sc->end = (int(*)(struct dma_softc *))picaDmaNull; sc->dma_reg = (pDmaReg)NULL; sc->pte_size = pages; diff --git a/sys/arch/arc/dev/dma.h b/sys/arch/arc/dev/dma.h index 3e6f4446ca2..cb9a69cadd3 100644 --- a/sys/arch/arc/dev/dma.h +++ b/sys/arch/arc/dev/dma.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.h,v 1.2 1996/07/30 20:24:21 pefo Exp $ */ +/* $OpenBSD: dma.h,v 1.3 1997/04/19 17:19:51 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom * All rights reserved. @@ -143,3 +143,15 @@ typedef struct dma_softc { #define DMA_INTR(r) ((r->intr)(r)) #define DMA_DRAIN(r) #define DMA_END(r) ((r->end)(r)) + +void picaDmaInit __P((void)); +void picaDmaTLBAlloc __P((dma_softc_t *)); +void picaDmaTLBFree __P((dma_softc_t *)); +void picaDmaTLBMap __P((dma_softc_t *)); +void picaDmaMap __P((struct dma_softc *, char *, size_t, int)); +void picaDmaStart __P((struct dma_softc *, char *, size_t, int)); +void picaDmaFlush __P((struct dma_softc *, char *, size_t, int)); +void asc_dma_init __P((struct dma_softc *)); +void fdc_dma_init __P((struct dma_softc *)); +void sn_dma_init __P((struct dma_softc *, int)); + diff --git a/sys/arch/arc/dev/fd.c b/sys/arch/arc/dev/fd.c index e932868c54f..3a98739bb0f 100644 --- a/sys/arch/arc/dev/fd.c +++ b/sys/arch/arc/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.4 1996/11/23 21:45:30 kstailey Exp $ */ +/* $OpenBSD: fd.c,v 1.5 1997/04/19 17:19:52 pefo Exp $ */ /* $NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp $ */ /*- @@ -189,9 +189,17 @@ void fdgetdisklabel __P((struct fd_softc *)); int fd_get_parms __P((struct fd_softc *)); void fdstrategy __P((struct buf *)); void fdstart __P((struct fd_softc *)); +int fdioctl __P((dev_t, u_long, caddr_t, int)); +int fddump __P((dev_t, daddr_t, caddr_t, size_t)); +int fdsize __P((dev_t)); +int fdopen __P((dev_t, int)); +int fdclose __P((dev_t, int)); +int fdwrite __P((dev_t, struct uio *)); +int fdread __P((dev_t, struct uio *)); struct dkdriver fddkdriver = { fdstrategy }; +int fdprint __P((void *, const char *)); struct fd_type *fd_nvtotype __P((char *, int, int)); void fd_set_motor __P((struct fdc_softc *fdc, int reset)); void fd_motor_off __P((void *arg)); @@ -410,18 +418,6 @@ fd_nvtotype(fdc, nvraminfo, drive) #endif } -inline struct fd_type * -fd_dev_to_type(fd, dev) - struct fd_softc *fd; - dev_t dev; -{ - int type = FDTYPE(dev); - - if (type > (sizeof(fd_types) / sizeof(fd_types[0]))) - return NULL; - return type ? &fd_types[type - 1] : fd->sc_deftype; -} - void fdstrategy(bp) register struct buf *bp; /* IO operation to perform */ @@ -567,7 +563,7 @@ fd_set_motor(fdc, reset) u_char status; int n; - if (fd = fdc->sc_drives.tqh_first) + if ((fd = fdc->sc_drives.tqh_first) != NULL) status = fd->sc_drive; else status = 0; @@ -665,7 +661,14 @@ fdopen(dev, flags) fd = fd_cd.cd_devs[unit]; if (fd == 0) return ENXIO; - type = fd_dev_to_type(fd, dev); + + if (FDTYPE(dev) > (sizeof(fd_types) / sizeof(fd_types[0]))) + type = NULL; + else if(FDTYPE(dev)) + type = &fd_types[FDTYPE(dev) - 1]; + else + type = fd->sc_deftype; + if (type == NULL) return ENXIO; @@ -714,7 +717,6 @@ fdcstatus(dv, n, s) char *s; { struct fdc_softc *fdc = (void *)dv->dv_parent; - int iobase = fdc->sc_iobase; if (n == 0) { out_fdc(fdc->sc_iobase, NE7CMD_SENSEI); @@ -790,7 +792,7 @@ fdcintr(arg) struct fd_softc *fd; struct buf *bp; int iobase = fdc->sc_iobase; - int read, head, trac, sec, i, s, nblks; + int read, head, sec, i, nblks; struct fd_type *type; loop: @@ -878,7 +880,7 @@ loop: #endif }} #endif - R4K_FlushDCache(bp->b_data + fd->sc_skip, fd->sc_nbytes); + R4K_FlushDCache((vm_offset_t)(bp->b_data + fd->sc_skip), fd->sc_nbytes); read = bp->b_flags & B_READ ? DMA_FROM_DEV : DMA_TO_DEV; DMA_START(fdc->dma, bp->b_data + fd->sc_skip, fd->sc_nbytes, read); outb(iobase + fdctl, type->rate); diff --git a/sys/arch/arc/dev/if_sn.c b/sys/arch/arc/dev/if_sn.c index 02fc28a0ee3..1b2ad7c7084 100644 --- a/sys/arch/arc/dev/if_sn.c +++ b/sys/arch/arc/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.8 1997/03/12 19:16:50 pefo Exp $ */ +/* $OpenBSD: if_sn.c,v 1.9 1997/04/19 17:19:52 pefo Exp $ */ /* * National Semiconductor SONIC Driver * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) @@ -12,6 +12,8 @@ #include "sn.h" #include +#include +#include #include #include #include @@ -52,6 +54,7 @@ typedef unsigned char uchar; #define SWR(a, x) (a) = (x) #define SRD(a) ((a) & 0xffff) +#include #include /* @@ -128,41 +131,6 @@ struct cfdriver sn_cd = { #endif #endif -void -m_check(m) - struct mbuf *m; -{ - if (m->m_flags & M_EXT) { - assert(m->m_len >= 0); - assert(m->m_len <= m->m_ext.ext_size); - assert(m->m_data >= &m->m_ext.ext_buf[0]); - assert(m->m_data <= &m->m_ext.ext_buf[m->m_ext.ext_size]); - assert(m->m_data + m->m_len <= &m->m_ext.ext_buf[m->m_ext.ext_size]); - } else if (m->m_flags & M_PKTHDR) { - assert(m->m_len >= 0); - assert(m->m_len <= MHLEN); - assert(m->m_data >= m->m_pktdat); - assert(m->m_data <= &m->m_pktdat[MHLEN]); - assert(m->m_data + m->m_len <= &m->m_pktdat[MHLEN]); - } else { - assert(m->m_len >= 0); - assert(m->m_len <= MLEN); - assert(m->m_data >= m->m_dat); - assert(m->m_data <= &m->m_dat[MLEN]); - assert(m->m_data + m->m_len <= &m->m_dat[MLEN]); - } -} - -void -m_checkm(m) - struct mbuf *m; -{ - while (m) { - m_check(m); - m = m->m_next; - } -} - int ethdebug = 0; int snintr __P((struct sn_softc *)); @@ -260,7 +228,6 @@ snmatch(parent, match, aux) struct device *parent; void *match, *aux; { - struct cfdata *cf = match; struct confargs *ca = aux; /* XXX CHECK BUS */ @@ -284,7 +251,6 @@ snattach(parent, self, aux) struct sn_softc *sc = (void *)self; struct confargs *ca = aux; struct ifnet *ifp = &sc->sc_if; - struct cfdata *cf = sc->sc_dev.dv_cfdata; int p, pp; sc->sc_csr = (struct sonic_reg *)BUS_CVTADDR(ca); @@ -455,7 +421,6 @@ snstart(ifp) { struct sn_softc *sc = ifp->if_softc; struct mbuf *m; - int len; if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) return; @@ -512,7 +477,7 @@ sninit(sc) struct sn_softc *sc; { struct sonic_reg *csr = sc->sc_csr; - int s, error; + int s; if (sc->sc_if.if_flags & IFF_RUNNING) /* already running */ @@ -523,8 +488,8 @@ sninit(sc) csr->s_cr = CR_RST; /* s_dcr only accessable reset mode! */ /* config it */ - csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 | DCR_DMABLOCK | - DCR_RFT16 | DCR_TFT16; + csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 | + DCR_RFT4 | DCR_TFT28; /*XXX RFT & TFT according to MIPS manual */ csr->s_rcr = RCR_BRD | RCR_LBNONE; csr->s_imr = IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_HBLEN | IMR_LCDEN; @@ -564,10 +529,6 @@ sninit(sc) splx(s); return (0); - -bad: - snstop(sc); - return (error); } /* @@ -589,7 +550,7 @@ snstop(sc) /* free all receive buffers (currently static so nothing to do) */ /* free all pending transmit mbufs */ - while (mtd = mtdhead) { + while ((mtd = mtdhead)) { mtdhead = mtdhead->mtd_link; if (mtd->mtd_mbuf) m_freem(mtd->mtd_mbuf); @@ -643,7 +604,6 @@ sonicput(sc, m0) struct mtd *mtdnew; struct mbuf *m; int len = 0, fr = 0; - int i; int fragoffset; /* Offset in viritual dma space for fragment */ /* grab the replacement mtd */ @@ -761,10 +721,9 @@ int sngetaddr(sc) struct sn_softc *sc; { - unsigned i, x, y; - char *cp, *ea; - #if 0 + int i; + sc->sc_csr->s_cr = CR_RST; wbflush(); sc->sc_csr->s_cep = 0; @@ -851,7 +810,6 @@ camprogram(sc) { struct sonic_reg *csr; int timeout; - int i; csr = sc->sc_csr; csr->s_cdp = LOWER(v_cda); @@ -989,7 +947,7 @@ snintr(sc) struct sonic_reg *csr = sc->sc_csr; int isr; - while (isr = (csr->s_isr & ISR_ALL)) { + while ((isr = (csr->s_isr & ISR_ALL))) { /* scrub the interrupts that we are going to service */ csr->s_isr = isr; wbflush(); @@ -1045,7 +1003,7 @@ sonictxint(sc) csr = sc->sc_csr; - while (mtd = mtdhead) { + while ((mtd = mtdhead)) { struct mbuf *m = mtd->mtd_mbuf; if (m == 0) @@ -1111,7 +1069,6 @@ sonicrxint(sc) { struct sonic_reg *csr = sc->sc_csr; struct RXpkt *rxp; - u_long addr; int orra; rxp = &p_rda[sc->sc_rxmark]; @@ -1188,7 +1145,7 @@ sonic_read(sc, rxp) /*extern char *ether_sprintf();*/ struct ether_header *et; struct mbuf *m; - int len, off, i; + int len; caddr_t pkt; /* @@ -1228,7 +1185,7 @@ sonic_read(sc, rxp) (et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ bcmp(et->ether_dhost, sc->sc_enaddr, sizeof(et->ether_dhost)) != 0) - return; + return(0); } #endif m = sonic_get(sc, et, len); diff --git a/sys/arch/arc/dev/pccons.c b/sys/arch/arc/dev/pccons.c index 0b4174f589c..cfb1359cc40 100644 --- a/sys/arch/arc/dev/pccons.c +++ b/sys/arch/arc/dev/pccons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccons.c,v 1.13 1997/04/10 16:29:19 pefo Exp $ */ +/* $OpenBSD: pccons.c,v 1.14 1997/04/19 17:19:53 pefo Exp $ */ /* $NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp $ */ /*- @@ -72,6 +72,7 @@ #include #include #include +#include #include #include @@ -104,6 +105,8 @@ static u_short cursor_shape = 0xffff, /* don't update until set by user */ static pccons_keymap_t scan_codes[KB_NUM_KEYS];/* keyboard translation table */ int pc_xmode = 0; +cdev_decl(pc); + /* * Keyboard output queue. */ @@ -150,6 +153,25 @@ struct pms_softc { /* driver status information */ int pcprobe __P((struct device *, void *, void *)); void pcattach __P((struct device *, struct device *, void *)); int pcintr __P((void *)); +void pc_xmode_on __P((void)); +void pc_xmode_off __P((void)); +static u_char kbc_get8042cmd __P((void)); +static int kbc_put8042cmd __P((u_char)); +int kbd_cmd __P((u_char, u_char)); +static __inline int kbd_wait_output __P((void)); +static __inline int kbd_wait_input __P((void)); +static __inline void kbd_flush_input __P((void)); +void set_cursor_shape __P((void)); +void get_cursor_shape __P((void)); +void async_update __P((void)); +void do_async_update __P((u_char));; + +void pccnprobe __P((struct consdev *)); +void pccninit __P((struct consdev *)); +void pccnputc __P((dev_t, char c)); +int pccngetc __P((dev_t)); +void pccnpollc __P((dev_t, int)); + struct cfdriver pc_cd = { NULL, "pc", DV_TTY, NULL, 0 @@ -189,11 +211,13 @@ static unsigned int kbd_datap = 0x60; char *sget __P((void)); void sput __P((u_char *, int)); -void pcstart(); -int pcparam(); +void pcstart __P((struct tty *)); +int pcparam __P((struct tty *, struct termios *)); +static __inline void wcopy __P((void *, void *, u_int)); + char partab[]; -extern pcopen(dev_t, int, int, struct proc *); +extern void fillw __P((int, u_int16_t *, int)); #define KBD_DELAY \ DELAY(10); @@ -253,7 +277,7 @@ kbd_flush_input() { u_char c; - while (c = inb(kbd_cmdp) & 0x03) + while ((c = inb(kbd_cmdp)) & 0x03) if ((c & KBS_DIB) == KBS_DIB) { /* XXX - delay is needed to prevent some keyboards from wedging when the system boots */ @@ -426,13 +450,13 @@ async_update() if (kernel || polling) { if (async) - untimeout(do_async_update, NULL); + untimeout((void(*)(void *))do_async_update, NULL); do_async_update(1); } else { if (async) return; async = 1; - timeout(do_async_update, NULL, 1); + timeout((void(*)(void *))do_async_update, NULL, 1); } } @@ -763,7 +787,7 @@ pcstart(tp) struct tty *tp; { struct clist *cl; - int s, len, n; + int s, len; u_char buf[PCBURST]; s = spltty(); @@ -795,12 +819,12 @@ out: splx(s); } -void +int pcstop(tp, flag) struct tty *tp; int flag; { - + return(0); } void @@ -886,6 +910,7 @@ pccnputc(dev, c) } /* ARGSUSED */ +int pccngetc(dev) dev_t dev; { @@ -1338,7 +1363,7 @@ sput(cp, n) fillw((vs.at << 8) | ' ', Crtat + vs.ncol * (vs.nrow - cx), vs.ncol * cx); - /* crtat -= vs.ncol * cx; /* XXX */ + /* crtat -= vs.ncol * cx; XXX */ vs.state = 0; break; } @@ -1388,7 +1413,7 @@ sput(cp, n) #endif fillw((vs.at << 8) | ' ', Crtat, vs.ncol * cx); - /* crtat += vs.ncol * cx; /* XXX */ + /* crtat += vs.ncol * cx; XXX */ vs.state = 0; break; } @@ -1486,134 +1511,134 @@ sput(cp, n) left and right shift when reading the keyboard map */ static pccons_keymap_t scan_codes[KB_NUM_KEYS] = { /* type unshift shift control altgr shift_altgr scancode */ - KB_NONE, "", "", "", "", "", /* 0 unused */ - KB_ASCII, "\033", "\033", "\033", "", "", /* 1 ESCape */ - KB_ASCII, "1", "!", "!", "", "", /* 2 1 */ - KB_ASCII, "2", "@", "\000", "", "", /* 3 2 */ - KB_ASCII, "3", "#", "#", "", "", /* 4 3 */ - KB_ASCII, "4", "$", "$", "", "", /* 5 4 */ - KB_ASCII, "5", "%", "%", "", "", /* 6 5 */ - KB_ASCII, "6", "^", "\036", "", "", /* 7 6 */ - KB_ASCII, "7", "&", "&", "", "", /* 8 7 */ - KB_ASCII, "8", "*", "\010", "", "", /* 9 8 */ - KB_ASCII, "9", "(", "(", "", "", /* 10 9 */ - KB_ASCII, "0", ")", ")", "", "", /* 11 0 */ - KB_ASCII, "-", "_", "\037", "", "", /* 12 - */ - KB_ASCII, "=", "+", "+", "", "", /* 13 = */ - KB_ASCII, "\177", "\177", "\010", "", "", /* 14 backspace */ - KB_ASCII, "\t", "\t", "\t", "", "", /* 15 tab */ - KB_ASCII, "q", "Q", "\021", "", "", /* 16 q */ - KB_ASCII, "w", "W", "\027", "", "", /* 17 w */ - KB_ASCII, "e", "E", "\005", "", "", /* 18 e */ - KB_ASCII, "r", "R", "\022", "", "", /* 19 r */ - KB_ASCII, "t", "T", "\024", "", "", /* 20 t */ - KB_ASCII, "y", "Y", "\031", "", "", /* 21 y */ - KB_ASCII, "u", "U", "\025", "", "", /* 22 u */ - KB_ASCII, "i", "I", "\011", "", "", /* 23 i */ - KB_ASCII, "o", "O", "\017", "", "", /* 24 o */ - KB_ASCII, "p", "P", "\020", "", "", /* 25 p */ - KB_ASCII, "[", "{", "\033", "", "", /* 26 [ */ - KB_ASCII, "]", "}", "\035", "", "", /* 27 ] */ - KB_ASCII, "\r", "\r", "\n", "", "", /* 28 return */ - KB_CTL, "", "", "", "", "", /* 29 control */ - KB_ASCII, "a", "A", "\001", "", "", /* 30 a */ - KB_ASCII, "s", "S", "\023", "", "", /* 31 s */ - KB_ASCII, "d", "D", "\004", "", "", /* 32 d */ - KB_ASCII, "f", "F", "\006", "", "", /* 33 f */ - KB_ASCII, "g", "G", "\007", "", "", /* 34 g */ - KB_ASCII, "h", "H", "\010", "", "", /* 35 h */ - KB_ASCII, "j", "J", "\n", "", "", /* 36 j */ - KB_ASCII, "k", "K", "\013", "", "", /* 37 k */ - KB_ASCII, "l", "L", "\014", "", "", /* 38 l */ - KB_ASCII, ";", ":", ";", "", "", /* 39 ; */ - KB_ASCII, "'", "\"", "'", "", "", /* 40 ' */ - KB_ASCII, "`", "~", "`", "", "", /* 41 ` */ - KB_SHIFT, "\001", "", "", "", "", /* 42 shift */ - KB_ASCII, "\\", "|", "\034", "", "", /* 43 \ */ - KB_ASCII, "z", "Z", "\032", "", "", /* 44 z */ - KB_ASCII, "x", "X", "\030", "", "", /* 45 x */ - KB_ASCII, "c", "C", "\003", "", "", /* 46 c */ - KB_ASCII, "v", "V", "\026", "", "", /* 47 v */ - KB_ASCII, "b", "B", "\002", "", "", /* 48 b */ - KB_ASCII, "n", "N", "\016", "", "", /* 49 n */ - KB_ASCII, "m", "M", "\r", "", "", /* 50 m */ - KB_ASCII, ",", "<", "<", "", "", /* 51 , */ - KB_ASCII, ".", ">", ">", "", "", /* 52 . */ - KB_ASCII, "/", "?", "\037", "", "", /* 53 / */ - KB_SHIFT, "\002", "", "", "", "", /* 54 shift */ - KB_KP, "*", "*", "*", "", "", /* 55 kp * */ - KB_ALT, "", "", "", "", "", /* 56 alt */ - KB_ASCII, " ", " ", "\000", "", "", /* 57 space */ - KB_CAPS, "", "", "", "", "", /* 58 caps */ - KB_FUNC, "\033[M", "\033[Y", "\033[k", "", "", /* 59 f1 */ - KB_FUNC, "\033[N", "\033[Z", "\033[l", "", "", /* 60 f2 */ - KB_FUNC, "\033[O", "\033[a", "\033[m", "", "", /* 61 f3 */ - KB_FUNC, "\033[P", "\033[b", "\033[n", "", "", /* 62 f4 */ - KB_FUNC, "\033[Q", "\033[c", "\033[o", "", "", /* 63 f5 */ - KB_FUNC, "\033[R", "\033[d", "\033[p", "", "", /* 64 f6 */ - KB_FUNC, "\033[S", "\033[e", "\033[q", "", "", /* 65 f7 */ - KB_FUNC, "\033[T", "\033[f", "\033[r", "", "", /* 66 f8 */ - KB_FUNC, "\033[U", "\033[g", "\033[s", "", "", /* 67 f9 */ - KB_FUNC, "\033[V", "\033[h", "\033[t", "", "", /* 68 f10 */ - KB_NUM, "", "", "", "", "", /* 69 num lock */ - KB_SCROLL, "", "", "", "", "", /* 70 scroll lock */ - KB_KP, "7", "\033[H", "7", "", "", /* 71 kp 7 */ - KB_KP, "8", "\033[A", "8", "", "", /* 72 kp 8 */ - KB_KP, "9", "\033[I", "9", "", "", /* 73 kp 9 */ - KB_KP, "-", "-", "-", "", "", /* 74 kp - */ - KB_KP, "4", "\033[D", "4", "", "", /* 75 kp 4 */ - KB_KP, "5", "\033[E", "5", "", "", /* 76 kp 5 */ - KB_KP, "6", "\033[C", "6", "", "", /* 77 kp 6 */ - KB_KP, "+", "+", "+", "", "", /* 78 kp + */ - KB_KP, "1", "\033[F", "1", "", "", /* 79 kp 1 */ - KB_KP, "2", "\033[B", "2", "", "", /* 80 kp 2 */ - KB_KP, "3", "\033[G", "3", "", "", /* 81 kp 3 */ - KB_KP, "0", "\033[L", "0", "", "", /* 82 kp 0 */ - KB_KP, ",", "\177", ",", "", "", /* 83 kp , */ - KB_NONE, "", "", "", "", "", /* 84 0 */ - KB_NONE, "", "", "", "", "", /* 85 0 */ - KB_NONE, "", "", "", "", "", /* 86 0 */ - KB_FUNC, "\033[W", "\033[i", "\033[u", "", "", /* 87 f11 */ - KB_FUNC, "\033[X", "\033[j", "\033[v", "", "", /* 88 f12 */ - KB_NONE, "", "", "", "", "", /* 89 0 */ - KB_NONE, "", "", "", "", "", /* 90 0 */ - KB_NONE, "", "", "", "", "", /* 91 0 */ - KB_NONE, "", "", "", "", "", /* 92 0 */ - KB_NONE, "", "", "", "", "", /* 93 0 */ - KB_NONE, "", "", "", "", "", /* 94 0 */ - KB_NONE, "", "", "", "", "", /* 95 0 */ - KB_NONE, "", "", "", "", "", /* 96 0 */ - KB_NONE, "", "", "", "", "", /* 97 0 */ - KB_NONE, "", "", "", "", "", /* 98 0 */ - KB_NONE, "", "", "", "", "", /* 99 0 */ - KB_NONE, "", "", "", "", "", /* 100 */ - KB_NONE, "", "", "", "", "", /* 101 */ - KB_NONE, "", "", "", "", "", /* 102 */ - KB_NONE, "", "", "", "", "", /* 103 */ - KB_NONE, "", "", "", "", "", /* 104 */ - KB_NONE, "", "", "", "", "", /* 105 */ - KB_NONE, "", "", "", "", "", /* 106 */ - KB_NONE, "", "", "", "", "", /* 107 */ - KB_NONE, "", "", "", "", "", /* 108 */ - KB_NONE, "", "", "", "", "", /* 109 */ - KB_NONE, "", "", "", "", "", /* 110 */ - KB_NONE, "", "", "", "", "", /* 111 */ - KB_NONE, "", "", "", "", "", /* 112 */ - KB_NONE, "", "", "", "", "", /* 113 */ - KB_NONE, "", "", "", "", "", /* 114 */ - KB_NONE, "", "", "", "", "", /* 115 */ - KB_NONE, "", "", "", "", "", /* 116 */ - KB_NONE, "", "", "", "", "", /* 117 */ - KB_NONE, "", "", "", "", "", /* 118 */ - KB_NONE, "", "", "", "", "", /* 119 */ - KB_NONE, "", "", "", "", "", /* 120 */ - KB_NONE, "", "", "", "", "", /* 121 */ - KB_NONE, "", "", "", "", "", /* 122 */ - KB_NONE, "", "", "", "", "", /* 123 */ - KB_NONE, "", "", "", "", "", /* 124 */ - KB_NONE, "", "", "", "", "", /* 125 */ - KB_NONE, "", "", "", "", "", /* 126 */ - KB_NONE, "", "", "", "", "" /* 127 */ + { KB_NONE, "", "", "", "", ""}, /* 0 unused */ + { KB_ASCII, "\033", "\033", "\033", "", ""}, /* 1 ESCape */ + { KB_ASCII, "1", "!", "!", "", ""}, /* 2 1 */ + { KB_ASCII, "2", "@", "\000", "", ""}, /* 3 2 */ + { KB_ASCII, "3", "#", "#", "", ""}, /* 4 3 */ + { KB_ASCII, "4", "$", "$", "", ""}, /* 5 4 */ + { KB_ASCII, "5", "%", "%", "", ""}, /* 6 5 */ + { KB_ASCII, "6", "^", "\036", "", ""}, /* 7 6 */ + { KB_ASCII, "7", "&", "&", "", ""}, /* 8 7 */ + { KB_ASCII, "8", "*", "\010", "", ""}, /* 9 8 */ + { KB_ASCII, "9", "(", "(", "", ""}, /* 10 9 */ + { KB_ASCII, "0", ")", ")", "", ""}, /* 11 0 */ + { KB_ASCII, "-", "_", "\037", "", ""}, /* 12 - */ + { KB_ASCII, "=", "+", "+", "", ""}, /* 13 = */ + { KB_ASCII, "\177", "\177", "\010", "", ""}, /* 14 backspace */ + { KB_ASCII, "\t", "\t", "\t", "", ""}, /* 15 tab */ + { KB_ASCII, "q", "Q", "\021", "", ""}, /* 16 q */ + { KB_ASCII, "w", "W", "\027", "", ""}, /* 17 w */ + { KB_ASCII, "e", "E", "\005", "", ""}, /* 18 e */ + { KB_ASCII, "r", "R", "\022", "", ""}, /* 19 r */ + { KB_ASCII, "t", "T", "\024", "", ""}, /* 20 t */ + { KB_ASCII, "y", "Y", "\031", "", ""}, /* 21 y */ + { KB_ASCII, "u", "U", "\025", "", ""}, /* 22 u */ + { KB_ASCII, "i", "I", "\011", "", ""}, /* 23 i */ + { KB_ASCII, "o", "O", "\017", "", ""}, /* 24 o */ + { KB_ASCII, "p", "P", "\020", "", ""}, /* 25 p */ + { KB_ASCII, "[", "{", "\033", "", ""}, /* 26 [ */ + { KB_ASCII, "]", "}", "\035", "", ""}, /* 27 ] */ + { KB_ASCII, "\r", "\r", "\n", "", ""}, /* 28 return */ + { KB_CTL, "", "", "", "", ""}, /* 29 control */ + { KB_ASCII, "a", "A", "\001", "", ""}, /* 30 a */ + { KB_ASCII, "s", "S", "\023", "", ""}, /* 31 s */ + { KB_ASCII, "d", "D", "\004", "", ""}, /* 32 d */ + { KB_ASCII, "f", "F", "\006", "", ""}, /* 33 f */ + { KB_ASCII, "g", "G", "\007", "", ""}, /* 34 g */ + { KB_ASCII, "h", "H", "\010", "", ""}, /* 35 h */ + { KB_ASCII, "j", "J", "\n", "", ""}, /* 36 j */ + { KB_ASCII, "k", "K", "\013", "", ""}, /* 37 k */ + { KB_ASCII, "l", "L", "\014", "", ""}, /* 38 l */ + { KB_ASCII, ";", ":", ";", "", ""}, /* 39 ; */ + { KB_ASCII, "'", "\"", "'", "", ""}, /* 40 ' */ + { KB_ASCII, "`", "~", "`", "", ""}, /* 41 ` */ + { KB_SHIFT, "\001", "", "", "", ""}, /* 42 shift */ + { KB_ASCII, "\\", "|", "\034", "", ""}, /* 43 \ */ + { KB_ASCII, "z", "Z", "\032", "", ""}, /* 44 z */ + { KB_ASCII, "x", "X", "\030", "", ""}, /* 45 x */ + { KB_ASCII, "c", "C", "\003", "", ""}, /* 46 c */ + { KB_ASCII, "v", "V", "\026", "", ""}, /* 47 v */ + { KB_ASCII, "b", "B", "\002", "", ""}, /* 48 b */ + { KB_ASCII, "n", "N", "\016", "", ""}, /* 49 n */ + { KB_ASCII, "m", "M", "\r", "", ""}, /* 50 m */ + { KB_ASCII, ",", "<", "<", "", ""}, /* 51 , */ + { KB_ASCII, ".", ">", ">", "", ""}, /* 52 . */ + { KB_ASCII, "/", "?", "\037", "", ""}, /* 53 / */ + { KB_SHIFT, "\002", "", "", "", ""}, /* 54 shift */ + { KB_KP, "*", "*", "*", "", ""}, /* 55 kp * */ + { KB_ALT, "", "", "", "", ""}, /* 56 alt */ + { KB_ASCII, " ", " ", "\000", "", ""}, /* 57 space */ + { KB_CAPS, "", "", "", "", ""}, /* 58 caps */ + { KB_FUNC, "\033[M", "\033[Y", "\033[k", "", ""}, /* 59 f1 */ + { KB_FUNC, "\033[N", "\033[Z", "\033[l", "", ""}, /* 60 f2 */ + { KB_FUNC, "\033[O", "\033[a", "\033[m", "", ""}, /* 61 f3 */ + { KB_FUNC, "\033[P", "\033[b", "\033[n", "", ""}, /* 62 f4 */ + { KB_FUNC, "\033[Q", "\033[c", "\033[o", "", ""}, /* 63 f5 */ + { KB_FUNC, "\033[R", "\033[d", "\033[p", "", ""}, /* 64 f6 */ + { KB_FUNC, "\033[S", "\033[e", "\033[q", "", ""}, /* 65 f7 */ + { KB_FUNC, "\033[T", "\033[f", "\033[r", "", ""}, /* 66 f8 */ + { KB_FUNC, "\033[U", "\033[g", "\033[s", "", ""}, /* 67 f9 */ + { KB_FUNC, "\033[V", "\033[h", "\033[t", "", ""}, /* 68 f10 */ + { KB_NUM, "", "", "", "", ""}, /* 69 num lock */ + { KB_SCROLL, "", "", "", "", ""}, /* 70 scroll lock */ + { KB_KP, "7", "\033[H", "7", "", ""}, /* 71 kp 7 */ + { KB_KP, "8", "\033[A", "8", "", ""}, /* 72 kp 8 */ + { KB_KP, "9", "\033[I", "9", "", ""}, /* 73 kp 9 */ + { KB_KP, "-", "-", "-", "", ""}, /* 74 kp - */ + { KB_KP, "4", "\033[D", "4", "", ""}, /* 75 kp 4 */ + { KB_KP, "5", "\033[E", "5", "", ""}, /* 76 kp 5 */ + { KB_KP, "6", "\033[C", "6", "", ""}, /* 77 kp 6 */ + { KB_KP, "+", "+", "+", "", ""}, /* 78 kp + */ + { KB_KP, "1", "\033[F", "1", "", ""}, /* 79 kp 1 */ + { KB_KP, "2", "\033[B", "2", "", ""}, /* 80 kp 2 */ + { KB_KP, "3", "\033[G", "3", "", ""}, /* 81 kp 3 */ + { KB_KP, "0", "\033[L", "0", "", ""}, /* 82 kp 0 */ + { KB_KP, ",", "\177", ",", "", ""}, /* 83 kp , */ + { KB_NONE, "", "", "", "", ""}, /* 84 0 */ + { KB_NONE, "", "", "", "", ""}, /* 85 0 */ + { KB_NONE, "", "", "", "", ""}, /* 86 0 */ + { KB_FUNC, "\033[W", "\033[i", "\033[u", "", ""}, /* 87 f11 */ + { KB_FUNC, "\033[X", "\033[j", "\033[v", "", ""}, /* 88 f12 */ + { KB_NONE, "", "", "", "", ""}, /* 89 0 */ + { KB_NONE, "", "", "", "", ""}, /* 90 0 */ + { KB_NONE, "", "", "", "", ""}, /* 91 0 */ + { KB_NONE, "", "", "", "", ""}, /* 92 0 */ + { KB_NONE, "", "", "", "", ""}, /* 93 0 */ + { KB_NONE, "", "", "", "", ""}, /* 94 0 */ + { KB_NONE, "", "", "", "", ""}, /* 95 0 */ + { KB_NONE, "", "", "", "", ""}, /* 96 0 */ + { KB_NONE, "", "", "", "", ""}, /* 97 0 */ + { KB_NONE, "", "", "", "", ""}, /* 98 0 */ + { KB_NONE, "", "", "", "", ""}, /* 99 0 */ + { KB_NONE, "", "", "", "", ""}, /* 100 */ + { KB_NONE, "", "", "", "", ""}, /* 101 */ + { KB_NONE, "", "", "", "", ""}, /* 102 */ + { KB_NONE, "", "", "", "", ""}, /* 103 */ + { KB_NONE, "", "", "", "", ""}, /* 104 */ + { KB_NONE, "", "", "", "", ""}, /* 105 */ + { KB_NONE, "", "", "", "", ""}, /* 106 */ + { KB_NONE, "", "", "", "", ""}, /* 107 */ + { KB_NONE, "", "", "", "", ""}, /* 108 */ + { KB_NONE, "", "", "", "", ""}, /* 109 */ + { KB_NONE, "", "", "", "", ""}, /* 110 */ + { KB_NONE, "", "", "", "", ""}, /* 111 */ + { KB_NONE, "", "", "", "", ""}, /* 112 */ + { KB_NONE, "", "", "", "", ""}, /* 113 */ + { KB_NONE, "", "", "", "", ""}, /* 114 */ + { KB_NONE, "", "", "", "", ""}, /* 115 */ + { KB_NONE, "", "", "", "", ""}, /* 116 */ + { KB_NONE, "", "", "", "", ""}, /* 117 */ + { KB_NONE, "", "", "", "", ""}, /* 118 */ + { KB_NONE, "", "", "", "", ""}, /* 119 */ + { KB_NONE, "", "", "", "", ""}, /* 120 */ + { KB_NONE, "", "", "", "", ""}, /* 121 */ + { KB_NONE, "", "", "", "", ""}, /* 122 */ + { KB_NONE, "", "", "", "", ""}, /* 123 */ + { KB_NONE, "", "", "", "", ""}, /* 124 */ + { KB_NONE, "", "", "", "", ""}, /* 125 */ + { KB_NONE, "", "", "", "", ""}, /* 126 */ + { KB_NONE, "", "", "", "", ""} /* 127 */ }; /* @@ -1878,8 +1903,10 @@ pcmmap(dev, offset, nprot) return mips_btop(TYNE_V_ISA_MEM + offset - 0x40000000); return -1; } + return -1; } +void pc_xmode_on() { if (pc_xmode) @@ -1893,6 +1920,7 @@ pc_xmode_on() #endif } +void pc_xmode_off() { if (pc_xmode == 0) @@ -1937,6 +1965,15 @@ pc_xmode_off() #define FLUSHQ(q) { if((q)->c_cc) ndflush(q, (q)->c_cc); } +int pmsopen __P((dev_t, int)); +int pmsclose __P((dev_t, int)); +int pmsread __P((dev_t, struct uio *, int)); +int pmsioctl __P((dev_t, u_long, caddr_t, int)); +int pmsselect __P((dev_t, int, struct proc *)); +static __inline void pms_dev_cmd __P((u_char)); +static __inline void pms_aux_cmd __P((u_char)); +static __inline void pms_pit_cmd __P((u_char)); + static __inline void pms_dev_cmd(value) u_char value; @@ -2085,7 +2122,8 @@ pmsread(dev, uio, flag) return EWOULDBLOCK; } sc->sc_state |= PMS_ASLP; - if (error = tsleep((caddr_t)sc, PZERO | PCATCH, "pmsrea", 0)) { + error = tsleep((caddr_t)sc, PZERO | PCATCH, "pmsrea", 0); + if (error) { sc->sc_state &= ~PMS_ASLP; splx(s); return error; @@ -2104,7 +2142,8 @@ pmsread(dev, uio, flag) (void) q_to_b(&sc->sc_q, buffer, length); /* Copy the data to the user process. */ - if (error = uiomove(buffer, length, uio)) + error = uiomove(buffer, length, uio); + if (error) break; } diff --git a/sys/arch/arc/dev/scsi.h b/sys/arch/arc/dev/scsi.h index f531019a4a6..5e603ef7f3b 100644 --- a/sys/arch/arc/dev/scsi.h +++ b/sys/arch/arc/dev/scsi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */ +/* $OpenBSD: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)scsi.h 8.1 (Berkeley) 6/10/93 - * $Id: scsi.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ + * $Id: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $ * * scsi.h -- * @@ -47,7 +47,7 @@ * * from: Header: /sprite/src/kernel/dev/RCS/scsi.h, * v 9.1 90/02/13 23:11:24 jhh Exp SPRITE (Berkeley) - * $Id: scsi.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ + * $Id: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $ */ #ifndef _SCSI_H @@ -548,12 +548,4 @@ struct scsi_fmt_sense { #define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb) #define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense) -#ifdef _KERNEL -/* - * Routines. - */ -extern void scsiGroup0Cmd(); -extern void scsiGroup1Cmd(); -#endif /* _KERNEL */ - #endif /* _SCSI_H */ diff --git a/sys/arch/arc/dti/btl.c b/sys/arch/arc/dti/btl.c index 512d33079b9..823758b33f3 100644 --- a/sys/arch/arc/dti/btl.c +++ b/sys/arch/arc/dti/btl.c @@ -159,6 +159,8 @@ void btminphys __P((struct buf *)); int bt_scsi_cmd __P((struct scsi_xfer *)); int bt_poll __P((struct bt_softc *, struct scsi_xfer *, int)); void bt_timeout __P((void *arg)); +void bt_free_buf __P((struct bt_softc *, struct bt_buf *)); +struct bt_buf * bt_get_buf __P((struct bt_softc *, int)); struct scsi_adapter bt_switch = { bt_scsi_cmd, @@ -716,7 +718,7 @@ bt_get_buf(sc, flags) buf = sc->sc_free_buf.tqh_first; if (buf) { TAILQ_REMOVE(&sc->sc_free_buf, buf, chain); - sc->sc_numbufs; + sc->sc_numbufs--; break; } if ((flags & SCSI_NOSLEEP) != 0) @@ -769,7 +771,6 @@ bt_collect_mbo(sc) struct bt_softc *sc; { struct bt_mbx_out *wmbo; /* Mail Box Out pointer */ - struct bt_ccb *ccb; wmbo = wmbx->cmbo; @@ -909,7 +910,7 @@ bt_done(sc, ccb) xs->resid = 0; } - if(datalen = xs->datalen) { + if((datalen = xs->datalen) != 0) { thiskv = (int)xs->data; sg = ccb->scat_gath; seg = phystol(ccb->data_length) / sizeof(struct bt_scat_gath); @@ -947,8 +948,6 @@ bt_find(ia, sc) u_char sts; struct bt_extended_inquire inquire; struct bt_config config; - struct bt_revision revision; - struct bt_digit digit; int irq, drq; /* @@ -1362,11 +1361,6 @@ badbuf: xs->error = XS_DRIVER_STUFFUP; bt_free_ccb(sc, ccb); return TRY_AGAIN_LATER; - -bad: - xs->error = XS_DRIVER_STUFFUP; - bt_free_ccb(sc, ccb); - return COMPLETE; } /* diff --git a/sys/arch/arc/include/bus.h b/sys/arch/arc/include/bus.h index 8ca525ae571..b9f6739ce26 100644 --- a/sys/arch/arc/include/bus.h +++ b/sys/arch/arc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.12 1997/04/10 16:29:22 pefo Exp $ */ +/* $OpenBSD: bus.h,v 1.13 1997/04/19 17:19:56 pefo Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -34,6 +34,8 @@ #ifndef _ARC_BUS_H_ #define _ARC_BUS_H_ +#include + #ifdef __STDC__ #define CAT(a,b) a##b #define CAT3(a,b,c) a##b##c @@ -83,15 +85,15 @@ bus_space_read(4,32) #define bus_space_read_8 !!! bus_space_read_8 unimplemented !!! #define bus_space_read_multi_1(t, h, o, a, c) do { \ - insb((h) + (o), (a), (c)); \ + insb((u_int8_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_read_multi_2(t, h, o, a, c) do { \ - insw((h) + (o), (a), (c)); \ + insw((u_int16_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_read_multi_4(t, h, o, a, c) do { \ - insl((h) + (o), (a), (c)); \ + insl((u_int32_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! @@ -112,15 +114,15 @@ bus_space_write(4,32) #define bus_space_write_multi_1(t, h, o, a, c) do { \ - outsb((h) + (o), (a), (c)); \ + outsb((u_int8_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_write_multi_2(t, h, o, a, c) do { \ - outsw((h) + (o), (a), (c)); \ + outsw((u_int16_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_write_multi_4(t, h, o, a, c) do { \ - outsl((h) + (o), (a), (c)); \ + outsl((u_int32_t *)((h) + (o)), (a), (c)); \ } while(0) #define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! diff --git a/sys/arch/arc/include/cpu.h b/sys/arch/arc/include/cpu.h index f9b81386545..b8994e12922 100644 --- a/sys/arch/arc/include/cpu.h +++ b/sys/arch/arc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.7 1997/04/10 16:29:24 pefo Exp $ */ +/* $OpenBSD: cpu.h,v 1.8 1997/04/19 17:19:56 pefo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -408,7 +408,33 @@ u_int CpuPrimaryDataCacheLSize; u_int CpuPrimaryInstCacheLSize; u_int CpuCacheAliasMask; u_int CpuTwoWayCache; +int l2cache_is_snooping; extern struct intr_tab intr_tab[]; + +struct tlb; +struct user; + +int R4K_ConfigCache __P((void)); +void R4K_SetWIRED __P((int)); +void R4K_SetPID __P((int)); +void R4K_FlushCache __P((void)); +void R4K_FlushDCache __P((vm_offset_t, int)); +void R4K_HitFlushDCache __P((vm_offset_t, int)); +void R4K_FlushICache __P((vm_offset_t, int)); +void R4K_TLBFlush __P((int)); +void R4K_TLBFlushAddr __P((vm_offset_t)); +void R4K_TLBWriteIndexed __P((int, struct tlb *)); +void R4K_TLBUpdate __P((vm_offset_t, unsigned)); +void R4K_TLBRead __P((int, struct tlb *)); +void wbflush __P((void)); +void savectx __P((struct user *, int)); +int copykstack __P((struct user *)); +void switch_exit __P((void)); +void MachSaveCurFPState __P((struct proc *)); +#ifdef DEBUG +void mdbpanic __P((void)); +#endif + #endif /* diff --git a/sys/arch/arc/include/intr.h b/sys/arch/arc/include/intr.h index 67e7ad75ff1..1d5cf50c665 100644 --- a/sys/arch/arc/include/intr.h +++ b/sys/arch/arc/include/intr.h @@ -58,6 +58,16 @@ #ifndef _LOCORE +void setsoftclock __P((void)); +void clearsoftclock __P((void)); +int splsoftclock __P((void)); +void setsoftnet __P((void)); +void clearsoftnet __P((void)); +int splsoftnet __P((void)); + +struct clockframe; +void set_intr __P((int, int(*)(u_int, struct clockframe *), int)); + volatile int cpl, ipending, astpending; int imask[7]; @@ -140,7 +150,6 @@ spllower(ncpl) #define splhigh() splraise(-1) #define spl0() spllower(0) -#endif /* * Software interrupt registration * @@ -158,6 +167,7 @@ softintr(mask) #define setsoftclock() softintr(1 << SIR_CLOCK) #define setsoftnet() softintr(1 << SIR_NET) #define setsofttty() softintr(1 << SIR_TTY) +#endif #endif /* _LOCORE */ diff --git a/sys/arch/arc/include/param.h b/sys/arch/arc/include/param.h index 456af7768d4..4d84f7f5f80 100644 --- a/sys/arch/arc/include/param.h +++ b/sys/arch/arc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.7 1997/02/28 22:57:34 niklas Exp $ */ +/* $OpenBSD: param.h,v 1.8 1997/04/19 17:19:57 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -41,6 +41,11 @@ * from: @(#)param.h 8.1 (Berkeley) 6/10/93 */ +#ifndef _ARC_PARAM_H_ +#define _ARC_PARAM_H_ + +#include + /* * Machine dependent constants for ARC BIOS MIPS machines: * Acer Labs PICA_61 @@ -88,7 +93,11 @@ #define SINCR 1 /* increment of stack/NBPG */ #define UPAGES 2 /* pages of u-area */ +#ifdef _LOCORE +#define UADDR 0xffffffffffffc000 /* address of u */ +#else #define UADDR 0xffffc000 /* address of u */ +#endif #define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ #define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ @@ -149,8 +158,8 @@ #ifdef _KERNEL #ifndef _LOCORE -extern int (*Mach_splnet)(), (*Mach_splbio)(), (*Mach_splimp)(), - (*Mach_spltty)(), (*Mach_splclock)(), (*Mach_splstatclock)(); +extern int (*Mach_splnet)(void), (*Mach_splbio)(void), (*Mach_splimp)(void), + (*Mach_spltty)(void), (*Mach_splclock)(void), (*Mach_splstatclock)(void); #define splnet() ((*Mach_splnet)()) #define splbio() ((*Mach_splbio)()) #define splimp() ((*Mach_splimp)()) @@ -158,14 +167,21 @@ extern int (*Mach_splnet)(), (*Mach_splbio)(), (*Mach_splimp)(), #define splclock() ((*Mach_splclock)()) #define splstatclock() ((*Mach_splstatclock)()) +int splhigh __P((void)); +int splx __P((int)); +int spl0 __P((void)); + /* * Delay is based on an assumtion that each time in the loop * takes 3 clocks. Three is for branch and subtract in the delay slot. */ extern int cpuspeed; #define DELAY(n) { register int N = cpuspeed * (n); while ((N -= 3) > 0); } +void delay __P((int)); #endif #else /* !_KERNEL */ #define DELAY(n) { register int N = (n); while (--N > 0); } #endif /* !_KERNEL */ + +#endif /* _ARC_PARAM_H_ */ diff --git a/sys/arch/arc/include/pio.h b/sys/arch/arc/include/pio.h index 39ddf216ce4..17a7fe63560 100644 --- a/sys/arch/arc/include/pio.h +++ b/sys/arch/arc/include/pio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pio.h,v 1.2 1996/07/30 20:24:27 pefo Exp $ */ +/* $OpenBSD: pio.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */ /* * Copyright (c) 1995 Per Fogelstrom. All rights reserved. @@ -29,6 +29,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _ARC_PIO_H_ +#define _ARC_PIO_H_ /* * I/O macros. */ @@ -44,3 +46,11 @@ #define inl(a) (*(volatile unsigned int*)(a)) #define in32(a) inl(a) +void insb __P((u_int8_t *, u_int8_t *,int)); +void insw __P((u_int16_t *, u_int16_t *,int)); +void insl __P((u_int32_t *, u_int32_t *,int)); +void outsb __P((u_int8_t *, const u_int8_t *,int)); +void outsw __P((u_int16_t *, const u_int16_t *,int)); +void outsl __P((u_int32_t *, const u_int32_t *,int)); + +#endif /*_ARC_PIO_H_*/ diff --git a/sys/arch/arc/include/pmap.h b/sys/arch/arc/include/pmap.h index 216571f641b..45ebf633f54 100644 --- a/sys/arch/arc/include/pmap.h +++ b/sys/arch/arc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.2 1996/07/16 07:46:18 pefo Exp $ */ +/* $OpenBSD: pmap.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -104,6 +104,17 @@ extern struct pmap kernel_pmap_store; #define PMAP_PREFER(pa, va) pmap_prefer((pa), (va)) +void pmap_prefer __P((vm_offset_t, vm_offset_t *)); + +void pmap_bootstrap __P((vm_offset_t)); +void pmap_zero_page __P((vm_offset_t)); +int pmap_is_page_ro __P(( pmap_t, vm_offset_t, int)); +int pmap_alloc_tlbpid __P((struct proc *)); +int pmap_remove_pv __P((pmap_t, vm_offset_t, vm_offset_t)); +int pmap_is_pa_mapped __P((vm_offset_t)); +vm_offset_t pmap_pa_to_va __P((vm_offset_t)); +void pmap_page_cache __P((vm_offset_t, int));; + #endif /* _KERNEL */ #endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/arc/include/types.h b/sys/arch/arc/include/types.h index 8a910c5e239..22a3669e7e4 100644 --- a/sys/arch/arc/include/types.h +++ b/sys/arch/arc/include/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */ +/* $OpenBSD: types.h,v 1.2 1997/04/19 17:19:59 pefo Exp $ */ /* $NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp $ */ /*- @@ -75,7 +75,6 @@ typedef unsigned long long u_int64_t; typedef int32_t register_t; -#define __BDEVSW_DUMP_OLD_TYPE #define __SWAP_BROKEN #define __FORK_BRAINDAMAGE diff --git a/sys/arch/arc/include/vmparam.h b/sys/arch/arc/include/vmparam.h index 4615bd8d68e..056a350318d 100644 --- a/sys/arch/arc/include/vmparam.h +++ b/sys/arch/arc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.2 1996/07/30 20:24:30 pefo Exp $ */ +/* $OpenBSD: vmparam.h,v 1.3 1997/04/19 17:19:59 pefo Exp $ */ /* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ /* @@ -227,3 +227,7 @@ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) #define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) #define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) + +struct vm_map; + +vm_offset_t kmem_alloc_upage __P((struct vm_map *, vm_size_t)); diff --git a/sys/arch/arc/isa/isa_machdep.h b/sys/arch/arc/isa/isa_machdep.h index 5186a287c94..8f6efd926c2 100644 --- a/sys/arch/arc/isa/isa_machdep.h +++ b/sys/arch/arc/isa/isa_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.h,v 1.4 1997/04/10 16:29:27 pefo Exp $ */ +/* $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -64,6 +64,10 @@ struct arc_isa_bus { #define isa_intr_disestablish(c, h) \ (*(c)->ic_intr_disestablish)((c)->ic_data, (h)) +void sysbeepstop __P((void *)); +void sysbeep __P((int, int)); + + /* * Interrupt control struct used to control the ICU setup. */ diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c index 4dfa984ed6e..1439c36d0c4 100644 --- a/sys/arch/arc/isa/isabus.c +++ b/sys/arch/arc/isa/isabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isabus.c,v 1.10 1997/04/11 21:18:02 maja Exp $ */ +/* $OpenBSD: isabus.c,v 1.11 1997/04/19 17:20:01 pefo Exp $ */ /* $NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp $ */ /*- @@ -88,12 +88,15 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -135,7 +138,8 @@ void *isabr_intr_establish __P((isa_chipset_tag_t, int, int, int, int (*)(void *), void *, char *)); void isabr_intr_disestablish __P((isa_chipset_tag_t, void*)); int isabr_iointr __P((unsigned int, struct clockframe *)); -void isabr_initicu(); +void isabr_initicu __P((void)); +void intr_calculatemasks __P((void)); extern int cputype; @@ -146,7 +150,6 @@ isabrmatch(parent, cfdata, aux) void *cfdata; void *aux; { - struct cfdata *cf = cfdata; struct confargs *ca = aux; /* Make sure that we're looking for a ISABR. */ diff --git a/sys/arch/arc/pci/pbcpcibus.c b/sys/arch/arc/pci/pbcpcibus.c index a92d7043aad..5b1e0d112c7 100644 --- a/sys/arch/arc/pci/pbcpcibus.c +++ b/sys/arch/arc/pci/pbcpcibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pbcpcibus.c,v 1.3 1997/04/10 16:29:31 pefo Exp $ */ +/* $OpenBSD: pbcpcibus.c,v 1.4 1997/04/19 17:20:02 pefo Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -77,8 +78,6 @@ void *pbc_intr_establish __P((void *, pci_intr_handle_t, void pbc_intr_disestablish __P((void *, void *)); int pbc_ether_hw_addr __P((u_int8_t *)); -extern void *algor_pci_intr_establish(); - struct cfattach pbcpcibr_ca = { sizeof(struct pcibr_softc), pbcpcibrmatch, pbcpcibrattach, }; @@ -96,7 +95,6 @@ pbcpcibrmatch(parent, match, aux) struct device *parent; void *match, *aux; { - struct cfdata *cf = match; struct confargs *ca = aux; /* Make sure that we're looking for a PCI bridge. */ @@ -173,15 +171,17 @@ pbcpcibrprint(aux, pnp) */ vm_offset_t -vtophys(va) - vm_offset_t va; +vtophys(p) + void *p; { vm_offset_t pa; + vm_offset_t va; - if(va >= UADDR) { /* Stupid driver have buffer on stack!! */ - va = (va & ~UADDR) + (vm_offset_t)(curproc->p_addr); + va = (vm_offset_t)p; + if(va >= UADDR) { /* Stupid driver have buf on stack!! */ + va = (vm_offset_t)curproc->p_addr + (va & ~UADDR); } - if(va < VM_MIN_KERNEL_ADDRESS) { + if((vm_offset_t)va < VM_MIN_KERNEL_ADDRESS) { pa = CACHED_TO_PHYS(va); } else { @@ -343,7 +343,6 @@ pbc_intr_map(lcv, bustag, buspin, line, ihp) struct pcibr_config *lcp = lcv; pci_chipset_tag_t pc = &lcp->lc_pc; int device, pirq; - u_int8_t pirqline; if (buspin == 0) { /* No IRQ used. */ @@ -392,7 +391,6 @@ pbc_intr_string(lcv, ih) pci_intr_handle_t ih; { static char str[16]; - struct pcibr_config *lcp = lcv; sprintf(str, "pciirq%d", ih); return(str); @@ -407,8 +405,6 @@ pbc_intr_establish(lcv, ih, level, func, arg, name) void *arg; char *name; { - struct pcibr_config *lcp = lcv; - return algor_pci_intr_establish(ih, level, func, arg, name); } @@ -416,7 +412,5 @@ void pbc_intr_disestablish(lcv, cookie) void *lcv, *cookie; { - struct pcibr_config *lcp = lcv; - algor_pci_intr_disestablish(cookie); } diff --git a/sys/arch/arc/pci/pci_machdep.h b/sys/arch/arc/pci/pci_machdep.h index 3afbeb1c206..5543d2c1f7e 100644 --- a/sys/arch/arc/pci/pci_machdep.h +++ b/sys/arch/arc/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.1 1997/03/12 19:17:01 pefo Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.2 1997/04/19 17:20:02 pefo Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -89,3 +89,5 @@ struct arc_pci_chipset { #define pci_ether_hw_addr(c, p) \ (*(c)->pc_ether_hw_addr)((p)) +vm_offset_t vtophys __P((void *)); + diff --git a/sys/arch/arc/pica/picabus.c b/sys/arch/arc/pica/picabus.c index e6170757e3c..06b38d76fce 100644 --- a/sys/arch/arc/pica/picabus.c +++ b/sys/arch/arc/pica/picabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: picabus.c,v 1.5 1996/11/23 21:45:35 kstailey Exp $ */ +/* $OpenBSD: picabus.c,v 1.6 1997/04/19 17:20:04 pefo Exp $ */ /* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */ /* @@ -30,14 +30,20 @@ */ #include +#include +#include +#include #include +#include +#include #include #include #include #include #include +#include struct pica_softc { struct device sc_dv; @@ -252,14 +258,10 @@ void pica_intr_disestablish(ca) struct confargs *ca; { - struct pica_softc *sc = pica_cd.cd_devs[0]; - int slot; slot = ca->ca_slot; - if(slot = 0) { /* Slot 0 is special, clock */ - } - else { + if(slot != 0) { /* Slot 0 is special, clock */ local_int_mask &= ~int_table[slot].int_mask; int_table[slot].int_mask = 0; int_table[slot].int_hand = pica_intrnull;