-/* $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
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_ */
-/* $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
*/
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/device.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/intr.h>
void *
algor_pci_intr_establish(ih, level, handler, arg, name)
+ int ih;
int level;
intr_handler_t handler;
void *arg;
}
imask = (0x1000 << ih);
- route = (0x30000 << ih+ih);
+ route = (0x30000 << (ih+ih));
slot = NUM_INT_SLOTS;
while(slot > 0) {
algor_intr_disestablish(ca)
struct confargs *ca;
{
- struct algor_softc *sc = algor_cd.cd_devs[0];
-
int slot;
slot = ca->ca_slot;
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;
unsigned mask;
struct clockframe *cf;
{
- int temp;
-
/* Ack clock interrupt */
outb(P4032_CLOCK, MC_REGC);
(void) inb(P4032_CLOCK + 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.
* SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <lib/libkern/libkern.h>
#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/memconf.h>
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. */
* 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;
{
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;
{
*
* Concatenate obvious adjecent segments.
*/
+static void
bios_configure_memory()
{
arc_mem_t *descr = 0;
/*
* Find out system type.
*/
-int
+static int
get_cpu_type()
{
arc_config_t *cf;
-/* $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.
*
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 */
#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 *));
+
+
-/* $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
* 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 $
*/
/*
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
* Configure all devices found that we know about.
* This is done at boot time.
*/
+void
configure()
{
(void)splhigh(); /* To be really sure.. */
/*
* Configure swap space and related parameters.
*/
+void
swapconf()
{
register struct swdevt *swp;
{
register struct device *dv;
register char *cp, c;
- int majdev, mindev, part;
+ int majdev, part;
if (len == 0)
return (NULL);
sprintf(bootdev, "%s%d%c", dp->dev, ctrl*16 + unit, 'a' + part);
}
+int
getpno(cp)
char **cp;
{
-/* $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
* 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 <sys/param.h>
};
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 */
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");
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;
-/* $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 $ */
/*
{
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;
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);
-/* $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
* 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 <sys/param.h>
*
* A minimal stub routine can always return 0.
*/
+int
iskmemdev(dev)
dev_t dev;
{
/*
* Returns true if def is /dev/zero
*/
+int
iszerodev(dev)
dev_t dev;
{
*
* A minimal stub routine can always return NODEV.
*/
+dev_t
chrtoblk(dev)
dev_t dev;
{
-/* $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
*/
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/device.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/autoconf.h>
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. */
struct device *dev;
void *aux;
{
- struct pcs *p;
- int needcomma, needrev, i;
printf(": ");
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");
}
-/* $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
#include <sys/exec_ecoff.h>
#include <machine/reg.h>
+#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().
+++ /dev/null
-/* $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 <sys/param.h>
-#include <sys/buf.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-#include <sys/user.h>
-
-#include <machine/reg.h>
-
-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);
-}
--- /dev/null
+# $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 <sys/param.h>
+include <sys/buf.h>
+include <sys/map.h>
+include <sys/proc.h>
+include <sys/mbuf.h>
+include <sys/user.h>
+
+include <machine/reg.h>
+
+
+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
-/* $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.
* 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 $
*/
/*
#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
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.
*
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
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
-/* $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
* 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 */
#ifdef SYSVMSG
#include <sys/msg.h>
#endif
+#ifdef MFS
+#include <ufs/mfs/mfs_extern.h>
+#endif
#include <vm/vm_kern.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/pio.h>
#include <machine/psl.h>
-#include <machine/pte.h>
#include <machine/bus.h>
#include <machine/autoconf.h>
#include <machine/memconf.h>
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" */
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 */
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));
/*
* 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[];
/*
* 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;
firstaddr += NBPG * 2;
}
sysend += UPAGES * NBPG;
- sysend = (caddr_t)((int)sysend+3 & -4);
+ sysend = (caddr_t)(((int)sysend + 3) & -4);
R4K_SetPID(1);
/*
*/
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.
*/
cpu_startup()
{
register unsigned i;
- register caddr_t v;
int base, residual;
vm_offset_t minaddr, maxaddr;
vm_size_t size;
/*
* machine dependent system variables.
*/
+int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
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;
(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
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
* a machine fault.
*/
/* ARGSUSED */
+int
sys_sigreturn(p, v, retval)
struct proc *p;
void *v;
int dumpsize = 0; /* also for savecore */
long dumplo = 0;
+void
dumpconf()
{
int nblks;
* getting on the dump stack, either when called above, or by
* the auto-restart code.
*/
+void
dumpsys()
{
- int error;
msgbufmapped = 0;
if (dumpdev == NODEV)
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");
case 0:
printf("succeeded\n");
}
+#endif
}
/*
splx(s);
}
+void
initcpu()
{
-/* $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.
{
struct mainbus_softc *sc = (struct mainbus_softc *)self;
struct confargs nca;
- extern int cputype, ncpus;
+ extern int cputype;
printf("\n");
-/* $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 $ */
/*
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/msgbuf.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/malloc.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <vm/vm.h>
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)
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;
return (error);
}
+/*ARGSUSED*/
int
mmmmap(dev, off, prot)
dev_t dev;
-/* $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.
* 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 <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <dev/cons.h>
#include <machine/pte.h>
#include <vm/vm_prot.h>
#undef SP
#include <machine/cpu.h>
#include <machine/reg.h>
-#include <machine/pcb.h>
+#include <machine/intr.h>
#include <machine/trap.h>
#include <machine/mips_opcode.h>
#define FALSE 0
#endif
-void arc_dump_tlb(int, int);
static char *op_name[64] = {
/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz",
"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;
/*
* Mini debugger for kernel.
*/
-int gethex(u_int *val, u_int dotval)
+static int
+gethex(u_int *val, u_int dotval)
{
u_int c;
return(c);
}
+static
void dump(u_int *addr, u_int size)
{
int cnt;
}
}
-void print_regs()
+static void
+print_regs()
{
printf("\n");
printf("T0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n",
mdbpcb.pcb_regs[RA],mdbpcb.pcb_regs[SR]);
}
-set_break(va)
+void
+set_break(int va)
{
int i;
printf(" Break table full!!");
}
-del_break(va)
+void
+del_break(int va)
{
int i;
printf(" Break to remove not found!!");
}
+static void
break_insert()
{
int i;
}
}
+static void
break_restore()
{
int i;
}
}
+static int
break_find(va)
+ int va;
{
int i;
return(-1);
}
+void
prt_break()
{
int i;
}
}
}
-mdb(causeReg, vadr, p, kernelmode)
+
+int
+mdb(int causeReg, int vadr, int p, int kernelmode)
{
int c;
int newaddr;
ssandrun = 0;
break_restore();
- while(c = cngetc()) {
+ while(1) {
+ c = cngetc();
switch(c) {
case 'T':
trapDump("Debugger");
switch(c) {
case 't':
printf("tlb");
- R4K_TLBFlush();
+ R4K_TLBFlush(num_tlbentries);
break;
case 'c':
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) {
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;
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;
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;
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;
-/* $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.
* 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 $
*/
/*
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
-#include <machine/cpu.h>
#include <machine/pte.h>
+#include <machine/cpu.h>
#include <machine/memconf.h>
#include <arc/dti/desktech.h>
#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;
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))
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++;
}
size = round_page(size);
avail_start += size;
- blkclr((caddr_t)val, size);
+ bzero((caddr_t)val, size);
return ((void *)val);
}
} else {
register struct segtab *stp;
vm_page_t mem;
- void pmap_zero_page();
do {
mem = vm_page_alloc1();
} /* 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));
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;
register vm_offset_t nssva;
register pt_entry_t *pte;
unsigned entry;
- int flush;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
#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))
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:
*
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
}
}
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) {
{
register pt_entry_t *pte;
register u_int npte;
- register int i, j;
+ register int i;
vm_page_t mem;
#ifdef DEBUG
/*
* Update the same virtual address entry.
*/
- j = R4K_TLBUpdate(va, npte);
+ R4K_TLBUpdate(va, npte);
pte->pt_entry = npte;
return;
}
} /* 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));
}
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);
}
{
register pt_entry_t *pte;
u_int p;
- register int i;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
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);
+ }
}
/*
*/
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) {
-/* $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.
* 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 $
*/
/*
#include <sys/user.h>
#include <sys/vnode.h>
#include <sys/ptrace.h>
+#include <machine/pte.h>
#include <machine/psl.h>
#include <machine/reg.h>
+extern void cpu_singlestep __P((struct proc *));
int
process_read_regs(p, regs)
struct proc *p;
-/* $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
}
#endif
+int
sys_sysarch(p, v, retval)
struct proc *p;
void *v;
-/* $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
* 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 <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/ktrace.h>
#endif
#include <net/netisr.h>
+#include <miscfs/procfs/procfs.h>
#include <machine/trap.h>
#include <machine/psl.h>
#include <machine/reg.h>
#include <machine/cpu.h>
#include <machine/pio.h>
+#include <machine/intr.h>
#include <machine/autoconf.h>
#include <machine/pte.h>
#include <machine/pmap.h>
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.
*/
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 */
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.
* 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;
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;
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]);
}
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]);
}
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]);
}
* 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;
* 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]++;
clnlintr();
}
#endif
-#include "ppp.h"
#if NPPP > 0
if(netisr & (1 << NETISR_PPP)) {
netisr &= ~(1 << NETISR_PPP);
void
set_intr(mask, int_hand, prio)
int mask;
- int (*int_hand)();
+ int (*int_hand)(u_int, struct clockframe *);
int prio;
{
if(prio > 5)
* 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 */
}
#ifdef DEBUG
+void
trapDump(msg)
char *msg;
{
}
#endif
+#if 0
/*
*----------------------------------------------------------------------
*
static void
arc_errintr()
{
-#if 0
volatile u_short *sysCSRPtr =
(u_short *)PHYS_TO_UNCACHED(KN01_SYS_CSR);
u_short csr;
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;
((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,
break;
default:
- if (!allowNonBranch)
- panic("MachEmulateBranch: Non-branch");
retAddr = instPC + 4;
break;
}
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);
}
* 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;
{
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 */
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);
/* 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;
}
*/
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;
}
* 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;
/* 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:
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;
-/* $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
* 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 <sys/param.h>
#include <machine/pte.h>
#include <machine/cpu.h>
-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.
* 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;
* 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;
/*
* 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;
*/
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++;
* 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;
-# $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
# 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
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
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 \
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 | \
-/* $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 $ */
/*-
/*
* 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;
*/
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;
/* 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
/*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
void *match;
void *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
if(!BUS_MATCHNAME(ca, "asc"))
{
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;
* 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
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;
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 */
}
asc->st[i].flags = 0;
}
asc->target = -1;
- return;
+ return(1);
}
/* check for command errors */
}
asc->cmd[asc->target]->error = XS_DRIVER_STUFFUP;
asc_end(asc, status, ss, ir);
- return;
+ return(1);
}
/* FALLTHROUGH */
state->flags |= DISCONN;
regs->asc_cmd = ASC_CMD_ENABLE_SEL;
readback(regs->asc_cmd);
- return;
+ return(1);
}
}
* 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);
}
/*
/* 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);
}
/* 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;
/* 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)) {
/*
* Dump the log buffer.
*/
+static void
asc_DumpLog(str)
char *str;
{
-/* $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.
* 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 $
*/
/*
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/autoconf.h>
-#include <machine/pte.h>
#include <machine/pio.h>
#include <scsi/scsi_all.h>
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.
*/
* the dma control structure and invalidate dma TLB cache.
*/
+void
picaDmaTLBMap(dma_softc_t *sc)
{
vm_offset_t pa;
size_t size;
int datain;
{
- int mode;
pDmaReg regs = sc->dma_reg;
/* Halt DMA */
void
picaDmaNull(dma_softc_t *sc)
{
- pDmaReg regs = sc->dma_reg;
-
printf("picaDmaNull called\n");
}
* 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;
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;
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;
-/* $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.
#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));
+
-/* $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 $ */
/*-
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));
#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 */
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;
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;
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);
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:
#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);
-/* $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)
#include "sn.h"
#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/buf.h>
#define SWR(a, x) (a) = (x)
#define SRD(a) ((a) & 0xffff)
+#include <machine/pte.h>
#include <machine/cpu.h>
/*
#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 *));
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
/* XXX CHECK BUS */
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);
{
struct sn_softc *sc = ifp->if_softc;
struct mbuf *m;
- int len;
if ((sc->sc_if.if_flags & IFF_RUNNING) == 0)
return;
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 */
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;
splx(s);
return (0);
-
-bad:
- snstop(sc);
- return (error);
}
/*
/* 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);
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 */
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;
{
struct sonic_reg *csr;
int timeout;
- int i;
csr = sc->sc_csr;
csr->s_cdp = LOWER(v_cda);
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();
csr = sc->sc_csr;
- while (mtd = mtdhead) {
+ while ((mtd = mtdhead)) {
struct mbuf *m = mtd->mtd_mbuf;
if (m == 0)
{
struct sonic_reg *csr = sc->sc_csr;
struct RXpkt *rxp;
- u_long addr;
int orra;
rxp = &p_rda[sc->sc_rxmark];
/*extern char *ether_sprintf();*/
struct ether_header *et;
struct mbuf *m;
- int len, off, i;
+ int len;
caddr_t pkt;
/*
(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);
-/* $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 $ */
/*-
#include <machine/display.h>
#include <machine/pccons.h>
#include <arc/arc/arctype.h>
+#include <arc/arc/arcbios.h>
#include <arc/pica/pica.h>
#include <arc/dti/desktech.h>
static pccons_keymap_t scan_codes[KB_NUM_KEYS];/* keyboard translation table */
int pc_xmode = 0;
+cdev_decl(pc);
+
/*
* Keyboard output queue.
*/
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
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);
{
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 */
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);
}
}
struct tty *tp;
{
struct clist *cl;
- int s, len, n;
+ int s, len;
u_char buf[PCBURST];
s = spltty();
splx(s);
}
-void
+int
pcstop(tp, flag)
struct tty *tp;
int flag;
{
-
+ return(0);
}
void
}
/* ARGSUSED */
+int
pccngetc(dev)
dev_t dev;
{
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;
}
#endif
fillw((vs.at << 8) | ' ', Crtat,
vs.ncol * cx);
- /* crtat += vs.ncol * cx; /* XXX */
+ /* crtat += vs.ncol * cx; XXX */
vs.state = 0;
break;
}
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 */
};
/*
return mips_btop(TYNE_V_ISA_MEM + offset - 0x40000000);
return -1;
}
+ return -1;
}
+void
pc_xmode_on()
{
if (pc_xmode)
#endif
}
+void
pc_xmode_off()
{
if (pc_xmode == 0)
#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;
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;
(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;
}
-/* $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.
* 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 --
*
*
* 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
#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 */
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,
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)
struct bt_softc *sc;
{
struct bt_mbx_out *wmbo; /* Mail Box Out pointer */
- struct bt_ccb *ccb;
wmbo = wmbx->cmbo;
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);
u_char sts;
struct bt_extended_inquire inquire;
struct bt_config config;
- struct bt_revision revision;
- struct bt_digit digit;
int irq, drq;
/*
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;
}
/*
-/* $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.
#ifndef _ARC_BUS_H_
#define _ARC_BUS_H_
+#include <machine/pio.h>
+
#ifdef __STDC__
#define CAT(a,b) a##b
#define CAT3(a,b,c) a##b##c
#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 !!!
#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 !!!
-/* $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
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
/*
#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];
#define splhigh() splraise(-1)
#define spl0() spllower(0)
-#endif
/*
* Software interrupt registration
*
#define setsoftclock() softintr(1 << SIR_CLOCK)
#define setsoftnet() softintr(1 << SIR_NET)
#define setsofttty() softintr(1 << SIR_TTY)
+#endif
#endif /* _LOCORE */
-/* $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.
* from: @(#)param.h 8.1 (Berkeley) 6/10/93
*/
+#ifndef _ARC_PARAM_H_
+#define _ARC_PARAM_H_
+
+#include <machine/intr.h>
+
/*
* Machine dependent constants for ARC BIOS MIPS machines:
* Acer Labs PICA_61
#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 */
#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)())
#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_ */
-/* $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.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _ARC_PIO_H_
+#define _ARC_PIO_H_
/*
* I/O macros.
*/
#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_*/
-/* $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
#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_ */
-/* $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 $ */
/*-
typedef int32_t register_t;
-#define __BDEVSW_DUMP_OLD_TYPE
#define __SWAP_BROKEN
#define __FORK_BRAINDAMAGE
-/* $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 $ */
/*
#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));
-/* $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
#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.
*/
-/* $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 $ */
/*-
*/
#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/autoconf.h>
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;
void *cfdata;
void *aux;
{
- struct cfdata *cf = cfdata;
struct confargs *ca = aux;
/* Make sure that we're looking for a ISABR. */
-/* $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
#include <vm/vm.h>
#include <machine/autoconf.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <dev/pci/pcireg.h>
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,
};
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
/* Make sure that we're looking for a PCI bridge. */
*/
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 {
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. */
pci_intr_handle_t ih;
{
static char str[16];
- struct pcibr_config *lcp = lcv;
sprintf(str, "pciirq%d", ih);
return(str);
void *arg;
char *name;
{
- struct pcibr_config *lcp = lcv;
-
return algor_pci_intr_establish(ih, level, func, arg, name);
}
pbc_intr_disestablish(lcv, cookie)
void *lcv, *cookie;
{
- struct pcibr_config *lcp = lcv;
-
algor_pci_intr_disestablish(cookie);
}
-/* $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.
#define pci_ether_hw_addr(c, p) \
(*(c)->pc_ether_hw_addr)((p))
+vm_offset_t vtophys __P((void *));
+
-/* $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 $ */
/*
*/
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/device.h>
+#include <machine/intr.h>
+#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/autoconf.h>
#include <arc/pica/pica.h>
#include <arc/arc/arctype.h>
+#include <arc/dev/dma.h>
struct pica_softc {
struct device sc_dv;
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;