diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/dev/bugio.c | 220 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/bussw.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ve.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/nvram.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sclock.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/bugio.h | 130 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/prom.h | 7 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 14 |
8 files changed, 83 insertions, 301 deletions
diff --git a/sys/arch/mvme88k/dev/bugio.c b/sys/arch/mvme88k/dev/bugio.c index 8973ee4ef8b..10d39ef1540 100644 --- a/sys/arch/mvme88k/dev/bugio.c +++ b/sys/arch/mvme88k/dev/bugio.c @@ -1,67 +1,58 @@ -/* $OpenBSD: bugio.c,v 1.8 2001/08/24 22:46:23 miod Exp $ */ +/* $OpenBSD: bugio.c,v 1.9 2002/03/05 22:11:37 miod Exp $ */ /* Copyright (c) 1998 Steve Murphree, Jr. */ + #include <sys/param.h> #include <sys/systm.h> -#include <machine/bugio.h> - -#define INCHR "0x0000" -#define INSTAT "0x0001" -#define INLN "0x0002" -#define READSTR "0x0003" -#define READLN "0x0004" -#define DSKRD "0x0010" -#define DSKWR "0x0011" -#define DSKCFIG "0x0012" -#define NETCFG "0x001A" -#define NETCTRL "0x001D" -#define OUTCHR "0x0020" -#define OUTSTR "0x0021" -#define PCRLF "0x0026" -#define TMDISP "0x0042" -#define BUGDELAY "0x0043" -#define RTC_DSP "0x0052" -#define RTC_RD "0x0053" -#define RETURN "0x0063" -#define BRD_ID "0x0070" -#define FORKMPU "0x0100" -#define BUGTRAP "0x01F0" - -int ossr0, ossr1, ossr2, ossr3; -int bugsr0, bugsr1, bugsr2, bugsr3; - -#define BUGCTXT() \ -{ \ - asm volatile ("ldcr %0, cr17" : "=r" (ossr0)); \ - asm volatile ("ldcr %0, cr18" : "=r" (ossr1)); \ - asm volatile ("ldcr %0, cr19" : "=r" (ossr2)); \ - asm volatile ("ldcr %0, cr20" : "=r" (ossr3)); \ - \ - asm volatile ("stcr %0, cr17" :: "r"(bugsr0)); \ - asm volatile ("stcr %0, cr18" :: "r"(bugsr1)); \ - asm volatile ("stcr %0, cr19" :: "r"(bugsr2)); \ - asm volatile ("stcr %0, cr20" :: "r"(bugsr3)); \ -} -#define OSCTXT() \ -{ \ - asm volatile ("ldcr %0, cr17" : "=r" (bugsr0):: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13"); \ - asm volatile ("ldcr %0, cr18" : "=r" (bugsr1)); \ - asm volatile ("ldcr %0, cr19" : "=r" (bugsr2)); \ - asm volatile ("ldcr %0, cr20" : "=r" (bugsr3)); \ - \ - asm volatile ("stcr %0, cr17" :: "r"(ossr0)); \ - asm volatile ("stcr %0, cr18" :: "r"(ossr1)); \ - asm volatile ("stcr %0, cr19" :: "r"(ossr2)); \ - asm volatile ("stcr %0, cr20" :: "r"(ossr3)); \ +#include <machine/bugio.h> +#include <machine/prom.h> + +register_t ossr0, ossr1, ossr2, ossr3; +register_t bugsr0, bugsr1, bugsr2, bugsr3; + +#define BUGCTXT() \ +{ \ + __asm__ __volatile__ ("ldcr %0, cr17" : "=r" (ossr0)); \ + __asm__ __volatile__ ("ldcr %0, cr18" : "=r" (ossr1)); \ + __asm__ __volatile__ ("ldcr %0, cr19" : "=r" (ossr2)); \ + __asm__ __volatile__ ("ldcr %0, cr20" : "=r" (ossr3)); \ + \ + __asm__ __volatile__ ("stcr %0, cr17" :: "r"(bugsr0)); \ + __asm__ __volatile__ ("stcr %0, cr18" :: "r"(bugsr1)); \ + __asm__ __volatile__ ("stcr %0, cr19" :: "r"(bugsr2)); \ + __asm__ __volatile__ ("stcr %0, cr20" :: "r"(bugsr3)); \ +} + +#define OSCTXT() \ +{ \ + __asm__ __volatile__ ("ldcr %0, cr17" : "=r" (bugsr0):: \ + "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \ + "r9", "r10", "r11", "r12", "r13"); \ + __asm__ __volatile__ ("ldcr %0, cr18" : "=r" (bugsr1)); \ + __asm__ __volatile__ ("ldcr %0, cr19" : "=r" (bugsr2)); \ + __asm__ __volatile__ ("ldcr %0, cr20" : "=r" (bugsr3)); \ + \ + __asm__ __volatile__ ("stcr %0, cr17" :: "r"(ossr0)); \ + __asm__ __volatile__ ("stcr %0, cr18" :: "r"(ossr1)); \ + __asm__ __volatile__ ("stcr %0, cr19" :: "r"(ossr2)); \ + __asm__ __volatile__ ("stcr %0, cr20" :: "r"(ossr3)); \ +} + +static void +bugpcrlf(void) +{ + BUGCTXT(); + MVMEPROM_CALL(MVMEPROM_OUTCRLF); + OSCTXT(); } void buginit() { - asm volatile ("ldcr %0, cr17" : "=r" (bugsr0)); - asm volatile ("ldcr %0, cr18" : "=r" (bugsr1)); - asm volatile ("ldcr %0, cr19" : "=r" (bugsr2)); - asm volatile ("ldcr %0, cr20" : "=r" (bugsr3)); + __asm__ __volatile__ ("ldcr %0, cr17" : "=r" (bugsr0)); + __asm__ __volatile__ ("ldcr %0, cr18" : "=r" (bugsr1)); + __asm__ __volatile__ ("ldcr %0, cr19" : "=r" (bugsr2)); + __asm__ __volatile__ ("ldcr %0, cr20" : "=r" (bugsr3)); } char @@ -70,9 +61,8 @@ buginchr(void) register int cc; int ret; BUGCTXT(); - asm volatile ("or r9,r0," INCHR); - asm volatile ("tb0 0,r0,0x1F0"); - asm volatile ("or %0,r0,r2" : "=r" (cc) : ); + MVMEPROM_CALL(MVMEPROM_INCHR); + __asm__ __volatile__ ("or %0,r0,r2" : "=r" (cc) : ); ret = cc; OSCTXT(); return ((char)ret & 0xFF); @@ -89,9 +79,8 @@ bugoutchr(unsigned char c) } BUGCTXT(); - asm("or r2,r0,%0" : : "r" (cc)); - asm("or r9,r0," OUTCHR); - asm("tb0 0,r0,0x1F0"); + __asm__ __volatile__ ("or r2,r0,%0" : : "r" (cc)); + MVMEPROM_CALL(MVMEPROM_OUTCHR); OSCTXT(); } @@ -102,9 +91,8 @@ buginstat(void) register int ret; BUGCTXT(); - asm volatile ("or r9,r0," INSTAT); - asm volatile ("tb0 0,r0,0x1F0"); - asm volatile ("or %0,r0,r2" : "=r" (ret) : ); + MVMEPROM_CALL(MVMEPROM_INSTAT); + __asm__ __volatile__ ("or %0,r0,r2" : "=r" (ret) : ); OSCTXT(); return (ret & 0x4 ? 0 : 1); } @@ -113,119 +101,35 @@ void bugoutstr(char *s, char *se) { BUGCTXT(); - asm("or r9,r0," OUTSTR); - asm("tb0 0,r0,0x1F0"); - OSCTXT(); -} - -void -bugpcrlf(void) -{ - BUGCTXT(); - asm("or r9,r0," PCRLF); - asm("tb0 0,r0,0x1F0"); - OSCTXT(); -} - -/* return 0 on success */ -int -bugdskrd(struct bugdisk_io *arg) -{ - int ret; - - BUGCTXT(); - asm("or r9,r0, " DSKRD); - asm("tb0 0,r0,0x1F0"); - asm("or %0,r0,r2" : "=r" (ret) : ); - OSCTXT(); - - return ((ret&0x4) == 0x4 ? 1 : 0); -} - -/* return 0 on success */ -int -bugdskwr(struct bugdisk_io *arg) -{ - int ret; - BUGCTXT(); - asm("or r9,r0, " DSKWR); - asm("tb0 0,r0,0x1F0"); - asm("or %0,r0,r2" : "=r" (ret) : ); + MVMEPROM_CALL(MVMEPROM_OUTSTR); OSCTXT(); - return ((ret&0x4) == 0x4 ? 1 : 0); } void -bugrtcrd(struct bugrtc *rtc) +bugrtcrd(struct mvmeprom_time *rtc) { BUGCTXT(); - asm("or r9,r0, " RTC_RD); - asm("tb0 0,r0,0x1F0"); + MVMEPROM_CALL(MVMEPROM_RTC_RD); OSCTXT(); } void -bugdelay(int delay) -{ - BUGCTXT(); - asm("or r2,r0,%0" : : "r" (delay)); - asm("or r9,r0, " BUGDELAY); - asm("tb0 0,r0,0x1F0"); - OSCTXT(); -} - -int -bugfork(int cpu, unsigned address) -{ - register int ret; - BUGCTXT(); - asm("or r9,r0, " FORKMPU); - asm("tb0 0,r0,0x1F0"); - asm volatile ("or %0,r0,r2" : "=r" (ret) : ); - OSCTXT(); - return(ret); -} - -void bugreturn(void) { BUGCTXT(); - asm("or r9,r0, " RETURN); - asm("tb0 0,r0,0x1F0"); + MVMEPROM_CALL(MVMEPROM_EXIT); OSCTXT(); } void -bugbrdid(struct bugbrdid *id) +bugbrdid(struct mvmeprom_brdid *id) { - struct bugbrdid *ptr; + struct mvmeprom_brdid *ptr; + BUGCTXT(); - asm("or r9,r0, " BRD_ID); - asm("tb0 0,r0,0x1F0"); - asm("or %0,r0,r2" : "=r" (ptr) : ); + MVMEPROM_CALL(MVMEPROM_GETBRDID); + __asm__ __volatile__ ("or %0,r0,r2" : "=r" (ptr) : ); OSCTXT(); - bcopy(ptr, id, sizeof(struct bugbrdid)); -} -void -bugnetctrl(struct bugniocall *niocall) -{ -/* BUGCTXT();*/ - asm("or r2,r0,%0" : : "r" (niocall)); - asm("or r9,r0, " NETCTRL); - asm("tb0 0,r0,0x1F0"); -/* OSCTXT();*/ -} - -int -bugnetcfg(struct bugniotcall *niotcall) -{ - register int ret; -/* BUGCTXT();*/ - asm("or r2,r0,%0" : : "r" (niotcall)); - asm("or r9,r0, " NETCTRL); - asm("tb0 0,r0,0x1F0"); - asm volatile ("or %0,r0,r2" : "=r" (ret) : ); -/* OSCTXT();*/ - return(ret); + bcopy(ptr, id, sizeof(struct mvmeprom_brdid)); } diff --git a/sys/arch/mvme88k/dev/bussw.c b/sys/arch/mvme88k/dev/bussw.c index 53c9fe1f0d1..1e14a411627 100644 --- a/sys/arch/mvme88k/dev/bussw.c +++ b/sys/arch/mvme88k/dev/bussw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bussw.c,v 1.4 2001/12/19 07:04:41 smurph Exp $ */ +/* $OpenBSD: bussw.c,v 1.5 2002/03/05 22:11:37 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -40,7 +40,6 @@ #include <sys/malloc.h> #include <machine/psl.h> #include <machine/autoconf.h> -#include <machine/bugio.h> #include <machine/cpu.h> #include <machine/mioctl.h> #include <machine/vmparam.h> diff --git a/sys/arch/mvme88k/dev/if_ve.c b/sys/arch/mvme88k/dev/if_ve.c index ae165edc1c7..1bfadff7007 100644 --- a/sys/arch/mvme88k/dev/if_ve.c +++ b/sys/arch/mvme88k/dev/if_ve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ve.c,v 1.15 2001/12/22 18:45:35 smurph Exp $ */ +/* $OpenBSD: if_ve.c,v 1.16 2002/03/05 22:11:37 miod Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1982, 1992, 1993 @@ -70,7 +70,6 @@ #include <machine/autoconf.h> #include <machine/cpu.h> -#include <machine/bugio.h> #include <machine/cmmu.h> /* DMA_CACHE_SYNC, etc... */ #include <mvme88k/dev/if_vereg.h> diff --git a/sys/arch/mvme88k/dev/nvram.c b/sys/arch/mvme88k/dev/nvram.c index f537cfbc9c4..49a64b524b0 100644 --- a/sys/arch/mvme88k/dev/nvram.c +++ b/sys/arch/mvme88k/dev/nvram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvram.c,v 1.16 2001/12/19 07:04:41 smurph Exp $ */ +/* $OpenBSD: nvram.c,v 1.17 2002/03/05 22:11:37 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -95,7 +95,7 @@ nvrammatch(parent, vcf, args) int ret; #endif struct confargs *ca = args; - struct bugrtc rtc; + struct mvmeprom_time rtc; ca->ca_vaddr = ca->ca_paddr; /* map 1:1 */ /*X*/ if (ca->ca_vaddr == (void *)-1) /*X*/ return (1); diff --git a/sys/arch/mvme88k/dev/sclock.c b/sys/arch/mvme88k/dev/sclock.c index 7949e40096b..62603c95164 100644 --- a/sys/arch/mvme88k/dev/sclock.c +++ b/sys/arch/mvme88k/dev/sclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sclock.c,v 1.10 2002/01/14 21:34:39 miod Exp $ */ +/* $OpenBSD: sclock.c,v 1.11 2002/03/05 22:11:37 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * @@ -90,7 +90,6 @@ #include <machine/board.h> #include <machine/psl.h> #include <machine/autoconf.h> -#include <machine/bugio.h> #include <machine/cpu.h> #include "pcctwo.h" #if NPCCTWO > 0 diff --git a/sys/arch/mvme88k/include/bugio.h b/sys/arch/mvme88k/include/bugio.h index c4ef12009ed..0f7f6dc93d2 100644 --- a/sys/arch/mvme88k/include/bugio.h +++ b/sys/arch/mvme88k/include/bugio.h @@ -1,141 +1,19 @@ -/* $OpenBSD: bugio.h,v 1.11 2001/09/28 20:45:48 miod Exp $ */ +/* $OpenBSD: bugio.h,v 1.12 2002/03/05 22:11:40 miod Exp $ */ #ifndef __MACHINE_BUGIO_H__ #define __MACHINE_BUGIO_H__ #include <sys/cdefs.h> -struct bugdisk_io { - char clun; - char dlun; - short status; - void *addr; - int blkno; -#define fileno blkno - short nblks; - char flag; -#define FILEMARKFLAG 0x80 -#define IGNOREFILENO 0x02 -#define ENDOFFILE 0x01 - char am; -}; - -/* values are in BCD {upper nibble+lower nibble} */ - -struct bugrtc { - unsigned char Y; - unsigned char M; - unsigned char D; - unsigned char d; - unsigned char H; - unsigned char m; - unsigned char s; - unsigned char c; -}; - -/* Board ID - lots of info */ - -struct bugbrdid { - unsigned char eye[4]; - char rev; - char month; - char day; - char year; - short packetsize; - short dummy; - short brdno; - unsigned char brdsuf[2]; - char options[3]; - char family:4; - char cpu:4; - short clun; - short dlun; - short type; - short dev; - int option; - char version[4]; - char serial[12]; /* SBC serial number */ - char id[16]; /* SBC id */ - char pwa[16]; /* printed wiring assembly number */ - char speed[4]; /* cpu speed */ - char etheraddr[6]; /* mac address, all zero if no ether */ - char fill[2]; - char scsiid[2]; /* local SCSI id */ - char sysid[8]; /* system id - nothing on mvme187 */ - char brd1_pwb[8]; /* memory board 1 pwb */ - char brd1_serial[8]; /* memory board 1 serial */ - char brd2_pwb[8]; /* memory board 2 pwb */ - char brd2_serial[8]; /* memory board 2 serial */ - char reserved[153]; - char cksum[1]; -}; - -struct bugniocall { - unsigned char clun; - unsigned char dlun; - unsigned char ci; - unsigned char cd; -#define NETCTRL_INITDEVICE 0 -#define NETCTRL_GETHDW 1 -#define NETCTRL_TX 2 -#define NETCTRL_RX 3 -#define NETCTRL_FLUSH 4 -#define NETCTRL_RESET 5 - unsigned long cid; - unsigned long memaddr; - unsigned long nbytes; - unsigned long csword; -}; - -typedef struct netcnfgp { - unsigned int magic; - unsigned int nodemem; - unsigned int bfla; - unsigned int bfea; - unsigned int bfed; - unsigned int bfl; - unsigned int bfbo; - unsigned int tbuffer; - unsigned char cipa[4]; - unsigned char sipa[4]; - unsigned char netmask[4]; - unsigned char broadcast[4]; - unsigned char gipa[4]; - unsigned char bootp_retry; - unsigned char tftp_retry; - unsigned char bootp_ctl; - unsigned char cnfgp_ctl; - unsigned char filename[64]; - unsigned char argfname[64]; -} NETCNFGP; - -struct bugniotcall { - unsigned char clun; - unsigned char dlun; - unsigned char ci; - unsigned char cd; - NETCNFGP * netcfngp_p; - void * unused; -#define NIOT_READ (1<<0) -#define NIOT_WRITE (1<<1) -#define NIOT_NVRAM (1<<2) - unsigned long cntrlflag; -}; +#include <machine/prom.h> void buginit __P((void)); int buginstat __P((void)); char buginchr __P((void)); void bugoutchr __P((unsigned char)); void bugoutstr __P((char *, char *)); -void bugpcrlf __P((void)); -int bugdskrd __P((struct bugdisk_io *)); -int bugdskwr __P((struct bugdisk_io *)); -void bugrtcrd __P((struct bugrtc *)); +void bugrtcrd __P((struct mvmeprom_time *)); void bugreturn __P((void)); -int bugfork __P((int cpu, unsigned address)); -void bugbrdid __P((struct bugbrdid *)); -void bugnetctrl __P((struct bugniocall *)); -void bugdelay __P((int)); -int bugnetcfg __P((struct bugniotcall *)); +void bugbrdid __P((struct mvmeprom_brdid *)); #endif /* __MACHINE_BUGIO_H__ */ diff --git a/sys/arch/mvme88k/include/prom.h b/sys/arch/mvme88k/include/prom.h index 2b1af80abea..f3d1a84a20d 100644 --- a/sys/arch/mvme88k/include/prom.h +++ b/sys/arch/mvme88k/include/prom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.h,v 1.8 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: prom.h,v 1.9 2002/03/05 22:11:40 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -46,14 +46,17 @@ #define MVMEPROM_DSKFMT 0x14 #define MVMEPROM_DSKCTRL 0x15 #define MVMEPROM_NETCTRL 0x1d +#define MVMEPROM_OUTSTR 0x21 #define MVMEPROM_OUTSTRCRLF 0x22 #define MVMEPROM_WRITE 0x23 #define MVMEPROM_WRITELN 0x24 +#define MVMEPROM_OUTCRLF 0x26 #define MVMEPROM_DELAY 0x43 #define MVMEPROM_RTC_RD 0x53 #define MVMEPROM_EXIT 0x63 #define MVMEPROM_GETBRDID 0x70 #define MVMEPROM_ENVIRON 0x71 +#define MVMEPROM_FORKMPU 0x100 #define NETCTRLCMD_GETETHER 1 @@ -161,7 +164,7 @@ struct mvmeprom_args { #define MVMEPROM_CALL(x) \ __asm__ __volatile__ ( __CONCAT("or r9,r0,",__STRING(x)) ); \ - __asm__ __volatile__ ("tb0 0,r0,496"); + __asm__ __volatile__ ("tb0 0,r0,496") #define MVMEPROM_REG_DEVLUN "r2" #define MVMEPROM_REG_CTRLLUN "r3" diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 8db7c28d268..64cdf4be1ee 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.89 2002/02/17 22:59:53 maja Exp $ */ +/* $OpenBSD: machdep.c,v 1.90 2002/03/05 22:11:42 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -365,7 +365,7 @@ size_memory() int getcpuspeed() { - struct bugbrdid brdid; + struct mvmeprom_brdid brdid; int speed = 0; int i, c; bugbrdid(&brdid); @@ -382,7 +382,7 @@ getcpuspeed() int getscsiid() { - struct bugbrdid brdid; + struct mvmeprom_brdid brdid; int scsiid = 0; int i, c; bugbrdid(&brdid); @@ -1179,6 +1179,7 @@ haltsys: } else { doboot(); } + for (;;); /* to keep compiler happy, and me from going crazy */ /*NOTREACHED*/ } @@ -2159,7 +2160,7 @@ void myetheraddr(cp) u_char *cp; { - struct bugbrdid brdid; + struct mvmeprom_brdid brdid; bugbrdid(&brdid); bcopy(&brdid.etheraddr, cp, 6); @@ -2319,8 +2320,7 @@ mvme_bootstrap() extern struct consdev *cn_tab; extern void set_tcfp __P((void)); - struct bugbrdid brdid; - + struct mvmeprom_brdid brdid; /* * Must initialize p_addr before autoconfig or @@ -2337,7 +2337,7 @@ mvme_bootstrap() buginit(); /* init the bug routines */ bugbrdid(&brdid); - brdtyp = brdid.brdno; + brdtyp = brdid.model; /* to support the M8120. It's based off of MVME187 */ if (brdtyp == BRD_8120) |