XDEFS= -undef -D__OpenBSD__ -Dm68k -Dmc68000
CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
-Dmc68020 -Dsun3 ${XDEFS}
-CWARNFLAGS= -Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
+CWARNFLAGS= -Werror -# Wall -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float -pipe
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
LINKFLAGS= -N -Ttext 0E004000 -e start
STRIPFLAGS= -d
assym.h: genassym
./genassym >assym.h
-genassym: genassym.o
- ${CC} -o $@ genassym.o
-
-genassym.o: ${SUN3}/sun3/genassym.c
- ${HOSTED_C}
+# Doing a cross-build of this is very tricky, and very dependent
+# on compatibility of things like structure member alignment in
+# the compiler used as HOSTED_CC (must match the native compiler).
+# Often this is not possible at all, and you just have to build
+# the assym.h file by hand on some other machine. -gwr
+genassym: ${SUN3}/sun3/genassym.c
+ ${CC} ${CPPFLAGS} -E $< > $@.i
+ ${HOSTED_CC} -o $@ $@.i
param.c: $S/conf/param.c
rm -f param.c
+/* $OpenBSD: am9516.h,v 1.2 1997/01/16 04:03:41 kstailey Exp $ */
/* $NetBSD: am9516.h,v 1.1 1995/10/29 21:19:06 gwr Exp $ */
/*
#define UDC_ADR_CMR_LOW 0x52 /* channel mode reg, low word */
#define UDC_ADR_COUNT 0x32 /* number of words to transfer */
-/*
- * For a dma transfer, the appropriate udc registers are loaded from a
+/*
+ * For a dma transfer, the appropriate udc registers are loaded from a
* table in memory pointed to by the chain address register.
*/
struct udc_table {
+/* $OpenBSD: bt_subr.c,v 1.2 1997/01/16 04:03:42 kstailey Exp $ */
/* $NetBSD: bt_subr.c,v 1.2 1995/04/10 22:12:48 gwr Exp $ */
/*
+/* $OpenBSD: bw2.c,v 1.8 1997/01/16 04:03:42 kstailey Exp $ */
/* $NetBSD: bw2.c,v 1.8 1996/10/13 03:47:25 christos Exp $ */
/*
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <vm/vm.h>
+#include <machine/conf.h>
#include <machine/cpu.h>
#include <machine/fbio.h>
#include <machine/autoconf.h>
/* XXX we do not handle frame buffer interrupts */
-/* frame buffer generic driver */
-int bw2open(), bw2close(), bw2ioctl(), bw2mmap();
-
-static int bw2gvideo __P((struct fbdevice *, int *));
+static int bw2gvideo __P((struct fbdevice *, int *));
static int bw2svideo __P((struct fbdevice *, int *));
static struct fbdriver bw2fbdriver = {
bw2open, bw2close, bw2mmap,
- enoioctl, /* gattr */
+ (void *)enoioctl, /* gattr */
bw2gvideo, bw2svideo,
- enoioctl, enoioctl };
+ (void *)enoioctl, (void *)enoioctl /* getcmap, putcmap */
+};
static int
bw2match(parent, vcf, args)
struct device *parent;
void *vcf, *args;
{
+#if 0
struct cfdata *cf = vcf;
+#endif
struct confargs *ca = args;
int x;
struct fbdevice *fb = &sc->sc_fb;
struct confargs *ca = args;
struct fbtype *fbt;
- int ramsize;
sc->sc_phys = ca->ca_paddr;
+/* $OpenBSD: cg2.c,v 1.6 1997/01/16 04:03:43 kstailey Exp $ */
/* $NetBSD: cg2.c,v 1.7 1996/10/13 03:47:26 christos Exp $ */
/*
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <vm/vm.h>
+#include <machine/conf.h>
#include <machine/fbio.h>
#include <machine/autoconf.h>
#include <machine/pmap.h>
NULL, "cgtwo", DV_DULL
};
-/* frame buffer generic driver */
-int cg2open(), cg2close(), cg2mmap();
-
-static int cg2gattr __P((struct fbdevice *, struct fbgattr *));
-static int cg2gvideo __P((struct fbdevice *, int *));
+static int cg2gattr __P((struct fbdevice *, struct fbgattr *));
+static int cg2gvideo __P((struct fbdevice *, int *));
static int cg2svideo __P((struct fbdevice *, int *));
static int cg2getcmap __P((struct fbdevice *, struct fbcmap *));
static int cg2putcmap __P((struct fbdevice *, struct fbcmap *));
static struct fbdriver cg2fbdriver = {
cg2open, cg2close, cg2mmap, cg2gattr,
cg2gvideo, cg2svideo,
- cg2getcmap, cg2putcmap };
+ cg2getcmap, cg2putcmap
+};
-static void cg2loadcmap __P((struct cg2_softc *, int, int));
-static int cg2intr __P((void*));
+static int cg2intr __P((void*));
/*
* Match a cg2.
struct fbdevice *fb = &sc->sc_fb;
struct confargs *ca = args;
struct fbtype *fbt;
- int i, ramsize, pa;
sc->sc_phys = ca->ca_paddr;
sc->sc_pmtype = PMAP_NC | PMAP_VME16;
int off, prot;
{
struct cg2_softc *sc = cgtwo_cd.cd_devs[minor(dev)];
- int realoff;
if (off & PGOFSET)
panic("cg2mmap");
*/
/* FBIOGATTR: */
-static int cg2gattr(fb, fba)
+static int
+cg2gattr(fb, fba)
struct fbdevice *fb;
struct fbgattr *fba;
{
}
/* FBIOGVIDEO: */
-static int cg2gvideo(fb, on)
+static int
+cg2gvideo(fb, on)
struct fbdevice *fb;
int *on;
{
}
/* FBIOGETCMAP: */
-static int cg2getcmap(fb, cmap)
+static int
+cg2getcmap(fb, cmap)
struct fbdevice *fb;
struct fbcmap *cmap;
{
}
/* FBIOPUTCMAP: */
-static int cg2putcmap(fb, cmap)
+static int
+cg2putcmap(fb, cmap)
struct fbdevice *fb;
struct fbcmap *cmap;
{
+/* $OpenBSD: cg4.c,v 1.8 1997/01/16 04:03:43 kstailey Exp $ */
/* $NetBSD: cg4.c,v 1.11 1996/10/29 19:54:19 gwr Exp $ */
/*
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <vm/vm.h>
+#include <machine/conf.h>
#include <machine/cpu.h>
#include <machine/fbio.h>
#include <machine/autoconf.h>
};
/* frame buffer generic driver */
-int cg4open(), cg4close(), cg4mmap();
static int cg4gattr __P((struct fbdevice *, struct fbgattr *));
static int cg4gvideo __P((struct fbdevice *, int *));
static struct fbdriver cg4_fbdriver = {
cg4open, cg4close, cg4mmap, cg4gattr,
cg4gvideo, cg4svideo,
- cg4getcmap, cg4putcmap };
+ cg4getcmap, cg4putcmap
+};
/*
* Match a cg4.
sc->sc_btcm = NULL;
cg4a_init(sc);
break;
-
+
case CG4_TYPE_B: /* Sun3/60 */
default:
sc->sc_va_cmap = (struct bt_regs *)
* 128k overlay data memory
* 128k overlay enable bitmap
* 1024k color memory
- *
+ *
* The hardware really looks like this (starting at ca_paddr)
* 4 bytes Brooktree DAC registers
* 2MB-4 gap
*/
/* FBIOGATTR: */
-static int cg4gattr(fb, fba)
+static int
+cg4gattr(fb, fba)
struct fbdevice *fb;
struct fbgattr *fba;
{
}
/* FBIOGVIDEO: */
-static int cg4gvideo(fb, on)
+static int
+cg4gvideo(fb, on)
struct fbdevice *fb;
int *on;
{
}
/* FBIOSVIDEO: */
-static int cg4svideo(fb, on)
+static int
+cg4svideo(fb, on)
struct fbdevice *fb;
int *on;
{
* FBIOGETCMAP:
* Copy current colormap out to user space.
*/
-static int cg4getcmap(fb, fbcm)
+static int
+cg4getcmap(fb, fbcm)
struct fbdevice *fb;
struct fbcmap *fbcm;
{
* FBIOPUTCMAP:
* Copy new colormap from user space and load.
*/
-static int cg4putcmap(fb, fbcm)
+static int
+cg4putcmap(fb, fbcm)
struct fbdevice *fb;
struct fbcmap *fbcm;
{
+/* $OpenBSD: eeprom.c,v 1.6 1997/01/16 04:03:44 kstailey Exp $ */
/* $NetBSD: eeprom.c,v 1.8 1996/03/26 15:16:06 gwr Exp $ */
/*
*/
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <machine/autoconf.h>
#include <machine/obio.h>
#include <machine/eeprom.h>
-#define HZ 100 /* XXX */
-
int ee_console; /* for convenience of drivers */
-static int ee_update(caddr_t buf, int off, int cnt);
-
static char *eeprom_va;
static int ee_busy, ee_want;
static int eeprom_match __P((struct device *, void *vcf, void *args));
static void eeprom_attach __P((struct device *, struct device *, void *));
+static int ee_update __P((caddr_t, int, int));
+static int ee_take __P((void));
+static void ee_give __P((void));
struct cfattach eeprom_ca = {
sizeof(struct device), eeprom_match, eeprom_attach
static int
eeprom_match(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
+ struct device *parent;
+ void *vcf, *args;
{
- struct cfdata *cf = vcf;
+ struct cfdata *cf = vcf;
struct confargs *ca = args;
int pa;
struct device *self;
void *args;
{
- struct confargs *ca = args;
printf("\n");
}
-static int ee_take() /* Take the lock. */
+static int
+ee_take() /* Take the lock. */
{
int error = 0;
+
while (ee_busy) {
ee_want = 1;
error = tsleep(&ee_busy, PZERO | PCATCH, "eeprom", 0);
return error;
}
-static void ee_give() /* Give the lock. */
+static void
+ee_give() /* Give the lock. */
{
+
ee_busy = 0;
if (ee_want) {
ee_want = 0;
}
}
-int eeprom_uio(struct uio *uio)
+int
+eeprom_uio(struct uio *uio)
{
int error;
int off; /* NOT off_t */
/*
* Update the EEPROM from the passed buf.
*/
-static int ee_update(char *buf, int off, int cnt)
+static int
+ee_update(char *buf, int off, int cnt)
{
volatile char *ep;
char *bp;
* holding the lock to prevent all access to
* the EEPROM while it recovers.
*/
- (void)tsleep(eeprom_va, PZERO-1, "eeprom", HZ/50);
+ (void)tsleep(eeprom_va, PZERO-1, "eeprom", hz/50);
}
/* Make sure the write worked. */
if (*ep != *bp)
* things like the zs driver very early to find out
* which device should be used as the console.
*/
-int ee_get_byte(int off, int canwait)
+int
+ee_get_byte(int off, int canwait)
{
int c = -1;
if ((off < 0) || (off >= OBIO_EEPROM_SIZE))
+/* $OpenBSD: fb.c,v 1.4 1997/01/16 04:03:45 kstailey Exp $ */
/* $NetBSD: fb.c,v 1.3 1995/04/10 05:45:56 mycroft Exp $ */
/*
#include <sys/ioctl.h>
#include <sys/proc.h>
+#include <machine/conf.h>
#include <machine/fbio.h>
+#include <machine/machdep.h>
#include "fbvar.h"
+/* $OpenBSD: fbvar.h,v 1.5 1997/01/16 04:03:45 kstailey Exp $ */
/* $NetBSD: fbvar.h,v 1.3 1996/10/29 19:27:37 gwr Exp $ */
/*
void fb_attach __P((struct fbdevice *, int));
int fbioctlfb __P((struct fbdevice *, u_long, caddr_t));
-extern int enoioctl();
+/* $OpenBSD: idprom.c,v 1.6 1997/01/16 04:03:46 kstailey Exp $ */
/* $NetBSD: idprom.c,v 1.13 1996/11/20 18:56:50 gwr Exp $ */
/*-
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/conf.h>
#include <machine/control.h>
#include <machine/idprom.h>
#include <machine/mon.h>
*/
struct idprom identity_prom;
-int idpromopen(dev, oflags, devtype, p)
+int
+idpromopen(dev, oflags, devtype, p)
dev_t dev;
int oflags;
int devtype;
return 0;
}
-int idpromclose(dev, fflag, devtype, p)
+int
+idpromclose(dev, fflag, devtype, p)
dev_t dev;
int fflag;
int devtype;
return 0;
}
+int
idpromread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
int ioflag;
{
- int error, unit, length;
+ int error, length;
error = 0;
while (uio->uio_resid > 0 && error == 0) {
* This is called very early during startup to
* get a copy of the idprom from control space.
*/
-int idprom_init()
+int
+idprom_init()
{
struct idprom *idp;
char *src, *dst;
return 0;
}
-void idprom_etheraddr(eaddrp)
+void
+idprom_etheraddr(eaddrp)
u_char *eaddrp;
{
u_char *src, *dst;
+/* $OpenBSD: if_ie.c,v 1.9 1997/01/16 04:03:46 kstailey Exp $ */
/* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */
/*-
void iereset __P((struct ie_softc *));
static void ie_readframe __P((struct ie_softc *, int));
static void ie_drop_packet_buffer __P((struct ie_softc *));
-static int command_and_wait __P((struct ie_softc *, int,
- void volatile *, int));
+static int command_and_wait __P((struct ie_softc *, int, void volatile *, int));
+static __inline__ void ie_setup_config __P((volatile struct ie_config_cmd *,
+ int, int));
static void ierint __P((struct ie_softc *));
static void ietint __P((struct ie_softc *));
static void setup_bufs __P((struct ie_softc *));
static int mc_setup __P((struct ie_softc *, void *));
static void mc_reset __P((struct ie_softc *));
+static int ie_setupram __P((struct ie_softc *));
+static __inline__ caddr_t Align __P((caddr_t));
+static __inline__ void ie_ack __P((struct ie_softc *, u_int));
+static __inline__ u_short ether_cmp __P((u_char *, u_char *));
+static __inline__ int check_eh __P((struct ie_softc *, struct ether_header *,
+ int *));
+static __inline__ int ie_buflen __P((struct ie_softc *, int));
+static __inline__ int ie_packet_len __P((struct ie_softc *));
+static __inline__ void iexmit __P((struct ie_softc *));
+static __inline__ int ieget __P((struct ie_softc *, struct mbuf **,
+ struct ether_header *, int *));
+static void chan_attn_timeout __P((void *));
+static void run_tdr __P((struct ie_softc *, struct ie_tdr_cmd *));
+static void iestop __P((struct ie_softc *));
#ifdef IEDEBUG
void print_rbd __P((volatile struct ie_recv_buf_desc *));
* but since we have the inline facility, it makes sense to use that
* instead.
*/
-static inline void
+static __inline__ void
ie_setup_config(cmd, promiscuous, manchester)
volatile struct ie_config_cmd *cmd;
int promiscuous, manchester;
cmd->ie_junk = 0xff;
}
-static inline caddr_t
+static __inline__ caddr_t
Align(ptr)
caddr_t ptr;
{
return (caddr_t)l;
}
-static inline void
+static __inline__ void
ie_ack(sc, mask)
struct ie_softc *sc;
u_int mask;
volatile struct ievme *iev = (volatile struct ievme *)sc->sc_reg;
if (iev->status & IEVME_PERR) {
printf("%s: parity error (ctrl %x @ %02x%04x)\n",
- iev->pectrl, iev->pectrl & IEVME_HADDR,
- iev->peaddr);
+ sc->sc_dev.dv_xname,
+ iev->pectrl, iev->pectrl & IEVME_HADDR, iev->peaddr);
iev->pectrl = iev->pectrl | IEVME_PARACK;
}
}
struct ie_softc *sc;
{
int status;
- int i;
sc->sc_arpcom.ac_if.if_timer = 0;
sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
if (status & IE_STAT_OK) {
sc->sc_arpcom.ac_if.if_opackets++;
- sc->sc_arpcom.ac_if.if_collisions +=
+ sc->sc_arpcom.ac_if.if_collisions +=
SWAP(status & IE_XS_MAXCOLL);
} else if (status & IE_STAT_ABORT) {
printf("%s: send aborted\n", sc->sc_dev.dv_xname);
* This expands to 10 short m68k instructions! -gwr
* Note: use this like bcmp()
*/
-static inline u_short
+static __inline__ u_short
ether_cmp(one, two)
u_char *one, *two;
{
* only client which will fiddle with IFF_PROMISC is BPF. This is
* probably a good assumption, but we do not make it here. (Yet.)
*/
-static inline int
+static __inline__ int
check_eh(sc, eh, to_bpf)
struct ie_softc *sc;
struct ether_header *eh;
* IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds
* the size of the buffer, then we are screwed anyway.
*/
-static inline int
+static __inline__ int
ie_buflen(sc, head)
struct ie_softc *sc;
int head;
& (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1)));
}
-static inline int
+static __inline__ int
ie_packet_len(sc)
struct ie_softc *sc;
{
* command to the chip to be executed. On the way, if we have a BPF listener
* also give him a copy.
*/
-inline static void
+static __inline__ void
iexmit(sc)
struct ie_softc *sc;
{
sc->xmit_cmds[sc->xctail]->ie_xmit_desc =
MK_16(sc->sc_maddr, sc->xmit_buffs[sc->xctail]);
- sc->scb->ie_command_list =
+ sc->scb->ie_command_list =
MK_16(sc->sc_maddr, sc->xmit_cmds[sc->xctail]);
command_and_wait(sc, IE_CU_START, 0, 0);
* chain of partially-full mbufs. This should help to speed up the
* operation considerably. (Provided that it works, of course.)
*/
-static inline int
+static __inline__ int
ieget(sc, mp, ehp, to_bpf)
struct ie_softc *sc;
struct mbuf **mp;
/*
* set up IE's ram space
*/
-int
+static int
ie_setupram(sc)
struct ie_softc *sc;
{
if (iscp->ie_busy) {
splx(s);
- return 0;
+ return (0);
}
/*
* Acknowledge any interrupts we may have caused...
ie_ack(sc, IE_ST_WHENCE);
splx(s);
- return 1;
+ return (1);
}
void
* This is called if we time out.
*/
static void
-chan_attn_timeout(rock)
- caddr_t rock;
+chan_attn_timeout(arg)
+ void *arg;
{
- *(int *) rock = 1;
+ *((int *) arg) = 1;
}
/*
* note: this function was written to be easy to understand, rather than
* highly efficient (it isn't in the critical path).
*/
-static void
+static void
setup_bufs(sc)
struct ie_softc *sc;
{
caddr_t ptr = sc->buf_area; /* memory pool */
- volatile struct ie_recv_frame_desc *rfd = (void *) ptr;
- volatile struct ie_recv_buf_desc *rbd;
int n, r;
/*
(sc->sc_bzero)(ptr, sc->buf_area_sz);
ptr = Align(ptr); /* set alignment and stick with it */
- n = (int)Align(sizeof(struct ie_xmit_cmd)) +
- (int)Align(sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE;
+ n = (int)Align((caddr_t)sizeof(struct ie_xmit_cmd)) +
+ (int)Align((caddr_t)sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE;
n *= NTXBUF; /* n = total size of xmit area */
n = sc->buf_area_sz - n;/* n = free space for recv stuff */
- r = (int)Align(sizeof(struct ie_recv_frame_desc)) +
- (((int)Align(sizeof(struct ie_recv_buf_desc)) + IE_RBUF_SIZE) * B_PER_F);
+ r = (int)Align((caddr_t)sizeof(struct ie_recv_frame_desc)) +
+ (((int)Align((caddr_t)sizeof(struct ie_recv_buf_desc)) +
+ IE_RBUF_SIZE) * B_PER_F);
/* r = size of one R frame */
{
volatile struct ie_sys_ctl_block *scb = sc->scb;
void *ptr;
- int n;
ptr = sc->buf_area;
+/* $OpenBSD: if_ie_obio.c,v 1.5 1997/01/16 04:03:47 kstailey Exp $ */
/* $NetBSD: if_ie_obio.c,v 1.6 1996/11/20 18:56:51 gwr Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
-#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/idprom.h>
#include <machine/vmparam.h>
struct device *parent;
void *vcf, *args;
{
- struct cfdata *cf = vcf;
struct confargs *ca = args;
/* Make sure there is something there... */
void *args;
{
struct ie_softc *sc = (void *) self;
- struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
sc->hard_type = IE_OBIO;
+/* $OpenBSD: if_ie_vmes.c,v 1.5 1997/01/16 04:03:48 kstailey Exp $ */
/* $NetBSD: if_ie_vmes.c,v 1.5 1996/11/20 18:56:51 gwr Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
-#include <machine/isr.h>
#include <machine/idprom.h>
#include <machine/vmparam.h>
* zero/copy functions: OBIO can use the normal functions, but VME
* must do only byte or half-word (16 bit) accesses...
*/
-static void wcopy(), wzero();
+static void wcopy __P((const void *, void *, u_int));
+static void wzero __P((void *, u_int));
/*
* New-style autoconfig attachment
void *vcf, *args;
{
struct confargs *ca = args;
- int x, sz;
+ int x;
#ifdef DIAGNOSTIC
if (ca->ca_bustype != BUS_VME16) {
/*
* MULTIBUS/VME support
*/
-void
+void
ie_vmereset(sc)
struct ie_softc *sc;
{
iev->status = 0;
}
-void
+void
ie_vmeattend(sc)
struct ie_softc *sc;
{
iev->status &= ~IEVME_ATTEN; /* down. */
}
-void
+void
ie_vmerun(sc)
struct ie_softc *sc;
{
+/* $OpenBSD: if_ievar.h,v 1.4 1997/01/16 04:03:48 kstailey Exp $ */
/* $NetBSD: if_ievar.h,v 1.6 1996/03/26 14:38:33 gwr Exp $ */
/*
* Machine-dependent glue for the Intel Ethernet (ie) driver.
*/
-#define B_PER_F 3 /* number of buffers to allocate per frame */
+#define B_PER_F 3 /* number of buffers to allocate per frame */
#define MXFRAMES 256 /* max number of frames to allow for receive */
#define MXRXBUF (MXFRAMES*B_PER_F) /* max number of buffers to allocate */
#define IE_RBUF_SIZE 256 /* size of each buffer, MUST BE POWER OF TWO */
*
* the chip uses two types of pointers: 16 bit and 24 bit
* 16 bit pointers are offsets from sc_maddr/ie_base
- * KVA(16 bit offset) = offset + sc_maddr
+ * KVA(16 bit offset) = offset + sc_maddr
* 24 bit pointers are offset from sc_iobase in KVA
- * KVA(24 bit address) = address + sc_iobase
+ * KVA(24 bit address) = address + sc_iobase
*
* on the vme/multibus we have the page map to control where ram appears
* in the address space. we choose to have RAM start at 0 in the
* For example:
* if the register is @ 0xffe88000, then the top 12 bits are 0xffe00000.
* to get the 4 bits from the the status word just do status & IEVME_HADDR.
- * suppose the value is "4". Then just shift it left 16 bits to get
- * it into bits 17-20 (e.g. 0x40000). Then or it to get the
+ * suppose the value is "4". Then just shift it left 16 bits to get
+ * it into bits 17-20 (e.g. 0x40000). Then or it to get the
* address of RAM (in our example: 0xffe40000). see the attach routine!
*
* In the onboard ie interface, the 24 bit address space is hardwired
* to be 0xff000000 -> 0xffffffff of KVA. this means that sc_iobase
- * will be 0xff000000. sc_maddr will be where ever we allocate RAM
+ * will be 0xff000000. sc_maddr will be where ever we allocate RAM
* in KVA. note that since the SCP is at a fixed address it means
* that we have to use some memory at a fixed KVA for the SCP.
* The Sun PROM leaves a page for us at the end of KVA space.
struct device sc_dev; /* device structure */
struct arpcom sc_arpcom;/* system arpcom structure */
-#define sc_if sc_arpcom.ac_if /* network-visible interface */
+#define sc_if sc_arpcom.ac_if /* network-visible interface */
#define sc_addr sc_arpcom.ac_enaddr /* hardware Ethernet address */
caddr_t sc_iobase; /* KVA of base of 24bit addr space */
caddr_t sc_maddr; /* KVA of base of chip's RAM */
- u_int sc_msize; /* how much RAM we have/use */
+ u_int sc_msize; /* how much RAM we have/use */
caddr_t sc_reg; /* KVA of card's register */
- enum ie_hardware hard_type; /* card type */
- void (*reset_586)(); /* card dependent reset function */
- void (*chan_attn)(); /* card dependent attn function */
- void (*run_586)(); /* card dependent "go on-line" function */
- void (*sc_bcopy) __P((const void *, void *, u_int));
- void (*sc_bzero) __P((void *, u_int));
+ enum ie_hardware hard_type; /* card type */
+ void (*reset_586) __P((struct ie_softc *)); /* three card */
+ void (*chan_attn) __P((struct ie_softc *)); /* dependant */
+ void (*run_586) __P((struct ie_softc *)); /* functions */
+ void (*sc_bcopy) __P((const void *, void *, u_int));
+ void (*sc_bzero) __P((void *, u_int));
- int want_mcsetup; /* flag for multicast setup */
- int promisc; /* are we in promisc mode? */
+ int want_mcsetup; /* flag for multicast setup */
+ int promisc; /* are we in promisc mode? */
/*
* pointers to the 3 major control structures
* are to be allocated from
*/
caddr_t buf_area;
- int buf_area_sz;
+ int buf_area_sz;
/*
* the actual buffers (recv and xmit)
volatile struct ie_recv_frame_desc *rframes[MXFRAMES];
volatile struct ie_recv_buf_desc *rbuffs[MXRXBUF];
volatile char *cbuffs[MXRXBUF];
- int rfhead, rftail, rbhead, rbtail;
+ int rfhead, rftail, rbhead, rbtail;
volatile struct ie_xmit_cmd *xmit_cmds[NTXBUF];
volatile struct ie_xmit_buf *xmit_buffs[NTXBUF];
int xchead, xctail;
struct ie_en_addr mcast_addrs[MAXMCAST + 1];
- int mcast_count;
+ int mcast_count;
- int nframes; /* number of frames in use */
- int nrxbuf; /* number of recv buffs in use */
+ int nframes; /* number of frames in use */
+ int nrxbuf; /* number of recv buffs in use */
#ifdef IEDEBUG
- int sc_debug;
+ int sc_debug;
#endif
};
-extern void ie_attach __P((struct ie_softc *));
+extern void ie_attach __P((struct ie_softc *));
extern int ie_intr __P((void *));
+/* $OpenBSD: if_le.c,v 1.9 1997/01/16 04:03:49 kstailey Exp $ */
/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
-#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/idprom.h>
};
hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
-hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t));
+hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t));
hide void
lewrcsr(sc, port, val)
ler1->ler1_rap = port;
val = ler1->ler1_rdp;
return (val);
-}
+}
int
le_match(parent, vcf, aux)
struct device *parent;
void *vcf, *aux;
{
- struct cfdata *cf = vcf;
struct confargs *ca = aux;
/* Make sure there is something there... */
{
struct le_softc *lesc = (struct le_softc *)self;
struct am7990_softc *sc = &lesc->sc_am7990;
- struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = aux;
lesc->sc_r1 = (struct lereg1 *)
+/* $OpenBSD: kd.c,v 1.7 1997/01/16 04:03:49 kstailey Exp $ */
/* $NetBSD: kd.c,v 1.21 1996/11/20 18:56:55 gwr Exp $ */
/*-
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/conf.h>
+#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/psl.h>
#include <dev/cons.h>
#include <dev/sun/kbd_xlate.h>
+#include "zs_cons.h"
+
#define KDMAJOR 1
#define PUT_WSIZE 64
int kd_is_console;
/*
- * This is called by kbd_attach()
+ * This is called by kbd_attach()
* XXX - Make this a proper child of kbd?
*/
void
struct kd_softc *kd;
int error, s, unit;
struct tty *tp;
-
+
unit = minor(dev);
if (unit != 0)
return ENXIO;
tp->t_ispeed = t->c_ispeed;
tp->t_ospeed = t->c_ospeed;
tp->t_cflag = t->c_cflag;
- return 0;
+ return (0);
}
-void
+int
kdstop(tp, flag)
struct tty *tp;
int flag;
{
-
+ return (0);
}
static void kd_later(void*);
****************************************************************/
extern void *zs_conschan;
-extern int zs_getc();
-extern void nullcnprobe();
-cons_decl(kd);
/* The debugger gets its own key translation state. */
static struct kbd_state kdcn_state;
+cons_decl(kd);
+
void
kdcninit(cn)
struct consdev *cn;
(romVectorPtr->fbWriteChar)(c & 0x7f);
}
-extern void fb_unblank();
void kdcnpollc(dev, on)
dev_t dev;
int on;
+/* $OpenBSD: memerr.c,v 1.8 1997/01/16 04:03:50 kstailey Exp $ */
/* $NetBSD: memerr.c,v 1.6 1996/11/13 07:05:14 thorpej Exp $ */
/*
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/control.h>
#include <machine/cpu.h>
#include <machine/obio.h>
#include <machine/pte.h>
{
struct memerr_softc *sc = arg;
volatile struct memerr *me = sc->sc_reg;
- u_char csr, ctx, err;
+ u_char csr, ctx;
u_int pa, va;
int pte;
+/* $OpenBSD: obctl.c,v 1.4 1997/01/16 04:03:50 kstailey Exp $ */
/* $NetBSD: obctl.c,v 1.11 1996/11/20 18:56:55 gwr Exp $ */
/*-
+/* $OpenBSD: obio.c,v 1.6 1997/01/16 04:03:51 kstailey Exp $ */
/* $NetBSD: obio.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */
/*-
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/control.h>
#include <machine/pte.h>
#include <machine/mon.h>
-#include <machine/isr.h>
#include <machine/obio.h>
static int obio_match __P((struct device *, void *, void *));
static void obio_attach __P((struct device *, struct device *, void *));
static int obio_print __P((void *, const char *parentname));
-static int obio_submatch __P((struct device *, void *, void *));
+static int obio_submatch __P((struct device *, void *, void *));
+
+static void save_prom_mappings __P((void));
+static void make_required_mappings __P((void));
struct cfattach obio_ca = {
sizeof(struct device), obio_match, obio_attach
*/
#define PGBITS (PG_VALID|PG_WRITE|PG_SYSTEM)
-static void save_prom_mappings()
+static void
+save_prom_mappings()
{
- vm_offset_t pa;
- caddr_t segva, pgva;
+ vm_offset_t pa, segva, pgva;
int pte, sme, i;
-
- segva = (caddr_t)MONSTART;
- while (segva < (caddr_t)MONEND) {
+
+ segva = (vm_offset_t)MONSTART;
+ while (segva < (vm_offset_t)MONEND) {
sme = get_segmap(segva);
if (sme == SEGINV) {
segva += NBSG;
{
i = pa >> SAVE_SHIFT;
if (prom_mappings[i] == NULL) {
- prom_mappings[i] = pgva;
+ prom_mappings[i] = (caddr_t)pgva;
#ifdef DEBUG
mon_printf("obio: found pa=0x%x\n", pa);
#endif
(vm_offset_t)-1, /* end marker */
};
-static void make_required_mappings()
+static void
+make_required_mappings()
{
- vm_offset_t pa, *rmp;
- int idx;
-
+ vm_offset_t *rmp;
+
rmp = required_mappings;
while (*rmp != (vm_offset_t)-1) {
if (!obio_find_mapping(*rmp, NBPG)) {
* accessible before the mainline OBIO autoconfiguration as part of
* configure().
*/
-void obio_init()
+void
+obio_init()
{
save_prom_mappings();
make_required_mappings();
}
-caddr_t obio_alloc(obio_addr, obio_size)
+caddr_t
+obio_alloc(obio_addr, obio_size)
int obio_addr, obio_size;
{
caddr_t cp;
+/* $OpenBSD: obmem.c,v 1.6 1997/01/16 04:03:51 kstailey Exp $ */
/* $NetBSD: obmem.c,v 1.11 1996/11/20 18:56:57 gwr Exp $ */
/*-
+/* $OpenBSD: rd_root.c,v 1.6 1997/01/16 04:03:52 kstailey Exp $ */
/* $NetBSD: rd_root.c,v 1.7 1996/11/20 18:56:58 gwr Exp $ */
/*-
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/reboot.h>
#include <dev/ramdisk.h>
+/* $OpenBSD: si.c,v 1.7 1997/01/16 04:03:52 kstailey Exp $ */
/* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */
/*-
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
-#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/dvma.h>
NULL, /* Use default "done" routine. */
};
+
+static int siprint __P((void *, const char *));
+
/*
* New-style autoconfig attachment. The cfattach
* structures are in si_obio.c and si_vme.c
/*
* Fill in the prototype scsi_link.
*/
+#ifndef __OpenBSD__
ncr_sc->sc_link.channel = SCSI_CHANNEL_ONLY_ONE;
+#endif
ncr_sc->sc_link.adapter_softc = sc;
ncr_sc->sc_link.adapter_target = 7;
ncr_sc->sc_link.adapter = &si_ops;
#ifdef DEBUG
if (si_debug)
- printf("si: Set TheSoftC=%x TheRegs=%x\n", sc, regs);
+ printf("si: Set TheSoftC=%p TheRegs=%p\n", sc, regs);
ncr_sc->sc_link.flags |= si_link_flags;
#endif
si_reset_adapter(ncr_sc);
ncr5380_init(ncr_sc);
ncr5380_reset_scsibus(ncr_sc);
- config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint);
+ config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), siprint);
}
static void
if (bp->b_bcount > MAX_DMA_LEN) {
#ifdef DEBUG
if (si_debug) {
- printf("si_minphys len = 0x%x.\n", bp->b_bcount);
+ printf("si_minphys len = 0x%lx.\n", bp->b_bcount);
Debugger();
}
#endif
dh->dh_dvma = (u_long) dvma_mapin((char *)addr, xlen);
if (!dh->dh_dvma) {
/* Can't remap segment */
- printf("si_dma_alloc: can't remap %x/%x\n",
+ printf("si_dma_alloc: can't remap %p/%x\n",
dh->dh_addr, dh->dh_maplen);
dh->dh_flags = 0;
return;
{
struct si_softc *sc = (struct si_softc *)ncr_sc;
struct sci_req *sr = ncr_sc->sc_current;
- struct si_dma_handle *dh = sr->sr_dma_hand;
volatile struct si_regs *si = sc->sc_regs;
int tmo;
#endif
}
+static int
+siprint(aux, name)
+ void *aux;
+ const char *name;
+{
+
+ if (name != NULL)
+ printf("%s: scsibus ", name);
+ return UNCONF;
+}
+/* $OpenBSD: si_obio.c,v 1.6 1997/01/16 04:03:53 kstailey Exp $ */
/* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */
/*-
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
-#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/dvma.h>
void si_obio_dma_eop __P((struct ncr5380_softc *));
void si_obio_dma_stop __P((struct ncr5380_softc *));
+static __inline__ int si_obio_udc_read __P((volatile struct si_regs *, int));
+static __inline__ void si_obio_udc_write __P((volatile struct si_regs *,
+ int, int));
+
/*
* New-style autoconfig attachment
*/
struct device *parent;
void *vcf, *args;
{
- struct cfdata *cf = vcf;
struct confargs *ca = args;
/* Make sure there is something there... */
#ifdef DEBUG
if (si_debug & 2) {
- printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n",
+ printf("si_dma_setup: dh=%p, pa=0x%lx, xlen=%d\n",
dh, data_pa, xlen);
}
#endif
#ifdef DEBUG
if (si_debug & 2) {
- printf("si_dma_start: sr=0x%x\n", sr);
+ printf("si_dma_start: sr=%p\n", sr);
}
#endif
+/* $OpenBSD: si_vme.c,v 1.6 1997/01/16 04:03:54 kstailey Exp $ */
/* $NetBSD: si_vme.c,v 1.7 1996/11/20 18:57:01 gwr Exp $ */
/*-
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
-#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/dvma.h>
struct device *parent;
void *vcf, *args;
{
- struct cfdata *cf = vcf;
struct confargs *ca = args;
int probe_addr;
/* Clear the count so nothing happens. */
si->dma_counth = 0;
si->dma_countl = 0;
-
+
/* Clear the start address too. (paranoid?) */
si->dma_addrh = 0;
si->dma_addrl = 0;
#ifdef DEBUG
if (si_debug & 2) {
- printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n",
+ printf("si_dma_setup: dh=%p, pa=0x%lx, xlen=%d\n",
dh, data_pa, xlen);
}
#endif
#if 0
/* Clear FIFO counter. (also hits dma_count) */
si->fifo_cnt_hi = 0;
- si->fifo_count = 0;
+ si->fifo_count = 0;
#endif
}
struct sci_req *sr = ncr_sc->sc_current;
struct si_dma_handle *dh = sr->sr_dma_hand;
volatile struct si_regs *si = sc->sc_regs;
- long data_pa;
int s, xlen;
xlen = sc->sc_reqlen;
+/* $OpenBSD: sireg.h,v 1.2 1997/01/16 04:03:54 kstailey Exp $ */
/* $NetBSD: sireg.h,v 1.1 1996/03/26 15:01:14 gwr Exp $ */
/*
/*
* Some of these registers apply to only one interface and some
- * apply to both. The registers which apply to the Sun3/50 onboard
+ * apply to both. The registers which apply to the Sun3/50 onboard
* version only are udc_rdata and udc_raddr. The registers which
* apply to the Sun3 vme version only are dma_addr, dma_count, bpr,
- * iv_am, and bcrh. Thus, the sbc registers, fifo_data, bcr, and csr
+ * iv_am, and bcrh. Thus, the sbc registers, fifo_data, bcr, and csr
* apply to both interfaces.
- * One other feature of the vme interface: a write to the dma count
+ * One other feature of the vme interface: a write to the dma count
* register also causes a write to the fifo byte count register and
* vis versa.
*/
u_short fifo_data; /* fifo data register */
/* holds extra byte on odd */
/* byte dma read */
- u_short fifo_count; /* fifo byte count */
+ u_short fifo_count; /* fifo byte count */
u_short si_csr; /* control/status register */
/* The rest of these are on the VME interface only: */
- u_short si_bprh; /* byte pack, high (VME only) */
- u_short si_bprl; /* byte pack, low (VME only) */
- u_short si_iv_am; /* bits 0-7: intr vector */
+ u_short si_bprh; /* byte pack, high (VME only) */
+ u_short si_bprl; /* byte pack, low (VME only) */
+ u_short si_iv_am; /* bits 0-7: intr vector */
/* bits 8-13: addr modifier (VME only) */
/* bits 14-15: unused */
u_short fifo_cnt_hi; /* high part of fifo_count (VME only) */
+/* $OpenBSD: vme.c,v 1.4 1997/01/16 04:03:55 kstailey Exp $ */
/* $NetBSD: vme.c,v 1.6 1996/11/20 18:57:02 gwr Exp $ */
/*-
+/* $OpenBSD: xd.c,v 1.10 1997/01/16 04:03:55 kstailey Exp $ */
/* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */
/*
struct xd_softc *, int, u_long, int,
caddr_t, struct buf *));
void xdc_rqtopb __P((struct xd_iorq *, struct xd_iopb *, int, int));
-int xdc_start __P((struct xdc_softc *, int));
+void xdc_start __P((struct xdc_softc *, int));
int xdc_startbuf __P((struct xdc_softc *, struct xd_softc *, struct buf *));
int xdc_submit_iorq __P((struct xdc_softc *, int, int));
void xdc_tick __P((void *));
-int xdc_xdreset __P((struct xdc_softc *, struct xd_softc *));
+void xdc_xdreset __P((struct xdc_softc *, struct xd_softc *));
/* machine interrupt hook */
int xdcintr __P((void *));
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
int x;
struct xdc_softc *xdc = (void *) self;
struct confargs *ca = aux;
struct xdc_attach_args xa;
- int lcv, rqno, err, pri;
+ int lcv, rqno, err;
struct xd_iopb_ctrl *ctl;
/* get addressing and intr level stuff from autoconfig and load it
void *match, *aux;
{
- struct xdc_softc *xdc = (void *) parent;
struct cfdata *cf = match;
struct xdc_attach_args *xa = aux;
struct xd_softc *xd = (void *) self;
struct xdc_softc *xdc = (void *) parent;
struct xdc_attach_args *xa = aux;
- int rqno, err, spt, mb, blk, lcv, fmode, s, newstate;
+ int rqno, err, spt = 0, mb, blk, lcv, fmode, s = -1, newstate;
struct xd_iopb_drive *driopb;
struct dkbad *dkb;
- struct bootpath *bp;
/*
* Always re-initialize the disk structure. We want statistics
{
struct xd_softc *xdsc;
- int unit, part, size;
+ int part, size;
/* valid unit? try an open */
{
struct xdc_softc *xdcsc = v;
- struct xd_softc *xd;
- struct buf *bp;
/* kick the event counter */
{
int rqno, submode = XD_STATE(fullmode), retry;
- u_long dp;
struct xd_iorq *iorq;
struct xd_iopb *iopb;
struct xd_iorq *iorq;
struct xd_iopb *iopb;
struct buf *wq;
- u_long block, dp;
+ u_long block;
caddr_t dbuf;
if (!xdcsc->nfree)
* xdc_reset: reset one drive. NOTE: assumes xdc was just reset.
* we steal iopb[0] for this, but we put it back when we are done.
*/
-int
+void
xdc_xdreset(xdcsc, xdsc)
struct xdc_softc *xdcsc;
struct xd_softc *xdsc;
struct xd_iopb tmpiopb;
u_long addr;
int del;
+
bcopy(xdcsc->iopbase, &tmpiopb, sizeof(tmpiopb));
bzero(xdcsc->iopbase, sizeof(tmpiopb));
xdcsc->iopbase->comm = XDCMD_RST;
struct xd_softc *xdsc;
{
- int del = 0, lcv, poll = -1, retval = XD_ERR_AOK;
+ int del = 0, lcv, retval = XD_ERR_AOK;
int oldfree = xdcsc->nfree;
struct xd_iorq *iorq;
* xdc_start: start all waiting buffers
*/
-int
+void
xdc_start(xdcsc, maxio)
struct xdc_softc *xdcsc;
int maxio;
{
int rqno;
+
while (maxio && xdcsc->nwait &&
(xdcsc->xdc->xdc_csr & XDC_ADDING) == 0) {
XDC_GET_WAITER(xdcsc, rqno); /* note: rqno is an "out"
maxio--;
}
}
+
/*
* xdc_remove_iorq: remove "done" IOPB's.
*/
{
int errno, rqno, comm, errs;
struct xdc *xdc = xdcsc->xdc;
- u_long addr;
struct xd_iopb *iopb;
struct xd_iorq *iorq;
struct buf *bp;
struct xdc_softc *xdcsc = arg;
int lcv, s, reset = 0;
#ifdef XDC_DIAG
- int wait, run, free, done, whd;
+ int wait, run, free, done, whd = 0;
u_char fqc[XDC_MAXIOPB], wqc[XDC_MAXIOPB], mark[XDC_MAXIOPB];
s = splbio();
wait = xdcsc->nwait;
printf("\n");
for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
if (mark[lcv] == 0)
- printf("MARK: running %d: mode %d done %d errs %d errno 0x%x ttl %d buf %x\n",
+ printf("MARK: running %d: mode %d done %d errs %d errno 0x%x ttl %d buf %p\n",
lcv, xdcsc->reqs[lcv].mode,
xdcsc->iopbase[lcv].done,
xdcsc->iopbase[lcv].errs,
if (xio->dlen) {
dvmabuf = dvma_malloc(xio->dlen);
if (xio->cmd == XDCMD_WR || xio->cmd == XDCMD_XWR) {
- if (err = copyin(xio->dptr, dvmabuf, xio->dlen)) {
+ if ((err = copyin(xio->dptr, dvmabuf, xio->dlen))) {
dvma_free(dvmabuf, xio->dlen);
return (err);
}
+/* $OpenBSD: xdreg.h,v 1.3 1997/01/16 04:03:56 kstailey Exp $ */
/* $NetBSD: xdreg.h,v 1.2 1996/02/22 06:55:32 thorpej Exp $ */
/*
/*
* some commands overload bytes 6 to 0x13 of the iopb with different meanings.
- * these commands include:
+ * these commands include:
* section 4.2: controller parameters
- * section 4.3: drive parameters
+ * section 4.3: drive parameters
* sectino 4.4: format parameters
*
* note that the commands that overload the iopb are not part of the
#define XDC_DELAY_SPARC 0
/*
- * drive parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, e
+ * drive parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, e
*/
struct xd_iopb_drive {
};
/*
- * format parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, 0x10, 0x11
+ * format parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, 0x10, 0x11
*/
struct xd_iopb_format {
+/* $OpenBSD: xdvar.h,v 1.4 1997/01/16 04:03:57 kstailey Exp $ */
/* $NetBSD: xdvar.h,v 1.3 1996/02/22 06:55:33 thorpej Exp $ */
/*
*/
/*
- * x d v a r . h
+ * x d v a r . h
*
- * this file defines the software structure we use to control the
+ * this file defines the software structure we use to control the
* 753/7053.
*
* author: Chuck Cranor <chuck@ccrc.wustl.edu>
#define XD_SUB_MASK 0xf0 /* mask bits for state */
#define XD_SUB_FREE 0x00 /* free */
#define XD_SUB_NORM 0x10 /* normal I/O request */
-#define XD_SUB_WAIT 0x20 /* normal I/O request in the
+#define XD_SUB_WAIT 0x20 /* normal I/O request in the
context of a process */
#define XD_SUB_POLL 0x30 /* polled mode */
#define XD_SUB_DONE 0x40 /* not active, but can't be free'd yet */
struct buf sc_wq; /* queue'd IOPBs for this controller */
char freereq[XDC_MAXIOPB]; /* free list (stack) */
char waitq[XDC_MAXIOPB]; /* wait queue */
- char nfree; /* number of iopbs free */
+ int nfree; /* number of iopbs free */
char nrun; /* number running */
char nwait; /* number of waiting iopbs */
char ndone; /* number of done IORQs */
- char waithead; /* head of queue */
- char waitend; /* end of queue */
+ int waithead; /* head of queue */
+ int waitend; /* end of queue */
};
/*
+/* $OpenBSD: xio.h,v 1.2 1997/01/16 04:03:57 kstailey Exp $ */
/* $NetBSD: xio.h,v 1.1 1995/10/30 20:58:20 gwr Exp $ */
/*
*/
/*
- * x i o . h
+ * x i o . h
*
- * this file defines the software structure we use to ioctl the
+ * this file defines the software structure we use to ioctl the
* 753/7053. this interface isn't set in stone and may (or may not)
* need adjustment.
*
*/
struct xd_iocmd {
- u_char cmd; /* in: command number */
- u_char subfn; /* in: subfunction number */
- u_char errno; /* out: error number */
- u_char tries; /* out: number of tries */
- u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */
- u_short dlen; /* in: length of data buffer (good sanity check) */
- u_long block; /* in: block number */
- caddr_t dptr; /* in: data buffer to do I/O from */
+ u_char cmd; /* in: command number */
+ u_char subfn; /* in: subfunction number */
+ u_char errno; /* out: error number */
+ u_char tries; /* out: number of tries */
+ u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */
+ u_short dlen; /* in: length of data buffer (good sanity check) */
+ u_long block; /* in: block number */
+ caddr_t dptr; /* in: data buffer to do I/O from */
};
#ifndef DIOSXDCMD
+/* $OpenBSD: xy.c,v 1.9 1997/01/16 04:03:58 kstailey Exp $ */
/* $NetBSD: xy.c,v 1.11 1996/10/13 03:47:40 christos Exp $ */
/*
(SC)->ciorq->mode = XY_SUB_FREE; \
wakeup((SC)->ciorq); \
} \
- }
+}
/*
* XYC_ADVANCE: advance iorq's pointers by a number of sectors
struct xy_softc *, int, u_long, int,
caddr_t, struct buf *));
void xyc_rqtopb __P((struct xy_iorq *, struct xy_iopb *, int, int));
-int xyc_start __P((struct xyc_softc *, struct xy_iorq *));
+void xyc_start __P((struct xyc_softc *, struct xy_iorq *));
int xyc_startbuf __P((struct xyc_softc *, struct xy_softc *, struct buf *));
int xyc_submit_iorq __P((struct xyc_softc *, struct xy_iorq *, int));
void xyc_tick __P((void *));
int xyc_unbusy __P((struct xyc *, int));
-int xyc_xyreset __P((struct xyc_softc *, struct xy_softc *));
+void xyc_xyreset __P((struct xyc_softc *, struct xy_softc *));
/* machine interrupt hook */
int xycintr __P((void *));
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
int x;
struct xyc_softc *xyc = (void *) self;
struct confargs *ca = aux;
struct xyc_attach_args xa;
- int lcv, err, pri, res, pbsz;
+ int lcv, err, res, pbsz;
void *tmp, *tmp2;
u_long ultmp;
void *match, *aux;
{
- struct xyc_softc *xyc = (void *) parent;
struct cfdata *cf = match;
struct xyc_attach_args *xa = aux;
struct xy_softc *xy = (void *) self, *oxy;
struct xyc_softc *xyc = (void *) parent;
struct xyc_attach_args *xa = aux;
- int res, err, spt, mb, blk, lcv, fmode, s, newstate;
+ int err, spt, mb, blk, lcv, fmode, s = -1, newstate;
struct dkbad *dkb;
- struct bootpath *bp;
/*
* Always re-initialize the disk structure. We want statistics
xy->state = newstate;
if (!xa->booting) {
wakeup(&xy->state);
+ if (s == -1)
+ panic("xy: spl/splx mismatch");
splx(s);
}
}
{
struct xy_softc *xysc;
- int unit, part, size;
+ int part, size;
/* valid unit? try an open */
{
struct xy_softc *xy;
- struct xyc_softc *parent;
- struct buf *wq;
int s, unit;
struct xyc_attach_args xa;
{
struct xyc_softc *xycsc = v;
- struct xy_softc *xy;
- struct buf *bp;
/* kick the event counter */
int fullmode;
{
- int submode = XY_STATE(fullmode), retry;
- u_long dp;
+ int submode = XY_STATE(fullmode);
struct xy_iorq *iorq = xycsc->ciorq;
struct xy_iopb *iopb = xycsc->ciopb;
struct buf *bp;
{
+ u_long block;
int partno;
struct xy_iorq *iorq;
struct xy_iopb *iopb;
- u_long block, dp;
caddr_t dbuf;
iorq = xysc->xyrq;
int nreset = 0;
int retval = 0;
u_long res;
- struct xyc *xyc = xycsc->xyc;
#ifdef XYC_DEBUG
printf("xyc_piodriver(%s, 0x%x)\n", xycsc->sc_dev.dv_xname, iorq);
#endif
* xyc_xyreset: reset one drive. NOTE: assumes xyc was just reset.
* we steal iopb[XYC_CTLIOPB] for this, but we put it back when we are done.
*/
-int
+void
xyc_xyreset(xycsc, xysc)
struct xyc_softc *xycsc;
struct xy_softc *xysc;
struct xy_softc *xysc;
{
- int del = 0, lcv, poll = -1, retval = XY_ERR_AOK;
+ int del = 0, lcv, retval = XY_ERR_AOK;
struct xy_iorq *iorq;
/* soft reset hardware */
* xyc_start: start waiting buffers
*/
-int
+void
xyc_start(xycsc, iorq)
struct xyc_softc *xycsc;
struct xy_iorq *iorq;
struct xd_iocmd *xio;
{
- int s, err, rqno, dummy;
+ int s, err, rqno, dummy = 0;
caddr_t dvmabuf = NULL;
struct xyc_softc *xycsc;
if (xio->dlen) {
dvmabuf = dvma_malloc(xio->dlen);
if (xio->cmd == XYCMD_WR) {
- if (err = copyin(xio->dptr, dvmabuf, xio->dlen)) {
+ if ((err = copyin(xio->dptr, dvmabuf, xio->dlen))) {
dvma_free(dvmabuf, xio->dlen);
return (err);
}
+/* $OpenBSD: xyreg.h,v 1.2 1997/01/16 04:03:59 kstailey Exp $ */
/* $NetBSD: xyreg.h,v 1.1 1995/10/30 20:58:22 gwr Exp $ */
/*
* add iopb to the chain, and clear AREQ to resume I/O
*
* when the controller is done with a command it may interrupt (if you
- * ask it to) and it will set the XYC_IPND bit in the csr. clear
+ * ask it to) and it will set the XYC_IPND bit in the csr. clear
* the interrupt by writing one to this bit.
- *
+ *
* the format of the iopb is described in section 2.4 of the manual.
* note that it is byte-swapped on the sun.
*/
+/* $OpenBSD: xyvar.h,v 1.3 1997/01/16 04:04:00 kstailey Exp $ */
/* $NetBSD: xyvar.h,v 1.2 1996/01/07 22:03:22 thorpej Exp $ */
/*
*/
/*
- * x y v a r . h
+ * x y v a r . h
*
- * this file defines the software structure we use to control the
+ * this file defines the software structure we use to control the
* 450/451.
*
* author: Chuck Cranor <chuck@ccrc.wustl.edu>
#define XY_SUB_MASK 0xf0 /* mask bits for state */
#define XY_SUB_FREE 0x00 /* free */
#define XY_SUB_NORM 0x10 /* normal I/O request */
-#define XY_SUB_WAIT 0x20 /* normal I/O request in the
+#define XY_SUB_WAIT 0x20 /* normal I/O request in the
context of a process */
#define XY_SUB_POLL 0x30 /* polled mode */
#define XY_SUB_DONE 0x40 /* not active, but can't be free'd yet */
+/* $OpenBSD: zs.c,v 1.7 1997/01/16 04:04:00 kstailey Exp $ */
/* $NetBSD: zs.c,v 1.42 1996/11/20 18:57:03 gwr Exp $ */
/*-
#define NZS 2 /* XXX */
-/* The Sun3 provides a 4.9152 MHz clock to the ZS chips. */
+/*
+ * The Sun3 provides a 4.9152 MHz clock to the ZS chips.
+ */
#define PCLK (9600 * 512) /* PCLK pin input clock rate */
/*
#define ZS_DELAY() delay(2)
-/* The layout of this is hardware-dependent (padding, order). */
+/*
+ * The layout of this is hardware-dependent (padding, order).
+ */
struct zschan {
volatile u_char zc_csr; /* ctrl,status, and indirect access */
u_char zc_xxx0;
volatile u_char zc_data; /* data */
u_char zc_xxx1;
};
+
struct zsdevice {
/* Yes, they are backwards. */
struct zschan zs_chan_b;
/* Default OBIO addresses. */
static int zs_physaddr[NZS] = { OBIO_KEYBD_MS, OBIO_ZS };
+
/* Saved PROM mappings */
static struct zsdevice *zsaddr[NZS]; /* See zs_init() */
+
/* Flags from cninit() */
static int zs_hwflags[NZS][2];
+
/* Default speed for each channel */
static int zs_defspeed[NZS][2] = {
{ 1200, /* keyboard */
};
+static struct zschan *zs_get_chan_addr __P((int, int));
+int zs_getc __P((volatile void *));
+static void zs_putc __P((volatile void *, int));
+
+int zscngetc __P((dev_t));
+void zscnputc __P((dev_t, int));
+void nullcnprobe __P((struct consdev *));
+void zscninit __P((struct consdev *));
+
/* Find PROM mappings (for console support). */
void zs_init()
{
zsaddr[i] = (struct zsdevice *)
obio_find_mapping(zs_physaddr[i], OBIO_ZS_SIZE);
}
-}
+}
-struct zschan *
+static struct zschan *
zs_get_chan_addr(zsc_unit, channel)
int zsc_unit, channel;
{
{
struct zsc_softc *zsc = (void *) self;
struct cfdata *cf = self->dv_cfdata;
- struct confargs *ca = aux;
struct zsc_attach_args zsc_args;
volatile struct zschan *zc;
struct zs_chanstate *cs;
{
struct zsc_softc *zsc;
int unit, rval;
-
+
/* Do ttya/ttyb first, because they go faster. */
rval = 0;
unit = zsc_cd.cd_ndevs;
void
zsc_req_softint(zsc)
struct zsc_softc *zsc;
-{
+{
if (zssoftpending == 0) {
/* We are at splzs here, so no need to lock. */
zssoftpending = ZSSOFT_PRI;
ZS_DELAY();
}
-u_char zs_read_csr(cs)
+u_char
+zs_read_csr(cs)
struct zs_chanstate *cs;
{
register u_char v;
return v;
}
-u_char zs_read_data(cs)
+u_char
+zs_read_data(cs)
struct zs_chanstate *cs;
{
register u_char v;
ZS_DELAY();
}
-void zs_write_data(cs, val)
+void
+zs_write_data(cs, val)
struct zs_chanstate *cs;
u_char val;
{
*/
int
zs_getc(arg)
- void *arg;
+ volatile void *arg;
{
register volatile struct zschan *zc = arg;
register int s, c, rr0;
/*
* Polled output char.
*/
-void
+static void
zs_putc(arg, c)
- void *arg;
+ volatile void *arg;
int c;
{
register volatile struct zschan *zc = arg;
extern struct consdev consdev_kd; /* keyboard/display */
extern struct consdev consdev_tty;
extern struct consdev *cn_tab; /* physical console device info */
-extern void nullcnpollc();
void *zs_conschan;
--- /dev/null
+/* $OpenBSD: zs_cons.h,v 1.1 1997/01/16 04:04:01 kstailey Exp $ */
+
+extern void *zs_conschan;
+
+extern void nullcnprobe __P((struct consdev *));
+
+extern int zs_getc __P((void *arg));
+extern void zs_putc __P((void *arg, int c));
+
+/* $OpenBSD: zs_kgdb.c,v 1.5 1997/01/16 04:04:01 kstailey Exp $ */
/* $NetBSD: zs_kgdb.c,v 1.9 1996/11/20 18:57:04 gwr Exp $ */
/*-
struct zs_chanstate *cs;
int dev;
{
- int tconst;
if (dev != kgdb_dev)
return (0);
* KGDB framing character received: enter kernel debugger. This probably
* should time out after a few seconds to avoid hanging on spurious input.
*/
+void
zskgdb()
{
int unit = minor(kgdb_dev);
+/* $OpenBSD: autoconf.h,v 1.7 1997/01/16 04:04:04 kstailey Exp $ */
/* $NetBSD: autoconf.h,v 1.12 1996/11/20 18:57:05 gwr Exp $ */
/*-
int bus_peek __P((int, int, int));
char * bus_mapin __P((int, int, int));
+typedef int (*isr_func_t) __P((void *));
+void isr_add_custom __P((int, void *));
+void isr_add_autovect __P((isr_func_t, void *arg, int level));
+void isr_add_vectored __P((isr_func_t, void *arg, int pri, int vec));
+
+void isr_soft_request __P((int level));
+void isr_soft_clear __P((int level));
+
+/* Bus-error tolerant access to mapped address. */
+int peek_byte __P((caddr_t));
+int peek_word __P((caddr_t));
-/* $OpenBSD: conf.h,v 1.4 1997/01/07 23:36:15 kstailey Exp $ */
+/* $OpenBSD: conf.h,v 1.5 1997/01/16 04:04:05 kstailey Exp $ */
/*-
* Copyright (c) 1996 Kenneth Stailey. All rights reserved.
dev_decl(filedesc,open);
+cdev_decl(idprom);
+
#define mmread mmrw
#define mmwrite mmrw
cdev_decl(mm);
* isr_soft_request() so this scheme just multiplexes four
* software interrupt `sources' on the level one handler.
*/
+extern void isr_soft_request __P((int level));
union sun3sir {
int sir_any;
char sir_which[4];
+/* $OpenBSD: db_machdep.h,v 1.4 1997/01/16 04:04:06 kstailey Exp $ */
/* $NetBSD: db_machdep.h,v 1.7 1995/02/07 04:34:45 gwr Exp $ */
#include <m68k/db_machdep.h>
/* This enables some code in db_command.c */
#define DB_MACHINE_COMMANDS
+void db_machine_init __P((void));
+void ddb_init __P((void));
+
+/* These are in db_memrw.c */
+extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data));
+extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data));
+/* $OpenBSD: dvma.h,v 1.6 1997/01/16 04:04:06 kstailey Exp $ */
/* $NetBSD: dvma.h,v 1.4 1996/11/20 18:57:08 gwr Exp $ */
/*-
#define DVMA_SPACE_START 0x0FF00000
#define DVMA_SPACE_END 0x0FFFE000
+void dvma_init __P((void));
+
/* Allocate/free actual pages of DVMA space. */
caddr_t dvma_malloc(size_t bytes);
void dvma_free(caddr_t addr, size_t bytes);
+/* $OpenBSD: idprom.h,v 1.5 1997/01/16 04:04:07 kstailey Exp $ */
/* $NetBSD: idprom.h,v 1.12 1996/11/20 18:57:10 gwr Exp $ */
/*-
#define IDPROM_SIZE (sizeof(struct idprom))
#ifdef _KERNEL
+
extern struct idprom identity_prom;
-int idprom_init();
+
+int idprom_init __P((void));
void idprom_etheraddr __P((u_char *));
+
#endif
+++ /dev/null
-/* $NetBSD: isr.h,v 1.10 1996/11/20 18:57:11 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass and Gordon W. Ross.
- *
- * 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 NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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.
- */
-
-void isr_init __P((void));
-void isr_config __P((void));
-
-void isr_add_custom __P((int, void (*handler)()));
-void isr_add_autovect __P((int (*handler)(), void *arg, int level));
-void isr_add_vectored __P((int (*handler)(), void *arg, int pri, int vec));
-
-void isr_soft_request __P((int level));
-void isr_soft_clear __P((int level));
--- /dev/null
+/* $OpenBSD: machdep.h,v 1.1 1997/01/16 04:04:08 kstailey Exp $ */
+/*
+ * Copyright (c) 1994 Gordon W. Ross
+ * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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: Utah Hdr: cpu.h 1.16 91/03/25
+ * from: @(#)cpu.h 7.7 (Berkeley) 6/27/91
+ * cpu.h,v 1.2 1993/05/22 07:58:17 cgd Exp
+ */
+
+#ifdef _KERNEL
+
+/*
+ * Internal definitions unique to sun3/68k cpu support.
+ * These are the "private" declarations - those needed
+ * only here in machine-independent code. The "public"
+ * definitions are in cpu.h (used by common code).
+ */
+
+/* 680X0 function codes */
+#define FC_USERD 1 /* user data space */
+#define FC_USERP 2 /* user program space */
+#define FC_CONTROL 3 /* sun control space */
+#define FC_SUPERD 5 /* supervisor data space */
+#define FC_SUPERP 6 /* supervisor program space */
+#define FC_CPU 7 /* CPU space */
+
+/* fields in the 68020 cache control register */
+#define IC_ENABLE 0x0001 /* enable instruction cache */
+#define IC_FREEZE 0x0002 /* freeze instruction cache */
+#define IC_CE 0x0004 /* clear instruction cache entry */
+#define IC_CLR 0x0008 /* clear entire instruction cache */
+
+#define IC_CLEAR (IC_CLR|IC_ENABLE)
+
+
+/* Prototypes... */
+
+struct frame;
+struct fpframe;
+struct pcb;
+struct proc;
+struct reg;
+struct trapframe;
+struct pmap;
+
+extern int cache_size;
+extern int cold;
+extern int fpu_type;
+
+extern label_t *nofault;
+
+extern vm_offset_t vmmap; /* XXX - See mem.c */
+
+/* Kernel virtual address space available: */
+extern vm_offset_t virtual_avail, virtual_end;
+/* Physical address space available: */
+extern vm_offset_t avail_start, avail_end;
+/* The "hole" (used to skip the Sun3/50 video RAM) */
+extern vm_offset_t hole_start, hole_size;
+
+void ICIA __P((void));
+void DCIA __P((void));
+void DCIU __P((void));
+
+void cache_enable __P((void));
+void cache_flush_page(vm_offset_t pgva);
+void cache_flush_segment(vm_offset_t sgva);
+void cache_flush_context(void);
+
+int cachectl __P((int req, caddr_t addr, int len));
+
+void child_return __P((struct proc *));
+
+void configure __P((void));
+void cninit __P((void));
+
+void dumpconf __P((void));
+void dumpsys __P((void));
+
+void fb_unblank __P((void));
+
+int fpu_emulate __P((struct frame *, struct fpframe *));
+
+int getdfc __P((void));
+int getsfc __P((void));
+
+void** getvbr __P((void));
+
+vm_offset_t high_segment_alloc __P((int npages));
+
+void initfpu __P((void));
+
+void intreg_init __P((void));
+
+void isr_init __P((void));
+void isr_config __P((void));
+
+void m68881_save __P((struct fpframe *));
+void m68881_restore __P((struct fpframe *));
+
+void netintr __P((void));
+
+void proc_do_uret __P((void));
+void proc_trampoline __P((void));
+
+void pmap_bootstrap __P((void));
+int pmap_fault_reload __P((struct pmap *, vm_offset_t, int));
+void pmap_get_ksegmap __P((u_char *));
+void pmap_get_pagemap __P((int *pt, int off));
+
+int reboot2 __P((int, char *));
+
+void regdump __P((struct frame *, int));
+
+void savectx __P((struct pcb *));
+
+void setvbr __P((void **));
+
+void sun3_mon_abort __P((void));
+void sun3_mon_halt __P((void));
+void sun3_mon_reboot __P((char *));
+void sun3_pmeg_init __P((void));
+void sun3_reserve_pmeg __P((int pmeg_num));
+
+void swapconf __P((void));
+void swapgeneric __P((void));
+
+void switch_exit __P((struct proc *));
+
+#endif /* _KERNEL */
+/* $OpenBSD: mon.h,v 1.5 1997/01/16 04:04:08 kstailey Exp $ */
/* $NetBSD: mon.h,v 1.19 1996/11/20 18:57:12 gwr Exp $ */
/*-
* translate these structs into Sprite format.
*/
typedef struct {
- char *initSp; /* Initial system stack ptr
- * for hardware */
- int (*startMon)(); /* Initial PC for hardware */
+ char *initSp; /* Initial system stack ptr
+ * for hardware */
+ int (*startMon)__P((void)); /* Initial PC for hardware */
- int *diagberr; /* Bus err handler for diags */
+ int *diagberr; /* Bus err handler for diags */
- /*
+ /*
* Monitor and hardware revision and identification
*/
- struct bootparam **bootParam; /* Info for bootstrapped pgm */
- unsigned *memorySize; /* Usable memory in bytes */
+ struct bootparam **bootParam; /* Info for bootstrapped pgm */
+ u_int *memorySize; /* Usable memory in bytes */
- /*
- * Single-character input and output
+ /*
+ * Single-character input and output
*/
- unsigned char (*getChar)(); /* Get char from input source */
- int (*putChar)(); /* Put char to output sink */
- int (*mayGet)(); /* Maybe get char, or -1 */
- int (*mayPut)(); /* Maybe put char, or -1 */
- unsigned char *echo; /* Should getchar echo? */
- unsigned char *inSource; /* Input source selector */
- unsigned char *outSink; /* Output sink selector */
+ u_char (*getChar)__P((void)); /* Get char from input source */
+ int (*putChar)__P((int)); /* Put char to output sink */
+ int (*mayGet)__P((void)); /* Maybe get char, or -1 */
+ int (*mayPut)__P((int)); /* Maybe put char, or -1 */
+ u_char *echo; /* Should getchar echo? */
+ u_char *inSource; /* Input source selector */
+ u_char *outSink; /* Output sink selector */
- /*
- * Keyboard input (scanned by monitor nmi routine)
+ /*
+ * Keyboard input (scanned by monitor nmi routine)
*/
- int (*getKey)(); /* Get next key if one exists */
- int (*initGetKey)(); /* Initialize get key */
- unsigned int *translation; /* Kbd translation selector
- (see keyboard.h in sun
+ int (*getKey)__P((void)); /* Get next key if one exists */
+ int (*initGetKey)__P((void*)); /* Initialize get key */
+ u_int *translation; /* Kbd translation selector
+ (see keyboard.h in sun
monitor code) */
- unsigned char *keyBid; /* Keyboard ID byte */
+ u_char *keyBid; /* Keyboard ID byte */
int *screen_x; /* V2: Screen x pos (R/O) */
int *screen_y; /* V2: Screen y pos (R/O) */
struct keybuf *keyBuf; /* Up/down keycode buffer */
* Monitor revision level.
*/
- char *monId;
+ char *monId;
- /*
- * Frame buffer output and terminal emulation
+ /*
+ * Frame buffer output and terminal emulation
*/
- int (*fbWriteChar)(); /* Write a character to FB */
- int *fbAddr; /* Address of frame buffer */
- char **font; /* Font table for FB */
- int (*fbWriteStr)(); /* Quickly write string to FB */
+ int (*fbWriteChar)__P((int)); /* Write a character to FB */
+ int *fbAddr; /* Address of frame buffer */
+ char **font; /* Font table for FB */
+ /* Quickly write string to FB */
+ int (*fbWriteStr)__P((char *buf, int len));
- /*
- * Reboot interface routine -- resets and reboots system. No return.
+ /*
+ * Reboot interface routine -- resets and reboots system. No return.
+ * XXX should this be declared volatile?
*/
- int (*reBoot)(); /* e.g. reBoot("xy()vmunix") */
+ int (*reBoot)__P((char *)); /* e.g. reBoot("sd()bsd") */
- /*
- * Line input and parsing
+ /*
+ * Line input and parsing
*/
- unsigned char *lineBuf; /* The line input buffer */
- unsigned char **linePtr; /* Cur pointer into linebuf */
- int *lineSize; /* length of line in linebuf */
- int (*getLine)(); /* Get line from user */
- unsigned char (*getNextChar)(); /* Get next char from linebuf */
- unsigned char (*peekNextChar)(); /* Peek at next char */
- int *fbThere; /* =1 if frame buffer there */
- int (*getNum)(); /* Grab hex num from line */
-
- /*
- * Print formatted output to current output sink
+ u_char *lineBuf; /* The line input buffer */
+ u_char **linePtr; /* Cur pointer into linebuf */
+ int *lineSize; /* length of line in linebuf */
+ int (*getLine)__P((int)); /* Get line from user */
+ u_char (*getNextChar)__P((void)); /* Get next char from linebuf */
+ u_char (*peekNextChar)__P((void)); /* Peek at next char */
+ int *fbThere; /* =1 if frame buffer there */
+ int (*getNum)__P((void)); /* Grab hex num from line */
+
+ /*
+ * Print formatted output to current output sink
*/
- int (*printf)(); /* Similar to "Kernel printf" */
- int (*printHex)(); /* Format N digits in hex */
+ int (*printf)__P((char *, ...)); /* Similar to "Kernel printf" */
+ int (*printHex)__P((int,int)); /* Format N digits in hex */
/*
- * Led stuff
+ * Led stuff
*/
- unsigned char *leds; /* RAM copy of LED register */
- int (*setLeds)(); /* Sets LED's and RAM copy */
+ u_char *leds; /* RAM copy of LED register */
+ int (*setLeds)__P((int)); /* Sets LED's and RAM copy */
- /*
+ /*
* Non-maskable interrupt (nmi) information
- */
+ */
- int (*nmiAddr)(); /* Addr for level 7 vector */
- int (*abortEntry)(); /* Entry for keyboard abort */
- int *nmiClock; /* Counts up in msec */
+ int (*nmiAddr)__P((void*)); /* Addr for level 7 vector */
+ int (*abortEntry)__P((void*)); /* Entry for keyboard abort */
+ int *nmiClock; /* Counts up in msec */
/*
- * Frame buffer type: see <sun/fbio.h>
+ * Frame buffer type: see <machine/fbio.h>
*/
- int *fbType;
+ int *fbType;
- /*
- * Assorted other things
+ /*
+ * Assorted other things
*/
- unsigned romvecVersion; /* Version # of Romvec */
+ u_int romvecVersion; /* Version # of Romvec */
struct globram *globRam; /* monitor global variables */
caddr_t kbdZscc; /* Addr of keyboard in use */
- int *keyrInit; /* ms before kbd repeat */
- unsigned char *keyrTick; /* ms between repetitions */
- unsigned *memoryAvail; /* V1: Main mem usable size */
- long *resetAddr; /* where to jump on a reset */
- long *resetMap; /* pgmap entry for resetaddr */
+ int *keyrInit; /* ms before kbd repeat */
+ u_char *keyrTick; /* ms between repetitions */
+ u_int *memoryAvail; /* V1: Main mem usable size */
+ long *resetAddr; /* where to jump on a reset */
+ long *resetMap; /* pgmap entry for resetaddr */
/* Really struct pgmapent * */
- int (*exitToMon)(); /* Exit from user program */
- unsigned char **memorybitmap; /* V1: &{0 or &bits} */
- void (*setcxsegmap)(); /* Set seg in any context */
- void (**vector_cmd)(); /* V2: Handler for 'v' cmd */
- int dummy1z;
- int dummy2z;
- int dummy3z;
- int dummy4z;
+ int (*exitToMon)__P((void)); /* Exit from user program */
+ u_char **memorybitmap; /* V1: &{0 or &bits} */
+ void (*setcxsegmap)__P((int,int,int)); /* Set seg in any context */
+ void (**vector_cmd)__P((int, char*)); /* V2: Handler for 'v' cmd */
+ int dummy1z;
+ int dummy2z;
+ int dummy3z;
+ int dummy4z;
} MachMonRomVector;
/*
* putChar -- Write the given character to the output source.
*
* void putChar(ch)
- * char ch;
+ * char ch;
*
- * mayGet -- Maybe get a character from the current input source. Return -1
+ * mayGet -- Maybe get a character from the current input source. Return -1
* if don't return a character.
*
* int mayGet()
- *
+ *
* mayPut -- Maybe put a character to the current output source. Return -1
* if no character output.
*
* NOKEY (if no key has been hit).
*
* int getKey()
- *
+ *
* initGetKey -- Initialize things for get key.
*
* void initGetKey()
/*
* MONSTART and MONEND denote the range of the damn monitor.
- *
+ *
* supposedly you can steal pmegs within this range that do not contain
- * valid pages.
+ * valid pages.
*/
#define MONSTART 0x0FE00000
#define MONEND 0x0FF00000
*
*/
-#define MONSHORTPAGE 0x0FFFE000
-#define MONSHORTSEG 0x0FFE0000
+#define MONSHORTPAGE 0x0FFFE000
+#define MONSHORTSEG 0x0FFE0000
#endif /* _MACHMON */
-#endif /* MACHINE_MON_H */
+#endif /* MACHINE_MON_H */
+/* $OpenBSD: obio.h,v 1.6 1997/01/16 04:04:09 kstailey Exp $ */
/* $NetBSD: obio.h,v 1.16 1996/11/20 18:57:14 gwr Exp $ */
/*-
caddr_t obio_vm_alloc __P((int));
caddr_t obio_find_mapping __P((int pa, int size));
+/* routines called during earily startup */
+void obio_init __P((void));
+void zs_init __P((void));
+void eeprom_init __P((void));
+void intreg_init __P((void));
+void clock_init __P((void));
+
#endif /* _KERNEL */
+/* $OpenBSD: pmap.h,v 1.6 1997/01/16 04:04:09 kstailey Exp $ */
/* $NetBSD: pmap.h,v 1.15 1996/11/20 18:57:16 gwr Exp $ */
/*-
#ifdef _KERNEL
struct pmap kernel_pmap_store;
+struct pcb;
+void pmap_activate __P((pmap_t pmap, struct pcb *pcbp));
+void pmap_deactivate __P((pmap_t pmap, struct pcb *pcbp));
#define pmap_kernel() (&kernel_pmap_store)
+/* $OpenBSD: psl.h,v 1.6 1997/01/16 04:04:10 kstailey Exp $ */
/* $NetBSD: psl.h,v 1.10 1996/11/20 18:57:17 gwr Exp $ */
/*-
#define splhigh() spl7()
#define splsched() spl7()
+/* Get current sr value (debug, etc.) */
+extern int getsr __P((void));
+
#endif /* KERNEL && !_LOCORE */
#endif /* PSL_C */
void zsc_req_softint __P((struct zsc_softc *zsc));
/* Handle user request to enter kernel debugger. */
-void zs_abort();
+void zs_abort __P((void));
/*
* Some warts needed by z8530tty.c -
+/* $OpenBSD: autoconf.c,v 1.6 1997/01/16 04:04:11 kstailey Exp $ */
/* $NetBSD: autoconf.c,v 1.37 1996/11/20 18:57:22 gwr Exp $ */
/*-
#include <vm/vm_map.h>
#include <machine/autoconf.h>
+#include <machine/control.h>
#include <machine/cpu.h>
-#include <machine/isr.h>
+#include <machine/machdep.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-extern int soft1intr();
-
-void swapgeneric();
-void swapconf(), dumpconf();
-
int cold;
-void configure()
+void
+configure()
{
struct device *mainbus;
struct swdevt *swp;
u_int maj;
int nblks;
-
+
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
maj = major(swp->sw_dev);
if (maj > nblkdev) /* paranoid? */
break;
-
+
if (bdevsw[maj].d_psize) {
nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
if (nblks > 0 &&
* bus_print:
* Just prints out the final (non-default) locators.
*/
-int bus_scan(parent, child, aux)
+int
+bus_scan(parent, child, aux)
struct device *parent;
void *child, *aux;
{
ca->ca_intvec = -1;
if ((ca->ca_bustype == BUS_VME16) ||
- (ca->ca_bustype == BUS_VME32))
- {
+ (ca->ca_bustype == BUS_VME32)) {
ca->ca_intvec = cf->cf_loc[2];
}
bus_mapin(bustype, paddr, sz)
int bustype, paddr, sz;
{
- int off, pa, pgs, pmt;
+ int off, pa, pmt;
vm_offset_t va, retval;
if (bustype & ~3)
#endif
return ((char*)retval);
-}
+}
+
+/* from hp300: badaddr() */
+int
+peek_word(addr)
+ register caddr_t addr;
+{
+ label_t faultbuf;
+ register int x;
+
+ nofault = &faultbuf;
+ if (setjmp(&faultbuf)) {
+ nofault = NULL;
+ return(-1);
+ }
+ x = *(volatile u_short *)addr;
+ nofault = NULL;
+ return(x);
+}
+
+/* from hp300: badbaddr() */
+int
+peek_byte(addr)
+ register caddr_t addr;
+{
+ label_t faultbuf;
+ register int x;
+
+ nofault = &faultbuf;
+ if (setjmp(&faultbuf)) {
+ nofault = NULL;
+ return(-1);
+ }
+ x = *(volatile u_char *)addr;
+ nofault = NULL;
+ return(x);
+}
+/* $OpenBSD: buserr.h,v 1.3 1997/01/16 04:04:12 kstailey Exp $ */
/* $NetBSD: buserr.h,v 1.6 1996/11/20 18:57:23 gwr Exp $ */
/*-
+/* $OpenBSD: cache.c,v 1.5 1997/01/16 04:04:13 kstailey Exp $ */
/* $NetBSD: cache.c,v 1.5 1996/11/20 18:57:24 gwr Exp $ */
/*-
#include <machine/cpu.h>
#include <machine/pte.h>
#include <machine/control.h>
+#include <machine/machdep.h>
#include <machine/vmparam.h>
-#include "cache.h"
-
#define CACHE_LINE 16 /* bytes */
#define VAC_FLUSH_INCR 512 /* bytes */
#define VADDR_MASK 0xfFFffFF /* 28 bits */
+static void cache_clear_tags __P((void));
+
void
cache_flush_page(pgva)
vm_offset_t pgva;
+++ /dev/null
-/* $NetBSD: cache.h,v 1.2 1996/11/20 18:57:25 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * 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 NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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.
- */
-
-/*
- * All sun3 cache implementations are write-back.
- * Flushes must be done before removing translations
- * from the MMU because the cache uses the MMU.
- */
-
-extern int cache_size;
-
-void cache_flush_page(vm_offset_t pgva);
-void cache_flush_segment(vm_offset_t sgva);
-void cache_flush_context(void);
-
-/* $OpenBSD: clock.c,v 1.6 1997/01/13 00:29:23 kstailey Exp $ */
+/* $OpenBSD: clock.c,v 1.7 1997/01/16 04:04:14 kstailey Exp $ */
/* $NetBSD: clock.c,v 1.31 1996/10/30 00:24:42 gwr Exp $ */
/*
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/psl.h>
+#include <machine/control.h>
#include <machine/cpu.h>
-
+#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/obio.h>
-#include <machine/control.h>
#include "intersil7170.h"
#include "interreg.h"
#define CLOCK_PRI 5
+void cpu_initclocks __P((void));
+void clock_intr __P((struct clockframe *));
+
+
extern volatile u_char *interrupt_reg;
volatile char *clock_va;
static int
clock_match(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
+ struct device *parent;
+ void *vcf, *args;
{
- struct cfdata *cf = vcf;
+ struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa;
/* This driver only supports one unit. */
if (cf->cf_unit != 0)
struct device *self;
void *args;
{
- struct cfdata *cf = self->dv_cfdata;
- struct confargs *ca = args;
printf("\n");
* register. We have to be extremely careful that we do it
* in such a manner that we don't get ourselves lost.
*/
+void
set_clk_mode(on, off, enable)
u_char on, off;
int enable;
panic("set_clk_mode: map");
/*
- * make sure that we are only playing w/
+ * make sure that we are only playing w/
* clock interrupt register bits
*/
on &= (IREG_CLOCK_ENAB_7 | IREG_CLOCK_ENAB_5);
cpu_initclocks(void)
{
int s;
- extern void _isr_clock();
+ extern void _isr_clock __P((void)); /* in locore.s */
if (!intersil_clock)
panic("cpu_initclocks");
if (diff < 0)
diff = -diff;
if (diff >= (SECDAY*2)) {
- printf("WARNING: clock %s %d days",
+ printf("WARNING: clock %s %ld days",
(clk_time < fs_time) ? "lost" : "gained",
diff / SECDAY);
clk_bad = 1;
time.tv_sec = clk_time;
}
-/*
+/*
* Resettodr restores the time of day hardware after a time change.
*/
-void resettodr()
+void
+resettodr()
{
clk_set_secs(time.tv_sec);
}
* The clock registers have to be read or written
* in sequential order (or so it appears). -gwr
*/
-static void clk_get_dt(struct date_time *dt)
+static void
+clk_get_dt(struct date_time *dt)
{
int s;
register volatile char *src, *dst;
splx(s);
}
-static void clk_set_dt(struct date_time *dt)
+static void
+clk_set_dt(struct date_time *dt)
{
int s;
register volatile char *src, *dst;
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
-void gmt_to_dt(long *tp, struct date_time *dt)
+void
+gmt_to_dt(long *tp, struct date_time *dt)
{
register int i;
register long days, secs;
dt->dt_month = i;
/* Days are what is left over (+1) from all that. */
- dt->dt_day = days + 1;
+ dt->dt_day = days + 1;
}
-void dt_to_gmt(struct date_time *dt, long *tp)
+void
+dt_to_gmt(struct date_time *dt, long *tp)
{
register int i;
register long tmp;
* Now routines to get and set clock as POSIX time.
*/
-static long clk_get_secs()
+static long
+clk_get_secs()
{
struct date_time dt;
long gmt;
return (gmt);
}
-static void clk_set_secs(long secs)
+static void
+clk_set_secs(long secs)
{
struct date_time dt;
long gmt;
#ifdef DEBUG
/* Call this from DDB or whatever... */
-int clkdebug()
+int
+clkdebug()
{
struct date_time dt;
long gmt;
+/* $OpenBSD: conf.c,v 1.18 1997/01/16 04:04:14 kstailey Exp $ */
/* $NetBSD: conf.c,v 1.51 1996/11/04 16:16:09 gwr Exp $ */
/*-
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_tty_init(NKBD,kd), /* 1: Sun keyboard/display */
+ cdev_tty_init(NKBD,kd), /* 1: Sun keyboard/display */
cdev_ctty_init(1,ctty), /* 2: controlling terminal */
cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
cdev_notdef(), /* 4: was PROM console */
/*
* Returns true if dev is /dev/mem or /dev/kmem.
*/
+int
iskmemdev(dev)
dev_t dev;
{
/*
* Returns true if dev is /dev/zero.
*/
+int
iszerodev(dev)
dev_t dev;
{
/*
* Convert a character device number to a block device number.
*/
+int
chrtoblk(dev)
dev_t dev;
{
+/* $OpenBSD: control.c,v 1.5 1997/01/16 04:04:15 kstailey Exp $ */
/* $NetBSD: control.c,v 1.14 1996/11/20 18:57:25 gwr Exp $ */
/*-
#define CONTROL_ALIGN(x) (x & CONTROL_ADDR_MASK)
#define CONTROL_ADDR_BUILD(space, va) (CONTROL_ALIGN(va)|space)
-int get_context()
+int
+get_context()
{
int c;
return (c & CONTEXT_MASK);
}
-void set_context(int c)
+void
+set_context(int c)
{
+
set_control_byte((char *) CONTEXT_REG, c & CONTEXT_MASK);
}
-vm_offset_t get_pte(va)
+vm_offset_t
+get_pte(va)
vm_offset_t va;
{
+
return (vm_offset_t)
get_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va));
}
-void set_pte(va, pte)
+void
+set_pte(va, pte)
vm_offset_t va, pte;
{
+
set_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va),
(unsigned int) pte);
}
-unsigned char get_segmap(va)
+unsigned
+char get_segmap(va)
vm_offset_t va;
{
+
return get_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va));
}
-void set_segmap(va, sme)
+void
+set_segmap(va, sme)
vm_offset_t va;
unsigned char sme;
{
+
set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), sme);
}
* XXX - Should optimize: "(get|set)_control_(word|byte)"
* calls so this does save/restore of sfc/dfc only once!
*/
-void set_segmap_allctx(va, sme)
+void
+set_segmap_allctx(va, sme)
vm_offset_t va;
unsigned char sme; /* segmap entry */
{
/* Inlined set_context() */
set_control_byte((char *) CONTEXT_REG, ctx);
/* Inlined set_segmap() */
- set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), sme);
+ set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va),
+ sme);
}
/* Inlined set_context(ctx); */
+/* $OpenBSD: ctrlsp.S,v 1.3 1997/01/16 04:04:16 kstailey Exp $ */
/* $NetBSD: ctrlsp.S,v 1.3 1996/11/20 18:57:26 gwr Exp $ */
/*-
+/* $OpenBSD: db_machdep.c,v 1.8 1997/01/16 04:04:16 kstailey Exp $ */
/* $NetBSD: db_machdep.c,v 1.8 1996/11/20 18:57:27 gwr Exp $ */
/*-
#include <vm/vm.h>
+#include <machine/control.h>
#include <machine/db_machdep.h>
+#include <machine/machdep.h>
+#include <machine/pte.h>
+
#include <ddb/db_command.h>
+#include <ddb/db_output.h>
-#include <machine/pte.h>
+static void db_mach_pagemap __P((db_expr_t, int, db_expr_t, char *));
+static void db_mach_abort __P((db_expr_t, int, db_expr_t, char *));
+static void db_mach_halt __P((db_expr_t, int, db_expr_t, char *));
+static void db_mach_reboot __P((db_expr_t, int, db_expr_t, char *));
+static void pte_print __P((int));
static char *pgt_names[] = {
"MEM", "OBIO", "VMES", "VMEL" };
-void pte_print(pte)
+void
+pte_print(pte)
int pte;
{
int t;
}
static void
-db_pagemap(addr)
- db_expr_t addr;
+db_mach_pagemap(addr, have_addr, count, modif)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char * modif;
{
int pte, sme;
* pgmap: Given addr, Print addr, segmap, pagemap, pte
*/
-extern void sun3_mon_abort();
-extern void sun3_mon_halt();
+static void
+db_mach_abort(addr, have_addr, count, modif)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char * modif;
+{
-void
-db_mon_reboot()
+ sun3_mon_abort();
+}
+
+static void
+db_mach_halt(addr, have_addr, count, modif)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char * modif;
+{
+
+ sun3_mon_halt();
+}
+
+static void
+db_mach_reboot(addr, have_addr, count, modif)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char * modif;
{
- sun3_mon_reboot("");
+
+ sun3_mon_reboot("");
}
struct db_command db_machine_cmds[] = {
- { "abort", sun3_mon_abort, 0, 0 },
- { "halt", sun3_mon_halt, 0, 0 },
- { "reboot", db_mon_reboot, 0, 0 },
- { "pgmap", db_pagemap, CS_SET_DOT, 0 },
+ { "abort", db_mach_abort, 0, 0 },
+ { "halt", db_mach_halt, 0, 0 },
+ { "reboot", db_mach_reboot, 0, 0 },
+ { "pgmap", db_mach_pagemap, CS_SET_DOT, 0 },
{ (char *)0, }
};
void
db_machine_init()
{
+
db_machine_commands_install(db_machine_cmds);
}
+/* $OpenBSD: db_memrw.c,v 1.6 1997/01/16 04:04:17 kstailey Exp $ */
/* $NetBSD: db_memrw.c,v 1.13 1996/11/20 18:57:28 gwr Exp $ */
/*-
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/proc.h>
#include <vm/vm.h>
+#include <machine/control.h>
#include <machine/pte.h>
#include <machine/db_machdep.h>
+#include <machine/machdep.h>
#include <ddb/db_access.h>
-#include "cache.h"
+
+static void db_write_text __P((vm_offset_t, size_t size, char *));
/*
* Read bytes from kernel address space for debugger.
register size_t size;
register char *data;
{
- register char *dst;
- int ch, oldpte, tmppte;
- vm_offset_t pgva, prevpg;
+ register char *dst;
+ int oldpte, tmppte;
+ vm_offset_t pgva, prevpg;
/* Prevent restoring a garbage PTE. */
if (size <= 0)
#endif
oldpte = get_pte(pgva);
if ((oldpte & PG_VALID) == 0) {
- printf(" address 0x%x not a valid page\n", dst);
+ printf(" address %p not a valid page\n", dst);
return;
}
tmppte = oldpte | PG_WRITE | PG_NC;
/*
* Write bytes to kernel address space for debugger.
*/
+
extern char kernel_text[], etext[];
+
void
db_write_bytes(addr, size, data)
vm_offset_t addr;
/* If any part is in kernel text, use db_write_text() */
if ((dst < etext) && ((dst + size) > kernel_text)) {
- db_write_text(dst, size, data);
+ db_write_text((vm_offset_t)dst, size, data);
return;
}
+/* $OpenBSD: disksubr.c,v 1.8 1997/01/16 04:04:18 kstailey Exp $ */
/* $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $ */
/*
char *
readdisklabel(dev, strat, lp, clp)
dev_t dev;
- void (*strat)();
+ void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *clp;
{
* Check new disk label for sensibility
* before setting it.
*/
+int
setdisklabel(olp, nlp, openmask, clp)
struct disklabel *olp, *nlp;
u_long openmask;
* Write disk label back to device after modification.
* Current label is already in clp->cd_block[]
*/
+int
writedisklabel(dev, strat, lp, clp)
dev_t dev;
- void (*strat)();
+ void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *clp;
{
return(0);
}
+#if 0 /* XXX used by xy.c and xd.c */
/*
* Search the bad sector table looking for the specified sector.
* Return index if found.
}
return (-1);
}
+#endif
+/* $OpenBSD: dvma.c,v 1.6 1997/01/16 04:04:19 kstailey Exp $ */
/* $NetBSD: dvma.c,v 1.5 1996/11/20 18:57:29 gwr Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/cpu.h>
-#include <machine/reg.h>
+#include <machine/control.h>
+#include <machine/dvma.h>
+#include <machine/machdep.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-#include <machine/dvma.h>
+#include <machine/reg.h>
-#include "cache.h"
/* Resource map used by dvma_mapin/dvma_mapout */
#define NUM_DVMA_SEGS 10
/* Using phys_map to manage DVMA scratch-memory pages. */
/* Note: Could use separate pagemap for obio if needed. */
-void dvma_init()
+void
+dvma_init()
{
vm_offset_t segmap_addr;
* Allocate actual memory pages in DVMA space.
* (idea for implementation borrowed from Chris Torek.)
*/
-caddr_t dvma_malloc(bytes)
+caddr_t
+dvma_malloc(bytes)
size_t bytes;
{
caddr_t new_mem;
/*
* Free pages from dvma_malloc()
*/
-void dvma_free(addr, size)
+void
+dvma_free(addr, size)
caddr_t addr;
size_t size;
{
* would be used by some OTHER bus-master besides the CPU.
* (Examples: on-board ie/le, VME xy board).
*/
-long dvma_kvtopa(kva, bustype)
+long
+dvma_kvtopa(kva, bustype)
long kva;
int bustype;
{
* This IS safe to call at interrupt time.
* (Typically called at SPLBIO)
*/
-caddr_t dvma_mapin(char *kva, int len)
+caddr_t
+dvma_mapin(kva, len)
+ char *kva;
+ int len;
{
vm_offset_t seg_kva, seg_dma, seg_len, seg_off;
register vm_offset_t v, x;
* This IS safe to call at interrupt time.
* (Typically called at SPLBIO)
*/
-void dvma_mapout(char *dma, int len)
+void
+dvma_mapout(dma, len)
+ char *dma;
+ int len;
{
vm_offset_t seg_dma, seg_len, seg_off;
register vm_offset_t v, x;
+/* $OpenBSD: fpu.c,v 1.6 1997/01/16 04:04:20 kstailey Exp $ */
/* $NetBSD: fpu.c,v 1.9 1996/11/20 18:57:29 gwr Exp $ */
/*-
#include <sys/kernel.h>
#include <sys/device.h>
-#include <machine/psl.h>
+#include <machine/control.h>
#include <machine/cpu.h>
#include <machine/frame.h>
+#include <machine/machdep.h>
#include <machine/mon.h>
-#include <machine/control.h>
+#include <machine/psl.h>
#include "interreg.h"
-extern int fpu_type;
-extern long *nofault;
-
-int fpu_probe();
-
static char *fpu_descr[] = {
#ifdef FPU_EMULATE
"emulator", /* 0 */
"mc68882", /* 2 */
"?" };
-void initfpu()
+static int fpu_probe __P((void));
+
+void
+initfpu()
{
char *descr;
int enab_reg;
}
}
-int fpu_probe()
+static int
+fpu_probe()
{
label_t faultbuf;
- int null_fpframe[2];
+ struct fpframe null_fpframe;
- nofault = (long *) &faultbuf;
+ nofault = &faultbuf;
if (setjmp(&faultbuf)) {
nofault = NULL;
return(0);
}
- null_fpframe[0] = 0;
- null_fpframe[1] = 0;
- m68881_restore(null_fpframe);
+ bzero(&null_fpframe, sizeof(null_fpframe));
+ m68881_restore(&null_fpframe);
nofault = NULL;
return(1);
}
+/* $OpenBSD: genassym.c,v 1.6 1997/01/16 04:04:21 kstailey Exp $ */
/* $NetBSD: genassym.c,v 1.32 1996/10/23 16:39:27 gwr Exp $ */
/*
#include <vm/vm.h>
+#include <machine/control.h>
#include <machine/cpu.h>
+#include <machine/dvma.h>
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/pte.h>
-#include <machine/control.h>
+#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/vmparam.h>
-#include <machine/dvma.h>
#include "intersil7170.h"
#include "interreg.h"
#define def1(name) def("name", name)
#endif
+extern void printf __P((char *fmt, ...));
+extern void exit __P((int));
+
void
def(what, val)
char *what;
printf(((val > 999) ? "0x%x\n" : "%d\n"), val);
}
+int
main()
{
struct pcb *pcb = (struct pcb *) 0;
def1(ENAMETOOLONG);
/* trap types: locore.s includes trap.h */
-
+
/*
* unix structure-isms
*/
+/* $OpenBSD: interreg.h,v 1.5 1997/01/16 04:04:22 kstailey Exp $ */
/* $NetBSD: interreg.h,v 1.7 1996/11/20 18:57:30 gwr Exp $ */
/*-
#define IREG_BITS "\20\8CLK7\7RSV6\6CLK5\5VIDEO\4SOFT3\3SOFT2\2SOFT1\1ALL\n"
-int set_clk_mode(u_char on, u_char off, int enable);
+void set_clk_mode __P((u_char on, u_char off, int enable));
+/* $OpenBSD: intersil7170.h,v 1.5 1997/01/16 04:04:23 kstailey Exp $ */
/* $NetBSD: intersil7170.h,v 1.9 1996/11/20 18:57:31 gwr Exp $ */
/*-
+/* $OpenBSD: intreg.c,v 1.5 1997/01/16 04:04:23 kstailey Exp $ */
/* $NetBSD: intreg.c,v 1.5 1996/11/20 18:57:32 gwr Exp $ */
/*-
#include <machine/autoconf.h>
#include <machine/cpu.h>
+#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/obio.h>
-#include <machine/isr.h>
#include "interreg.h"
static int intreg_match __P((struct device *, void *vcf, void *args));
static void intreg_attach __P((struct device *, struct device *, void *));
-static int soft1intr();
+static int soft1intr __P((void *));
struct cfattach intreg_ca = {
sizeof(struct intreg_softc), intreg_match, intreg_attach
/* called early (by internal_configure) */
-void intreg_init()
+void
+intreg_init()
{
interrupt_reg = obio_find_mapping(OBIO_INTERREG, 1);
if (!interrupt_reg)
static int
intreg_match(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
+ struct device *parent;
+ void *vcf, *args;
{
- struct cfdata *cf = vcf;
+ struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa;
/* This driver only supports one unit. */
if (cf->cf_unit != 0)
void *args;
{
struct intreg_softc *sc = (void *)self;
- struct cfdata *cf = self->dv_cfdata;
printf("\n");
* Network software interrupt
* Soft clock interrupt
*/
-int soft1intr(arg)
+static int
+soft1intr(arg)
void *arg;
{
union sun3sir sir;
- int n, s;
+ int s;
s = splhigh();
sir.sir_any = sun3sir.sir_any;
return(0);
}
-
static int isr_soft_pending;
-void isr_soft_request(level)
+
+void
+isr_soft_request(level)
int level;
{
u_char bit, reg_val;
splx(s);
}
-void isr_soft_clear(level)
+void
+isr_soft_clear(level)
int level;
{
u_char bit, reg_val;
+/* $OpenBSD: isr.c,v 1.6 1997/01/16 04:04:24 kstailey Exp $ */
/* $NetBSD: isr.c,v 1.25 1996/11/20 18:57:32 gwr Exp $ */
/*-
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/vmmeter.h>
#include <net/netisr.h>
+#include <machine/autoconf.h>
#include <machine/cpu.h>
+#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/obio.h>
-#include <machine/isr.h>
#include "vector.h"
#include "ether.h" /* for NETHER */
+#include "ppp.h" /* for NPPP */
extern int intrcnt[]; /* statistics */
#define NUM_LEVELS 8
struct isr {
- struct isr *isr_next;
- int (*isr_intr)();
- void *isr_arg;
- int isr_ipl;
+ struct isr *isr_next;
+ isr_func_t isr_intr;
+ void *isr_arg;
+ int isr_ipl;
};
-void set_vector_entry __P((int, void (*handler)()));
+void set_vector_entry __P((int, void (*handler) __P((void))));
unsigned int get_vector_entry __P((int));
-void isr_add_custom(level, handler)
+void isr_autovec __P((int));
+void isr_vectored __P((int));
+
+void
+isr_add_custom(level, handler)
int level;
- void (*handler)();
+ void *handler;
{
set_vector_entry(AUTOVEC_BASE + level, handler);
}
* Also, should use an array of chars instead of
* a bitmask to avoid atomicity locking issues.
*/
-void netintr()
+
+/*
+ * Declarations for the netisr functions...
+ * They are in the header files, but that's not
+ * really a good reason to drag all those in.
+ */
+void arpintr __P((void));
+void ipintr __P((void));
+void nsintr __P((void));
+void clnlintr __P((void));
+void ccittintr __P((void));
+void pppintr __P((void));
+
+void
+netintr()
{
int n, s;
ccittintr();
}
#endif
-#include "ppp.h"
#if NPPP > 0
if (n & (1 << NETISR_PPP)) {
pppintr();
* This is called by the assembly routines
* for handling auto-vectored interupts.
*/
-void isr_autovec(evec)
+void
+isr_autovec(evec)
int evec; /* format | vector offset */
{
struct isr *isr;
* Establish an interrupt handler.
* Called by driver attach functions.
*/
-void isr_add_autovect(handler, arg, level)
- int (*handler)();
+void
+isr_add_autovect(handler, arg, level)
+ isr_func_t handler;
void *arg;
int level;
{
isr_autovec_list[level] = new_isr;
}
-extern void badtrap();
struct vector_handler {
- int (*func)();
+ isr_func_t func;
void *arg;
};
static struct vector_handler isr_vector_handlers[192];
* Establish an interrupt handler.
* Called by driver attach functions.
*/
-extern void _isr_vectored();
-void isr_add_vectored(func, arg, level, vec)
- int (*func)();
+
+extern void _isr_vectored __P((void));
+
+void
+isr_add_vectored(func, arg, level, vec)
+ isr_func_t func;
void *arg;
int level, vec;
{
/*
* XXX - could just kill these...
*/
-void set_vector_entry(entry, handler)
+void
+set_vector_entry(entry, handler)
int entry;
- void (*handler)();
+ void (*handler) __P((void));
{
if ((entry <0) || (entry >= NVECTORS))
- panic("set_vector_entry: setting vector too high or low\n");
+ panic("set_vector_entry: setting vector too high or low\n");
vector_table[entry] = handler;
}
-unsigned int get_vector_entry(entry)
+
+unsigned int
+get_vector_entry(entry)
int entry;
{
if ((entry <0) || (entry >= NVECTORS))
- panic("get_vector_entry: setting vector too high or low\n");
+ panic("get_vector_entry: setting vector too high or low\n");
return (unsigned int) vector_table[entry];
}
+/* $OpenBSD: kgdb_proto.h,v 1.3 1997/01/16 04:04:25 kstailey Exp $ */
/* $NetBSD: kgdb_proto.h,v 1.2 1996/11/20 18:57:33 gwr Exp $ */
/*-
+/* $OpenBSD: kgdb_stub.c,v 1.5 1997/01/16 04:04:25 kstailey Exp $ */
/* $NetBSD: kgdb_stub.c,v 1.6 1996/10/23 16:30:48 gwr Exp $ */
/*
#include <machine/control.h>
#include <machine/cpu.h>
#include <machine/frame.h>
+#include <machine/machdep.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/reg.h>
#include <machine/trap.h>
#include <sun3/sun3/kgdb_proto.h>
+#include <machine/db_machdep.h>
#include <machine/remote-sl.h>
-/* These are in db_memrw.c */
-extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data));
-extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data));
#ifndef KGDBDEV
#define KGDBDEV -1
*dst++ = *src++;
}
+#if 0
/* ditto for bzero */
static void
kgdb_zero(vptr, len)
while (--len >= 0)
*ptr++ = (char) 0;
}
+#endif
/*
* Translate the values stored in the kernel regs struct to the format
* XXX: Should we just use the PTE bits? Why not?
* XXX: Better yet, setup a fault handler?
*/
+int
kgdb_acc(addr, len)
caddr_t addr;
int len;
-/* $OpenBSD: leds.c,v 1.3 1997/01/13 21:28:24 kstailey Exp $ */
+/* $OpenBSD: leds.c,v 1.4 1997/01/16 04:04:26 kstailey Exp $ */
#include <sys/types.h>
-#include <sys/uio.h>
#include <sys/systm.h>
#include <sys/errno.h>
+#include <sys/uio.h>
+
#include <machine/psl.h>
#include "ledsvar.h"
int
ledrw(uio)
- struct uio *uio;
+ struct uio *uio;
{
unsigned int v[2];
int s;
o = uio->uio_offset;
if (o < sizeof(v)) {
err = uiomove(((caddr_t)&v[0])+o, sizeof(v)-o, uio);
- if (err) return(err);
+ if (err)
+ return(err);
o = sizeof(v);
if (uio->uio_rw == UIO_WRITE) {
if ((v[0] > MAXCDOWN) ||
return(0);
if (uio->uio_resid > 0) {
err = uiomove((caddr_t)&pattern[o], v[1]-o, uio);
- if (err) return(err);
+ if (err)
+ return(err);
}
return(0);
}
-/* $OpenBSD: ledsvar.h,v 1.1 1997/01/13 00:29:25 kstailey Exp $ */
+/* $OpenBSD: ledsvar.h,v 1.2 1997/01/16 04:04:26 kstailey Exp $ */
extern volatile unsigned int led_n_patterns;
extern volatile unsigned int led_countmax;
extern volatile const unsigned char * volatile led_patterns;
extern volatile unsigned int led_countdown;
extern volatile unsigned int led_px;
+
+extern int ledrw __P((struct uio *));
+/* $OpenBSD: locore.s,v 1.8 1997/01/16 04:04:27 kstailey Exp $ */
/* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */
/*
/*
* the sun3 specific code
- *
+ *
* our mission: figure out whether what we are looking at is
* bus error in the UNIX sense, or
* a memory error i.e a page fault
*
- * [this code replaces similarly mmu specific code in the hp300 code]
+ * [this code replaces similarly mmu specific code in the hp300 code]
*/
sun3_mmu_specific:
clrl d0 | make sure top bits are cleard too
jne Lbrkpt3 | yes, done
#endif
#ifdef DDB
- | Let DDB handle it.
+ | Let DDB handle it.
movl a2,sp@- | push frame ptr
movl d2,sp@- | push trap type
jbsr _kdb_trap | handle the trap
/*
* cpu_switch()
- * Hacked for sun3
+ * Hacked for sun3
* XXX - Arg 1 is a proc pointer (curproc) but this doesn't use it.
* XXX - Sould we use p->p_addr instead of curpcb? -gwr
*/
+/* $OpenBSD: machdep.c,v 1.11 1997/01/16 04:04:28 kstailey Exp $ */
/* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */
/*
#include <sys/shm.h>
#endif
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/mon.h>
-#include <machine/isr.h>
-#include <machine/kcore.h>
-
-#include <dev/cons.h>
-
#include <vm/vm.h>
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
-#include <net/netisr.h>
+#include <dev/cons.h>
-#include "cache.h"
+#include <machine/cpu.h>
+#include <machine/db_machdep.h>
+#include <machine/dvma.h>
+#include <machine/kcore.h>
+#include <machine/machdep.h>
+#include <machine/mon.h>
+#include <machine/psl.h>
+#include <machine/pte.h>
+#include <machine/reg.h>
extern char *cpu_string;
extern char version[];
extern short exframesize[];
extern vm_offset_t vmmap; /* XXX - poor name. See mem.c */
-extern int cold;
int physmem;
int fpu_type;
int msgbufmapped;
+label_t *nofault;
+vm_offset_t vmmap;
/*
* safepri is a safe priority for sleep to set for a spin-wait
#else
int bufpages = 0;
#endif
-long *nofault;
-void identifycpu();
+static caddr_t allocsys __P((caddr_t));
+static void identifycpu __P((void));
+static void initcpu __P((void));
+static void dumpmem __P((int *, int, int));
+static char *hexstr __P((int, int));
+static void reboot_sync __P((void));
+int reboot2 __P((int, char *)); /* share with sunos_misc.c */
+
+void straytrap __P((struct trapframe)); /* called from locore.s */
/*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
* to choose and initialize a console.
*/
-void consinit()
+void
+consinit()
{
- extern void cninit();
- cninit();
+
+ cninit();
#ifdef KGDB
/* XXX - Ask on console for kgdb_dev? */
* allocate that much and fill it with zeroes, and then call
* allocsys() again with the correct base virtual address.
*/
+
#define valloc(name, type, num) \
v = (caddr_t)(((name) = (type *)v) + (num))
+
static caddr_t
allocsys(v)
register caddr_t v;
callout[i-1].c_next = &callout[i];
callout[i-1].c_next = NULL;
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
+ printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
char cpu_model[120];
extern long hostid;
-void
+static void
identifycpu()
{
/*
/* should eventually include whether it has a VAC, mc6888x version, etc */
strcat(cpu_model, cpu_string);
- printf("Model: %s (hostid %x)\n", cpu_model, hostid);
+ printf("Model: %s (hostid %lx)\n", cpu_model, hostid);
}
/*
* machine dependent system variables.
*/
+int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
* XXX - Put waittime checks in there too?
*/
int waittime = -1; /* XXX - Who else looks at this? -gwr */
-static void reboot_sync()
+static void
+reboot_sync()
{
extern struct proc proc0;
- struct buf *bp;
- int iter, nbusy;
/* Check waittime here to localize its use to this function. */
if (waittime >= 0)
/*
* Common part of the BSD and SunOS reboot system calls.
*/
-int reboot2(howto, user_boot_string)
+int
+reboot2(howto, user_boot_string)
int howto;
char *user_boot_string;
{
* that specifies a machine-dependent boot string that
* is passed to the boot program if RB_STRING is set.
*/
-void boot(howto)
+void
+boot(howto)
int howto;
{
(void) reboot2(howto, NULL);
{
int nblks; /* size of dump area */
int maj;
- int (*getsize)();
+ int (*getsize) __P((dev_t));
if (dumpdev == NODEV)
return;
* pagemap (2*NBPG)
* physical memory...
*/
+void
dumpsys()
{
struct bdevsw *dsw;
return;
}
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
+ printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo);
/*
* Write the dump header, including MMU state.
*/
blkno = dumplo;
todo = dumpsize - DUMP_EXTRA; /* pages */
- vaddr = (char*)dumppage_va;
+ vaddr = (char *)dumppage_va;
bzero(vaddr, NBPG);
/* kcore header */
blkno += btodb(NBPG);
/* translation RAM (page zero) */
- pmap_get_pagemap(vaddr, 0);
+ pmap_get_pagemap((int *)vaddr, 0);
error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
if (error)
goto fail;
blkno += btodb(NBPG);
/* translation RAM (page one) */
- pmap_get_pagemap(vaddr, NBPG);
+ pmap_get_pagemap((int *)vaddr, NBPG);
error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
if (error)
goto fail;
printf(" dump error=%d\n", error);
}
+void
initcpu()
{
/* XXX: Enable RAM parity/ECC checking? */
#endif
}
+void
straytrap(frame)
- struct frame frame;
+ struct trapframe frame;
{
printf("unexpected trap; vector offset 0x%x from 0x%x\n",
- frame.f_vector, frame.f_pc);
+ frame.tf_vector, frame.tf_pc);
#ifdef DDB
- kdb_trap(-1, &frame);
+ /* XXX - Yuck! Make DDB use "struct trapframe" instead! */
+ kdb_trap(-1, (struct mc68020_saved_state *) &frame);
#endif
}
-/* from hp300: badaddr() */
-int
-peek_word(addr)
- register caddr_t addr;
-{
- label_t faultbuf;
- register int x;
-
- nofault = (long*)&faultbuf;
- if (setjmp(&faultbuf)) {
- nofault = NULL;
- return(-1);
- }
- x = *(volatile u_short *)addr;
- nofault = NULL;
- return(x);
-}
-
-/* from hp300: badbaddr() */
-int
-peek_byte(addr)
- register caddr_t addr;
-{
- label_t faultbuf;
- register int x;
-
- nofault = (long*)&faultbuf;
- if (setjmp(&faultbuf)) {
- nofault = NULL;
- return(-1);
- }
- x = *(volatile u_char *)addr;
- nofault = NULL;
- return(x);
-}
-
/* XXX: parityenable() ? */
/*
* Print a register and stack dump.
*/
+void
regdump(fp, sbytes)
struct frame *fp; /* must not be register */
int sbytes;
static int doingdump = 0;
register int i;
int s;
- extern char *hexstr();
if (doingdump)
return;
#define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG))
+static void
dumpmem(ptr, sz, ustack)
register int *ptr;
int sz, ustack;
{
register int i, val;
- extern char *hexstr();
for (i = 0; i < sz; i++) {
if ((i & 7) == 0)
* Determine if the given exec package refers to something which we
* understand and, if so, set up the vmcmds for it.
*/
+int
cpu_exec_aout_makecmds(p, epp)
struct proc *p;
struct exec_package *epp;
+++ /dev/null
-
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * 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: Utah Hdr: cpu.h 1.16 91/03/25
- * from: @(#)cpu.h 7.7 (Berkeley) 6/27/91
- * cpu.h,v 1.2 1993/05/22 07:58:17 cgd Exp
- */
-
-#ifdef _KERNEL
-
-/*
- * Internal definitions unique to sun3/68k cpu support.
- * These are the "private" declarations - those needed
- * only here in machine-independent code. The "public"
- * definitions are in cpu.h (used by common code).
- */
-
-/* 680X0 function codes */
-#define FC_USERD 1 /* user data space */
-#define FC_USERP 2 /* user program space */
-#define FC_CONTROL 3 /* sun control space */
-#define FC_SUPERD 5 /* supervisor data space */
-#define FC_SUPERP 6 /* supervisor program space */
-#define FC_CPU 7 /* CPU space */
-
-/* fields in the 68020 cache control register */
-#define IC_ENABLE 0x0001 /* enable instruction cache */
-#define IC_FREEZE 0x0002 /* freeze instruction cache */
-#define IC_CE 0x0004 /* clear instruction cache entry */
-#define IC_CLR 0x0008 /* clear entire instruction cache */
-
-#define IC_CLEAR (IC_CLR|IC_ENABLE)
-
-
-/* Prototypes... */
-
-struct frame;
-struct fpframe;
-struct pcb;
-struct proc;
-struct reg;
-struct trapframe;
-struct pmap;
-
-extern int cache_size;
-extern int cold;
-extern int fpu_type;
-
-extern label_t *nofault;
-
-extern vm_offset_t vmmap; /* XXX - See mem.c */
-
-/* Kernel virtual address space available: */
-extern vm_offset_t virtual_avail, virtual_end;
-/* Physical address space available: */
-extern vm_offset_t avail_start, avail_end;
-/* The "hole" (used to skip the Sun3/50 video RAM) */
-extern vm_offset_t hole_start, hole_size;
-
-void ICIA __P((void));
-void DCIA __P((void));
-void DCIU __P((void));
-
-void cache_enable __P((void));
-void cache_flush_page(vm_offset_t pgva);
-void cache_flush_segment(vm_offset_t sgva);
-void cache_flush_context(void);
-
-int cachectl __P((int req, caddr_t addr, int len));
-
-void child_return __P((struct proc *));
-
-void configure __P((void));
-void cninit __P((void));
-
-void dumpconf __P((void));
-void dumpsys __P((void));
-
-int fpu_emulate __P((struct frame *, struct fpframe *));
-
-int getdfc __P((void));
-int getsfc __P((void));
-
-void** getvbr __P((void));
-
-vm_offset_t high_segment_alloc __P((int npages));
-
-void initfpu __P((void));
-
-void isr_init __P((void));
-void isr_config __P((void));
-
-void m68881_save __P((struct fpframe *));
-void m68881_restore __P((struct fpframe *));
-
-void netintr __P((void));
-void proc_trampoline __P((void));
-
-void pmap_bootstrap __P((void));
-int pmap_fault_reload __P((struct pmap *, vm_offset_t, int));
-void pmap_get_ksegmap __P((u_char *));
-void pmap_get_pagemap __P((int *pt, int off));
-
-void regdump __P((struct frame *, int));
-
-void savectx __P((struct pcb *));
-
-void setvbr __P((void **));
-
-void sun3_mon_abort __P((void));
-void sun3_mon_halt __P((void));
-void sun3_mon_reboot __P((char *));
-void sun3_pmeg_init __P((void));
-void sun3_reserve_pmeg __P((int pmeg_num));
-
-void swapconf __P((void));
-void swapgeneric __P((void));
-
-void switch_exit __P((struct proc *));
-
-#endif /* _KERNEL */
+/* $OpenBSD: mainbus.c,v 1.4 1997/01/16 04:04:29 kstailey Exp $ */
/* $NetBSD: mainbus.c,v 1.5 1996/12/17 21:11:35 gwr Exp $ */
/*-
+/* $OpenBSD: mem.c,v 1.5 1997/01/16 04:04:30 kstailey Exp $ */
/* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */
/*
*/
#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
#include <sys/systm.h>
-#include <sys/uio.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
+#include <machine/conf.h>
#include <machine/cpu.h>
+#include <machine/eeprom.h>
+#include <machine/machdep.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-extern int eeprom_uio();
-extern vm_offset_t avail_start, avail_end;
+extern int ledrw __P((struct uio *));
-vm_offset_t vmmap; /* XXX - poor name...
- * It is a virtual page, not a map.
- */
caddr_t zeropage;
-
/*ARGSUSED*/
int
-mmopen(dev, flag, mode)
+mmopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
return (0);
/*ARGSUSED*/
int
-mmclose(dev, flag, mode)
+mmclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
return (0);
+/* $OpenBSD: pmap.c,v 1.7 1997/01/16 04:04:31 kstailey Exp $ */
/* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */
/*-
#include <machine/control.h>
#include <machine/cpu.h>
-#include <machine/mon.h>
-#include <machine/vmparam.h>
#include <machine/dvma.h>
+#include <machine/machdep.h>
+#include <machine/mon.h>
#include <machine/pmap.h>
-
-#include "cache.h"
+#include <machine/vmparam.h>
#if (PMAP_OBIO << PG_MOD_SHIFT) != PGT_OBIO
#error "PMAP_XXX definitions don't match pte.h!"
{ \
result = (headp)->tqh_first; \
if (result) TAILQ_REMOVE(headp, result, entries); \
- }
+}
/*
* pv support, i.e stuff that maps from physical pages to virtual addresses
struct pv_entry {
struct pv_entry *pv_next;
- pmap_t pv_pmap;
- vm_offset_t pv_va;
+ pmap_t pv_pmap;
+ vm_offset_t pv_va;
/* XXX - put flags in low byte of pv_va */
- unsigned int pv_flags;
+ unsigned int pv_flags;
};
typedef struct pv_entry *pv_entry_t;
pv_entry_t pv_head_table = NULL;
+
#ifdef DIAGNOSTIC
+static struct pv_entry * pa_to_pvp __P((vm_offset_t pa));
static struct pv_entry *
pa_to_pvp(pa)
vm_offset_t pa;
return pvp;
}
#else
-#define pa_to_pvp(pa) &pv_head_table[PA_PGNUM(pa)]
+# define pa_to_pvp(pa) &pv_head_table[PA_PGNUM(pa)]
#endif
/* These are as in the MMU but shifted by PV_SHIFT. */
#define PM_UPDATE_CACHE 1
-static int pmap_version = 1;
-struct pmap kernel_pmap_store;
+static int pmap_version = 1;
+struct pmap kernel_pmap_store;
#define kernel_pmap (&kernel_pmap_store)
/* protection conversion */
static struct pmeg_state pmeg_array[NPMEG];
#ifdef PMAP_DEBUG
+void pmap_print __P((pmap_t pmap));
+void pv_print __P((vm_offset_t pa));
+
+static pmeg_t pmeg_p __P((int sme));
+static void pmeg_verify_empty __P((vm_offset_t va));
+static void pmeg_print __P((pmeg_t pmegp));
+
static pmeg_t
pmeg_p(sme)
int sme;
return &pmeg_array[sme];
}
#else
-#define pmeg_p(x) &pmeg_array[x]
+# define pmeg_p(x) &pmeg_array[x]
#endif
#define is_pmeg_wired(pmegp) (pmegp->pmeg_wired != 0)
static void context_free __P((pmap_t pmap));
static void context_init __P((void));
-static void pmeg_flush __P((pmeg_t pmegp));
static pmeg_t pmeg_allocate __P((pmap_t pmap, vm_offset_t va));
static void pmeg_release __P((pmeg_t pmegp));
static void pmeg_free __P((pmeg_t pmegp, int segnum));
static pmeg_t pmeg_cache __P((pmap_t pmap, vm_offset_t va));
static void pmeg_set_wiring __P((pmeg_t pmegp, vm_offset_t va, int));
-static int pv_compute_cache __P((pv_entry_t head));
static int pv_link __P((pmap_t pmap, vm_offset_t, vm_offset_t, u_int));
static void pv_unlink __P((pmap_t, vm_offset_t, vm_offset_t));
static void pv_remove_all __P(( vm_offset_t pa));
static void pv_syncflags __P((pv_entry_t head));
static void pv_init __P((void));
-void sun3_pmeg_init __P((void));
-void sun3_reserve_pmeg __P((int pmeg_num));
-void sun3_protection_init __P((void));
+static void pmeg_clean __P((pmeg_t pmegp));
+static void pmeg_clean_free __P((void));
+
+static void sun3_protection_init __P((void));
static void pmap_common_init __P((pmap_t pmap));
#endif /* PMAP_DEBUG */
#ifdef PMAP_DEBUG /* XXX */
-extern int getsr();
#define CHECK_SPL() do { \
if ((getsr() & PSL_IPL) < PSL_IPL3) \
panic("pmap: bad spl, line %d", __LINE__); \
PMAP_LOCK();
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_allocate: for pmap %x\n", pmap);
+ printf("context_allocate: for pmap %p\n", pmap);
#endif
if (pmap == kernel_pmap)
panic("context_allocate: kernel_pmap");
if (has_context(pmap))
panic("pmap: pmap already has context allocated to it");
- if (TAILQ_EMPTY(&context_free_queue)) {
- /* Steal one from the active queue. */
- if (TAILQ_EMPTY(&context_active_queue))
- panic("pmap: no contexts to be found");
- context_free((&context_active_queue)->tqh_first->context_upmap);
+ context = (&context_free_queue)->tqh_first;
+ if (context == NULL) {
+ /* Steal the head of the active queue. */
+ context = (&context_active_queue)->tqh_first;
+ if (context == NULL)
+ panic("pmap: no contexts left?");
+ context_free(context->context_upmap);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_allocate: pmap %x, take context %x num %d\n",
- pmap, context, context->context_num);
+ printf("context_allocate: pmap %p, take context %p num %d\n",
+ pmap, context, context->context_num);
#endif
}
TAILQ_REMOVE_FIRST(context, &context_free_queue, context_link);
context->context_upmap = pmap;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_allocate: pmap %x given context %x num %d\n",
+ printf("context_allocate: pmap %p given context %p num %d\n",
pmap, context, context->context_num);
#endif
ctxnum = pmap->pm_ctxnum;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_free: freeing context num %d of pmap 0x%x\n",
+ printf("context_free: freeing context num %d of pmap %p\n",
ctxnum, pmap);
#endif
pmap->pm_ctxnum = CTXINVAL;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_free: pmap %x context removed\n", pmap);
+ printf("context_free: pmap %p context removed\n", pmap);
#endif
PMAP_UNLOCK();
}
context_link);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CONTEXT)
- printf("context_init: context num %d is %x\n",
+ printf("context_init: context num %d is %p\n",
i, &context_array[i]);
#endif
}
{
printf(" pm_ctxnum=%d\n", pmap->pm_ctxnum);
printf(" pm_version=0x%x\n", pmap->pm_version);
- printf(" pm_segmap=0x%x\n", pmap->pm_segmap);
+ printf(" pm_segmap=%p\n", pmap->pm_segmap);
}
#endif
pmeg_print(pmegp)
pmeg_t pmegp;
{
- printf("link_next=0x%x link_prev=0x%x\n",
+ printf("link_next=%p link_prev=%p\n",
pmegp->pmeg_link.tqe_next,
pmegp->pmeg_link.tqe_prev);
- printf("index=0x%x owner=0x%x own_vers=0x%x\n",
+ printf("index=0x%x owner=%p own_vers=0x%x\n",
pmegp->pmeg_index, pmegp->pmeg_owner,
pmegp->pmeg_version);
- printf("va=0x%x wired=0x%x reserved=0x%x vpgs=0x%x qstate=0x%x\n",
+ printf("va=0x%lx wired=0x%x reserved=0x%x vpgs=0x%x qstate=0x%x\n",
pmegp->pmeg_va, pmegp->pmeg_wired,
pmegp->pmeg_reserved, pmegp->pmeg_vpages,
pmegp->pmeg_qstate);
pmegp->pmeg_qstate = PMEGQ_ACTIVE;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SEGMAP) {
- printf("pm_segmap: pmap=%x i=%x old=%x new=%x (pget)\n",
+ printf("pm_segmap: pmap=%p i=%x old=%x new=%x (pget)\n",
pmap, VA_SEGNUM(va),
pmap->pm_segmap[VA_SEGNUM(va)],
pmegp->pmeg_index);
}
#ifdef PMAP_DEBUG
-static void
+/* call from debugger */
+void
pv_print(pa)
vm_offset_t pa;
{
return;
pv = pa_to_pvp(pa);
- printf("pv_list for pa %x: flags=%x\n", pa, pv->pv_flags);
+ printf("pv_list for pa %lx: flags=%x\n", pa, pv->pv_flags);
while (pv) {
- printf("pv_entry %x pmap %x va %x next %x\n",
+ printf("pv_entry %p pmap %p va %lx next %p\n",
pv, pv->pv_pmap, pv->pv_va, pv->pv_next);
pv = pv->pv_next;
}
for (pv = head; pv != NULL; pv = pv->pv_next) {
pmap = pv->pv_pmap;
va = pv->pv_va;
+ sme = SEGINV;
+
#ifdef DIAGNOSTIC
/*
* Only the head may have a null pmap, and
for (pv = head; pv != NULL; pv = pv->pv_next) {
pmap = pv->pv_pmap;
va = pv->pv_va;
+ sme = SEGINV;
+
#ifdef DIAGNOSTIC
/*
* Only the head may have a null pmap, and
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_REMOVE)
- printf("pv_remove_all(%x)\n", pa);
+ printf("pv_remove_all(%lx)\n", pa);
#endif
if (!pv_initialized)
return;
/* Make sure it went away. */
if ((pv->pv_pmap == pmap) && (pv->pv_va == va))
{
- printf("pv_remove_all: head unchanged for pa=0x%x\n", pa);
+ printf("pv_remove_all: head unchanged for pa=0x%lx\n", pa);
Debugger();
}
#endif
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_LINK) || (va == pmap_db_watchva)) {
- printf("pv_link(%x, %x, %x, %x)\n", pmap, pa, va, flags);
+ printf("pv_link(%p, %lx, %lx, %x)\n", pmap, pa, va, flags);
/* pv_print(pa); */
}
#endif
if ((pmap_debug & PMD_UNLINK) ||
(va == pmap_db_watchva))
{
- printf("pv_unlink(%x, %x, %x)\n", pmap, pa, va);
+ printf("pv_unlink(%p, %lx, %lx)\n", pmap, pa, va);
}
#endif
head = pa_to_pvp(pa);
for (prev = head;; prev = npv, npv = npv->pv_next) {
pmap_stats.ps_unlink_pvsearch++;
if (npv == NULL) {
- printf("pv_unlink: not on list (pa=%x,va=%x)\n",
+ printf("pv_unlink: not on list (pa=%lx,va=%lx)\n",
pa, va);
Debugger(); /* XXX */
return;
pv_initialized++;
}
-void
+static void
sun3_protection_init()
{
unsigned int *kp, prot;
void
pmap_bootstrap()
{
- extern void vm_set_page_size();
/*
* Reserve a segment for the kernel to use to access a pmeg
pmap_page_index(pa)
vm_offset_t pa;
{
- u_long idx;
#ifdef DIAGNOSTIC
if (pa < avail_start || pa >= avail_end)
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_CREATE)
- printf("pmap_destroy(%x)\n", pmap);
+ printf("pmap_destroy(%p)\n", pmap);
#endif
if (pmap == kernel_pmap)
panic("pmap_destroy: kernel_pmap!");
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_PROTECT)
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
+ printf("pmap_page_protect(%lx, %x)\n", pa, prot);
#endif
switch (prot) {
case VM_PROT_ALL:
pmap_t pmap;
vm_offset_t sva, eva;
{
- int old_ctx, i;
pmeg_t pmegp;
vm_offset_t va;
int pte, sme;
+#ifdef HAVECACHE
int flush_by_page = 0;
+#endif
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_REMOVE) ||
((sva <= pmap_db_watchva && eva > pmap_db_watchva)))
- printf("pmap_remove_range_mmu(%x, %x, %x)\n", pmap, sva, eva);
+ printf("pmap_remove_range_mmu(%p, %lx, %lx)\n", pmap, sva, eva);
#endif
/* Interrupt level handled by caller. */
}
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) {
- printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrmmu)\n",
+ printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (rrmmu)\n",
pmap, va, pte, PG_INVAL);
}
#endif
if (is_pmeg_wired(pmegp)) {
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_WIRING) {
- printf("pmap: removing wired pmeg: 0x%x\n", pmegp);
+ printf("pmap: removing wired pmeg: 0x%p\n", pmegp);
Debugger(); /* XXX */
}
#endif /* PMAP_DEBUG */
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_REMOVE) ||
((sva <= pmap_db_watchva && eva > pmap_db_watchva)))
- printf("pmap_remove_range_noctx(%x, %x, %x)\n", pmap, sva, eva);
+ printf("pmap_remove_range_noctx(%p, %lx, %lx)\n", pmap, sva, eva);
#endif
/* Interrupt level handled by caller. */
}
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) {
- printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrncx)\n",
+ printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (rrncx)\n",
pmap, va, pte, PG_INVAL);
}
#endif
pmap_t pmap;
vm_offset_t sva, eva;
{
- int c, s, sme;
+ int s, sme;
int old_ctx;
boolean_t in_ctx;
sva = VM_MIN_KERNEL_ADDRESS;
if (eva > DVMA_SPACE_END) {
#ifdef PMAP_DEBUG
- printf("pmap_remove: eva=0x%x\n", eva);
+ printf("pmap_remove: eva=0x%lx\n", eva);
Debugger();
#endif
eva = DVMA_SPACE_END;
boolean_t wired;
int new_pte;
{
- int s, i, c;
+ int s;
int sme, old_pte;
int nflags, do_pv;
vm_offset_t seg_va;
#ifdef PMAP_DEBUG
if (va < virtual_avail) {
- printf("pmap_enter_kernel: va=0x%x < virtual_avail\n", va);
+ printf("pmap_enter_kernel: va=0x%lx < virtual_avail\n", va);
Debugger();
}
#endif
set_segmap_allctx(va, sme);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SEGMAP) {
- printf("pmap: set_segmap pmap=%x va=%x sme=%x (ek1)\n",
+ printf("pmap: set_segmap pmap=%p va=%lx sme=%x (ek1)\n",
kernel_pmap, seg_va, sme);
}
pmeg_verify_empty(sun3_trunc_seg(va));
#endif
/* There are no existing mappings to deal with. */
+ old_pte = 0;
goto add_pte;
}
}
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) {
- printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (ek)\n",
+ printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (ek)\n",
kernel_pmap, va, old_pte, new_pte);
}
#endif
*/
if (wired && (pmap_debug & PMD_WIRING)) {
printf("pmap_enter_user: attempt to wire user page, ignored\n");
- printf("pmap=0x%x va=0x%x pa=0x%x\n", pmap, va, pa);
+ printf("pmap=%p va=0x%lx pa=0x%lx\n", pmap, va, pa);
}
#endif
#ifdef DIAGNOSTIC
set_segmap(va, sme);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SEGMAP) {
- printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu1)\n",
+ printf("pmap: set_segmap pmap=%p va=%lx sme=%x (eu1)\n",
pmap, seg_va, sme);
}
pmeg_verify_empty(seg_va);
#endif
/* There are no existing mappings to deal with. */
+ old_pte = 0;
goto add_pte;
}
set_segmap(va, sme);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SEGMAP) {
- printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu2)\n",
+ printf("pmap: set_segmap pmap=%p va=%lx sme=%x (eu2)\n",
pmap, seg_va, sme);
}
#endif
}
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) {
- printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (eu)\n",
+ printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (eu)\n",
pmap, va, old_pte, new_pte);
}
#endif
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_ENTER) ||
(va == pmap_db_watchva))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
+ printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
pmap, va, pa, prot, wired);
#endif
vm_offset_t va;
vm_prot_t ftype;
{
- int rv, s, pte, chkpte, sme, segnum, ctx;
+ int rv, s, pte, chkpte, sme, ctx;
vm_offset_t seg_va;
pmeg_t pmegp;
context_allocate(pmap);
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SWITCH)
- printf("pmap_activate(%x) takes context %d\n",
+ printf("pmap_activate(%p) takes context %d\n",
pmap, pmap->pm_ctxnum);
#endif
}
if (pmap_debug & PMD_SWITCH) {
int old_ctx = get_context();
if (old_ctx != pmap->pm_ctxnum) {
- printf("pmap_activate(%x) old_ctx=%d new_ctx=%d\n",
+ printf("pmap_activate(%p) old_ctx=%d new_ctx=%d\n",
pmap, old_ctx, pmap->pm_ctxnum);
}
}
{
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_SWITCH)
- printf("pmap_deactivate(%x, %x)\n", pmap, pcbp);
+ printf("pmap_deactivate(%p, %p)\n", pmap, pcbp);
#endif
/* Nothing to do really, and not called anyway... */
}
return;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_WIRING)
- printf("pmap_change_wiring(pmap=0x%x, va=0x%x, wire=%d)\n",
+ printf("pmap_change_wiring(pmap=%p, va=0x%lx, wire=%d)\n",
pmap, va, wired);
#endif
/*
}
PMAP_UNLOCK();
if ((pte & PG_VALID) == 0) {
- printf("pmap_extract: invalid va=0x%x\n", va);
+ printf("pmap_extract: invalid va=0x%lx\n", va);
Debugger();
pte = 0;
}
pmap_t pmap;
vm_offset_t sva, eva;
{
- int old_ctx, i;
pmeg_t pmegp;
vm_offset_t va;
int pte, sme;
- int nflags;
+#ifdef HAVECACHE
int flush_by_page = 0;
+#endif
/* Interrupt level handled by caller. */
CHECK_SPL();
int pte, sme, ptenum, segnum;
vm_offset_t va;
pmeg_t pmegp;
- int nflags;
/* Interrupt level handled by caller. */
CHECK_SPL();
pmap_t pmap;
vm_offset_t sva, eva;
{
- int c, s, sme;
+ int s, sme;
int old_ctx;
boolean_t in_ctx;
#ifdef PMAP_DEBUG
if ((pmap_debug & PMD_PROTECT) ||
((sva <= pmap_db_watchva && eva > pmap_db_watchva)))
- printf("pmap_protect_range(%x, %x, %x)\n", pmap, sva, eva);
+ printf("pmap_protect_range(%p, %lx, %lx)\n", pmap, sva, eva);
#endif
#ifdef DIAGNOSTIC
if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-NBPG))
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_PROTECT)
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
+ printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot);
#endif
if (pmap == NULL)
sva = VM_MIN_KERNEL_ADDRESS;
if (eva > DVMA_SPACE_END) {
#ifdef PMAP_DEBUG
- printf("pmap_protect: eva=0x%x\n", eva);
+ printf("pmap_protect: eva=0x%lx\n", eva);
Debugger();
#endif
eva = DVMA_SPACE_END;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_COW)
- printf("pmap_copy_page: %x -> %x\n", src, dst);
+ printf("pmap_copy_page: %lx -> %lx\n", src, dst);
#endif
PMAP_LOCK();
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_COW)
- printf("pmap_zero_page: %x\n", pa);
+ printf("pmap_zero_page: %lx\n", pa);
#endif
PMAP_LOCK();
* Copy the kernel segmap into the passed buffer (256 bytes).
*/
void
-pmap_get_ksegmap(vaddr)
- vm_offset_t vaddr;
+pmap_get_ksegmap(cp)
+ u_char *cp;
{
vm_offset_t va;
- u_char *cp = (u_char*)vaddr;
va = KERNBASE;
do {
* starting at OFF in the pagemap RAM.
*/
void
-pmap_get_pagemap(vaddr, off)
- vm_offset_t vaddr;
- int off;
+pmap_get_pagemap(pt, off)
+ int *pt;
+ int off;
{
- vm_offset_t va, va_end;
- int sme, sme_end; /* SegMap Entry numbers */
- int *pt;
+ vm_offset_t va, va_end;
+ int sme, sme_end; /* SegMap Entry numbers */
- pt = (int*)vaddr; /* destination */
- sme = (off >> 6); /* PMEG to start on */
- sme_end = sme + 128; /* where to stop */
- va_end = temp_seg_va + NBSG;
+ sme = (off >> 6); /* PMEG to start on */
+ sme_end = sme + 128; /* where to stop */
+ va_end = temp_seg_va + NBSG;
- do {
- set_segmap(temp_seg_va, sme);
- va = temp_seg_va;
do {
- *pt++ = get_pte(va);
- va += NBPG;
- } while (va < va_end);
- sme++;
- } while (sme < sme_end);
- set_segmap(temp_seg_va, SEGINV);
+ set_segmap(temp_seg_va, sme);
+ va = temp_seg_va;
+ do {
+ *pt++ = get_pte(va);
+ va += NBPG;
+ } while (va < va_end);
+ sme++;
+ } while (sme < sme_end);
+ set_segmap(temp_seg_va, SEGINV);
}
temp_seg_inuse--;
}
-
-/*
- * Local Variables:
- * tab-width: 4
- * End:
- */
+/* $OpenBSD: stub.c,v 1.5 1997/01/16 04:04:32 kstailey Exp $ */
/* $NetBSD: stub.c,v 1.13 1996/11/20 18:57:37 gwr Exp $ */
/*-
*/
+#include <sys/param.h>
+
+#include <machine/machdep.h>
+
/* Called by autoconf.c */
#ifndef GENERIC
void swapgeneric() {}
+/* $OpenBSD: sun3_startup.c,v 1.8 1997/01/16 04:04:33 kstailey Exp $ */
/* $NetBSD: sun3_startup.c,v 1.55 1996/11/20 18:57:38 gwr Exp $ */
/*-
#include <vm/vm.h>
#include <machine/control.h>
-#include <machine/cpufunc.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
-#include <machine/mon.h>
-#include <machine/pte.h>
-#include <machine/pmap.h>
#include <machine/idprom.h>
+#include <machine/machdep.h>
+#include <machine/mon.h>
#include <machine/obio.h>
#include <machine/obmem.h>
+#include <machine/pmap.h>
+#include <machine/pte.h>
#include "vector.h"
#include "interreg.h"
/*
* Globals shared with the pmap code.
* XXX - should reexamine this...
- */
+ */
vm_offset_t virtual_avail, virtual_end;
vm_offset_t avail_start, avail_end;
/* used to skip the Sun3/50 video RAM */
/*
* Now our own stuff.
*/
-unsigned int *old_vector_table;
+void **old_vector_table;
unsigned char cpu_machine_id = 0;
char *cpu_string = NULL;
extern vm_offset_t dumppage_pa;
extern vm_offset_t dumppage_va;
-/*
- * Switch to our own interrupt vector table.
- */
-static void initialize_vector_table()
-{
- old_vector_table = getvbr();
- setvbr((unsigned int *) vector_table);
-}
+void sun3_bootstrap __P((struct exec));
+
+static void sun3_mode_monitor __P((void));
+static void sun3_mode_normal __P((void));
+static void sun3_mon_init __P((vm_offset_t sva, vm_offset_t eva, int keep));
+static void sun3_monitor_hooks __P((void));
+static void sun3_context_equiv __P((void));
+static void sun3_save_symtab __P((struct exec *kehp));
+static void sun3_verify_hardware __P((void));
+static void sun3_vm_init __P((struct exec *kehp));
+static void tracedump __P((int));
+static void v_handler __P((int addr, char *str));
-vm_offset_t high_segment_alloc(npages)
+static void internal_configure __P((void));
+
+vm_offset_t
+high_segment_alloc(npages)
int npages;
{
- int i;
vm_offset_t va, tmp;
-
+
if (npages == 0)
mon_panic("panic: request for high segment allocation of 0 pages");
if (high_segment_free_start == high_segment_free_end) return NULL;
-
+
va = high_segment_free_start + (npages*NBPG);
if (va > high_segment_free_end) return NULL;
tmp = high_segment_free_start;
/*
* Prepare for running the kernel
*/
-static void sun3_mode_normal()
+static void
+sun3_mode_normal()
{
/* Install our vector table and disable the NMI clock. */
set_clk_mode(0, IREG_CLOCK_ENAB_7, 0);
- setvbr((unsigned int *) vector_table);
+ setvbr((void **) vector_table);
set_clk_mode(IREG_CLOCK_ENAB_5, 0, 1);
}
* also put our hardware state back into place after
* the PROM "c" (continue) command is given.
*/
-void sun3_mon_abort()
+void
+sun3_mon_abort()
{
int s = splhigh();
* stuff it into the PROM interrupt vector for trap zero
* and then do a trap. Needs PROM vector table in RAM.
*/
- old_vector_table[32] = (int)romp->abortEntry;
+ old_vector_table[32] = (void *)romp->abortEntry;
asm(" trap #0 ; _sun3_mon_continued: nop");
/* We have continued from a PROM abort! */
splx(s);
}
-void sun3_mon_halt()
+void
+sun3_mon_halt()
{
(void) splhigh();
sun3_mode_monitor();
/*NOTREACHED*/
}
-void sun3_mon_reboot(bootstring)
+void
+sun3_mon_reboot(bootstring)
char *bootstring;
{
(void) splhigh();
* is identically mapped in all contexts. The PROM can
* do the job using hardware-dependent tricks...
*/
-void sun3_context_equiv()
+static void
+sun3_context_equiv()
{
- unsigned int i, sme;
+ unsigned int sme;
int x;
vm_offset_t va;
vm_offset_t pgva, endseg;
int pte, valid;
unsigned char sme;
-
+
sva &= ~(NBSG-1);
-
+
while (sva < eva) {
sme = get_segmap(sva);
if (sme != SEGINV) {
/*
* Preserve DDB symbols and strings by setting esym.
*/
+void
sun3_save_symtab(kehp)
struct exec *kehp; /* kernel exec header */
{
* between [ KERNBASE .. virtual_avail ] and this is
* checked in trap.c for kernel-mode MMU faults.
*/
-void sun3_vm_init(kehp)
+void
+sun3_vm_init(kehp)
struct exec *kehp; /* kernel exec header */
{
- vm_offset_t va, eva, sva, pte, temp_seg;
+ vm_offset_t va, eva, pte;
unsigned int sme;
/*
* segmap entries in the MMU unless pmeg_array records them.
*/
va = virtual_avail;
- while (va < virtual_end) {
+ while (va < virtual_end) {
set_segmap(va, SEGINV);
va += NBSG;
}
*/
int delay_divisor = 82; /* assume the fastest (3/260) */
-void sun3_verify_hardware()
+void
+sun3_verify_hardware()
{
unsigned char machtype;
int cpu_match = 0;
int fr_arg[1];
};
/*VARARGS0*/
+void
tracedump(x1)
- caddr_t x1;
+ int x1;
{
struct funcall_frame *fp = (struct funcall_frame *)(&x1 - 2);
u_int stackpage = ((u_int)fp) & ~PGOFSET;
int addr;
char *str;
{
-
+
switch (*str) {
case '\0':
/*
sun3_mode_normal();
panic("zero");
/*NOTREACHED*/
-
+
case 4: /* old g4 */
- tracedump();
+ goto do_trace;
break;
-
+
default:
goto err;
}
break;
-
+
case 'p': /* 'p'rint string command */
case 'P':
mon_printf("%s\n", (char *)addr);
break;
-
+
case '%': /* p'%'int anything a la printf */
mon_printf(str, addr);
mon_printf("\n");
break;
-
+
+ do_trace:
case 't': /* 't'race kernel stack */
case 'T':
- tracedump();
+ tracedump(addr);
break;
-
+
case 'u': /* d'u'mp hack ('d' look like hex) */
case 'U':
goto err;
break;
-
+
default:
err:
mon_printf("Don't understand 0x%x '%s'\n", addr, str);
* argv[1] = options (i.e. "-ds" or NULL)
* argv[2] = NULL
*/
-void sun3_monitor_hooks()
+void
+sun3_monitor_hooks()
{
MachMonBootParam *bpp;
char **argp;
* First the obio module finds and records useful PROM mappings, then
* the necessary drivers are given a chance to use those recorded.
*/
-void internal_configure()
+static void
+internal_configure()
{
- obio_init(); /* find and record PROM mappings in OBIO space */
+ obio_init(); /* find and record PROM mappings in OBIO space */
/* Drivers that use those OBIO mappings from the PROM */
zs_init();
eeprom_init();
sun3_bootstrap(keh)
struct exec keh; /* kernel exec header */
{
- int i;
extern int cold;
/* First, Clear BSS. */
* the interrupt register and disables the NMI clock so
* it will not cause "spurrious level 7" complaints.
*/
- initialize_vector_table();
+ old_vector_table = getvbr();
+ setvbr((void **) vector_table);
/* Interrupts are enabled in locore.s just after this return. */
}
+/* $OpenBSD: swapgeneric.c,v 1.5 1997/01/16 04:04:33 kstailey Exp $ */
/* $NetBSD: swapgeneric.c,v 1.14 1995/04/26 23:30:08 gwr Exp $ */
/*
#include <sys/systm.h>
#include <sys/reboot.h>
+#include <dev/cons.h>
+
+#include <machine/machdep.h>
#include <machine/mon.h>
-
+
#ifdef NFSCLIENT
extern char *nfsbootdevname; /* nfs_boot.c */
-#else /* NFSCLIENT */
+#endif /* NFSCLIENT */
int (*mountroot) __P((void)) = NULL;
{ NODEV, 0, 0 },
};
+
+struct devspec {
+ int major;
+ int unit;
+ int part;
+ char name[4];
+};
+
#define NAMESZ 16
char boot_ifname[NAMESZ];
+
+static int net_mkunit __P((int, int));
+static int sd_mkunit __P((int, int));
+static int xx_mkunit __P((int, int));
+static struct genconf *gc_lookup __P((char *));
+static void gc_print_all __P((void));
+static int ds_parse __P((struct devspec *, char *));
+static int ds_tostr __P((struct devspec *, char *));
+static void ds_from_boot __P((struct devspec *));
+static void ds_query __P((struct devspec *, char *));
+static dev_t ds_todev __P((struct devspec *));
+
+/*
+ * Devices which MIGHT be available.
+ * If gc_root is NODEV, use NFS root.
+ */
+static struct genconf {
+ char gc_name[4];
+ int gc_major;
+ int (*gc_mkunit)__P((int, int));
+} genconf[] = {
+ { {"ie"}, -1, net_mkunit },
+ { {"le"}, -1, net_mkunit },
+ { {"sd"}, 7, sd_mkunit },
+ { {"xy"}, 3, xx_mkunit },
+ { {"xd"}, 10, xx_mkunit },
+ { {0}, },
+};
+
/*
* Functions to convert PROM ctlr/unit into our unit numbers
*/
-static int net_mkunit(ctlr, unit)
+static int
+net_mkunit(ctlr, unit)
int ctlr, unit;
{
+
/* XXX - Not sure which is set. */
return (ctlr + unit);
}
-static int sd_mkunit(ctlr, unit)
+static int
+sd_mkunit(ctlr, unit)
int ctlr, unit;
{
int target, lun;
return (target * 2 + lun);
}
-static int xx_mkunit(ctlr, unit)
+static int
+xx_mkunit(ctlr, unit)
int ctlr, unit;
{
+
return (ctlr * 2 + unit);
}
-/*
- * Devices which MIGHT be available.
- * If gc_root is NODEV, use NFS root.
- */
-static struct genconf {
- char gc_name[4];
- int gc_major;
- int (*gc_mkunit)();
-} genconf[] = {
- { "ie", -1, net_mkunit },
- { "le", -1, net_mkunit },
- { "sd", 7, sd_mkunit },
- { "xy", 3, xx_mkunit },
- { "xd", 10, xx_mkunit },
- { 0 },
-};
-
static struct genconf *
gc_lookup(name)
char *name;
return NULL;
}
-static void gc_print_all()
+static void
+gc_print_all()
{
struct genconf *gc;
}
printf("\n");
}
-
-
-struct devspec {
- int major;
- int unit;
- int part;
- char name[4];
-};
/*
* Set devspec from a string like: "sd0a"
* Return length of recognized part.
*/
-static int ds_parse(ds, str)
+static int
+ds_parse(ds, str)
struct devspec *ds;
char *str;
{
* Format a devspec into a string like: "sd0a"
* Returns length of string.
*/
-static int ds_tostr(ds, str)
+static int
+ds_tostr(ds, str)
struct devspec *ds;
char *str;
{
- struct genconf *gc;
int unit, part;
char *p;
* Set the devspec to the device we booted from.
* (Just converts PROM boot parameters.)
*/
-static void ds_from_boot(ds)
+static void
+ds_from_boot(ds)
struct devspec *ds;
{
MachMonBootParam *bpp;
* Fill in the devspec by asking the operator.
* The ds passed may hold a default value.
*/
-static void ds_query(ds, what)
+static void
+ds_query(ds, what)
struct devspec *ds;
char *what;
{
- struct genconf *gc;
- char *p;
- int len, minor;
+ int len;
char buf[64];
for (;;) {
len = ds_tostr(ds, buf);
printf("%s device? [%s] ", what, buf);
- gets(buf);
+ getsn(buf, 64);
if (buf[0] == '\0')
return;
}
}
-static dev_t ds_todev(ds)
+static dev_t
+ds_todev(ds)
struct devspec *ds;
{
int minor;
* Choose the root and swap device, either by asking,
* (if RB_ASKNAME) or from the PROM boot parameters.
*/
+void
swapgeneric()
{
- struct genconf *gc;
- dev_t root, swap, dump;
- int minor;
struct devspec ds;
char buf[NAMESZ];
}
dumpdev = ds_todev(&ds);
}
-
-/* XXX - Isn't this in some common file? */
-gets(cp)
- char *cp;
-{
- register char *lp;
- register c;
-
- top:
- lp = cp;
- for (;;) {
- c = cngetc();
- switch (c) {
-
- case '\n':
- case '\r':
- cnputc('\n');
- *lp++ = '\0';
- return;
-
- case '\b':
- case '\177':
- if (lp > cp) {
- lp--;
- printf("\b \b");
- }
- continue;
-
- case ('U'&037):
- cnputc('\n');
- goto top;
-
- default:
- if (c < ' ') {
- cnputc('^');
- *lp++ = '^';
- c |= 0100;
- }
- cnputc(c);
- *lp++ = c;
- break;
- }
- }
-}
+/* $OpenBSD: sys_machdep.c,v 1.6 1997/01/16 04:04:34 kstailey Exp $ */
/* $NetBSD: sys_machdep.c,v 1.3 1995/10/27 15:58:23 gwr Exp $ */
/*
#include <sys/syscallargs.h>
+#include <machine/cpu.h>
+#include <machine/machdep.h>
+
#ifdef TRACE
int nvualarm;
+int
sys_vtrace(p, v, retval)
struct proc *p;
void *v;
return (0);
}
+void
vdoualarm(arg)
void *arg;
{
}
#endif
-#include <machine/cpu.h>
-#include "cache.h"
-
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
#define CC_FLUSH 2
/* XXX end should be */
/*ARGSUSED1*/
+int
cachectl(req, addr, len)
int req;
caddr_t addr;
void *v;
register_t *retval;
{
+#if 0
struct sys_sysarch_args /* {
- syscallarg(int) op;
+ syscallarg(int) op;
syscallarg(char *) parms;
} */ *uap = v;
+#endif
- return ENOSYS;
+ return (ENOSYS);
}
+/* $OpenBSD: trap.c,v 1.8 1997/01/16 04:04:34 kstailey Exp $ */
/* $NetBSD: trap.c,v 1.62 1996/12/17 21:35:31 gwr Exp $ */
/*
#include <machine/cpu.h>
#include <machine/db_machdep.h>
#include <machine/endian.h>
+#include <machine/machdep.h>
#include <machine/psl.h>
-#include <machine/trap.h>
#include <machine/reg.h>
-
-#include "machdep.h"
+#include <machine/trap.h>
#ifdef COMPAT_SUNOS
#include <compat/sunos/sunos_syscall.h>
#endif
goto copyfault;
}
- printf("vm_fault(%p, %x, %x, 0) -> %x\n",
+ printf("vm_fault(%p, %lx, %x, 0) -> %x\n",
map, va, ftype, rv);
goto dopanic;
}
+/* $OpenBSD: vector.c,v 1.6 1997/01/16 04:04:35 kstailey Exp $ */
/* $NetBSD: vector.c,v 1.15 1996/11/20 18:57:40 gwr Exp $ */
/*-
badtrap, badtrap, badtrap, badtrap, \
badtrap, badtrap, badtrap, badtrap
-void addrerr(), badtrap(), buserr(), chkinst(), coperr(), fmterr(),
- fpfline(), fpunsupp(), illinst(), privinst(), trace(), trap0(),
- trap1(), trap12(), trap15(), trap2(), trapvinst(), zerodiv(), fpfault();
+void addrerr __P((void));
+void badtrap __P((void));
+void buserr __P((void));
+void chkinst __P((void));
+void coperr __P((void));
+void fmterr __P((void));
+void fpfline __P((void));
+void fpunsupp __P((void));
+void illinst __P((void));
+void privinst __P((void));
+void trace __P((void));
+void trap0 __P((void));
+void trap1 __P((void));
+void trap12 __P((void));
+void trap15 __P((void));
+void trap2 __P((void));
+void trapvinst __P((void));
+void zerodiv __P((void));
+void fpfault __P((void));
-void _isr_autovec();
+void _isr_autovec __P((void));
#define fpbsun fpfault
#define fpdz fpfault
#define fpsnan fpfault
#define fpunfl fpfault
-void (*vector_table[NVECTORS])() = {
+void (*vector_table[NVECTORS]) __P((void)) = {
(void*)0xfffe000, /* 0: NOT USED (reset SP) */
(void*)0xfef0000, /* 1: NOT USED (reset PC) */
buserr, /* 2: bus error */
+/* $OpenBSD: vector.h,v 1.5 1997/01/16 04:04:36 kstailey Exp $ */
/* $NetBSD: vector.h,v 1.10 1996/11/20 18:57:40 gwr Exp $ */
/*-
#define AUTOVEC_BASE 0x18
-extern void (*vector_table[])();
+extern void (*vector_table[]) __P((void));
+
+void badtrap __P((void));
+/* $OpenBSD: vm_machdep.c,v 1.6 1997/01/16 04:04:36 kstailey Exp $ */
/* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1993 Adam Glass
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
+#include <sys/ptrace.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/vnode.h>
/* #include <vm/vm_map.h> */
#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/pte.h>
+#include <machine/machdep.h>
#include <machine/pmap.h>
-
-#include "cache.h"
-
-extern int fpu_type;
+#include <machine/pte.h>
+#include <machine/reg.h>
/*
cpu_fork(p1, p2)
register struct proc *p1, *p2;
{
- register struct pcb *pcb2 = &p2->p_addr->u_pcb;
+ register struct pcb *p1pcb = &p1->p_addr->u_pcb;
+ register struct pcb *p2pcb = &p2->p_addr->u_pcb;
register struct trapframe *p2tf;
register struct switchframe *p2sf;
- extern void proc_do_uret(), child_return();
/*
* Before copying the PCB from the current process,
* make sure it is up-to-date. (p1 == curproc)
*/
- savectx(curproc->p_addr);
+ if (p1 == curproc)
+ savectx(p1pcb);
/* copy over the machdep part of struct proc */
p2->p_md.md_flags = p1->p_md.md_flags;
/* Copy pcb from proc p1 to p2. */
- bcopy(&p1->p_addr->u_pcb, pcb2, sizeof(*pcb2));
+ bcopy(p1pcb, p2pcb, sizeof(*p2pcb));
/* Child can start with low IPL (XXX - right?) */
- pcb2->pcb_ps = PSL_LOWIPL;
+ p2pcb->pcb_ps = PSL_LOWIPL;
/*
* Our cpu_switch MUST always call PMAP_ACTIVATE on a
*/
p2sf = (struct switchframe *)p2tf - 1;
p2sf->sf_pc = (u_int)proc_do_uret;
- pcb2->pcb_regs[11] = (int)p2sf; /* SSP */
+ p2pcb->pcb_regs[11] = (int)p2sf; /* SSP */
/*
* This will "push a call" to an arbitrary kernel function
void (*func)(struct proc *);
{
struct pcb *pcbp;
- struct switchframe *sf;
- extern void proc_trampoline();
struct ksigframe {
struct switchframe sf;
void (*func)(struct proc *);
struct md_core md_core;
struct coreseg cseg;
int error;
- register i;
/* XXX: Make sure savectx() was done? */