diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /sys/arch/sparc/include |
initial import of NetBSD tree
Diffstat (limited to 'sys/arch/sparc/include')
49 files changed, 6159 insertions, 0 deletions
diff --git a/sys/arch/sparc/include/ansi.h b/sys/arch/sparc/include/ansi.h new file mode 100644 index 00000000000..6e90c691b78 --- /dev/null +++ b/sys/arch/sparc/include/ansi.h @@ -0,0 +1,74 @@ +/* $NetBSD: ansi.h,v 1.3 1994/11/20 20:52:50 deraadt Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _ANSI_H_ +#define _ANSI_H_ + +/* + * Types which are fundamental to the implementation and may appear in + * more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock() */ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time() */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * Runes (wchar_t) is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you + * lose a bit of ANSI conformance, but your programs will still work. + * + * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t + * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains + * defined for ctype.h. + */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +#endif /* _ANSI_H_ */ diff --git a/sys/arch/sparc/include/asm.h b/sys/arch/sparc/include/asm.h new file mode 100644 index 00000000000..4241a44caa5 --- /dev/null +++ b/sys/arch/sparc/include/asm.h @@ -0,0 +1,102 @@ +/* $NetBSD: asm.h,v 1.3 1994/11/20 20:52:51 deraadt Exp $ */ + +/* + * Copyright (c) 1994 Allen Briggs + * All rights reserved. + * + * Gleaned from locore.s and sun3 asm.h which had the following copyrights: + * locore.s: + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990 The Regents of the University of California. + * sun3/include/asm.h: + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1990 The Regents of the University of California. + * + * 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. + */ + +#ifndef _ASM_H_ +#define _ASM_H_ + +#ifdef __STDC__ +#define _C_LABEL(name) _ ## name +#else +#define _C_LABEL(name) _/**/name +#endif +#define _ASM_LABEL(name) name + +#ifdef PIC +/* + * PIC_PROLOGUE() is akin to the compiler generated function prologue for + * PIC code. It leaves the address of the Global Offset Table in DEST, + * clobbering register TMP in the process. Using the temporary enables us + * to work without a stack frame (doing so requires saving %o7) . + */ +#define PIC_PROLOGUE(dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + sethi %hi(__GLOBAL_OFFSET_TABLE_-(3b-.)),dest; \ + or dest,%lo(__GLOBAL_OFFSET_TABLE_-(3b-.)),dest; \ + add dest,%o7,dest; mov tmp,%o7 + +/* + * PICCY_SET() does the equivalent of a `set var, %dest' instruction in + * a PIC-like way, but without involving the Global Offset Table. This + * only works for VARs defined in the same file *and* in the text segment. + */ +#define PICCY_SET(var,dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + add %o7,(var-3b),dest; mov tmp,%o7 +#else +#define PIC_PROLOGUE(dest,tmp) +#define PICCY_OFFSET(var,dest,tmp) +#endif + +#define FTYPE(x) .type x,@function +#define OTYPE(x) .type x,@object + +#define _ENTRY(name) \ + .align 4; .globl name; .proc 1; FTYPE(name); name: + +#ifdef PROF +#define _PROF_PROLOGUE \ + .data; .align 4; 1: .long 0; \ + .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ + or %o0,%lo(1b),%o0; restore +#else +#define _PROF_PROLOGUE +#endif + +#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE +#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE +#define FUNC(name) ASENTRY(name) + + +#define ASMSTR .asciz + +#endif /* _ASM_H_ */ diff --git a/sys/arch/sparc/include/autoconf.h b/sys/arch/sparc/include/autoconf.h new file mode 100644 index 00000000000..a4b10fd27e0 --- /dev/null +++ b/sys/arch/sparc/include/autoconf.h @@ -0,0 +1,170 @@ +/* $NetBSD: autoconf.h,v 1.10 1995/08/18 10:47:46 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)autoconf.h 8.2 (Berkeley) 9/30/93 + */ + +/* + * Autoconfiguration information. + */ + +/* + * Most devices are configured according to information kept in + * the FORTH PROMs. In particular, we extract the `name', `reg', + * and `address' properties of each device attached to the mainbus; + * other drives may also use this information. The mainbus itself + * (which `is' the CPU, in some sense) gets just the node, with a + * fake name ("mainbus"). + */ +#define RA_MAXVADDR 4 /* max (virtual) addresses per device */ +#define RA_MAXREG 2 /* max # of register banks per device */ +#define RA_MAXINTR 8 /* max interrupts per device */ +struct romaux { + const char *ra_name; /* name from FORTH PROM */ + int ra_node; /* FORTH PROM node ID */ + void *ra_vaddrs[RA_MAXVADDR];/* ROM mapped virtual addresses */ + int ra_nvaddrs; /* # of ra_vaddrs[]s, may be 0 */ +#define ra_vaddr ra_vaddrs[0] /* compatibility */ + struct rom_reg { + int rr_iospace; /* register space (obio, etc) */ + void *rr_paddr; /* register physical address */ + int rr_len; /* register length */ + } ra_reg[RA_MAXREG]; + int ra_nreg; /* # of ra_reg[]s */ +#define ra_iospace ra_reg[0].rr_iospace +#define ra_paddr ra_reg[0].rr_paddr +#define ra_len ra_reg[0].rr_len + struct rom_intr { /* interrupt information: */ + int int_pri; /* priority (IPL) */ + int int_vec; /* vector (always 0?) */ + } ra_intr[RA_MAXINTR]; + int ra_nintr; /* number of interrupt info elements */ + struct bootpath *ra_bp; /* used for locating boot device */ +}; + + +struct confargs { + int ca_bustype; + struct romaux ca_ra; + int ca_slot; + int ca_offset; +}; +#define BUS_MAIN 0 +#define BUS_OBIO 1 +#define BUS_VME16 2 +#define BUS_VME32 3 +#define BUS_SBUS 4 + +extern int bt2pmt[]; + +/* + * The various getprop* functions obtain `properties' from the ROMs. + * getprop() obtains a property as a byte-sequence, and returns its + * length; the others convert or make some other guarantee. + */ +int getprop __P((int node, char *name, void *buf, int bufsiz)); +char *getpropstring __P((int node, char *name)); +int getpropint __P((int node, char *name, int deflt)); + +/* Frequently used options node */ +extern int optionsnode; + +/* + * The romprop function gets physical and virtual addresses from the PROM + * and fills in a romaux. It returns 1 on success, 0 if the physical + * address is not available as a "reg" property. + */ +int romprop __P((struct romaux *ra, const char *name, int node)); + +/* + * The matchbyname function is useful in drivers that are matched + * by romaux name, i.e., all `mainbus attached' devices. It expects + * its aux pointer to point to a pointer to the name (the address of + * a romaux structure suffices, for instance). + */ +int matchbyname __P((struct device *, void *cf, void *aux)); + +/* + * `clockfreq' produces a printable representation of a clock frequency + * (this is just a frill). + */ +char *clockfreq __P((int freq)); + +/* + * mapiodev maps an I/O device to a virtual address, returning the address. + * mapdev does the real work: you can supply a special virtual address and + * it will use that instead of creating one, but you must only do this if + * you get it from ../sparc/vaddrs.h. + */ +void *mapdev __P((void *pa, int va, int size, int bustype)); +#define mapiodev(pa, size, bustype) mapdev(pa, 0, size, bustype) + +/* + * Memory description arrays. Shared between pmap.c and autoconf.c; no + * one else should use this (except maybe mem.c, e.g., if we fix the VM to + * handle discontiguous physical memory). + */ +struct memarr { + u_int addr; + u_int len; +}; +int makememarr(struct memarr *, int max, int which); +#define MEMARR_AVAILPHYS 0 +#define MEMARR_TOTALPHYS 1 + +/* Pass a string to the FORTH interpreter. May fail silently. */ +void rominterpret __P((char *)); + +/* Openprom V2 style boot path */ +struct bootpath { + char name[8]; /* name of this node */ + int val[2]; /* up to two optional values */ +}; + +struct device *bootdv; /* found during autoconfiguration */ + +struct bootpath *bootpath_store __P((int, struct bootpath *)); +int sd_crazymap __P((int)); + +/* Parse a disk string into a dev_t, return device struct pointer */ +struct device *parsedisk __P((char *, int, int, dev_t *)); diff --git a/sys/arch/sparc/include/bsd_audioio.h b/sys/arch/sparc/include/bsd_audioio.h new file mode 100644 index 00000000000..4d8bc0aeb34 --- /dev/null +++ b/sys/arch/sparc/include/bsd_audioio.h @@ -0,0 +1,135 @@ +/* $NetBSD: bsd_audioio.h,v 1.3 1995/03/04 09:58:45 pk Exp $ */ + +/* + * Copyright (c) 1991, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)bsd_audioio.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _BSD_AUDIOIO_H_ +#define _BSD_AUDIOIO_H_ + +/* + * /dev/audio ioctls. needs comments! + */ +#define AUDIO_MIN_GAIN (0) +#define AUDIO_MAX_GAIN (255) + +#define AUDIO_ENCODING_ULAW (1) +#define AUDIO_ENCODING_ALAW (2) + +struct audio_prinfo { + u_int sample_rate; + u_int channels; + u_int precision; + u_int encoding; + u_int gain; + u_int port; + u_long seek; /* BSD extension */ + u_int ispare[3]; + u_int samples; + u_int eof; + + u_char pause; + u_char error; + u_char waiting; + u_char cspare[3]; + u_char open; + u_char active; + +}; + +struct audio_info { + struct audio_prinfo play; + struct audio_prinfo record; + u_int monitor_gain; + /* BSD extensions */ + u_int blocksize; /* input blocking threshold */ + u_int hiwat; /* output high water mark */ + u_int lowat; /* output low water mark */ + u_int backlog; /* samples of output backlog to gen. */ + u_int mode; +}; +typedef struct audio_info audio_info_t; + +#define AUDIO_INITINFO(p)\ + (void)memset((void *)(p), 0xff, sizeof(struct audio_info)) + +#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__) +#define AUDIO_GETINFO _IOR(A, 21, struct audio_info) +#define AUDIO_SETINFO _IOWR(A, 22, struct audio_info) +#define AUDIO_DRAIN _IO(A, 23) +#define AUDIO_FLUSH _IO(A, 24) +#define AUDIO_WSEEK _IOR(A, 25, u_long) +#define AUDIO_RERROR _IOR(A, 26, int) +#define AUDIO_GETMAP _IOR(A, 27, struct mapreg) +#define AUDIO_SETMAP _IOW(A, 28, struct mapreg) +#else +#define AUDIO_GETINFO _IOR('A', 21, struct audio_info) +#define AUDIO_SETINFO _IOWR('A', 22, struct audio_info) +#define AUDIO_DRAIN _IO('A', 23) +#define AUDIO_FLUSH _IO('A', 24) +#define AUDIO_WSEEK _IOR('A', 25, u_long) +#define AUDIO_RERROR _IOR('A', 26, int) +#define AUDIO_GETMAP _IOR('A', 27, struct mapreg) +#define AUDIO_SETMAP _IOW('A', 28, struct mapreg) +#endif + +#define AUDIO_SPEAKER 1 +#define AUDIO_HEADPHONE 2 + +/* + * Low level interface. + */ +struct mapreg { + u_short mr_x[8]; + u_short mr_r[8]; + u_short mr_gx; + u_short mr_gr; + u_short mr_ger; + u_short mr_stgr; + u_short mr_ftgr; + u_short mr_atgr; + u_char mr_mmr1; + u_char mr_mmr2; +}; + +#endif /* _BSD_AUDIOIO_H_ */ diff --git a/sys/arch/sparc/include/bsd_openprom.h b/sys/arch/sparc/include/bsd_openprom.h new file mode 100644 index 00000000000..da6db9619dd --- /dev/null +++ b/sys/arch/sparc/include/bsd_openprom.h @@ -0,0 +1,302 @@ +/* $NetBSD: bsd_openprom.h,v 1.3 1995/09/04 09:53:53 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry. + * + * 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. + * + * @(#)bsd_openprom.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * This file defines the interface between the kernel and the Openboot PROM. + * N.B.: this has been tested only on interface versions 0 and 2 (we have + * never seen interface version 1). + */ + +/* + * The v0 interface tells us what virtual memory to scan to avoid PMEG + * conflicts, but the v2 interface fails to do so, and we must `magically' + * know where the OPENPROM lives in virtual space. + */ +#define OPENPROM_STARTVADDR 0xffd00000 +#define OPENPROM_ENDVADDR 0xfff00000 + +#define OPENPROM_MAGIC 0x10010407 + +/* + * Version 0 PROM vector device operations (collected here to emphasise that + * they are deprecated). Open and close are obvious. Read and write are + * segregated according to the device type (block, network, or character); + * this is unnecessary and was eliminated from the v2 device operations, but + * we are stuck with it. + * + * Seek is probably only useful on tape devices, since the only character + * devices are the serial ports. + * + * Note that a v0 device name is always exactly two characters ("sd", "le", + * and so forth). + */ +struct v0devops { + int (*v0_open)(char *dev); + int (*v0_close)(int d); + int (*v0_rbdev)(int d, int nblks, int blkno, caddr_t addr); + int (*v0_wbdev)(int d, int nblks, int blkno, caddr_t addr); + int (*v0_wnet)(int d, int nbytes, caddr_t addr); + int (*v0_rnet)(int d, int nbytes, caddr_t addr); + int (*v0_rcdev)(int d, int nbytes, int, caddr_t addr); + int (*v0_wcdev)(int d, int nbytes, int, caddr_t addr); + int (*v0_seek)(int d, long offset, int whence); +}; + +/* + * Version 2 device operations. Open takes a device `path' such as + * /sbus/le@0,c00000,0 or /sbus/esp@.../sd@0,0, which means it can open + * anything anywhere, without any magic translation. + * + * The memory allocator and map functions are included here even though + * they relate only indirectly to devices (e.g., mmap is good for mapping + * device memory, and drivers need to allocate space in which to record + * the device state). + */ +struct v2devops { + /* + * Convert an `instance handle' (acquired through v2_open()) to + * a `package handle', a.k.a. a `node'. + */ + int (*v2_fd_phandle)(int d); + + /* Memory allocation and release. */ + caddr_t (*v2_malloc)(caddr_t va, u_int sz); + void (*v2_free)(caddr_t va, u_int sz); + + /* Device memory mapper. */ + caddr_t (*v2_mmap)(caddr_t va, int asi, u_int pa, u_int sz); + void (*v2_munmap)(caddr_t va, u_int sz); + + /* Device open, close, etc. */ + int (*v2_open)(char *devpath); + void (*v2_close)(int d); + int (*v2_read)(int d, caddr_t buf, int nbytes); + int (*v2_write)(int d, caddr_t buf, int nbytes); + void (*v2_seek)(int d, int hi, int lo); + + void (*v2_xxx2)(); /* ??? */ + void (*v2_xxx3)(); /* ??? */ +}; + +/* + * The v0 interface describes memory regions with these linked lists. + * (The !$&@#+ v2 interface reformats these as properties, so that we + * have to extract them into local temporary memory and reinterpret them.) + */ +struct v0mlist { + struct v0mlist *next; + caddr_t addr; + u_int nbytes; +}; + +/* + * V0 gives us three memory lists: Total physical memory, VM reserved to + * the PROM, and available physical memory (which, presumably, is just the + * total minus any pages mapped in the PROM's VM region). We can find the + * reserved PMEGs by scanning the taken VM. Unfortunately, the V2 prom + * forgot to provide taken VM, and we are stuck with scanning ``magic'' + * addresses. + */ +struct v0mem { + struct v0mlist **v0_phystot; /* physical memory */ + struct v0mlist **v0_vmprom; /* VM used by PROM */ + struct v0mlist **v0_physavail; /* available physical memory */ +}; + +/* + * The version 0 PROM breaks up the string given to the boot command and + * leaves the decoded version behind. + */ +struct v0bootargs { + char *ba_argv[8]; /* argv format for boot string */ + char ba_args[100]; /* string space */ + char ba_bootdev[2]; /* e.g., "sd" for `b sd(...' */ + int ba_ctlr; /* controller # */ + int ba_unit; /* unit # */ + int ba_part; /* partition # */ + char *ba_kernel; /* kernel to boot, e.g., "vmunix" */ + void *ba_spare0; /* not decoded here XXX */ +}; + +/* + * The version 2 PROM interface uses the more general, if less convenient, + * approach of passing the boot strings unchanged. We also get open file + * numbers for stdin and stdout (keyboard and screen, or whatever), for use + * with the v2 device ops. + */ +struct v2bootargs { + char **v2_bootpath; /* V2: Path to boot device */ + char **v2_bootargs; /* V2: Boot args */ + int *v2_fd0; /* V2: Stdin descriptor */ + int *v2_fd1; /* V2: Stdout descriptor */ +}; + +/* + * The following structure defines the primary PROM vector interface. + * The Boot PROM hands the kernel a pointer to this structure in %o0. + * There are numerous substructures defined below. + */ +struct promvec { + /* Version numbers. */ + u_int pv_magic; /* Magic number */ + u_int pv_romvec_vers; /* interface version (0, 2) */ + u_int pv_plugin_vers; /* ??? */ + u_int pv_printrev; /* PROM rev # (* 10, e.g 1.9 = 19) */ + + /* Version 0 memory descriptors (see below). */ + struct v0mem pv_v0mem; /* V0: Memory description lists. */ + + /* Node operations (see below). */ + struct nodeops *pv_nodeops; /* node functions */ + + char **pv_bootstr; /* Boot command, eg sd(0,0,0)vmunix */ + + struct v0devops pv_v0devops; /* V0: device ops */ + + /* + * PROMDEV_* cookies. I fear these may vanish in lieu of fd0/fd1 + * (see below) in future PROMs, but for now they work fine. + */ + char *pv_stdin; /* stdin cookie */ + char *pv_stdout; /* stdout cookie */ +#define PROMDEV_KBD 0 /* input from keyboard */ +#define PROMDEV_SCREEN 0 /* output to screen */ +#define PROMDEV_TTYA 1 /* in/out to ttya */ +#define PROMDEV_TTYB 2 /* in/out to ttyb */ + + /* Blocking getchar/putchar. NOT REENTRANT! (grr) */ + int (*pv_getchar)(void); + void (*pv_putchar)(int ch); + + /* Non-blocking variants that return -1 on error. */ + int (*pv_nbgetchar)(void); + int (*pv_nbputchar)(int ch); + + /* Put counted string (can be very slow). */ + void (*pv_putstr)(char *str, int len); + + /* Miscellany. */ + void (*pv_reboot)(char *bootstr); + void (*pv_printf)(const char *fmt, ...); + void (*pv_abort)(void); /* L1-A abort */ + int *pv_ticks; /* Ticks since last reset */ + __dead void (*pv_halt)(void); /* Halt! */ + void (**pv_synchook)(void); /* "sync" command hook */ + + /* + * This eval's a FORTH string. Unfortunately, its interface + * changed between V0 and V2, which gave us much pain. + */ + union { + void (*v0_eval)(int len, char *str); + void (*v2_eval)(char *str); + } pv_fortheval; + + struct v0bootargs **pv_v0bootargs; /* V0: Boot args */ + + /* Extract Ethernet address from network device. */ + u_int (*pv_enaddr)(int d, char *enaddr); + + struct v2bootargs pv_v2bootargs; /* V2: Boot args + std in/out */ + struct v2devops pv_v2devops; /* V2: device operations */ + + int pv_spare[15]; + + /* + * The following is machine-dependent. + * + * The sun4c needs a PROM function to set a PMEG for another + * context, so that the kernel can map itself in all contexts. + * It is not possible simply to set the context register, because + * contexts 1 through N may have invalid translations for the + * current program counter. The hardware has a mode in which + * all memory references go to the PROM, so the PROM can do it + * easily. + */ + void (*pv_setctxt)(int ctxt, caddr_t va, int pmeg); +}; + +/* + * In addition to the global stuff defined in the PROM vectors above, + * the PROM has quite a collection of `nodes'. A node is described by + * an integer---these seem to be internal pointers, actually---and the + * nodes are arranged into an N-ary tree. Each node implements a fixed + * set of functions, as described below. The first two deal with the tree + * structure, allowing traversals in either breadth- or depth-first fashion. + * The rest deal with `properties'. + * + * A node property is simply a name/value pair. The names are C strings + * (NUL-terminated); the values are arbitrary byte strings (counted strings). + * Many values are really just C strings. Sometimes these are NUL-terminated, + * sometimes not, depending on the the interface version; v0 seems to + * terminate and v2 not. Many others are simply integers stored as four + * bytes in machine order: you just get them and go. The third popular + * format is an `address', which is made up of one or more sets of three + * integers as defined below. + * + * N.B.: for the `next' functions, next(0) = first, and next(last) = 0. + * Whoever designed this part had good taste. On the other hand, these + * operation vectors are global, rather than per-node, yet the pointers + * are not in the openprom vectors but rather found by indirection from + * there. So the taste balances out. + */ +struct openprom_addr { + int oa_space; /* address space (may be relative) */ + u_int oa_base; /* address within space */ + u_int oa_size; /* extent (number of bytes) */ +}; + +struct nodeops { + /* + * Tree traversal. + */ + int (*no_nextnode)(int node); /* next(node) */ + int (*no_child)(int node); /* first child */ + + /* + * Property functions. Proper use of getprop requires calling + * proplen first to make sure it fits. Kind of a pain, but no + * doubt more convenient for the PROM coder. + */ + int (*no_proplen)(int node, caddr_t name); + int (*no_getprop)(int node, caddr_t name, caddr_t val); + int (*no_setprop)(int node, caddr_t name, caddr_t val, int len); + caddr_t (*no_nextprop)(int node, caddr_t name); +}; diff --git a/sys/arch/sparc/include/cdefs.h b/sys/arch/sparc/include/cdefs.h new file mode 100644 index 00000000000..36f4990a9cc --- /dev/null +++ b/sys/arch/sparc/include/cdefs.h @@ -0,0 +1,35 @@ +/* $NetBSD: cdefs.h,v 1.2 1995/03/23 20:10:48 jtc Exp $ */ + +/* + * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95. + * Public domain. + */ + +#ifndef _MACHINE_CDEFS_H_ +#define _MACHINE_CDEFS_H_ + +#ifdef __STDC__ +#define _C_LABEL(x) _STRING(_ ## x) +#else +#define _C_LABEL(x) _STRING(_/**/x) +#endif + +#ifdef __GNUC__ +#ifdef __STDC__ +#define __indr_reference(sym,alias) \ + __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs \"" msg "\",30,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#else +#define __indr_reference(sym,alias) \ + __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs msg,30,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#endif +#endif + +#endif /* !_MACHINE_CDEFS_H_ */ diff --git a/sys/arch/sparc/include/cgtworeg.h b/sys/arch/sparc/include/cgtworeg.h new file mode 100644 index 00000000000..6a874e77cfd --- /dev/null +++ b/sys/arch/sparc/include/cgtworeg.h @@ -0,0 +1,266 @@ +/* $NetBSD: cgtworeg.h,v 1.3 1995/10/04 00:21:27 pk Exp $ */ + +/* + * Copyright (c) 1994 Dennis Ferguson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* cgtworeg.h - CG2 colour frame buffer definitions + * + * The mapped memory looks like: + * + * offset contents + * 0x000000 bit plane map - 1st (of 8) plane used by the X server in -mono mode + * 0x100000 pixel map - used by the X server in color mode + * 0x200000 raster op mode memory map - unused by X server + * 0x300000 random control registers (lots of spaces in between) + * 0x310000 shadow colour map + */ + +/* Frame buffer memory size and depth */ +#define CG2_FBSIZE (1024 * 1024) +#define CG2_N_PLANE 8 + +/* Screen dimensions */ +#define CG2_WIDTH 1152 +#define CG2_HEIGHT 900 + +/* Colourmap size */ +#define CG2_CMSIZE 256 + +#define CG2_BITPLANE_OFF 0 +#define CG2_BITPLANE_SIZE 0x100000 +#define CG2_PIXMAP_OFF (CG2_BITPLANE_OFF + CG2_BITPLANE_SIZE) +#define CG2_PIXMAP_SIZE 0x100000 +#define CG2_ROPMEM_OFF (CG2_PIXMAP_OFF + CG2_PIXMAP_SIZE) +#define CG2_ROPMEM_SIZE 0x100000 +#define CG2_CTLREG_OFF (CG2_ROPMEM_OFF + CG2_ROPMEM_SIZE) +#define CG2_CTLREG_SIZE 0x010600 +#define CG2_MAPPED_SIZE (CG2_CTLREG_OFF + CG2_CTLREG_SIZE) + + +/* arrangement of bit plane mode memory */ +union bitplane { + u_short word[CG2_HEIGHT][CG2_WIDTH/(CG2_N_PLANE * sizeof(u_short))]; + u_short plane[CG2_FBSIZE/(CG2_N_PLANE * sizeof(u_short))]; +}; + +/* arrangement of pixel mode memory */ +union byteplane { + u_char pixel[CG2_HEIGHT][CG2_WIDTH]; + u_char frame[CG2_FBSIZE]; +}; + + +/* + * Structure describing the first two megabytes of the frame buffer. + * Normal memory maps in bit plane and pixel modes + */ +struct cg2memfb { + union bitplane memplane[CG2_N_PLANE]; /* bit plane map */ + union byteplane pixplane; /* pixel map */ +}; + + +/* + * Control/status register. The X server only appears to use update_cmap + * and video_enab. + */ +struct cg2statusreg { + u_int reserved : 2; /* not used */ + u_int fastread : 1; /* r/o: has some feature I don't understand */ + u_int id : 1; /* r/o: ext status and ID registers exist */ + u_int resolution : 4; /* screen resolution, 0 means 1152x900 */ + u_int retrace : 1; /* r/o: retrace in progress */ + u_int inpend : 1; /* r/o: interrupt request */ + u_int ropmode : 3; /* ?? */ + u_int inten : 1; /* interrupt enable (for end of retrace) */ + u_int update_cmap : 1; /* copy/use shadow colour map */ + u_int video_enab : 1; /* enable video */ +}; + + +/* + * Extended status register. Unused by X server + */ +struct cg2_extstatus { + u_int gpintreq : 1; /* interrupt request */ + u_int gpintdis : 1; /* interrupt disable */ + u_int reserved : 13; /* unused */ + u_int gpbus : 1; /* bus enabled */ +}; + + +/* + * Double buffer control register. It appears that (some of?) the + * cg2 cards support a pair of memory sets, referred to as `A' and + * `B', which can be swapped to allow atomic screen updates. This + * controls them. + */ +struct dblbufreg { + u_int display_b : 1; /* display memory B (set) or A (reset) */ + u_int read_b : 1; /* accesss memory B (set) or A (reset) */ + u_int nowrite_b : 1; /* when set, writes don't update memory B */ + u_int nowrite_a : 1; /* when set, writes don't update memory A */ + u_int read_ecmap : 1; /* copy from(clear)/to(set) shadow colour map */ + u_int fast_read : 1; /* fast reads, but wrong data */ + u_int wait : 1; /* when set, remains so to end up v. retrace */ + u_int update_ecmap : 1; /* copy/use shadow colour map */ + u_int reserved : 8; +}; + + +/* + * Zoom register, apparently present on Sun-2 colour boards only. See + * the Sun documentation, I don't know anyone who still has a Sun-2. + */ +struct cg2_zoom { + union { + u_int short reg; + u_char reg_pad[4096]; + } wordpan; + union { + struct { + u_int unused : 8; + u_int lineoff : 4; + u_int pixzoom : 4; + } reg; + u_short word; + u_char reg_pad[4096]; + } zoom; + union { + struct { + u_int unused : 8; + u_int lorigin : 4; + u_int pixeloff : 4; + } reg; + u_short word; + u_char reg_pad[4096]; + } pixpan; + union { + u_short reg; + u_char reg_pad[4096]; + } varzoom; +}; + + +/* + * Miscellany. On the Sun-3 these registers exist in place of the above. + */ +struct cg2_nozoom { + union { /* double buffer register (see above) */ + struct dblbufreg reg; + u_short word; + u_char reg_pad[4096]; + } dblbuf; + union { /* start of dma window */ + u_short reg; + u_char reg_pad[4096]; + } dmabase; + union { /* dma window size */ + u_short reg; /* actually 8 bits. reg*16 == size */ + u_char reg_pad[4096]; + } dmawidth; + union { /* frame count */ + u_short reg; /* actually 8 bits only. r/o */ + u_char reg_pad[4096]; + } framecnt; +}; + + +/* + * Raster op control registers. X doesn't use this, but documented here + * for future reference. + */ +struct memropc { + u_short mrc_dest; + u_short mrc_source1; + u_short mrc_source2; + u_short mrc_pattern; + u_short mrc_mask1; + u_short mrc_mask2; + u_short mrc_shift; + u_short mrc_op; + u_short mrc_width; + u_short mrc_opcount; + u_short mrc_decoderout; + u_short mrc_x11; + u_short mrc_x12; + u_short mrc_x13; + u_short mrc_x14; + u_short mrc_x15; +}; + + +/* + * Last chunk of the frame buffer (i.e. from offset 0x200000 and above). + * Exists separately from struct cg2memfb apparently because Sun software + * avoids mapping the latter, though X uses it. + */ +struct cg2fb { + union { /* raster op mode frame memory */ + union bitplane ropplane[CG2_N_PLANE]; + union byteplane roppixel; + } ropio; + union { /* raster op control unit (1 per plane) */ + struct memropc ropregs; + struct { + u_char pad[2048]; + struct memropc ropregs; + } prime; + u_char reg_pad[4096]; + } ropcontrol[9]; + union { /* status register */ + struct cg2statusreg reg; + u_short word; + u_char reg_pad[4096]; + } status; + union { /* per-plane mask register */ + u_short reg; /* 8 bit mask register - set means plane r/w */ + u_char reg_pad[4096]; + } ppmask; + union { /* miscellaneous registers */ + struct cg2_zoom zoom; + struct cg2_nozoom nozoom; + } misc; + union { /* interrupt vector */ + u_short reg; + u_char reg_pad[32]; + } intrptvec; + union { /* board ID */ + u_short reg; + u_char reg_pad[16]; + } id; + union { /* extended status */ + struct cg2_extstatus reg; + u_short word; + u_char reg_pad[16]; + } extstatus; + union { /* auxiliary raster op mode register (?)*/ + u_short reg; + u_char reg_pad[4032]; + } ropmode; + u_short redmap[CG2_CMSIZE]; /* shadow colour maps */ + u_short greenmap[CG2_CMSIZE]; + u_short bluemap[CG2_CMSIZE]; +}; diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h new file mode 100644 index 00000000000..1dccb549d5d --- /dev/null +++ b/sys/arch/sparc/include/cpu.h @@ -0,0 +1,196 @@ +/* $NetBSD: cpu.h,v 1.17 1995/06/28 02:56:05 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)cpu.h 8.4 (Berkeley) 1/5/94 + */ + +#ifndef _CPU_H_ +#define _CPU_H_ + +/* + * CTL_MACHDEP definitinos. + */ +#define CPU_MAXID 1 /* no valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ +} + +#ifdef _KERNEL +/* + * Exported definitions unique to SPARC cpu support. + */ + +#include <machine/psl.h> +#include <sparc/sparc/intreg.h> + +/* + * definitions of cpu-dependent requirements + * referenced in generic code + */ +#define cpu_swapin(p) /* nothing */ +#define cpu_swapout(p) /* nothing */ +#define cpu_wait(p) /* nothing */ + +/* + * See syscall() for an explanation of the following. Note that the + * locore bootstrap code follows the syscall stack protocol. The + * framep argument is unused. + */ +#define cpu_set_init_frame(p, fp) \ + (p)->p_md.md_tf = (struct trapframe *) \ + ((caddr_t)(p)->p_addr + USPACE - sizeof(struct trapframe)) + +/* + * Arguments to hardclock, softclock and gatherstats encapsulate the + * previous machine state in an opaque clockframe. The ipl is here + * as well for strayintr (see locore.s:interrupt and intr.c:strayintr). + * Note that CLKF_INTR is valid only if CLKF_USERMODE is false. + */ +struct clockframe { + u_int psr; /* psr before interrupt, excluding PSR_ET */ + u_int pc; /* pc at interrupt */ + u_int npc; /* npc at interrupt */ + u_int ipl; /* actual interrupt priority level */ + u_int fp; /* %fp at interrupt */ +}; +typedef struct clockframe clockframe; + +extern int eintstack[]; + +#define CLKF_USERMODE(framep) (((framep)->psr & PSR_PS) == 0) +#define CLKF_BASEPRI(framep) (((framep)->psr & PSR_PIL) == 0) +#define CLKF_PC(framep) ((framep)->pc) +#define CLKF_INTR(framep) ((framep)->fp < (u_int)eintstack) + +/* + * Software interrupt request `register'. + */ +union sir { + int sir_any; + char sir_which[4]; +} sir; + +#define SIR_NET 0 +#define SIR_CLOCK 1 + +#define setsoftint() ienab_bis(IE_L1) +#define setsoftnet() (sir.sir_which[SIR_NET] = 1, setsoftint()) +#define setsoftclock() (sir.sir_which[SIR_CLOCK] = 1, setsoftint()) + +int want_ast; + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +int want_resched; /* resched() was called */ +#define need_resched() (want_resched = 1, want_ast = 1) + +/* + * Give a profiling tick to the current process when the user profiling + * buffer pages are invalid. On the sparc, request an ast to send us + * through trap(), marking the proc as needing a profiling tick. + */ +#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1) + +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +#define signotify(p) (want_ast = 1) + +/* + * Only one process may own the FPU state. + * + * XXX this must be per-cpu (eventually) + */ +struct proc *fpproc; /* FPU owner */ +int foundfpu; /* true => we have an FPU */ + +/* + * Interrupt handler chains. Interrupt handlers should return 0 for + * ``not me'' or 1 (``I took care of it''). intr_establish() inserts a + * handler into the list. The handler is called with its (single) + * argument, or with a pointer to a clockframe if ih_arg is NULL. + */ +struct intrhand { + int (*ih_fun) __P((void *)); + void *ih_arg; + struct intrhand *ih_next; +} *intrhand[15]; + +void intr_establish __P((int level, struct intrhand *)); +void vmeintr_establish __P((int vec, int level, struct intrhand *)); + +/* + * intr_fasttrap() is a lot like intr_establish, but is used for ``fast'' + * interrupt vectors (vectors that are not shared and are handled in the + * trap window). Such functions must be written in assembly. + */ +void intr_fasttrap __P((int level, void (*vec)(void))); + +/* + * + * The SPARC has a Trap Base Register (TBR) which holds the upper 20 bits + * of the trap vector table. The next eight bits are supplied by the + * hardware when the trap occurs, and the bottom four bits are always + * zero (so that we can shove up to 16 bytes of executable code---exactly + * four instructions---into each trap vector). + * + * The hardware allocates half the trap vectors to hardware and half to + * software. + * + * Traps have priorities assigned (lower number => higher priority). + */ + +struct trapvec { + int tv_instr[4]; /* the four instructions */ +}; +extern struct trapvec trapbase[256]; /* the 256 vectors */ + +extern void wzero __P((void *, u_int)); +extern void wcopy __P((const void *, void *, u_int)); + +#endif /* _KERNEL */ +#endif /* _CPU_H_ */ diff --git a/sys/arch/sparc/include/ctlreg.h b/sys/arch/sparc/include/ctlreg.h new file mode 100644 index 00000000000..7ba5f7eea30 --- /dev/null +++ b/sys/arch/sparc/include/ctlreg.h @@ -0,0 +1,202 @@ +/* $NetBSD: ctlreg.h,v 1.8 1995/06/25 21:35:05 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)ctlreg.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Sun-4, 4c, and 4m control registers. (includes address space definitions + * and some registers in control space). + */ + +/* 0x00 unused */ +/* 0x01 unused */ +#if defined(SUN4C) || defined(SUN4) +#define ASI_CONTROL 0x02 /* cache enable, context reg, etc */ +#define ASI_SEGMAP 0x03 /* segment maps (so we can reach each pmeg) */ +#define ASI_PTE 0x04 /* PTE space (pmegs) */ +#define ASI_REGMAP 0x06 /* region maps (3 level MMUs only) */ +#define ASI_HWFLUSHSEG 0x05 /* hardware assisted version of FLUSHSEG */ +#define ASI_HWFLUSHPG 0x06 /* hardware assisted version of FLUSHPG */ +#define ASI_HWFLUSHCTX 0x07 /* hardware assisted version of FLUSHCTX */ +#endif +#if defined(SUN4M) +#define ASI_SRMMUFP 0x03 /* ref mmu flush/probe */ +#define ASI_SRMMUFP_L3 (0<<8) /* probe L3 | flush L3 PTE */ +#define ASI_SRMMUFP_L2 (1<<8) /* probe L2 | flush L2/L3 PTE/PTD's */ +#define ASI_SRMMUFP_L1 (2<<8) /* probe L1 | flush L1/L2/L3 PTE/PTD's*/ +#define ASI_SRMMUFP_L0 (3<<8) /* probe L0 | flush L0/L1/L2/L3 PTE/PTD's */ +#define ASI_SRMMUFP_LN (4<<8) /* probe all | flush all levels */ + +#define ASI_SRMMU 0x04 /* ref mmu registers */ +#define ASI_SRMMUDIAG 0x06 +#endif + +#define ASI_USERI 0x08 /* I-space (user) */ +#define ASI_KERNELI 0x09 /* I-space (kernel) */ +#define ASI_USERD 0x0a /* D-space (user) */ +#define ASI_KERNELD 0x0b /* D-space (kernel) */ + +#if defined(SUN4C) || defined(SUN4) +#define ASI_FLUSHREG 0x7 /* causes hardware to flush cache region */ +#define ASI_FLUSHSEG 0x0c /* causes hardware to flush cache segment */ +#define ASI_FLUSHPG 0x0d /* causes hardware to flush cache page */ +#define ASI_FLUSHCTX 0x0e /* causes hardware to flush cache context */ +#endif +#if defined(SUN4) +#define ASI_DCACHE 0x0f /* flush data cache; not used on 4c */ +#endif + +#if defined(SUN4M) +#define ASI_ICACHETAG 0x0c /* instruction cache tag */ +#define ASI_ICACHEDATA 0x0d /* instruction cache data */ +#define ASI_DCACHETAG 0x0e /* data cache tag */ +#define ASI_DCACHEDATA 0x0f /* data cache data */ +#define ASI_IDCACHELFP 0x10 /* ms2 only: flush i&d cache line (page) */ +#define ASI_IDCACHELFS 0x11 /* ms2 only: flush i&d cache line (seg) */ +#define ASI_IDCACHELFR 0x12 /* ms2 only: flush i&d cache line (reg) */ +#define ASI_IDCACHELFC 0x13 /* ms2 only: flush i&d cache line (ctxt) */ +#define ASI_IDCACHELFU 0x14 /* ms2 only: flush i&d cache line (user) */ +#define ASI_BYPASS 0x20 /* sun ref mmu bypass, ie. direct phys access */ +#define ASI_ICACHECLR 0x36 /* ms1 only: instruction cache flash clear */ +#define ASI_DCACHECLR 0x37 /* ms1 only: data cache clear */ +#define ASI_DCACHEDIAG 0x39 /* data cache diagnostic register access */ +#endif + +#if defined(SUN4C) || defined(SUN4) +/* registers in the control space */ +#define AC_CONTEXT 0x30000000 /* context register (byte) */ +#define AC_SYSENABLE 0x40000000 /* system enable register (byte) */ +#define AC_CACHETAGS 0x80000000 /* cache tag base address */ +#define AC_SERIAL 0xf0000000 /* special serial port sneakiness */ + /* AC_SERIAL is not used in the kernel (it is for the PROM) */ +#endif + +#if defined(SUN4) +#define AC_IDPROM 0x00000000 /* ID PROM */ +#define AC_DVMA_ENABLE 0x50000000 /* enable user dvma */ +#define AC_BUS_ERR 0x60000000 /* bus error register */ +#define AC_DIAG_REG 0x70000000 /* diagnostic reg */ +#define AC_DVMA_MAP 0xd0000000 /* user dvma map entries */ +#define AC_VMEINTVEC 0xe0000000 /* vme interrupt vector */ + +/* XXX: does not belong here */ +#define ME_REG_IERR 0x80 /* memory err ctrl reg error intr pending bit */ +#endif + +#if defined(SUN4C) +#define AC_SYNC_ERR 0x60000000 /* sync (memory) error reg */ +#define AC_SYNC_VA 0x60000004 /* sync error virtual addr */ +#define AC_ASYNC_ERR 0x60000008 /* async error reg */ +#define AC_ASYNC_VA 0x6000000c /* async error virtual addr */ +#define AC_CACHEDATA 0x90000000 /* cached data */ +#endif + +#if defined(SUN4C) || defined(SUN4) +/* + * Bits in sync error register. Reading the register clears these; + * otherwise they accumulate. The error(s) occurred at the virtual + * address stored in the sync error address register, and may have + * been due to, e.g., what would usually be called a page fault. + * Worse, the bits accumulate during instruction prefetch, so + * various bits can be on that should be off. + */ +#define SER_WRITE 0x8000 /* error occurred during write */ +#define SER_INVAL 0x80 /* PTE had PG_V off */ +#define SER_PROT 0x40 /* operation violated PTE prot */ +#define SER_TIMEOUT 0x20 /* bus timeout (non-existent mem) */ +#define SER_SBUSERR 0x10 /* S-Bus bus error */ +#define SER_MEMERR 0x08 /* memory ecc/parity error */ +#define SER_SZERR 0x02 /* size error, whatever that is */ +#define SER_WATCHDOG 0x01 /* watchdog reset (never see this) */ + +#define SER_BITS \ +"\20\20WRITE\10INVAL\7PROT\6TIMEOUT\5SBUSERR\4MEMERR\2SZERR\1WATCHDOG" + +/* + * Bits in async error register (errors from DVMA or Sun-4 cache + * writeback). The corresponding bit is also set in the sync error reg. + * + * A writeback invalid error means there is a bug in the PTE manager. + * + * The word is that the async error register does not work right. + */ +#define AER_WBINVAL 0x80 /* writeback found PTE without PG_V */ +#define AER_TIMEOUT 0x20 /* bus timeout */ +#define AER_DVMAERR 0x10 /* bus error during DVMA */ + +#define AER_BITS "\20\10WBINVAL\6TIMEOUT\5DVMAERR" + +/* + * Bits in system enable register. + */ +#define SYSEN_DVMA 0x20 /* Enable dvma */ +#define SYSEN_CACHE 0x10 /* Enable cache */ +#define SYSEN_IOCACHE 0x40 /* Enable IO cache */ +#define SYSEN_RESET 0x04 /* Reset the hardware */ +#define SYSEN_RESETVME 0x02 /* Reset the VME bus */ +#endif + +#if defined(SUN4M) +#define SRMMU_PCR 0x00000000 /* Processor control register */ +#define SRMMU_CXTPTR 0x00000100 /* Context table pointer register */ +#define SRMMU_CXR 0x00000200 /* Context register */ +#define SRMMU_SFSTAT 0x00000300 /* Synchronous fault status reg */ +#define SRMMU_SFADDR 0x00000400 /* Synchronous fault address reg */ +#define SRMMU_TLBCTRL 0x00001000 /* TLB replacement control reg */ + +/* Synchronous Fault Status Register bits */ +#define SFSR_CS 0x00010000 /* Control Space error */ +#define SFSR_PERR 0x00006000 /* Parity error code */ +#define SFSR_TO 0x00000800 /* S-Bus timeout */ +#define SFSR_BE 0x00000400 /* S-Bus bus error */ +#define SFSR_LVL 0x00000300 /* Pagetable level causing the fault */ +#define SFSR_AT 0x000000e0 /* Access type */ +#define SFSR_FT 0x0000001c /* Fault type */ +#define SFSR_FAV 0x00000002 /* Fault Address is valid */ +#define SFSR_OW 0x00000001 /* Overwritten with new fault */ + +/* TLB Replacement Control Register bits */ +#define TLBC_DISABLE 0x00000020 /* Disable replacement counter */ +#define TLBC_RCNTMASK 0x0000001f /* Replacement counter (0-31) */ +#endif diff --git a/sys/arch/sparc/include/db_machdep.h b/sys/arch/sparc/include/db_machdep.h new file mode 100644 index 00000000000..92b5fa14d50 --- /dev/null +++ b/sys/arch/sparc/include/db_machdep.h @@ -0,0 +1,81 @@ +/* $NetBSD: db_machdep.h,v 1.3 1995/02/09 10:34:21 pk Exp $ */ + +/* + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +#ifndef _SPARC_DB_MACHDEP_H_ +#define _SPARC_DB_MACHDEP_H_ + +/* + * Machine-dependent defines for new kernel debugger. + */ + + +#include <vm/vm_prot.h> +#include <vm/vm_param.h> +#include <vm/vm_inherit.h> +#include <vm/lock.h> +#include <machine/frame.h> +#include <machine/psl.h> +#include <machine/trap.h> +#include <machine/reg.h> + +/* end of mangling */ + +typedef vm_offset_t db_addr_t; /* address - unsigned */ +typedef int db_expr_t; /* expression - signed */ + +typedef struct { + struct trapframe ddb_tf; + struct frame ddb_fr; +} db_regs_t; + +db_regs_t ddb_regs; /* register state */ +#define DDB_REGS (&ddb_regs) +#define DDB_TF (&ddb_regs.ddb_tf) +#define DDB_FR (&ddb_regs.ddb_fr) + +#define PC_REGS(regs) ((db_addr_t)(regs)->ddb_tf.tf_pc) + +#define BKPT_INST 0x91d02001 /* breakpoint instruction */ +#define BKPT_SIZE (4) /* size of breakpoint inst */ +#define BKPT_SET(inst) (BKPT_INST) + +#define db_clear_single_step(regs) (0) +#define db_set_single_step(regs) (0) + +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT) +#define IS_WATCHPOINT_TRAP(type, code) (0) + +#define inst_trap_return(ins) ((ins)&0) +#define inst_return(ins) ((ins)&0) +#define inst_call(ins) ((ins)&0) +#define inst_load(ins) 0 +#define inst_store(ins) 0 + +#define DB_MACHINE_COMMANDS + +#endif /* _SPARC_DB_MACHDEP_H_ */ diff --git a/sys/arch/sparc/include/disklabel.h b/sys/arch/sparc/include/disklabel.h new file mode 100644 index 00000000000..3b4601fb0f2 --- /dev/null +++ b/sys/arch/sparc/include/disklabel.h @@ -0,0 +1,45 @@ +/* $NetBSD: disklabel.h,v 1.4 1995/09/01 17:20:31 pk Exp $ */ + +/* + * Copyright (c) 1994 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_DISKLABEL_H_ +#define _MACHINE_DISKLABEL_H_ + +#define LABELSECTOR 0 /* sector containing label */ +#define LABELOFFSET 64 /* offset of label in sector */ +#define MAXPARTITIONS 8 /* number of partitions */ +#define RAW_PART 2 /* raw partition: xx?c */ + +struct cpu_disklabel { + char cd_block[512]; +}; + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/sparc/include/eeprom.h b/sys/arch/sparc/include/eeprom.h new file mode 100644 index 00000000000..902153d3f04 --- /dev/null +++ b/sys/arch/sparc/include/eeprom.h @@ -0,0 +1,183 @@ +/* $NetBSD: eeprom.h,v 1.2 1995/08/29 22:11:58 pk Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Structure/definitions for the Sun3/Sun4 EEPROM. + * + * This information is published in the Sun document: + * "PROM User's Manual", part number 800-1736010. + */ + + +/* + * Note that most places where the PROM stores a "true/false" flag, + * the true value is 0x12 and false is the usual zero. Such flags + * all take the values EE_TRUE or EE_FALSE so this file does not + * need to define so many value macros. + */ +#define EE_TRUE 0x12 +#define EE_FALSE 0 + +struct eeprom { + + /* 0x00 */ + u_char eeTestArea[4]; /* Factory Defined */ + u_short eeWriteCount[4]; /* || || */ + u_char eeChecksum[4]; /* || || */ + time_t eeLastHwUpdate; /* || || */ + + /* 0x14 */ + u_char eeInstalledMem; /* Megabytes */ + u_char eeMemTestSize; /* || */ + + /* 0x16 */ + u_char eeScreenSize; +#define EE_SCR_1152X900 0x00 +#define EE_SCR_1024X1024 0x12 +#define EE_SCR_1600X1280 0x13 +#define EE_SCR_1440X1440 0x14 + + u_char eeWatchDogDoesReset; /* Watchdog timeout action: + * true: reset/reboot + * false: return to monitor + */ + /* 0x18 */ + u_char eeBootDevStored; /* Is the boot device stored: + * true: use stored device spec. + * false: use default (try all) + */ + /* Stored boot device spec. i.e.: "sd(Ctlr,Unit,Part)" */ + u_char eeBootDevName[2]; /* xy,xd,sd,ie,le,st,xt,mt,... */ + u_char eeBootDevCtlr; + u_char eeBootDevUnit; + u_char eeBootDevPart; + + /* 0x1E */ + u_char eeKeyboardType; /* zero for sun keyboards */ + u_char eeConsole; /* What to use for the console */ +#define EE_CONS_BW 0x00 /* - On-board B&W / keyboard */ +#define EE_CONS_TTYA 0x10 /* - serial port A */ +#define EE_CONS_TTYB 0x11 /* - serial port B */ +#define EE_CONS_COLOR 0x12 /* - Color FB / keyboard */ +#define EE_CONS_P4OPT 0x20 /* - Option board on P4 */ + + /* 0x20 */ + u_char eeCustomBanner; /* Is there a custom banner: + * true: use text at 0x68 + * false: use Sun banner + */ + + u_char eeKeyClick; /* true/false */ + + /* Boot device with "Diag" switch in Diagnostic mode: */ + u_char eeDiagDevName[2]; + u_char eeDiagDevCtlr; + u_char eeDiagDevUnit; + u_char eeDiagDevPart; + + /* Video white-on-black (not implemented) */ + u_char eeWhiteOnBlack; /* true/false */ + + /* 0x28 */ + char eeDiagPath[40]; /* path name of diag program */ + + /* 0x50 */ + u_char eeTtyCols; /* normally 80 */ + u_char eeTtyRows; /* normally 34 */ + u_char ee_x52[6]; /* unused */ + + /* 0x58 */ + /* Default parameters for tty A and tty B: */ + struct eeTtyDef { + u_char eetBaudSet; /* Is the baud rate set? + * true: use values here + * false: use default (9600) + */ + u_char eetBaudHi; /* i.e. 96.. */ + u_char eetBaudLo; /* ..00 */ + u_char eetNoRtsDtr; /* true: disable H/W flow + * false: enable H/W flow */ + u_char eet_pad[4]; + } eeTtyDefA, eeTtyDefB; + + /* 0x68 */ + char eeBannerString[80]; /* see eeCustomBanner above */ + + /* 0xB8 */ + u_short eeTestPattern; /* must be 0xAA55 */ + u_short ee_xBA; /* unused */ + + /* 0xBC */ + /* Configuration data. Hopefully we don't need it. */ + struct eeConf { + u_char eecData[16]; + } eeConf[12+1]; + + /* 0x18c */ + u_char eeAltKeyTable; /* What Key table to use: + * 0x58: EEPROM tables + * else: PROM key tables + */ + u_char eeKeyboardLocale; /* extended keyboard type */ + u_char eeKeyboardID; /* for EEPROM key tables */ + u_char eeCustomLogo; /* true: use eeLogoBitmap */ + + /* 0x190 */ + u_char eeKeymapLC[0x80]; + u_char eeKeymapUC[0x80]; + + /* 0x290 */ + u_char eeLogoBitmap[64][8]; /* 64x64 bit custom logo */ + + /* 0x490 */ + u_char ee_x490[0x500-0x490]; /* unused */ + + /* Other stuff we don't care about... */ + /* 0x500 */ + u_char eeReserved[0x100]; + /* 0x600 */ + u_char eeROM_Area[0x100]; + /* 0x700 */ + u_char eeUnixArea[0x100]; +}; + +/* + * The size of the eeprom on machines with the old clock is 2k. However, + * on machines with the new clock (and the `eeprom' in the nvram area) + * there are only 2040 bytes available. (???). Since we really only + * care about the `diagnostic' area, we'll use it's size when dealing + * with the eeprom in general. + */ +#define EEPROM_SIZE 0x500 + +#ifdef _KERNEL +extern char *eeprom_va; +int eeprom_uio __P((struct uio *)); +#endif /* _KERNEL */ + diff --git a/sys/arch/sparc/include/endian.h b/sys/arch/sparc/include/endian.h new file mode 100644 index 00000000000..a7004e09ea6 --- /dev/null +++ b/sys/arch/sparc/include/endian.h @@ -0,0 +1,85 @@ +/* $NetBSD: endian.h,v 1.2 1994/11/20 20:53:01 deraadt Exp $ */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)endian.h 7.7 (Berkeley) 4/3/91 + */ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +#define _QUAD_HIGHWORD 0 +#define _QUAD_LOWWORD 1 + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER BIG_ENDIAN + +#include <sys/cdefs.h> + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +/* + * Macros for network/external number representation conversion. + */ +#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) +#define NTOHS(x) (x) +#define HTONL(x) (x) +#define HTONS(x) (x) + +#else + +#define NTOHL(x) (x) = ntohl((u_long)x) +#define NTOHS(x) (x) = ntohs((u_short)x) +#define HTONL(x) (x) = htonl((u_long)x) +#define HTONS(x) (x) = htons((u_short)x) +#endif + +#endif /* _MACHINE_ENDIAN_H_ */ diff --git a/sys/arch/sparc/include/exec.h b/sys/arch/sparc/include/exec.h new file mode 100644 index 00000000000..beac6897c05 --- /dev/null +++ b/sys/arch/sparc/include/exec.h @@ -0,0 +1,60 @@ +/* $NetBSD: exec.h,v 1.7 1994/11/20 20:53:02 deraadt Exp $ */ + +/* + * Copyright (c) 1993 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SPARC_EXEC_H_ +#define _SPARC_EXEC_H_ + +#define __LDPGSZ 8192 /* linker page size */ + +enum reloc_type { + RELOC_8, RELOC_16, RELOC_32, + RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, + RELOC_WDISP30, RELOC_WDISP22, + RELOC_HI22, RELOC_22, + RELOC_13, RELOC_LO10, + RELOC_UNUSED1, RELOC_UNUSED2, + RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, + RELOC_PC10, RELOC_PC22, + RELOC_JMP_TBL, + RELOC_UNUSED3, + RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, +}; + +/* Relocation format. */ +struct relocation_info_sparc { + int r_address; /* offset in text or data segment */ + unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ + r_extern : 1, /* 1 if need to add symbol to value */ + : 2; /* unused bits */ + enum reloc_type r_type : 5; /* relocation type time copy */ + long r_addend; /* relocation addend */ +}; +#define relocation_info relocation_info_sparc + +#endif /* _SPARC_EXEC_H_ */ diff --git a/sys/arch/sparc/include/fbio.h b/sys/arch/sparc/include/fbio.h new file mode 100644 index 00000000000..a80ec853cb2 --- /dev/null +++ b/sys/arch/sparc/include/fbio.h @@ -0,0 +1,185 @@ +/* $NetBSD: fbio.h,v 1.3 1994/11/20 20:53:03 deraadt Exp $ */ + +/* + * Copyright (c) 1992 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software developed by the Computer Systems + * Engineering group at Lawrence Berkeley Laboratory under DARPA + * contract BG 91-66 and contributed to Berkeley. + * + * 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. + * + * @(#)fbio.h 7.2 (Berkeley) 4/1/92 + */ + +/* + * Frame buffer ioctls (from Sprite, trimmed to essentials for X11). + */ + +/* + * Frame buffer type codes. + */ +#define FBTYPE_SUN1BW 0 /* multibus mono */ +#define FBTYPE_SUN1COLOR 1 /* multibus color */ +#define FBTYPE_SUN2BW 2 /* memory mono */ +#define FBTYPE_SUN2COLOR 3 /* color w/rasterop chips */ +#define FBTYPE_SUN2GP 4 /* GP1/GP2 */ +#define FBTYPE_SUN5COLOR 5 /* RoadRunner accelerator */ +#define FBTYPE_SUN3COLOR 6 /* memory color */ +#define FBTYPE_MEMCOLOR 7 /* memory 24-bit */ +#define FBTYPE_SUN4COLOR 8 /* memory color w/overlay */ + +#define FBTYPE_NOTSUN1 9 /* reserved for customer */ +#define FBTYPE_NOTSUN2 10 /* reserved for customer */ +#define FBTYPE_NOTSUN3 11 /* reserved for customer */ + +#define FBTYPE_SUNFAST_COLOR 12 /* accelerated 8bit */ +#define FBTYPE_SUNROP_COLOR 13 /* MEMCOLOR with rop h/w */ +#define FBTYPE_SUNFB_VIDEO 14 /* Simple video mixing */ +#define FBTYPE_RESERVED5 15 /* reserved, do not use */ +#define FBTYPE_RESERVED4 16 /* reserved, do not use */ +#define FBTYPE_RESERVED3 17 /* reserved, do not use */ +#define FBTYPE_RESERVED2 18 /* reserved, do not use */ +#define FBTYPE_RESERVED1 19 /* reserved, do not use */ + +#define FBTYPE_LASTPLUSONE 20 /* max number of fbs (change as add) */ + +/* + * Frame buffer descriptor as returned by FBIOGTYPE. + */ +struct fbtype { + int fb_type; /* as defined above */ + int fb_height; /* in pixels */ + int fb_width; /* in pixels */ + int fb_depth; /* bits per pixel */ + int fb_cmsize; /* size of color map (entries) */ + int fb_size; /* total size in bytes */ +}; +#define FBIOGTYPE _IOR('F', 0, struct fbtype) + +#ifdef notdef +/* + * General purpose structure for passing info in and out of frame buffers + * (used for gp1) -- unsupported. + */ +struct fbinfo { + int fb_physaddr; /* physical frame buffer address */ + int fb_hwwidth; /* fb board width */ + int fb_hwheight; /* fb board height */ + int fb_addrdelta; /* phys addr diff between boards */ + u_char *fb_ropaddr; /* fb virtual addr */ + int fb_unit; /* minor devnum of fb */ +}; +#define FBIOGINFO _IOR('F', 2, struct fbinfo) +#endif + +/* + * Color map I/O. + */ +struct fbcmap { + int index; /* first element (0 origin) */ + int count; /* number of elements */ + u_char *red; /* red color map elements */ + u_char *green; /* green color map elements */ + u_char *blue; /* blue color map elements */ +}; +#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap) +#define FBIOGETCMAP _IOW('F', 4, struct fbcmap) + +/* + * Set/get attributes. + */ +#define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */ +#define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */ + +struct fbsattr { + int flags; /* flags; see below */ + int emu_type; /* emulation type (-1 if unused) */ + int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */ +}; +#define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */ +#define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */ + +struct fbgattr { + int real_type; /* real device type */ + int owner; /* PID of owner, 0 if myself */ + struct fbtype fbtype; /* fbtype info for real device */ + struct fbsattr sattr; /* see above */ + int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */ + /* (-1 if unused) */ +}; +/* FBIOSATTR _IOW('F', 5, struct fbsattr) -- unsupported */ +#define FBIOGATTR _IOR('F', 6, struct fbgattr) + +/* + * Video control. + */ +#define FBVIDEO_OFF 0 +#define FBVIDEO_ON 1 + +#define FBIOSVIDEO _IOW('F', 7, int) +#define FBIOGVIDEO _IOR('F', 8, int) + +/* + * hardware cursor control + */ +struct fbcurpos { + short x; + short y; +}; + +#define FB_CUR_SETCUR 0x01 +#define FB_CUR_SETPOS 0x02 +#define FB_CUR_SETHOT 0x04 +#define FB_CUR_SETCMAP 0x08 +#define FB_CUR_SETSHAPE 0x10 +#define FB_CUR_SETALL 0x1F + +struct fbcursor { + short set; /* what to set */ + short enable; /* enable/disable cursor */ + struct fbcurpos pos; /* cursor's position */ + struct fbcurpos hot; /* cursor's hot spot */ + struct fbcmap cmap; /* color map info */ + struct fbcurpos size; /* cursor's bit map size */ + char *image; /* cursor's image bits */ + char *mask; /* cursor's mask bits */ +}; + +/* set/get cursor attributes/shape */ +#define FBIOSCURSOR _IOW('F', 24, struct fbcursor) +#define FBIOGCURSOR _IOWR('F', 25, struct fbcursor) + +/* set/get cursor position */ +#define FBIOSCURPOS _IOW('F', 26, struct fbcurpos) +#define FBIOGCURPOS _IOW('F', 27, struct fbcurpos) + +/* get max cursor size */ +#define FBIOGCURMAX _IOR('F', 28, struct fbcurpos) diff --git a/sys/arch/sparc/include/fbvar.h b/sys/arch/sparc/include/fbvar.h new file mode 100644 index 00000000000..1b00249ae50 --- /dev/null +++ b/sys/arch/sparc/include/fbvar.h @@ -0,0 +1,89 @@ +/* $NetBSD: fbvar.h,v 1.5 1995/10/08 01:40:25 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)fbvar.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Frame buffer variables. All frame buffer drivers must provide the + * following in order to participate. + */ + +#ifdef RASTERCONSOLE +#include <dev/rcons/rcons.h> +#endif + +struct fbdriver { + /* device unblank function (force kernel output to display) */ + void (*fbd_unblank) __P((struct device *)); + int (*fbd_open) __P((dev_t, int, int, struct proc *)); + int (*fbd_close) __P((dev_t, int, int, struct proc *)); + int (*fbd_ioctl) __P((dev_t, u_long, caddr_t, int, struct proc *)); + int (*fbd_mmap) __P((dev_t, int, int)); +#ifdef notyet + void (*fbd_wrrop)(); /* `write region' rasterop */ + void (*fbd_cprop)(); /* `copy region' rasterop */ + void (*fbd_clrop)(); /* `clear region' rasterop */ +#endif +}; + +struct fbdevice { + int fb_major; /* XXX */ + struct fbtype fb_type; /* what it says */ + caddr_t fb_pixels; /* display RAM */ + int fb_linebytes; /* bytes per display line */ + + struct fbdriver *fb_driver; /* pointer to driver */ + struct device *fb_device; /* parameter for fbd_unblank */ + +#ifdef RASTERCONSOLE + /* Raster console emulator state */ + struct rconsole fb_rcons; +#endif +}; + +void fbattach __P((struct fbdevice *)); +void fb_setsize __P((struct fbdevice *, int, int, int, int, int)); +#ifdef RASTERCONSOLE +void fbrcons_init __P((struct fbdevice *)); +#endif diff --git a/sys/arch/sparc/include/float.h b/sys/arch/sparc/include/float.h new file mode 100644 index 00000000000..8022d3aa8b4 --- /dev/null +++ b/sys/arch/sparc/include/float.h @@ -0,0 +1,89 @@ +/* $NetBSD: float.h,v 1.5 1995/06/20 20:45:53 jtc Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)float.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _SPARC_FLOAT_H_ +#define _SPARC_FLOAT_H_ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +extern int __flt_rounds(); +__END_DECLS + +#define FLT_RADIX 2 /* b */ +#define FLT_ROUNDS __flt_rounds() + +#define FLT_MANT_DIG 24 /* p */ +#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ +#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define FLT_MIN_EXP -125 /* emin */ +#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ +#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */ +#define FLT_MAX_EXP 128 /* emax */ +#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ +#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503131E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP -1021 +#define DBL_MIN 2.2250738585072014E-308 +#define DBL_MIN_10_EXP -307 +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MAX_10_EXP 308 + +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EPSILON DBL_EPSILON +#define LDBL_DIG DBL_DIG +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MIN DBL_MIN +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MAX DBL_MAX +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP + +#endif /* _SPARC_FLOAT_H_ */ diff --git a/sys/arch/sparc/include/frame.h b/sys/arch/sparc/include/frame.h new file mode 100644 index 00000000000..bc72dfff806 --- /dev/null +++ b/sys/arch/sparc/include/frame.h @@ -0,0 +1,67 @@ +/* $NetBSD: frame.h,v 1.2 1994/11/20 20:53:07 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)frame.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Sparc stack frame format. + * + * Note that the contents of each stack frame may be held only in + * machine register windows. In order to get an accurate picture + * of the frame, you must first force the kernel to write any such + * windows to the stack. + */ +struct frame { + int fr_local[8]; /* space to save locals (%l0..%l7) */ + int fr_arg[6]; /* space to save arguments (%i0..%i5) */ + struct frame *fr_fp; /* space to save frame pointer (%i6) */ + int fr_pc; /* space to save return pc (%i7) */ + /* + * SunOS reserves another 8 words here; this is pointless + * but we do it for compatibility. + */ + int fr_xxx; /* `structure return pointer' (unused) */ + int fr_argd[6]; /* `arg dump area' (lunacy) */ + int fr_argx[1]; /* arg extension (args 7..n; variable size) */ +}; diff --git a/sys/arch/sparc/include/fsr.h b/sys/arch/sparc/include/fsr.h new file mode 100644 index 00000000000..a1d43581015 --- /dev/null +++ b/sys/arch/sparc/include/fsr.h @@ -0,0 +1,116 @@ +/* $NetBSD: fsr.h,v 1.2 1994/11/20 20:53:08 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)fsr.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _MACHINE_FSR_H_ +#define _MACHINE_FSR_H_ + +/* + * Bits in FSR. + */ +#define FSR_RD 0xc0000000 /* rounding direction */ +#define FSR_RD_RN 0 /* round to nearest */ +#define FSR_RD_RZ 1 /* round towards 0 */ +#define FSR_RD_RP 2 /* round towards +inf */ +#define FSR_RD_RM 3 /* round towards -inf */ +#define FSR_RD_SHIFT 30 +#define FSR_RD_MASK 0x03 + +#define FSR_RP 0x30000000 /* extended rounding precision */ +#define FSR_RP_X 0 /* extended stays extended */ +#define FSR_RP_S 1 /* extended => single */ +#define FSR_RP_D 2 /* extended => double */ +#define FSR_RP_80 3 /* extended => 80-bit */ +#define FSR_RP_SHIFT 28 +#define FSR_RP_MASK 0x03 + +#define FSR_TEM 0x0f800000 /* trap enable mask */ +#define FSR_TEM_SHIFT 23 +#define FSR_TEM_MASK 0x1f + +#define FSR_NS 0x00400000 /* ``nonstandard mode'' */ +#define FSR_AU 0x00400000 /* aka abrupt underflow mode */ +#define FSR_MBZ 0x00300000 /* reserved; must be zero */ + +#define FSR_VER 0x000e0000 /* version bits */ +#define FSR_VER_SHIFT 17 +#define FSR_VER_MASK 0x07 + +#define FSR_FTT 0x0001c000 /* FP trap type */ +#define FSR_TT_NONE 0 /* no trap */ +#define FSR_TT_IEEE 1 /* IEEE exception */ +#define FSR_TT_UNFIN 2 /* unfinished operation */ +#define FSR_TT_UNIMP 3 /* unimplemented operation */ +#define FSR_TT_SEQ 4 /* sequence error */ +#define FSR_TT_HWERR 5 /* hardware error (unrecoverable) */ +#define FSR_FTT_SHIFT 14 +#define FSR_FTT_MASK 0x03 + +#define FSR_QNE 0x00002000 /* queue not empty */ +#define FSR_PR 0x00001000 /* partial result */ + +#define FSR_FCC 0x00000c00 /* FP condition codes */ +#define FSR_CC_EQ 0 /* f1 = f2 */ +#define FSR_CC_LT 1 /* f1 < f2 */ +#define FSR_CC_GT 2 /* f1 > f2 */ +#define FSR_CC_UO 3 /* (f1,f2) unordered */ +#define FSR_FCC_SHIFT 10 +#define FSR_FCC_MASK 0x03 + +#define FSR_AX 0x000003e0 /* accrued exceptions */ +#define FSR_AX_SHIFT 5 +#define FSR_AX_MASK 0x1f +#define FSR_CX 0x0000001f /* current exceptions */ +#define FSR_CX_SHIFT 0 +#define FSR_CX_MASK 0x1f + +/* The following exceptions apply to TEM, AX, and CX. */ +#define FSR_NV 0x10 /* invalid operand */ +#define FSR_OF 0x08 /* overflow */ +#define FSR_UF 0x04 /* underflow */ +#define FSR_DZ 0x02 /* division by zero */ +#define FSR_NX 0x01 /* inexact result */ + +#endif /* _MACHINE_FSR_H_ */ diff --git a/sys/arch/sparc/include/idprom.h b/sys/arch/sparc/include/idprom.h new file mode 100644 index 00000000000..6d8bbe23194 --- /dev/null +++ b/sys/arch/sparc/include/idprom.h @@ -0,0 +1,51 @@ +/* $NetBSD: idprom.h,v 1.4 1995/02/01 12:37:45 pk Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * ID prom format. The ``host id'' is set up by taking the machine + * ID as the top byte and the hostid field as the remaining three. + * The id_xxx0 field appears to contain some other number. The id_xxx1 + * contains a bunch of 00's and a5's on my machines, suggesting it is + * not actually used. The checksum seems to include them, however. + */ +struct idprom { + u_char id_format; /* format identifier (= 1) */ + u_char id_machine; /* machine type (see param.h) */ + u_char id_ether[6]; /* ethernet address */ + long id_date; /* date of manufacture */ + u_char id_hostid[3]; /* ``host id'' bytes */ + u_char id_checksum; /* xor of everything else */ + char id_undef[16]; /* undefined */ +}; + +#define IDPROM_VERSION 1 diff --git a/sys/arch/sparc/include/ieee.h b/sys/arch/sparc/include/ieee.h new file mode 100644 index 00000000000..188438c0d95 --- /dev/null +++ b/sys/arch/sparc/include/ieee.h @@ -0,0 +1,141 @@ +/* $NetBSD: ieee.h,v 1.2 1994/11/20 20:53:10 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. It does *not* define (yet?) any of the rounding + * mode bits, exceptions, and so forth. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACBITS 52 + +#ifdef notyet +#define E80_EXPBITS 15 +#define E80_FRACBITS 64 +#endif + +#define EXT_EXPBITS 15 +#define EXT_FRACBITS 112 + +struct ieee_single { + u_int sng_sign:1; + u_int sng_exp:8; + u_int sng_frac:23; +}; + +struct ieee_double { + u_int dbl_sign:1; + u_int dbl_exp:11; + u_int dbl_frach:20; + u_int dbl_fracl; +}; + +struct ieee_ext { + u_int ext_sign:1; + u_int ext_exp:15; + u_int ext_frach:16; + u_int ext_frachm; + u_int ext_fraclm; + u_int ext_fracl; +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 +#define EXT_EXP_INFNAN 32767 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#define EXT_QUIETNAN (1 << 15) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 +#define EXT_EXP_BIAS 16383 diff --git a/sys/arch/sparc/include/ieeefp.h b/sys/arch/sparc/include/ieeefp.h new file mode 100644 index 00000000000..87c19132039 --- /dev/null +++ b/sys/arch/sparc/include/ieeefp.h @@ -0,0 +1,23 @@ +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public domain. + */ + +#ifndef _SPARC_IEEEFP_H_ +#define _SPARC_IEEEFP_H_ + +typedef int fp_except; +#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ +#define FP_X_DZ 0x02 /* divide-by-zero exception */ +#define FP_X_UFL 0x04 /* underflow exception */ +#define FP_X_OFL 0x08 /* overflow exception */ +#define FP_X_INV 0x10 /* invalid operation exception */ + +typedef enum { + FP_RN=0, /* round to nearest representable number */ + FP_RZ=1, /* round to zero (truncate) */ + FP_RM=2, /* round toward negative infinity */ + FP_RP=3 /* round toward positive infinity */ +} fp_rnd; + +#endif /* _SPARC_IEEEFP_H_ */ diff --git a/sys/arch/sparc/include/instr.h b/sys/arch/sparc/include/instr.h new file mode 100644 index 00000000000..6aa7c24229d --- /dev/null +++ b/sys/arch/sparc/include/instr.h @@ -0,0 +1,360 @@ +/* $NetBSD: instr.h,v 1.2 1994/11/20 20:53:11 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)instr.h 8.1 (Berkeley) 6/11/93 + */ + +/* see also Appendix F of the SPARC version 8 document */ +enum IOP { IOP_OP2, IOP_CALL, IOP_reg, IOP_mem }; +enum IOP2 { IOP2_UNIMP, IOP2_err1, IOP2_Bicc, IOP2_err3, + IOP2_SETHI, IOP2_err5, IOP2_FBfcc, IOP2_CBccc }; +enum IOP3_reg { + IOP3_ADD, IOP3_AND, IOP3_OR, IOP3_XOR, + IOP3_SUB, IOP3_ANDN, IOP3_ORN, IOP3_XNOR, + IOP3_ADDX, IOP3_rerr09, IOP3_UMUL, IOP3_SMUL, + IOP3_SUBX, IOP3_rerr0d, IOP3_UDIV, IOP3_SDIV, + IOP3_ADDcc, IOP3_ANDcc, IOP3_ORcc, IOP3_XORcc, + IOP3_SUBcc, IOP3_ANDNcc, IOP3_ORNcc, IOP3_XNORcc, + IOP3_ADDXcc, IOP3_rerr19, IOP3_UMULcc, IOP3_SMULcc, + IOP3_SUBXcc, IOP3_rerr1d, IOP3_UDIVcc, IOP3_SDIVcc, + IOP3_TADDcc, IOP3_TSUBcc, IOP3_TADDccTV, IOP3_TSUBccTV, + IOP3_MULScc, IOP3_SLL, IOP3_SRL, IOP3_SRA, + IOP3_RDASR_RDY_STBAR, IOP3_RDPSR, IOP3_RDWIM, IOP3_RDTGBR, + IOP3_rerr2c, IOP3_rerr2d, IOP3_rerr2e, IOP3_rerr2f, + IOP3_WRASR_WRY, IOP3_WRPSR, IOP3_WRWIM, IOP3_WRTBR, + IOP3_FPop1, IOP3_FPop2, IOP3_CPop1, IOP3_CPop2, + IOP3_JMPL, IOP3_RETT, IOP3_Ticc, IOP3_FLUSH, + IOP3_SAVE, IOP3_RESTORE, IOP3_rerr3e, IOP3_rerr3f +}; +enum IOP3_mem { + IOP3_LD, IOP3_LDUB, IOP3_LDUH, IOP3_LDD, + IOP3_ST, IOP3_STB, IOP3_STH, IOP3_STD, + IOP3_merr08, IOP3_LDSB, IOP3_LDSH, IOP3_merr0b, + IOP3_merr0c, IOP3_LDSTUB, IOP3_merr0f, IOP3_SWAP, + IOP3_LDA, IOP3_LDUBA, IOP3_LDUHA, IOP3_LDDA, + IOP3_STA, IOP3_STBA, IOP3_STHA, IOP3_STDA, + IOP3_merr18, IOP3_LDSBA, IOP3_LDSHA, IOP3_merr1b, + IOP3_merr1c, IOP3_LDSTUBA, IOP3_merr1f, IOP3_SWAPA, + IOP3_LDF, IOP3_LDFSR, IOP3_merr22, IOP3_LDDF, + IOP3_STF, IOP3_STFSR, IOP3_STDFQ, IOP3_STDF, + IOP3_merr28, IOP3_merr29, IOP3_merr2a, IOP3_merr2b, + IOP3_merr2c, IOP3_merr2d, IOP3_merr2e, IOP3_merr2f, + IOP3_LFC, IOP3_LDCSR, IOP3_merr32, IOP3_LDDC, + IOP3_STC, IOP3_STCSR, IOP3_STDCQ, IOP3_STDC, + IOP3_merr38, IOP3_merr39, IOP3_merr3a, IOP3_merr3b, + IOP3_merr3c, IOP3_merr3d, IOP3_merr3e, IOP3_merr3f +}; + +/* + * Integer condition codes. + */ +#define Icc_N 0x0 /* never */ +#define Icc_E 0x1 /* equal (equiv. zero) */ +#define Icc_LE 0x2 /* less or equal */ +#define Icc_L 0x3 /* less */ +#define Icc_LEU 0x4 /* less or equal unsigned */ +#define Icc_CS 0x5 /* carry set (equiv. less unsigned) */ +#define Icc_NEG 0x6 /* negative */ +#define Icc_VS 0x7 /* overflow set */ +#define Icc_A 0x8 /* always */ +#define Icc_NE 0x9 /* not equal (equiv. not zero) */ +#define Icc_G 0xa /* greater */ +#define Icc_GE 0xb /* greater or equal */ +#define Icc_GU 0xc /* greater unsigned */ +#define Icc_CC 0xd /* carry clear (equiv. gtr or eq unsigned) */ +#define Icc_POS 0xe /* positive */ +#define Icc_VC 0xf /* overflow clear */ + +/* + * Integer registers. + */ +#define I_G0 0 +#define I_G1 1 +#define I_G2 2 +#define I_G3 3 +#define I_G4 4 +#define I_G5 5 +#define I_G6 6 +#define I_G7 7 +#define I_O0 8 +#define I_O1 9 +#define I_O2 10 +#define I_O3 11 +#define I_O4 12 +#define I_O5 13 +#define I_O6 14 +#define I_O7 15 +#define I_L0 16 +#define I_L1 17 +#define I_L2 18 +#define I_L3 19 +#define I_L4 20 +#define I_L5 21 +#define I_L6 22 +#define I_L7 23 +#define I_I0 24 +#define I_I1 25 +#define I_I2 26 +#define I_I3 27 +#define I_I4 28 +#define I_I5 29 +#define I_I6 30 +#define I_I7 31 + +/* + * An instruction. + */ +union instr { + int i_int; /* as a whole */ + + /* + * The first level of decoding is to use the top 2 bits. + * This gives us one of three `formats', which usually give + * a second level of decoding. + */ + struct { + u_int i_op:2; /* first-level decode */ + u_int :30; + } i_any; + + /* + * Format 1 instructions: CALL (undifferentiated). + */ + struct { + u_int :2; /* 01 */ + int i_disp:30; /* displacement */ + } i_call; + + /* + * Format 2 instructions (SETHI, UNIMP, and branches, plus illegal + * unused codes). + */ + struct { + u_int :2; /* 00 */ + u_int :5; + u_int i_op2:3; /* second-level decode */ + u_int :22; + } i_op2; + + /* UNIMP, SETHI */ + struct { + u_int :2; /* 00 */ + u_int i_rd:5; /* destination register */ + u_int i_op2:3; /* opcode: UNIMP or SETHI */ + u_int i_imm:22; /* immediate value */ + } i_imm22; + + /* branches: Bicc, FBfcc, CBccc */ + struct { + u_int :2; /* 00 */ + u_int i_annul:1; /* annul bit */ + u_int i_cond:4; /* condition codes */ + u_int i_op2:3; /* opcode: {Bi,FBf,CBc}cc */ + int i_disp:22; /* branch displacement */ + } i_branch; + + /* + * Format 3 instructions (memory reference; arithmetic, logical, + * shift, and other miscellaneous operations). The second-level + * decode almost always makes use of an `rd' and `rs1', however + * (see also IOP3_reg and IOP3_mem). + * + * Beyond that, the low 14 bits may be broken up in one of three + * different ways, if at all: + * 1 bit of imm=0 + 8 bits of asi + 5 bits of rs2 [reg & mem] + * 1 bit of imm=1 + 13 bits of signed immediate [reg & mem] + * 9 bits of copressor `opf' opcode + 5 bits of rs2 [reg only] + */ + struct { + u_int :2; /* 10 or 11 */ + u_int i_rd:5; /* destination register */ + u_int i_op3:6; /* second-level decode */ + u_int i_rs1:5; /* source register 1 */ + u_int i_low14:14; /* varies */ + } i_op3; + + /* + * Memory forms. These set i_op=3 and use simm13 or asi layout. + * Memory references without an ASI should use 0, but the actual + * ASI field is simply ignored. + */ + struct { + u_int :2; /* 11 only */ + u_int i_rd:5; /* destination register */ + u_int i_op3:6; /* second-level decode (see IOP3_mem) */ + u_int i_i:1; /* immediate vs asi */ + u_int i_low13:13; /* depend on i bit */ + } i_loadstore; + + /* + * Memory and register forms. + * These come in quite a variety and we do not + * attempt to break them down much. + */ + struct { + u_int :2; /* 10 or 11 */ + u_int i_rd:5; /* destination register */ + u_int i_op3:6; /* second-level decode */ + u_int i_rs1:5; /* source register 1 */ + u_int i_i:1; /* immediate bit (1) */ + int i_simm13:13; /* signed immediate */ + } i_simm13; + struct { + u_int :2; /* 10 or 11 */ + u_int i_rd:5; /* destination register */ + u_int i_op3:6; /* second-level decode */ + u_int i_rs1:5; /* source register 1 */ + u_int i_asi:8; /* asi */ + u_int i_rs2:5; /* source register 2 */ + } i_asi; + struct { + u_int :2; /* 10 only (register, no memory) */ + u_int i_rd:5; /* destination register */ + u_int i_op3:6; /* second-level decode (see IOP3_reg) */ + u_int i_rs1:5; /* source register 1 */ + u_int i_opf:9; /* coprocessor 3rd-level decode */ + u_int i_rs2:5; /* source register 2 */ + } i_opf; + +}; + +/* + * Internal macros for building instructions. These correspond 1-to-1 to + * the names above. Note that x << y | z == (x << y) | z. + */ +#define _I_ANY(op, b) ((op) << 30 | (b)) + +#define _I_OP2(high, op2, low) \ + _I_ANY(IOP_OP2, (high) << 25 | (op2) << 22 | (low)) +#define _I_IMM22(rd, op2, imm) \ + _I_ANY(IOP_OP2, (rd) << 25 | (op2) << 22 | (imm)) +#define _I_BRANCH(a, c, op2, disp) \ + _I_ANY(IOP_OP2, (a) << 29 | (c) << 25 | (op2) << 22 | (disp)) +#define _I_FBFCC(a, cond, disp) \ + _I_BRANCH(a, cond, IOP2_FBfcc, disp) +#define _I_CBCCC(a, cond, disp) \ + _I_BRANCH(a, cond, IOP2_CBccc, disp) + +#define _I_SIMM(simm) (1 << 13 | ((simm) & 0x1fff)) + +#define _I_OP3_GEN(form, rd, op3, rs1, low14) \ + _I_ANY(form, (rd) << 25 | (op3) << 19 | (rs1) << 14 | (low14)) +#define _I_OP3_LS_RAR(rd, op3, rs1, asi, rs2) \ + _I_OP3_GEN(IOP_mem, rd, op3, rs1, (asi) << 5 | (rs2)) +#define _I_OP3_LS_RI(rd, op3, rs1, simm13) \ + _I_OP3_GEN(IOP_mem, rd, op3, rs1, _I_SIMM(simm13)) +#define _I_OP3_LS_RR(rd, op3, rs1, rs2) \ + _I_OP3_GEN(IOP_mem, rd, op3, rs1, rs2) +#define _I_OP3_R_RAR(rd, op3, rs1, asi, rs2) \ + _I_OP3_GEN(IOP_reg, rd, op3, rs1, (asi) << 5 | (rs2)) +#define _I_OP3_R_RI(rd, op3, rs1, simm13) \ + _I_OP3_GEN(IOP_reg, rd, op3, rs1, _I_SIMM(simm13)) +#define _I_OP3_R_RR(rd, op3, rs1, rs2) \ + _I_OP3_GEN(IOP_reg, rd, op3, rs1, rs2) + +#define I_CALL(d) _I_ANY(IOP_CALL, d) +#define I_UNIMP(v) _I_IMM22(0, IOP2_UNIMP, v) +#define I_BN(a, d) _I_BRANCH(a, Icc_N, IOP2_Bicc, d) +#define I_BE(a, d) _I_BRANCH(a, Icc_E, IOP2_Bicc, d) +#define I_BZ(a, d) _I_BRANCH(a, Icc_E, IOP2_Bicc, d) +#define I_BLE(a, d) _I_BRANCH(a, Icc_LE, IOP2_Bicc, d) +#define I_BL(a, d) _I_BRANCH(a, Icc_L, IOP2_Bicc, d) +#define I_BLEU(a, d) _I_BRANCH(a, Icc_LEU, IOP2_Bicc, d) +#define I_BCS(a, d) _I_BRANCH(a, Icc_CS, IOP2_Bicc, d) +#define I_BLU(a, d) _I_BRANCH(a, Icc_CS, IOP2_Bicc, d) +#define I_BNEG(a, d) _I_BRANCH(a, Icc_NEG, IOP2_Bicc, d) +#define I_BVS(a, d) _I_BRANCH(a, Icc_VS, IOP2_Bicc, d) +#define I_BA(a, d) _I_BRANCH(a, Icc_A, IOP2_Bicc, d) +#define I_B(a, d) _I_BRANCH(a, Icc_A, IOP2_Bicc, d) +#define I_BNE(a, d) _I_BRANCH(a, Icc_NE, IOP2_Bicc, d) +#define I_BNZ(a, d) _I_BRANCH(a, Icc_NE, IOP2_Bicc, d) +#define I_BG(a, d) _I_BRANCH(a, Icc_G, IOP2_Bicc, d) +#define I_BGE(a, d) _I_BRANCH(a, Icc_GE, IOP2_Bicc, d) +#define I_BGU(a, d) _I_BRANCH(a, Icc_GU, IOP2_Bicc, d) +#define I_BCC(a, d) _I_BRANCH(a, Icc_CC, IOP2_Bicc, d) +#define I_BGEU(a, d) _I_BRANCH(a, Icc_CC, IOP2_Bicc, d) +#define I_BPOS(a, d) _I_BRANCH(a, Icc_POS, IOP2_Bicc, d) +#define I_BVC(a, d) _I_BRANCH(a, Icc_VC, IOP2_Bicc, d) +#define I_SETHI(r, v) _I_IMM22(r, 4, v) + +#define I_ORri(rd, rs1, imm) _I_OP3_R_RI(rd, IOP3_OR, rs1, imm) +#define I_ORrr(rd, rs1, rs2) _I_OP3_R_RR(rd, IOP3_OR, rs1, rs2) + +#define I_MOVi(rd, imm) _I_OP3_R_RI(rd, IOP3_OR, I_G0, imm) +#define I_MOVr(rd, rs) _I_OP3_R_RR(rd, IOP3_OR, I_G0, rs) + +#define I_RDPSR(rd) _I_OP3_R_RR(rd, IOP3_RDPSR, 0, 0) + +#define I_JMPLri(rd, rs1, imm) _I_OP3_R_RI(rd, IOP3_JMPL, rs1, imm) +#define I_JMPLrr(rd, rs1, rs2) _I_OP3_R_RR(rd, IOP3_JMPL, rs1, rs2) + +/* + * (Since these are sparse, we skip the enumerations for now.) + * FPop values. All appear in both FPop1 and FPop2 spaces, but arithmetic + * ops should happen only with FPop1 and comparison only with FPop2. + * The type sits in the low two bits; those bits are given as zero here. + */ +#define FMOV 0x00 +#define FNEG 0x04 +#define FABS 0x08 +#define FSQRT 0x28 +#define FADD 0x40 +#define FSUB 0x44 +#define FMUL 0x48 +#define FDIV 0x4c +#define FCMP 0x50 +#define FCMPE 0x54 +#define FSMULD 0x68 +#define FDMULX 0x6c +#define FTOS 0xc4 +#define FTOD 0xc8 +#define FTOX 0xcc +#define FTOI 0xd0 + +/* + * FPU data types. + */ +#define FTYPE_INT 0 /* data = 32-bit signed integer */ +#define FTYPE_SNG 1 /* data = 32-bit float */ +#define FTYPE_DBL 2 /* data = 64-bit double */ +#define FTYPE_EXT 3 /* data = 128-bit extended (quad-prec) */ diff --git a/sys/arch/sparc/include/kbd.h b/sys/arch/sparc/include/kbd.h new file mode 100644 index 00000000000..7fe3c4e2653 --- /dev/null +++ b/sys/arch/sparc/include/kbd.h @@ -0,0 +1,88 @@ +/* $NetBSD: kbd.h,v 1.4 1995/07/06 05:36:29 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)kbd.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Keyboard `registers'. (This should be called kbd_reg.h but we need to + * be compatible.) + */ + +/* + * Control codes sent from type 2, 3, and 4 keyboards. + * + * Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not. + * KBD_IDLE does not take the place of any `up' transitions (it merely occurs + * after them). + */ +#define KBD_RESET 0xff /* keyboard `reset' response */ +#define KBD_IDLE 0x7f /* keyboard `all keys are up' code */ +#define KBD_LAYOUT 0xfe /* keyboard `get layout' response */ + +/* Keyboard IDs */ +#define KB_SUN2 2 /* type 2 keyboard */ +#define KB_SUN3 3 /* type 3 keyboard */ +#define KB_SUN4 4 /* type 4 keyboard */ + +/* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */ +#define KBD_KEYMASK 0x7f /* keyboard key mask */ +#define KBD_UP 0x80 /* keyboard `up' transition */ + +/* Keyboard codes needed to recognize the L1-A sequence */ +#define KBD_L1 1 /* keyboard code for `L1' key */ +#define KBD_A 77 /* keyboard code for `A' key */ + +/* Control codes sent to the various keyboards */ +#define KBD_CMD_RESET 1 /* reset keyboard */ +#define KBD_CMD_BELL 2 /* turn bell on */ +#define KBD_CMD_NOBELL 3 /* turn bell off */ +#define KBD_CMD_CLICK 10 /* turn keyclick on */ +#define KBD_CMD_NOCLICK 11 /* turn keyclick off */ +#define KBD_CMD_SETLED 14 /* set LED state (type 4 kbd) */ +#define KBD_CMD_GLAYOUT 15 /* get DIP switch (type 4 kbd) */ + +#define LED_NUM_LOCK 0x1 +#define LED_COMPOSE 0x2 +#define LED_SCROLL_LOCK 0x4 +#define LED_CAPS_LOCK 0x8 diff --git a/sys/arch/sparc/include/kbio.h b/sys/arch/sparc/include/kbio.h new file mode 100644 index 00000000000..049bfb79fed --- /dev/null +++ b/sys/arch/sparc/include/kbio.h @@ -0,0 +1,113 @@ +/* $NetBSD: kbio.h,v 1.4 1995/05/10 16:07:27 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)kbio.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * The following is a minimal emulation of Sun's `kio' structures + * and related operations necessary to make X11 happy (i.e., make it + * compile, and make old X11 binaries run). + */ + +/* + * The kiockey structure apparently gets and/or sets keyboard mappings. + * It seems to be kind of useless, but X11 uses it (according to the + * comments) to figure out when a Sun 386i has a type-4 keyboard but + * claims to have a type-3 keyboard. We need just enough to cause the + * appropriate ioctl to return the appropriate magic value. + * + * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask + * is for; X sets it before the call, so it is not an output, but we do not + * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send + * keys to the console or to X; we just send them to X whenever the keyboard + * is open at all. (XXX may need to change this later) + * + * Keyboard commands and types are defined in kbd.h as they are actually + * real hardware commands and type numbers. + */ +struct okiockey { /* Out-dated key translation structure */ + int kio_tablemask; /* whatever */ + u_char kio_station; /* key number */ + u_char kio_entry; /* HOLE if not present */ + char kio_text[10]; /* the silly escape sequences (unsupported) */ +}; + +struct kiockey { + int kio_tablemask; /* whatever */ + u_char kio_station; /* key number */ + u_short kio_entry; /* HOLE if not present */ + char kio_text[10]; /* the silly escape sequences (unsupported) */ +}; + +/* + * Values for kio_tablemask. These determine which table to read/modify + * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift" + * tables. + */ +#define KIOC_NOMASK 0x0 +#define KIOC_CAPSMASK 0x1 +#define KIOC_SHIFTMASK 0xe +#define KIOC_CTRLMASK 0x30 +#define KIOC_ALTGMASK 0x200 +#define KIOC_NUMLMASK 0x800 + +#define HOLE 0x302 /* value for kio_entry to say `really type 3' */ + +#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */ + /* (we only accept TR_UNTRANS_EVENT) */ +#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */ +#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */ +#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */ +#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */ +#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */ +#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */ +#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */ +#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */ +#define KIOCSLED _IOW('k', 14, char) /* set LED state */ +#define KIOCGLED _IOR('k', 15, char) /* get LED state */ + +#define TR_NONE 0 /* X compat, unsupported */ +#define TR_ASCII 1 /* X compat, unsupported */ +#define TR_EVENT 2 /* X compat, unsupported */ +#define TR_UNTRANS_EVENT 3 diff --git a/sys/arch/sparc/include/limits.h b/sys/arch/sparc/include/limits.h new file mode 100644 index 00000000000..25cbda15a68 --- /dev/null +++ b/sys/arch/sparc/include/limits.h @@ -0,0 +1,86 @@ +/* $NetBSD: limits.h,v 1.6 1994/11/20 20:53:14 deraadt Exp $ */ + +/* + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#define CHAR_BIT 8 /* number of bits in a char */ +#define MB_LEN_MAX 1 /* no multibyte characters */ + +#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */ +#define SCHAR_MAX 0x7f /* min value for a signed char */ + +#define UCHAR_MAX 0xff /* max value for an unsigned char */ +#define CHAR_MAX 0x7f /* max value for a char */ +#define CHAR_MIN (-0x7f-1) /* min value for a char */ + +#define USHRT_MAX 0xffff /* max value for an unsigned short */ +#define SHRT_MAX 0x7fff /* max value for a short */ +#define SHRT_MIN (-0x7fff-1) /* min value for a short */ + +#define UINT_MAX 0xffffffff /* max value for an unsigned int */ +#define INT_MAX 0x7fffffff /* max value for an int */ +#define INT_MIN (-0x7fffffff-1) /* min value for an int */ + +#define ULONG_MAX 0xffffffff /* max value for an unsigned long */ +#define LONG_MAX 0x7fffffff /* max value for a long */ +#define LONG_MIN (-0x7fffffff-1) /* min value for a long */ + +#if !defined(_ANSI_SOURCE) +#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#define SIZE_T_MAX UINT_MAX /* max value for a size_t */ + +/* GCC requires that quad constants be written as expressions. */ +#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ + /* max value for a quad_t */ +#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) +#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ + +#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) +#define LONG_BIT 32 +#define WORD_BIT 32 + +#define DBL_DIG 15 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MIN 2.2250738585072014E-308 + +#define FLT_DIG 6 +#define FLT_MAX 3.40282347E+38F +#define FLT_MIN 1.17549435E-38F +#endif diff --git a/sys/arch/sparc/include/oldmon.h b/sys/arch/sparc/include/oldmon.h new file mode 100644 index 00000000000..b7b176f1bc9 --- /dev/null +++ b/sys/arch/sparc/include/oldmon.h @@ -0,0 +1,298 @@ +/* $NetBSD: oldmon.h,v 1.5 1995/09/03 21:36:06 pk Exp $ */ + +/* + * Copyright (C) 1985 Regents of the University of California + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``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: Sprite /cdrom/src/kernel/Cvsroot/kernel/mach/sun3.md/machMon.h,v + * 9.1 90/10/03 13:52:34 mgbaker Exp SPRITE (Berkeley) + */ +#ifndef _MACHINE_OLDMON_H +#define _MACHINE_OLDMON_H + +/* + * Structures, constants and defines for access to the sun monitor. + * These are translated from the sun monitor header file "sunromvec.h". + * + * The memory addresses for the PROM, and the EEPROM. + * On the sun2 these addresses are actually 0x00EF??00 + * but only the bottom 24 bits are looked at so these still + * work ok. + */ +#define PROM_BASE 0xffe81000 + +enum maptypes { /* Page map entry types. */ + MAP_MAINMEM, + MAP_OBIO, + MAP_MBMEM, + MAP_MBIO, + MAP_VME16A16D, + MAP_VME16A32D, + MAP_VME24A16D, + MAP_VME24A32D, + MAP_VME32A16D, + MAP_VME32A32D +}; +/* + * This table gives information about the resources needed by a device. + */ +struct devinfo { + unsigned int d_devbytes; /* Bytes occupied by device in IO space.*/ + unsigned int d_dmabytes; /* Bytes needed by device in DMA memory.*/ + unsigned int d_localbytes;/* Bytes needed by device for local info.*/ + unsigned int d_stdcount; /* How many standard addresses. */ + unsigned long *d_stdaddrs; /* The vector of standard addresses. */ + enum maptypes d_devtype; /* What map space device is in. */ + unsigned int d_maxiobytes;/* Size to break big I/O's into. */ +}; + +/* + * The table entry that describes a device. It exists in the PROM; a + * pointer to it is passed in MachMonBootParam. It can be used to locate + * PROM subroutines for opening, reading, and writing the device. + * + * When using this interface, only one device can be open at once. + * + * NOTE: I am not sure what arguments boot, open, close, and strategy take. + * What is here is just translated verbatim from the sun monitor code. We + * should figure this out eventually if we need it. + */ +struct om_boottable { + char b_devname[2]; /* The name of the device */ + int (*b_probe)(); /* probe() --> -1 or found controller + number */ + int (*b_boot)(); /* boot(bp) --> -1 or start address */ + int (*b_open)(); /* open(iobp) --> -1 or 0 */ + int (*b_close)(); /* close(iobp) --> -1 or 0 */ + int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ + char *b_desc; /* Printable string describing dev */ + struct devinfo *b_devinfo; /* info to configure device. */ +}; + +/* + * Structure set up by the boot command to pass arguments to the program that + * is booted. + */ +struct om_bootparam { + char *argPtr[8]; /* String arguments */ + char strings[100]; /* String table for string arguments */ + char devName[2]; /* Device name */ + int ctlrNum; /* Controller number */ + int unitNum; /* Unit number */ + int partNum; /* Partition/file number */ + char *fileName; /* File name, points into strings */ + struct om_boottable *bootTable; /* Points to table entry for device */ +}; + +/* + * Here is the structure of the vector table which is at the front of the boot + * rom. The functions defined in here are explained below. + * + * NOTE: This struct has references to the structures keybuf and globram which + * I have not translated. If anyone needs to use these they should + * translate these structs into Sprite format. + */ +struct om_vector { + char *initSp; /* Initial system stack ptr for hardware */ + int (*startMon)(); /* Initial PC for hardware */ + int *diagberr; /* Bus err handler for diags */ + + /* Monitor and hardware revision and identification */ + struct om_bootparam **bootParam; /* Info for bootstrapped pgm */ + u_long *memorySize; /* Usable memory in bytes */ + + /* Single-character input and output */ + int (*getChar)(void); /* Get char from input source */ + void (*putChar)(int); /* Put char to output sink */ + int (*mayGet)(void); /* Maybe get char, or -1 */ + int (*mayPut)(int); /* Maybe put char, or -1 */ + u_char *echo; /* Should getchar echo? */ + u_char *inSource; /* Input source selector */ + u_char *outSink; /* Output sink selector */ +#define PROMDEV_KBD 0 /* input from keyboard */ +#define PROMDEV_SCREEN 0 /* output to screen */ +#define PROMDEV_TTYA 1 /* in/out to ttya */ +#define PROMDEV_TTYB 2 /* in/out to ttyb */ + + /* Keyboard input (scanned by monitor nmi routine) */ + int (*getKey)(); /* Get next key if one exists */ + int (*initGetKey)(); /* Initialize get key */ + u_int *translation; /* Kbd translation selector */ + 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; + + /* 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 */ + void (*fbWriteStr)(char *, int); /* Quickly write string to FB */ + + /* Reboot interface routine -- resets and reboots system. */ + void (*reBoot)(char *); /* e.g. reBoot("xy()vmunix") */ + + /* Line input and parsing */ + u_char *lineBuf; /* The line input buffer */ + u_char **linePtr; /* Cur pointer into linebuf */ + int *lineSize; /* length of line in linebuf */ + int (*getLine)(); /* Get line from user */ + u_char (*getNextChar)(); /* Get next char from linebuf */ + u_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 */ + int (*printf)(); /* Similar to "Kernel printf" */ + int (*printHex)(); /* Format N digits in hex */ + + /* Led stuff */ + u_char *leds; /* RAM copy of LED register */ + int (*setLeds)(); /* Sets LED's and RAM copy */ + + /* Non-maskable interrupt (nmi) information */ + int (*nmiAddr)(); /* Addr for level 7 vector */ + void (*abortEntry)(void); /* Entry for keyboard abort */ + int *nmiClock; /* Counts up in msec */ + + /* Frame buffer type: see <machine/fbio.h> */ + int *fbType; + + /* Assorted other things */ + u_long romvecVersion; /* Version # of Romvec */ + struct globram *globRam; /* monitor global variables */ + caddr_t kbdZscc; /* Addr of keyboard in use */ + + int *keyrInit; /* ms before kbd repeat */ + u_char *keyrTick; /* ms between repetitions */ + u_long *memoryAvail; /* V1: Main mem usable size */ + long *resetAddr; /* where to jump on a reset */ + long *resetMap; /* pgmap entry for resetaddr */ + /* Really struct pgmapent * */ + + __dead void (*exitToMon)(void); /* Exit from user program */ + u_char **memorybitmap; /* V1: &{0 or &bits} */ + void (*setcxsegmap)(); /* Set seg in any context */ + void (**vector_cmd)(); /* V2: Handler for 'v' cmd */ + u_long *ExpectedTrapSig; + u_long *TrapVectorTable; + int dummy1z; + int dummy2z; + int dummy3z; + int dummy4z; +}; + +#define romVectorPtr ((struct om_vector *)PROM_BASE) + +#define mon_printf (romVectorPtr->printf) +#define mon_putchar (romVectorPtr->putChar) +#define mon_may_getchar (romVectorPtr->mayGet) +#define mon_exit_to_mon (romVectorPtr->exitToMon) +#define mon_reboot (romVectorPtr->exitToMon) +#define mon_panic(x) { mon_printf(x); mon_exit_to_mon();} + +#define mon_setcxsegmap(context, va, sme) \ + romVectorPtr->setcxsegmap(context, va, sme) +#define romp (romVectorPtr) + +/* + * OLDMON_STARTVADDR and OLDMON_ENDVADDR denote the range of the damn monitor. + * + * supposedly you can steal pmegs within this range that do not contain + * valid pages. + */ +#define OLDMON_STARTVADDR 0xFFD00000 +#define OLDMON_ENDVADDR 0xFFF00000 + +/* + * These describe the monitor's short segment which it basically uses to map + * one stupid page that it uses for storage. MONSHORTPAGE is the page, + * and MONSHORTSEG is the segment that it is in. If this sounds dumb to + * you, it is. I can change the pmeg, but not the virtual address. + * Sun defines these with the high nibble set to 0xF. I believe this was + * for the monitor source which accesses this piece of memory with addressing + * limitations or some such crud. I haven't replicated this here, because + * it is confusing, and serves no obvious purpose if you aren't the monitor. + * + */ +#define MONSHORTPAGE 0x0FFFE000 +#define MONSHORTSEG 0x0FFE0000 + +/* + * A "stand alone I/O request". + * This is passed as the main argument to the PROM I/O routines + * in the `om_boottable' structure. + */ +struct saioreq { + char si_flgs; + struct om_boottable *si_boottab;/* Points to boottab entry if any */ + char *si_devdata; /* Device-specific data pointer */ + int si_ctlr; /* Controller number or address */ + int si_unit; /* Unit number within controller */ + long si_boff; /* Partition number within unit */ + long si_cyloff; + long si_offset; + long si_bn; /* Block number to R/W */ + char *si_ma; /* Memory address to R/W */ + int si_cc; /* Character count to R/W */ + struct saif *si_sif; /* net if. pointer (set by b_open) */ + char *si_devaddr; /* Points to mapped in device */ + char *si_dmaaddr; /* Points to allocated DMA space */ +}; +#define SAIO_F_READ 0x01 +#define SAIO_F_WRITE 0x02 +#define SAIO_F_ALLOC 0x04 +#define SAIO_F_FILE 0x08 +#define SAIO_F_EOF 0x10 /* EOF on device */ +#define SAIO_F_AJAR 0x20 /* Descriptor "ajar" (stopped but not closed) */ + + +/* + * Ethernet interface descriptor + * First, set: saiop->si_devaddr, saiop->si_dmaaddr, etc. + * Then: saiop->si_boottab->b_open() will set: + * saiop->si_sif; + * saiop->si_devdata; + * The latter is the first arg to the following functions. + * Note that the buffer must be in DVMA space... + */ +struct saif { + /* transmit packet, returns zero on success. */ + int (*sif_xmit)(void *devdata, char *buf, int len); + /* wait for packet, zero if none arrived */ + int (*sif_poll)(void *devdata, char *buf); + /* reset interface, set addresses, etc. */ + int (*sif_reset)(void *devdata, struct saioreq *sip); + /* Later (sun4 only) proms have more stuff here. */ +}; +#endif /* MACHINE_OLDMON_H */ diff --git a/sys/arch/sparc/include/openpromio.h b/sys/arch/sparc/include/openpromio.h new file mode 100644 index 00000000000..748f0fa3cd2 --- /dev/null +++ b/sys/arch/sparc/include/openpromio.h @@ -0,0 +1,60 @@ +/* $NetBSD: openpromio.h,v 1.2 1994/11/20 20:53:17 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)openpromio.h 8.1 (Berkeley) 6/11/93 + */ + +struct opiocdesc { + int op_nodeid; /* passed or returned node id */ + int op_namelen; /* length of op_name */ + char *op_name; /* pointer to field name */ + int op_buflen; /* length of op_buf (value-result) */ + char *op_buf; /* pointer to field value */ +}; + +#define OPIOCGET _IOWR('O', 1, struct opiocdesc) /* get openprom field */ +#define OPIOCSET _IOW('O', 2, struct opiocdesc) /* set openprom field */ +#define OPIOCNEXTPROP _IOWR('O', 3, struct opiocdesc) /* get next property */ +#define OPIOCGETOPTNODE _IOR('O', 4, int) /* get openprom field */ +#define OPIOCGETNEXT _IOWR('O', 5, int) /* get next node of node */ +#define OPIOCGETCHILD _IOWR('O', 6, int) /* get first child of node */ diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h new file mode 100644 index 00000000000..25a16df9d67 --- /dev/null +++ b/sys/arch/sparc/include/param.h @@ -0,0 +1,206 @@ +/* $NetBSD: param.h,v 1.16 1995/06/28 02:43:50 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)param.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Machine dependent constants for Sun-4c (SPARCstation) + */ +#define MACHINE "sparc" +#define MACHINE_ARCH "sparc" +#define MID_MACHINE MID_SPARC + +#ifdef _KERNEL /* XXX */ +#include <machine/cpu.h> /* XXX */ +#endif /* XXX */ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for + * the machine's strictest data type. The result is u_int and must be + * cast to any desired pointer type. + */ +#define ALIGNBYTES 7 +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) + +#define SUN4_PGSHIFT 13 /* for a sun4 machine */ +#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */ + +/* + * Three possible cases: + * sun4 only 8192 bytes/page + * sun4c/sun4m only 4096 bytes/page + * sun4/sun4c/sun4m either of the above + * + * In the later case NBPG, PGOFSET, and PGSHIFT are encoded in variables + * initialized early in locore.s. Since they are variables, rather than + * simple constants, the kernel will not perform slighly worse. + */ +#if defined(SUN4) && !defined(SUN4C) && !defined(SUN4M) +#define NBPG 8192 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define PGSHIFT SUN4_PGSHIFT /* log2(NBPG) */ +#endif +#if !defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) +#define NBPG 4096 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define PGSHIFT SUN4CM_PGSHIFT /* log2(NBPG) */ +#endif +#if defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) +#if defined(_KERNEL) && !defined(LOCORE) +extern int nbpg, pgofset, pgshift; +#endif +#define NBPG nbpg /* bytes/page */ +#define PGOFSET pgofset /* byte offset into page */ +#define PGSHIFT pgshift /* log2(NBPG) */ +#endif + +#define KERNBASE 0xf8000000 /* start of kernel virtual space */ +#define KERNTEXTOFF 0xf8004000 /* start of kernel text */ + +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) + +#define CLSIZE 1 +#define CLSIZELOG2 0 + +/* NOTE: SSIZE must be multiple of CLSIZE */ +#define SSIZE 1 /* initial stack size in pages */ +#define USPACE 8192 + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 128 /* size of an mbuf */ +#define MCLBYTES 2048 /* enough for whole Ethernet packet */ +#define MCLSHIFT 11 /* log2(MCLBYTES) */ +#define MCLOFSET (MCLBYTES - 1) + +#ifndef NMBCLUSTERS +#ifdef GATEWAY +#define NMBCLUSTERS 512 /* map size, max cluster allocation */ +#else +#define NMBCLUSTERS 256 /* map size, max cluster allocation */ +#endif +#endif + +/* + * Size of kernel malloc arena in CLBYTES-sized logical pages. + */ +#ifndef NKMEMCLUSTERS +#define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES) +#endif + +/* pages ("clicks") to disk blocks */ +#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) + +/* pages to bytes */ +#define ctob(x) ((x) << PGSHIFT) +#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) + +/* bytes to disk blocks */ +#define btodb(x) ((x) >> DEV_BSHIFT) +#define dbtob(x) ((x) << DEV_BSHIFT) + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and should use the bsize + * field from the disk label. + * For now though just use DEV_BSIZE. + */ +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE)) + +/* + * dvmamap manages a range of DVMA addresses intended to create double + * mappings of physical memory. In a way, `dvmamap' is a submap of the + * VM map `phys_map'. The difference is the use of the `resource map' + * routines to manage page allocation, allowing DVMA addresses to be + * allocated and freed from within interrupt routines. + * + * Note that `phys_map' can still be used to allocate memory-backed pages + * in DVMA space. + */ +#ifdef _KERNEL +#ifndef LOCORE +extern vm_offset_t dvmabase; +extern struct map *dvmamap; +#endif +#endif +/* + * The dvma resource map is defined in page units, which are numbered 1 to N. + * Use these macros to convert to/from virtual addresses. + */ +#define rctov(n) (ctob(((n)-1))+dvmabase) +#define vtorc(v) ((btoc((v)-dvmabase))+1) + + +#ifdef _KERNEL +#ifndef LOCORE +#define DELAY(n) delay(n) +#endif +#endif + +#ifdef _KERNEL +extern int cputyp; +extern int cpumod; +#endif +/* + * Values for the cputyp variable. + */ +#define CPU_SUN4 0 +#define CPU_SUN4C 1 +#define CPU_SUN4M 2 +/* + * Values for cpumod (cpu model) variable. XXX currently valid only for sun4 + */ +#define SUN4_100 0x22 +#define SUN4_200 0x21 +#define SUN4_300 0x23 +#define SUN4_400 0x24 diff --git a/sys/arch/sparc/include/pcb.h b/sys/arch/sparc/include/pcb.h new file mode 100644 index 00000000000..3692dd17d96 --- /dev/null +++ b/sys/arch/sparc/include/pcb.h @@ -0,0 +1,123 @@ +/* $NetBSD: pcb.h,v 1.4 1995/03/28 18:19:56 jtc Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)pcb.h 8.1 (Berkeley) 6/11/93 + */ + +#include <machine/reg.h> + +#ifdef notyet +#define PCB_MAXWIN 32 /* architectural limit */ +#else +#define PCB_MAXWIN 8 /* worried about u area sizes ... */ +#endif + +/* + * SPARC Process Control Block. + * + * pcb_uw is positive if there are any user windows that are + * are currently in the CPU windows rather than on the user + * stack. Whenever we are running in the kernel with traps + * enabled, we decrement pcb_uw for each ``push'' of a CPU + * register window into the stack, and we increment it for + * each ``pull'' from the stack into the CPU. (If traps are + * disabled, or if we are in user mode, pcb_uw is junk.) + * + * To ease computing pcb_uw on traps from user mode, we keep track + * of the log base 2 of the single bit that is set in %wim. + * + * If an overflow occurs while the associated user stack pages + * are invalid (paged out), we have to store the registers + * in a page that is locked in core while the process runs, + * i.e., right here in the pcb. We also need the stack pointer + * for the last such window (but only the last, as the others + * are in each window) and the count of windows saved. We + * cheat by having a whole window structure for that one %sp. + * Thus, to save window pcb_rw[i] to memory, we write it at + * pcb_rw[i + 1].rw_in[6]. + * + * pcb_nsaved has three `kinds' of values. If 0, it means no + * registers are in the PCB (though if pcb_uw is positive, + * there may be the next time you look). If positive, it means + * there are no user registers in the CPU, but there are some + * saved in pcb_rw[]. As a special case, traps that needed + * assistance to pull user registers from the stack also store + * the registers in pcb_rw[], and set pcb_nsaved to -1. This + * special state is normally short-term: it can only last until the + * trap returns, and it can never persist across entry to user code. + */ +struct pcb { + int pcb_sp; /* sp (%o6) when switch() was called */ + int pcb_pc; /* pc (%o7) when switch() was called */ + int pcb_psr; /* %psr when switch() was called */ + + caddr_t pcb_onfault; /* for copyin/out */ + + int pcb_uw; /* user windows inside CPU */ + int pcb_wim; /* log2(%wim) */ + int pcb_nsaved; /* number of windows saved in pcb */ + +#ifdef notdef + int pcb_winof; /* number of window overflow traps */ + int pcb_winuf; /* number of window underflow traps */ +#endif + int pcb_pad; /* pad to doubleword boundary */ + + /* the following MUST be aligned on a doubleword boundary */ + struct rwindow pcb_rw[PCB_MAXWIN]; /* saved windows */ +}; + +/* + * The pcb is augmented with machine-dependent additional data for + * core dumps. Note that the trapframe here is a copy of the one + * from the top of the kernel stack (included here so that the kernel + * stack itself need not be dumped). + */ +struct md_coredump { + struct trapframe md_tf; + struct fpstate md_fpstate; +}; + +#ifdef _KERNEL +extern struct pcb *cpcb; +#endif /* _KERNEL */ diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h new file mode 100644 index 00000000000..9fd2cf2e704 --- /dev/null +++ b/sys/arch/sparc/include/pmap.h @@ -0,0 +1,185 @@ +/* $NetBSD: pmap.h,v 1.17 1995/07/05 18:45:46 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)pmap.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _SPARC_PMAP_H_ +#define _SPARC_PMAP_H_ + +#include <machine/pte.h> + +/* + * Pmap structure. + * + * The pmap structure really comes in two variants, one---a single + * instance---for kernel virtual memory and the other---up to nproc + * instances---for user virtual memory. Unfortunately, we have to mash + * both into the same structure. Fortunately, they are almost the same. + * + * The kernel begins at 0xf8000000 and runs to 0xffffffff (although + * some of this is not actually used). Kernel space, including DVMA + * space (for now?), is mapped identically into all user contexts. + * There is no point in duplicating this mapping in each user process + * so they do not appear in the user structures. + * + * User space begins at 0x00000000 and runs through 0x1fffffff, + * then has a `hole', then resumes at 0xe0000000 and runs until it + * hits the kernel space at 0xf8000000. This can be mapped + * contiguously by ignorning the top two bits and pretending the + * space goes from 0 to 37ffffff. Typically the lower range is + * used for text+data and the upper for stack, but the code here + * makes no such distinction. + * + * Since each virtual segment covers 256 kbytes, the user space + * requires 3584 segments, while the kernel (including DVMA) requires + * only 512 segments. + * + * The segment map entry for virtual segment vseg is offset in + * pmap->pm_rsegmap by 0 if pmap is not the kernel pmap, or by + * NUSEG if it is. We keep a pointer called pmap->pm_segmap + * pre-offset by this value. pmap->pm_segmap thus contains the + * values to be loaded into the user portion of the hardware segment + * map so as to reach the proper PMEGs within the MMU. The kernel + * mappings are `set early' and are always valid in every context + * (every change is always propagated immediately). + * + * The PMEGs within the MMU are loaded `on demand'; when a PMEG is + * taken away from context `c', the pmap for context c has its + * corresponding pm_segmap[vseg] entry marked invalid (the MMU segment + * map entry is also made invalid at the same time). Thus + * pm_segmap[vseg] is the `invalid pmeg' number (127 or 511) whenever + * the corresponding PTEs are not actually in the MMU. On the other + * hand, pm_pte[vseg] is NULL only if no pages in that virtual segment + * are in core; otherwise it points to a copy of the 32 or 64 PTEs that + * must be loaded in the MMU in order to reach those pages. + * pm_npte[vseg] counts the number of valid pages in each vseg. + * + * XXX performance: faster to count valid bits? + * + * The kernel pmap cannot malloc() PTEs since malloc() will sometimes + * allocate a new virtual segment. Since kernel mappings are never + * `stolen' out of the the MMU, we just keep all its PTEs there, and + * have no software copies. Its mmu entries are nonetheless kept on lists + * so that the code that fiddles with mmu lists has something to fiddle. + */ +#define NKREG ((int)((-(unsigned)KERNBASE) / NBPRG)) /* i.e., 8 */ +#define NUREG (256 - NKREG) /* i.e., 248 */ + +TAILQ_HEAD(mmuhd,mmuentry); + +/* data appearing in both user and kernel pmaps */ +struct pmap { + union ctxinfo *pm_ctx; /* current context, if any */ + int pm_ctxnum; /* current context's number */ +#if NCPUS > 1 + simple_lock_data_t pm_lock; /* spinlock */ +#endif + int pm_refcount; /* just what it says */ + + struct mmuhd pm_reglist; /* MMU regions on this pmap */ + struct mmuhd pm_seglist; /* MMU segments on this pmap */ + void *pm_regstore; + struct regmap *pm_regmap; + int pm_gap_start; /* Starting with this vreg there's */ + int pm_gap_end; /* no valid mapping until here */ + + struct pmap_statistics pm_stats; /* pmap statistics */ +}; + +struct regmap { + struct segmap *rg_segmap; /* point to NSGPRG PMEGs */ + smeg_t rg_smeg; /* the MMU region number */ + u_char rg_nsegmap; /* number of valid PMEGS */ +}; + +struct segmap { + int *sg_pte; /* points to NPTESG PTEs */ + pmeg_t sg_pmeg; /* the MMU segment number */ + u_char sg_npte; /* number of valid PTEs per seg */ +}; + +typedef struct pmap *pmap_t; + +#ifdef _KERNEL + +#define PMAP_NULL ((pmap_t)0) + +extern struct pmap kernel_pmap_store; +extern vm_offset_t vm_first_phys, vm_num_phys; + +/* + * Since PTEs also contain type bits, we have to have some way + * to tell pmap_enter `this is an IO page' or `this is not to + * be cached'. Since physical addresses are always aligned, we + * can do this with the low order bits. + * + * The ordering below is important: PMAP_PGTYPE << PG_TNC must give + * exactly the PG_NC and PG_TYPE bits. + */ +#define PMAP_OBIO 1 /* tells pmap_enter to use PG_OBIO */ +#define PMAP_VME16 2 /* etc */ +#define PMAP_VME32 3 /* etc */ +#define PMAP_NC 4 /* tells pmap_enter to set PG_NC */ +#define PMAP_TNC 7 /* mask to get PG_TYPE & PG_NC */ +/*#define PMAP_IOC 0x00800000 -* IO cacheable, NOT shifted */ + +void pmap_bootstrap __P((int nmmu, int nctx, int nregion)); +int pmap_count_ptes __P((struct pmap *)); +vm_offset_t pmap_prefer __P((vm_offset_t, vm_offset_t)); +int pmap_pa_exists __P((vm_offset_t)); +int pmap_dumpsize __P((void)); +int pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)), + daddr_t)); + +#define pmap_kernel() (&kernel_pmap_store) +#define pmap_resident_count(pmap) pmap_count_ptes(pmap) +#define managed(pa) ((unsigned)((pa) - vm_first_phys) < vm_num_phys) + +#define PMAP_ACTIVATE(pmap, pcb, iscurproc) +#define PMAP_DEACTIVATE(pmap, pcb) +#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va)) + +#endif /* _KERNEL */ + +#endif /* _SPARC_PMAP_H_ */ diff --git a/sys/arch/sparc/include/proc.h b/sys/arch/sparc/include/proc.h new file mode 100644 index 00000000000..ff2b7b5805d --- /dev/null +++ b/sys/arch/sparc/include/proc.h @@ -0,0 +1,53 @@ +/* $NetBSD: proc.h,v 1.2 1994/11/20 20:53:23 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)proc.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Machine-dependent part of the proc structure for SPARC. + */ +struct mdproc { + struct trapframe *md_tf; /* trap/syscall registers */ + struct fpstate *md_fpstate; /* fpu state, if any; always resident */ +}; diff --git a/sys/arch/sparc/include/profile.h b/sys/arch/sparc/include/profile.h new file mode 100644 index 00000000000..2e6ea9a2c07 --- /dev/null +++ b/sys/arch/sparc/include/profile.h @@ -0,0 +1,78 @@ +/* $NetBSD: profile.h,v 1.4 1995/08/14 15:44:36 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)profile.h 8.1 (Berkeley) 6/11/93 + */ + +#ifdef PIC +/* Inline expansion of PICCY_SET() (see <machine/asm.h>). */ +#define MCOUNT \ + asm(".global mcount");\ + asm("mcount:");\ + asm("add %o7, 8, %o1");\ + asm("1: call 2f; nop; 2:");\ + asm("add %o7,__mcount-1b, %o2");\ + asm("ld [%o2], %o2");\ + asm("jmpl %o2, %g0");\ + asm("add %i7, 8, %o0"); +#else +#define MCOUNT \ + asm(".global mcount");\ + asm("mcount:");\ + asm("add %i7, 8, %o0");\ + asm("sethi %hi(__mcount), %o2");\ + asm("jmpl %o2 + %lo(__mcount), %g0");\ + asm("add %o7, 8, %o1"); +#endif + +#define _MCOUNT_DECL static void _mcount + +#ifdef _KERNEL +/* + * Block interrupts during mcount so that those interrupts can also be + * counted (as soon as we get done with the current counting). On the + * SPARC, we just splhigh/splx as those do not recursively invoke mcount. + */ +#define MCOUNT_ENTER s = splhigh() +#define MCOUNT_EXIT splx(s) +#endif /* _KERNEL */ diff --git a/sys/arch/sparc/include/psl.h b/sys/arch/sparc/include/psl.h new file mode 100644 index 00000000000..9dc8b1baa26 --- /dev/null +++ b/sys/arch/sparc/include/psl.h @@ -0,0 +1,195 @@ +/* $NetBSD: psl.h,v 1.7 1995/08/13 00:29:56 mycroft Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)psl.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef PSR_IMPL + +/* + * SPARC Process Status Register (in psl.h for hysterical raisins). + * + * The picture in the Sun manuals looks like this: + * 1 1 + * 31 28 27 24 23 20 19 14 3 2 11 8 7 6 5 4 0 + * +-------+-------+-------+-----------+-+-+-------+-+-+-+---------+ + * | impl | ver | icc | reserved |E|E| pil |S|P|E| CWP | + * | | |n z v c| |C|F| | |S|T| | + * +-------+-------+-------+-----------+-+-+-------+-+-+-+---------+ + */ + +#define PSR_IMPL 0xf0000000 /* implementation */ +#define PSR_VER 0x0f000000 /* version */ +#define PSR_ICC 0x00f00000 /* integer condition codes */ +#define PSR_N 0x00800000 /* negative */ +#define PSR_Z 0x00400000 /* zero */ +#define PSR_O 0x00200000 /* overflow */ +#define PSR_C 0x00100000 /* carry */ +#define PSR_EC 0x00002000 /* coprocessor enable */ +#define PSR_EF 0x00001000 /* FP enable */ +#define PSR_PIL 0x00000f00 /* interrupt level */ +#define PSR_S 0x00000080 /* supervisor (kernel) mode */ +#define PSR_PS 0x00000040 /* previous supervisor mode (traps) */ +#define PSR_ET 0x00000020 /* trap enable */ +#define PSR_CWP 0x0000001f /* current window pointer */ + +#define PSR_BITS "\20\16EC\15EF\10S\7PS\6ET" + +#define PIL_CLOCK 10 + +#if defined(_KERNEL) && !defined(LOCORE) +/* + * GCC pseudo-functions for manipulating PSR (primarily PIL field). + */ +static __inline int getpsr() { + int psr; + + __asm __volatile("rd %%psr,%0" : "=r" (psr)); + return (psr); +} + +static __inline void setpsr(int newpsr) { + __asm __volatile("wr %0,0,%%psr" : : "r" (newpsr)); + __asm __volatile("nop"); + __asm __volatile("nop"); + __asm __volatile("nop"); +} + +static __inline int spl0() { + int psr, oldipl; + + /* + * wrpsr xors two values: we choose old psr and old ipl here, + * which gives us the same value as the old psr but with all + * the old PIL bits turned off. + */ + __asm __volatile("rd %%psr,%0" : "=r" (psr)); + oldipl = psr & PSR_PIL; + __asm __volatile("wr %0,%1,%%psr" : : "r" (psr), "r" (oldipl)); + + /* + * Three instructions must execute before we can depend + * on the bits to be changed. + */ + __asm __volatile("nop; nop; nop"); + return (oldipl); +} + +/* + * PIL 1 through 14 can use this macro. + * (spl0 and splhigh are special since they put all 0s or all 1s + * into the ipl field.) + */ +#define SPL(name, newipl) \ +static __inline int name() { \ + int psr, oldipl; \ + __asm __volatile("rd %%psr,%0" : "=r" (psr)); \ + oldipl = psr & PSR_PIL; \ + psr &= ~oldipl; \ + __asm __volatile("wr %0,%1,%%psr" : : \ + "r" (psr), "n" ((newipl) << 8)); \ + __asm __volatile("nop; nop; nop"); \ + return (oldipl); \ +} + +SPL(splsoftint, 1) +#define splsoftclock splsoftint +#define splsoftnet splsoftint + +/* network hardware interrupts are at level 6 */ +#define PIL_NET 6 +SPL(splnet, PIL_NET) + +/* tty input runs at software level 6 */ +#define PIL_TTY 6 +SPL(spltty, PIL_TTY) + +/* Memory allocation (must be as high as highest network or tty device) */ +SPL(splimp, 7) + +/* audio software interrupts are at software level 4 */ +#define PIL_AUSOFT 4 +SPL(splausoft, PIL_AUSOFT) + +/* floppy software interrupts are at software level 4 too */ +#define PIL_FDSOFT 4 +SPL(splfdsoft, PIL_FDSOFT) + +SPL(splbio, 9) + +SPL(splclock, PIL_CLOCK) + +/* fd hardware interrupts are at level 11 */ +SPL(splfd, 11) + +/* zs hardware interrupts are at level 12 */ +SPL(splzs, 12) + +/* audio hardware interrupts are at level 13 */ +SPL(splaudio, 13) + +/* second sparc timer interrupts at level 14 */ +SPL(splstatclock, 14) + +static __inline int splhigh() { + int psr, oldipl; + + __asm __volatile("rd %%psr,%0" : "=r" (psr)); + __asm __volatile("wr %0,0,%%psr" : : "r" (psr | PSR_PIL)); + __asm __volatile("and %1,%2,%0; nop; nop" : "=r" (oldipl) : \ + "r" (psr), "n" (PSR_PIL)); + return (oldipl); +} + +/* splx does not have a return value */ +static __inline void splx(int newipl) { + int psr; + + __asm __volatile("rd %%psr,%0" : "=r" (psr)); + __asm __volatile("wr %0,%1,%%psr" : : \ + "r" (psr & ~PSR_PIL), "rn" (newipl)); + __asm __volatile("nop; nop; nop"); +} +#endif /* KERNEL && !LOCORE */ + +#endif /* PSR_IMPL */ diff --git a/sys/arch/sparc/include/pte.h b/sys/arch/sparc/include/pte.h new file mode 100644 index 00000000000..978e6a84d3a --- /dev/null +++ b/sys/arch/sparc/include/pte.h @@ -0,0 +1,305 @@ +/* $NetBSD: pte.h,v 1.12 1995/07/05 17:53:41 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)pte.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Sun-4 (sort of) and 4c (SparcStation) Page Table Entries + * (Sun call them `Page Map Entries'). + */ + +#ifndef LOCORE +/* + * Segment maps contain `pmeg' (Page Map Entry Group) numbers. + * A PMEG is simply an index that names a group of 32 (sun4) or + * 64 (sun4c) PTEs. + * Depending on the CPU model, we need 7 (sun4c) to 10 (sun4/400) bits + * to hold the hardware MMU resource number. + */ +typedef u_short pmeg_t; /* 10 bits needed per Sun-4 segmap entry */ +/* + * Region maps contain `smeg' (Segment Entry Group) numbers. + * An SMEG is simply an index that names a group of 64 PMEGs. + */ +typedef u_char smeg_t; /* 8 bits needed per Sun-4 regmap entry */ +#endif + +/* + * Address translation works as follows: + * + * (for sun4c and 2-level sun4) + * 1. test va<31:29> -- these must be 000 or 111 (or you get a fault) + * 2. concatenate context_reg<2:0> and va<29:18> to get a 15 bit number; + * use this to index the segment maps, yielding a 7 or 9 bit value. + * (for 3-level sun4) + * 1. concatenate context_reg<3:0> and va<31:24> to get a 8 bit number; + * use this to index the region maps, yielding a 10 bit value. + * 2. take the value from (1) above and concatenate va<17:12> to + * get a `segment map entry' index. This gives a 9 bit value. + * (for sun4c) + * 3. take the value from (2) above and concatenate va<17:12> to + * get a `page map entry' index. This gives a 32-bit PTE. + * (for sun4) + * 3. take the value from (2 or 3) above and concatenate va<17:13> to + * get a `page map entry' index. This gives a 32-bit PTE. + * + * In other words: + * + * struct sun4_3_levelmmu_virtual_addr { + * u_int va_reg:8, (virtual region) + * va_seg:6, (virtual segment) + * va_pg:5, (virtual page within segment) + * va_off:13; (offset within page) + * }; + * struct sun4_virtual_addr { + * u_int :2, (required to be the same as bit 29) + * va_seg:12, (virtual segment) + * va_pg:5, (virtual page within segment) + * va_off:13; (offset within page) + * }; + * struct sun4c_virtual_addr { + * u_int :2, (required to be the same as bit 29) + * va_seg:12, (virtual segment) + * va_pg:6, (virtual page within segment) + * va_off:12; (offset within page) + * }; + * + * Then, given any `va': + * + * extern smeg_t regmap[16][1<<8]; (3-level MMU only) + * extern pmeg_t segmap[8][1<<12]; ([16][1<<12] for sun4) + * extern int ptetable[128][1<<6]; ([512][1<<5] for sun4) + * + * (the above being in the hardware, accessed as Alternate Address Spaces) + * + * if (mmu_3l) + * physreg = regmap[curr_ctx][va.va_reg]; + * physseg = segmap[physreg][va.va_seg]; + * else + * physseg = segmap[curr_ctx][va.va_seg]; + * pte = ptetable[physseg][va.va_pg]; + * if (!(pte & PG_V)) TRAP(); + * if (writing && !pte.pg_w) TRAP(); + * if (usermode && pte.pg_s) TRAP(); + * if (pte & PG_NC) DO_NOT_USE_CACHE_FOR_THIS_ACCESS(); + * pte |= PG_U; (mark used/accessed) + * if (writing) pte |= PG_M; (mark modified) + * ptetable[physseg][va.va_pg] = pte; + * physadr = ((pte & PG_PFNUM) << PGSHIFT) | va.va_off; + */ + +#if defined(MMU_3L) && !defined(SUN4) +#error "configuration error" +#endif + +#if defined(MMU_3L) +extern int mmu_3l; +#endif + +#define NBPRG (1 << 24) /* bytes per region */ +#define RGSHIFT 24 /* log2(NBPRG) */ +#define RGOFSET (NBPRG - 1) /* mask for region offset */ +#define NSEGRG (NBPRG / NBPSG) /* segments per region */ + +#define NBPSG (1 << 18) /* bytes per segment */ +#define SGSHIFT 18 /* log2(NBPSG) */ +#define SGOFSET (NBPSG - 1) /* mask for segment offset */ + +/* number of PTEs that map one segment (not number that fit in one segment!) */ +#if defined(SUN4) && defined(SUN4C) +extern int nptesg; +#define NPTESG nptesg /* (which someone will have to initialize) */ +#else +#define NPTESG (NBPSG / NBPG) +#endif + +/* virtual address to virtual region number */ +#define VA_VREG(va) (((unsigned int)(va) >> RGSHIFT) & 255) + +/* virtual address to virtual segment number */ +#define VA_VSEG(va) (((unsigned int)(va) >> SGSHIFT) & 63) + +/* virtual address to virtual page number, for Sun-4 and Sun-4c */ +#define VA_SUN4_VPG(va) (((int)(va) >> 13) & 31) +#define VA_SUN4C_VPG(va) (((int)(va) >> 12) & 63) + +/* truncate virtual address to region base */ +#define VA_ROUNDDOWNTOREG(va) ((int)(va) & ~RGOFSET) + +/* truncate virtual address to segment base */ +#define VA_ROUNDDOWNTOSEG(va) ((int)(va) & ~SGOFSET) + +/* virtual segment to virtual address (must sign extend on holy MMUs!) */ +#if defined(MMU_3L) +#define VRTOVA(vr) (mmu_3l \ + ? ((int)(vr) << RGSHIFT) \ + : (((int)(vr) << (RGSHIFT+2)) >> 2)) +#define VSTOVA(vr,vs) (mmu_3l \ + ? (((int)vr << RGSHIFT) + ((int)vs << SGSHIFT)) \ + : ((((int)vr << (RGSHIFT+2)) >> 2) + ((int)vs << SGSHIFT))) +#else +#define VRTOVA(vr) (((int)vr << (RGSHIFT+2)) >> 2) +#define VSTOVA(vr,vs) ((((int)vr << (RGSHIFT+2)) >> 2) + ((int)vs << SGSHIFT)) +#endif + +extern int mmu_has_hole; +#define VA_INHOLE(va) (mmu_has_hole \ + ? ( (unsigned int)(((int)(va) >> PG_VSHIFT) + 1) > 1) \ + : 0) + +/* Define the virtual address space hole */ +#define MMU_HOLE_START 0x20000000 +#define MMU_HOLE_END 0xe0000000 + +#if defined(SUN4) && defined(SUN4C) +#define VA_VPG(va) (cputyp==CPU_SUN4C ? VA_SUN4C_VPG(va) : VA_SUN4_VPG(va)) +#endif +#if defined(SUN4C) && !defined(SUN4) +#define VA_VPG(va) VA_SUN4C_VPG(va) +#endif +#if !defined(SUN4C) && defined(SUN4) +#define VA_VPG(va) VA_SUN4_VPG(va) +#endif + +/* there is no `struct pte'; we just use `int' */ +#define PG_V 0x80000000 +#define PG_PROT 0x60000000 /* both protection bits */ +#define PG_W 0x40000000 /* allowed to write */ +#define PG_S 0x20000000 /* supervisor only */ +#define PG_NC 0x10000000 /* non-cacheable */ +#define PG_TYPE 0x0c000000 /* both type bits */ + +#define PG_OBMEM 0x00000000 /* on board memory */ +#define PG_OBIO 0x04000000 /* on board I/O (incl. Sbus on 4c) */ +#ifdef SUN4 +#define PG_VME16 0x08000000 /* 16-bit-data VME space */ +#define PG_VME32 0x0c000000 /* 32-bit-data VME space */ +#endif + +#define PG_U 0x02000000 +#define PG_M 0x01000000 +#define PG_IOC 0x00800000 /* IO-cacheable */ +#define PG_MBZ 0x00780000 /* unused; must be zero (oh really?) */ +#define PG_PFNUM 0x0007ffff /* n.b.: only 16 bits on sun4c */ + +#define PG_TNC_SHIFT 26 /* shift to get PG_TYPE + PG_NC */ +#define PG_M_SHIFT 24 /* shift to get PG_M, PG_U */ + +/*efine PG_NOACC 0 ** XXX */ +#define PG_KR 0x20000000 +#define PG_KW 0x60000000 +#define PG_URKR 0 +#define PG_UW 0x40000000 + +#ifdef KGDB +/* but we will define one for gdb anyway */ +struct pte { + u_int pg_v:1, + pg_w:1, + pg_s:1, + pg_nc:1; + enum pgtype { pg_obmem, pg_obio, pg_vme16, pg_vme32 } pg_type:2; + u_int pg_u:1, + pg_m:1, + pg_mbz:5, + pg_pfnum:19; +}; +#endif + +/* + * These are needed in the register window code + * to check the validity of (ostensible) user stack PTEs. + */ +#define PG_VSHIFT 29 /* (va>>vshift)==0 or -1 => valid */ + /* XXX fix this name, it is a va shift not a pte bit shift! */ + +#define PG_PROTSHIFT 29 +#define PG_PROTUWRITE 6 /* PG_V,PG_W,!PG_S */ +#define PG_PROTUREAD 4 /* PG_V,!PG_W,!PG_S */ + +/* static __inline int PG_VALID(void *va) { + register int t = va; t >>= PG_VSHIFT; return (t == 0 || t == -1); +} */ + +#if defined(SUN4M) + +/* + * Reference MMU PTE bits. + */ +#define SRPTE_PPN_MASK 0x07ffff00 +#define SRPTE_PPN_SHIFT 8 +#define SRPTE_CACHEABLE 0x00000080 /* Page is cacheable */ +#define SRPTE_MOD 0x00000040 /* Page is modified */ +#define SRPTE_REF 0x00000020 /* Page is referenced */ +#define SRPTE_ACCMASK 0x0000001c /* Access rights mask */ +#define SRPTE_ACCSHIFT 2 /* Access rights shift */ +#define SRPTE_TYPEMASK 0x00000003 /* PTE Type */ +#define SRPTE_PTE 0x00000002 /* A PTE (Page Table Entry) */ +#define SRPTE_PTP 0x00000001 /* A PTP (Page Table Pointer) */ + +/* + * Reference MMU access permission bits. + * format: SRACC_sssuuu, + * where <sss> denote the supervisor rights + * and <uuu> denote the user rights + */ +#define SRACC_R__R__ 0 +#define SRACC_RW_RW_ 1 +#define SRACC_R_XR_X 2 +#define SRACC_RWXRWX 3 +#define SRACC___X__X 4 +#define SRACC_RW_R__ 5 +#define SRACC_R_X___ 6 +#define SRACC_RWX___ 7 + +/* + * IOMMU PTE bits. + */ +#define IOPTE_PPN_MASK 0x07ffff00 +#define IOPTE_PPN_SHIFT 8 +#define IOPTE_RSVD 0x000000f1 +#define IOPTE_WRITE 0x00000004 +#define IOPTE_VALID 0x00000002 + +#endif /* SUN4M */ diff --git a/sys/arch/sparc/include/ptrace.h b/sys/arch/sparc/include/ptrace.h new file mode 100644 index 00000000000..f01223f36bd --- /dev/null +++ b/sys/arch/sparc/include/ptrace.h @@ -0,0 +1,53 @@ +/* $NetBSD: ptrace.h,v 1.4 1994/11/20 20:53:27 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)ptrace.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * SPARC-dependent ptrace definitions. + */ +#define PT_GETREGS (PT_FIRSTMACH + 0) +#define PT_SETREGS (PT_FIRSTMACH + 1) +#define PT_GETFPREGS (PT_FIRSTMACH + 2) +#define PT_SETFPREGS (PT_FIRSTMACH + 3) diff --git a/sys/arch/sparc/include/reg.h b/sys/arch/sparc/include/reg.h new file mode 100644 index 00000000000..137d9aed411 --- /dev/null +++ b/sys/arch/sparc/include/reg.h @@ -0,0 +1,126 @@ +/* $NetBSD: reg.h,v 1.4 1994/11/20 20:53:28 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)reg.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _MACHINE_REG_H_ +#define _MACHINE_REG_H_ + +/* + * Registers passed to trap/syscall/etc. + * This structure is known to occupy exactly 80 bytes (see locore.s). + * Note, tf_global[0] is not actually written (since g0 is always 0). + * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb. + * This is known as `cheating'.) + */ +struct trapframe { + int tf_psr; /* psr */ + int tf_pc; /* return pc */ + int tf_npc; /* return npc */ + int tf_y; /* %y register */ + int tf_global[8]; /* global registers in trap's caller */ + int tf_out[8]; /* output registers in trap's caller */ +}; + +/* + * Register windows. Each stack pointer (%o6 aka %sp) in each window + * must ALWAYS point to some place at which it is safe to scribble on + * 64 bytes. (If not, your process gets mangled.) Furthermore, each + * stack pointer should be aligned on an 8-byte boundary (the kernel + * as currently coded allows arbitrary alignment, but with a hefty + * performance penalty). + */ +struct rwindow { + int rw_local[8]; /* %l0..%l7 */ + int rw_in[8]; /* %i0..%i7 */ +}; + +/* + * Clone trapframe for now; this seems to be the more useful + * than the old struct reg above. + */ +struct reg { + int r_psr; /* psr */ + int r_pc; /* return pc */ + int r_npc; /* return npc */ + int r_y; /* %y register */ + int r_global[8]; /* global registers in trap's caller */ + int r_out[8]; /* output registers in trap's caller */ +}; + +#include <machine/fsr.h> + +/* + * FP coprocessor registers. + * + * FP_QSIZE is the maximum coprocessor instruction queue depth + * of any implementation on which the kernel will run. David Hough: + * ``I'd suggest allowing 16 ... allowing an indeterminate variable + * size would be even better''. Of course, we cannot do that; we + * need to malloc these. + */ +#define FP_QSIZE 16 + +struct fp_qentry { + int *fq_addr; /* the instruction's address */ + int fq_instr; /* the instruction itself */ +}; +struct fpstate { + u_int fs_regs[32]; /* our view is 32 32-bit registers */ + int fs_fsr; /* %fsr */ + int fs_qsize; /* actual queue depth */ + struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */ +}; + +/* + * Clone fpstate into an fpreg structure to satisfy <kern/sys_process.c> + */ +struct fpreg { + u_int fr_regs[32]; /* our view is 32 32-bit registers */ + int fr_fsr; /* %fsr */ + int fr_qsize; /* actual queue depth */ + struct fp_qentry fr_queue[FP_QSIZE]; /* queue contents */ +}; + +#endif /* _MACHINE_REG_H_ */ diff --git a/sys/arch/sparc/include/reloc.h b/sys/arch/sparc/include/reloc.h new file mode 100644 index 00000000000..01c0104e932 --- /dev/null +++ b/sys/arch/sparc/include/reloc.h @@ -0,0 +1,103 @@ +/* $NetBSD: reloc.h,v 1.2 1994/11/20 20:53:30 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)reloc.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * SPARC relocations. The linker has, unfortunately, a large number + * of link types. We do not do dynamic linking (yet?) but we define + * the dynamic link types. + */ +enum reloc_type { + /* architecturally-required types */ + RELOC_8, /* 8-bit absolute */ + RELOC_16, /* 16-bit absolute */ + RELOC_32, /* 32-bit absolute */ + RELOC_DISP8, /* 8-bit pc-relative */ + RELOC_DISP16, /* 16-bit pc-relative */ + RELOC_DISP32, /* 32-bit pc-relative */ + RELOC_WDISP30, /* 30-bit pc-relative signed word */ + RELOC_WDISP22, /* 22-bit pc-relative signed word */ + RELOC_HI22, /* 22-bit `%hi' (ie, sethi %hi(X),%l0) */ + RELOC_22, /* 22-bit non-%hi (i.e., sethi X,%l0) */ + RELOC_13, /* 13-bit absolute */ + RELOC_LO10, /* 10-bit `%lo' */ + + /* gnu ld understands some of these, but I do not */ + RELOC_SFA_BASE, /* ? */ + RELOC_SFA_OFF13, /* ? */ + RELOC_BASE10, /* ? */ + RELOC_BASE13, /* ? */ + RELOC_BASE22, /* ? */ + + /* gnu ld does not use these but Sun linker does */ + /* we define them anyway (note that they are included + in the freely-available gas sources!) */ + RELOC_PC10, /* ? */ + RELOC_PC22, /* ? */ + RELOC_JMP_TBL, /* ? */ + RELOC_SEGOFF16, /* ? */ + RELOC_GLOB_DAT, /* ? */ + RELOC_JMP_SLOT, /* ? */ + RELOC_RELATIVE, /* ? */ +}; + +/* + * SPARC relocation info. + * + * Symbol-relative relocation is done by: + * 1. locating the appropriate symbol + * 2. if defined, adding (value + r_addend), subtracting pc if pc-rel, + * and then shifting down 2 or 10 or 13 if necessary. + * The resulting value is then to be stuffed into the appropriate bits + * in the object (the low 22, or the high 30, or ..., etc). + */ +struct reloc_info_sparc { + u_long r_address; /* relocation addr (offset in segment) */ + u_int r_index:24, /* segment (r_extern==0) or symbol index */ + r_extern:1, /* if set, r_index is symbol index */ + :2; /* unused */ + enum reloc_type r_type:5; /* relocation type, from above */ + long r_addend; /* value to add to symbol value */ +}; diff --git a/sys/arch/sparc/include/remote-sl.h b/sys/arch/sparc/include/remote-sl.h new file mode 100644 index 00000000000..3c48e6b451a --- /dev/null +++ b/sys/arch/sparc/include/remote-sl.h @@ -0,0 +1,68 @@ +/* $NetBSD: remote-sl.h,v 1.2 1994/11/20 20:53:31 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)remote-sl.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * These definitions are factored out into an include file so + * the kernel stub has access to them. + */ +#define FRAME_START 0xc1 /* Frame End */ +#define FRAME_END 0xc0 /* Frame End */ +#define FRAME_ESCAPE 0xdb /* Frame Esc */ +#define TRANS_FRAME_START 0xde /* transposed frame start */ +#define TRANS_FRAME_END 0xdc /* transposed frame esc */ +#define TRANS_FRAME_ESCAPE 0xdd /* transposed frame esc */ + +/* + * Message limits. SL_MAXDATA is the maximum number of bytes that can + * be read or written. SL_BUFSIZE is the maximum amount of data that + * can be passed across the serial link. The actual MTU is two times + * the max message (since each byte might be escaped), plus the two + * framing bytes. We add two to the message length to account for the + * type byte and checksum. + */ +#define SL_MAXDATA 62 /* max data that can be read */ +#define SL_RPCSIZE (1 + SL_MAXDATA) /* errno byte + data */ +#define SL_MTU ((2 * (SL_RPCSIZE + 2) + 2)) diff --git a/sys/arch/sparc/include/setjmp.h b/sys/arch/sparc/include/setjmp.h new file mode 100644 index 00000000000..e224ce1e7c0 --- /dev/null +++ b/sys/arch/sparc/include/setjmp.h @@ -0,0 +1,7 @@ +/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:10 cgd Exp $ */ + +/* + * machine/setjmp.h: machine dependent setjmp-related information. + */ + +#define _JBLEN 10 /* size, in longs, of a jmp_buf */ diff --git a/sys/arch/sparc/include/signal.h b/sys/arch/sparc/include/signal.h new file mode 100644 index 00000000000..1dad46faf47 --- /dev/null +++ b/sys/arch/sparc/include/signal.h @@ -0,0 +1,100 @@ +/* $NetBSD: signal.h,v 1.3 1995/01/10 19:01:46 jtc Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)signal.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _SPARC_SIGNAL_H_ +#define _SPARC_SIGNAL_H_ + +#ifndef LOCORE +typedef int sig_atomic_t; +#endif + +#ifndef _ANSI_SOURCE +#ifndef LOCORE + +/* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * execution of the signal handler. It is also made available + * to the handler to allow it to restore state properly if + * a non-standard exit is performed. + * + * All machines must have an sc_onstack and sc_mask. + */ +struct sigcontext { + int sc_onstack; /* sigstack state to restore */ + int sc_mask; /* signal mask to restore */ + /* begin machine dependent portion */ + int sc_sp; /* %sp to restore */ + int sc_pc; /* pc to restore */ + int sc_npc; /* npc to restore */ + int sc_psr; /* psr to restore */ + int sc_g1; /* %g1 to restore */ + int sc_o0; /* %o0 to restore */ +}; +#else /* LOCORE */ +#define SC_SP_OFFSET 8 +#define SC_PC_OFFSET 12 +#define SC_NPC_OFFSET 16 +#define SC_PSR_OFFSET 20 +#define SC_G1_OFFSET 24 +#define SC_O0_OFFSET 28 +#endif /* LOCORE */ + +/* + * `Code' arguments to signal handlers. The names, and the funny numbering. + * are defined so as to match up with what SunOS uses; I have no idea why + * they did the numbers that way, except maybe to match up with the 68881. + */ +#define FPE_INTOVF_TRAP 0x01 /* integer overflow */ +#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */ +#define FPE_FLTINEX_TRAP 0xc4 /* inexact */ +#define FPE_FLTDIV_TRAP 0xc8 /* divide by zero */ +#define FPE_FLTUND_TRAP 0xcc /* underflow */ +#define FPE_FLTOPERR_TRAP 0xd0 /* operand error */ +#define FPE_FLTOVF_TRAP 0xd4 /* overflow */ + +#endif /* !_ANSI_SOURCE */ +#endif /* !_SPARC_SIGNAL_H_ */ diff --git a/sys/arch/sparc/include/stdarg.h b/sys/arch/sparc/include/stdarg.h new file mode 100644 index 00000000000..a1069e6a385 --- /dev/null +++ b/sys/arch/sparc/include/stdarg.h @@ -0,0 +1,118 @@ +/* $NetBSD: stdarg.h,v 1.6 1995/01/28 01:52:21 jtc Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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: @(#)stdarg.h 8.2 (Berkeley) 9/27/93 + */ + +/* + * SPARC stdarg.h + */ + +#ifndef _SPARC_STDARG_H_ +#define _SPARC_STDARG_H_ + +#include <machine/ansi.h> + +typedef _BSD_VA_LIST_ va_list; + +/* + * va_start sets ap to point to the first variable argument. + * The `last fixed argument' parameter l is ignored (and should + * never have been included in the ANSI standard!). + * + * va_end cleans up after va_start. There is nothing to do there. + */ +#ifdef __GCC_NEW_VARARGS__ /* gcc 2.4.5 */ +#define va_start(ap, l) ((ap) = (va_list)__builtin_saveregs()) +#else /* gcc 2.3.3 */ +#define va_start(ap, l) (__builtin_saveregs(), \ + (ap) = (va_list)__builtin_next_arg()) +#endif +#define va_end(ap) ((void) 0) + +#if __GNUC__ == 1 +#define __extension__ /* hack for bootstrapping via gcc 1.x */ +#endif + +/* + * va_arg picks up the next argument of type `ty'. Appending an + * asterisk to ty must produce a pointer to ty (i.e., ty may not be, + * e.g., `int (*)()'). In addition, ty must not be any type which + * undergoes promotion to some other type (e.g., char): it must + * be the promoted type instead. + * + * Gcc-2.x tries to use ldd/std for double and quad_t values, but Sun's + * brain-damaged calling convention does not quad-align these. Thus, + * for 8-byte arguments, we have to pick up the actual value four bytes + * at a time, and use type punning (i.e., a union) to produce the result. + * (We could also do this with a libc function, actually, by returning + * 8 byte integers in %o0+%o1 and the same 8 bytes as a double in %f0+%f1.) + * + * Note: we cannot use the union trick (which generates better code) for + * C++, since `ty' might be a type with a constructor (these may not appear + * in a union). + * + * The extraneous casts through `void *' avoid gcc alignment warnings. + */ +#ifdef __cplusplus +#define __va_8byte(ap, ty) ({ \ + int __va_i[2]; \ + __va_i[0] = ((int *)(void *)(ap))[0]; \ + __va_i[1] = ((int *)(void *)(ap))[1]; \ + (ap) += 8; *(ty *)(void *)__va_i; }) +#else +#define __va_8byte(ap, ty) ({ \ + union { ty __d; int __i[2]; } __va_u; \ + __va_u.__i[0] = ((int *)(void *)(ap))[0]; \ + __va_u.__i[1] = ((int *)(void *)(ap))[1]; \ + (ap) += 8; __va_u.__d; }) +#endif /* __cplusplus */ + +#define va_arg(ap, ty) __extension__ ({ \ + ty __va_temp; /* to check for invisible-ptr struct-valued args */ \ + __builtin_classify_type(__va_temp) >= 12 ? \ + ((ty **)(void *)((ap) += sizeof(ty *)))[-1][0] : \ + sizeof(ty) == 8 ? __va_8byte(ap, ty) : \ + ((ty *)(void *)(ap += sizeof(ty)))[-1]; }) + +#endif /* !_SPARC_STDARG_H_ */ diff --git a/sys/arch/sparc/include/sun_disklabel.h b/sys/arch/sparc/include/sun_disklabel.h new file mode 100644 index 00000000000..90fc6803c2e --- /dev/null +++ b/sys/arch/sparc/include/sun_disklabel.h @@ -0,0 +1,115 @@ +/* $NetBSD: sun_disklabel.h,v 1.5 1995/06/26 22:09:47 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * SunOS disk label layout (only relevant portions discovered here). + */ + +#define SUN_DKMAGIC 55998 + +/* These are the guys that Sun's dkinfo needs... */ +#define DKIOCGGEOM _IOR('d', 2, struct sun_dkgeom) /* geometry info */ +#define DKIOCINFO _IOR('d', 8, struct sun_dkctlr) /* controller info */ +#define DKIOCGPART _IOR('d', 4, struct sun_dkpart) /* partition info */ + +/* geometry info */ +struct sun_dkgeom { + u_short sdkc_ncylinders; /* data cylinders */ + u_short sdkc_acylinders; /* alternate cylinders */ + u_short sdkc_xxx1; + u_short sdkc_ntracks; /* tracks per cylinder */ + u_short sdkc_xxx2; + u_short sdkc_nsectors; /* sectors per track */ + u_short sdkc_interleave; /* interleave factor */ + u_short sdkc_xxx3; + u_short sdkc_xxx4; + u_short sdkc_sparespercyl; /* spare sectors per cylinder */ + u_short sdkc_rpm; /* rotational speed */ + u_short sdkc_pcylinders; /* physical cylinders */ + u_short sdkc_xxx5[7]; +}; + +/* controller info */ +struct sun_dkctlr { + int sdkc_addr; /* controller address */ + short sdkc_unit; /* unit (slave) address */ + short sdkc_type; /* controller type */ + short sdkc_flags; /* flags */ +}; + +/* partition info */ +struct sun_dkpart { + long sdkp_cyloffset; /* starting cylinder */ + long sdkp_nsectors; /* number of sectors */ +}; + +struct sun_disklabel { /* total size = 512 bytes */ + char sl_text[128]; + char sl_xxx1[292]; + u_short sl_rpm; /* rotational speed */ + u_short sl_pcylinders; /* number of physical cyls */ + u_short sl_sparespercyl; /* spare sectors per cylinder */ + char sl_xxx3[4]; + u_short sl_interleave; /* interleave factor */ + u_short sl_ncylinders; /* data cylinders */ + u_short sl_acylinders; /* alternate cylinders */ + u_short sl_ntracks; /* tracks per cylinder */ + u_short sl_nsectors; /* sectors per track */ + char sl_xxx4[4]; + struct sun_dkpart sl_part[8]; /* partition layout */ + u_short sl_magic; /* == SUN_DKMAGIC */ + u_short sl_cksum; /* xor checksum of all shorts */ +}; + +#define SUN_LABELOFFSET 128 + +#ifdef _KERNEL +/* reads sun label in sector at [cp..cp+511] and sets *lp to BSD label */ +int sun_disklabel __P((caddr_t, struct disklabel *)); /* true on success */ + +/* compatability dk ioctl's */ +int sun_dkioctl __P((struct dkdevice *, u_long, caddr_t, int)); +#endif diff --git a/sys/arch/sparc/include/svr4_machdep.h b/sys/arch/sparc/include/svr4_machdep.h new file mode 100644 index 00000000000..f8c52bab9bd --- /dev/null +++ b/sys/arch/sparc/include/svr4_machdep.h @@ -0,0 +1,103 @@ +/* $NetBSD: svr4_machdep.h,v 1.1 1995/03/31 02:55:59 christos Exp $ */ + +/* + * Copyright (c) 1994 Christos Zoulas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SPARC_SVR4_MACHDEP_H_ +#define _SPARC_SVR4_MACHDEP_H_ + +#include <compat/svr4/svr4_types.h> + +/* + * Machine dependent portions [SPARC] + */ + +#define SVR4_SPARC_PSR 0 +#define SVR4_SPARC_PC 1 +#define SVR4_SPARC_nPC 2 +#define SVR4_SPARC_Y 3 +#define SVR4_SPARC_G1 4 +#define SVR4_SPARC_G2 5 +#define SVR4_SPARC_G3 6 +#define SVR4_SPARC_G4 7 +#define SVR4_SPARC_G5 8 +#define SVR4_SPARC_G6 9 +#define SVR4_SPARC_G7 10 +#define SVR4_SPARC_O0 11 +#define SVR4_SPARC_O1 12 +#define SVR4_SPARC_O2 13 +#define SVR4_SPARC_O3 14 +#define SVR4_SPARC_O4 15 +#define SVR4_SPARC_O5 16 +#define SVR4_SPARC_O6 17 +#define SVR4_SPARC_O7 18 +#define SVR4_SPARC_MAXREG 19 + +#define SVR4_SPARC_SP SVR4_SPARC_O6 +#define SVR4_SPARC_PS SVR4_SPARC_PSR + +#define SVR4_SPARC_MAXWIN 31 + +typedef int svr4_greg_t; + +typedef struct { + svr4_greg_t rwin_lo[8]; + svr4_greg_t rwin_in[8]; +} svr4_rwindow_t; + +typedef struct { + int cnt; + int *sp[SVR4_SPARC_MAXWIN]; + svr4_rwindow_t win[SVR4_SPARC_MAXWIN]; +} svr4_gwindow_t; + +typedef svr4_greg_t svr4_gregset_t[SVR4_SPARC_MAXREG]; + +typedef struct { + double fpu_regs[32]; + void *fp_q; + unsigned fp_fsr; + u_char fp_nqel; + u_char fp_nqsize; + u_char fp_busy; +} svr4_fregset_t; + +typedef struct { + svr4_gregset_t greg; + svr4_gwindow_t *gwin; + svr4_fregset_t freg; + long pad[21]; +} svr4_mcontext_t; + +struct svr4_ucontext; + +void svr4_getcontext __P((struct proc *, struct svr4_ucontext *, + int, int)); +int svr4_setcontext __P((struct proc *p, struct svr4_ucontext *)); +void svr4_sendsig __P((sig_t, int, int, u_long)); + +#endif /* !_SPARC_SVR4_MACHDEP_H_ */ diff --git a/sys/arch/sparc/include/trap.h b/sys/arch/sparc/include/trap.h new file mode 100644 index 00000000000..9c1f1529592 --- /dev/null +++ b/sys/arch/sparc/include/trap.h @@ -0,0 +1,133 @@ +/* $NetBSD: trap.h,v 1.6 1995/07/04 22:58:51 christos Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)trap.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _MACHINE_TRAP_H +#define _MACHINE_TRAP_H + +/* trap vec (pri) description */ +#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */ +#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */ +#define T_ILLINST 0x02 /* (3) illegal instruction */ +#define T_PRIVINST 0x03 /* (4) privileged instruction */ +#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */ +#define T_WINOF 0x05 /* (6) register window overflow */ +#define T_WINUF 0x06 /* (7) register window underflow */ +#define T_ALIGN 0x07 /* (8) address not properly aligned */ +#define T_FPE 0x08 /* (9) floating point exception */ +#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */ +#define T_TAGOF 0x0a /* (11) tag overflow */ +/* 0x0b unused */ +/* 0x0c unused */ +/* 0x0d unused */ +/* 0x0e unused */ +/* 0x0f unused */ +/* 0x10 unused */ +#define T_L1INT 0x11 /* (27) level 1 interrupt */ +#define T_L2INT 0x12 /* (26) level 2 interrupt */ +#define T_L3INT 0x13 /* (25) level 3 interrupt */ +#define T_L4INT 0x14 /* (24) level 4 interrupt */ +#define T_L5INT 0x15 /* (23) level 5 interrupt */ +#define T_L6INT 0x16 /* (22) level 6 interrupt */ +#define T_L7INT 0x17 /* (21) level 7 interrupt */ +#define T_L8INT 0x18 /* (20) level 8 interrupt */ +#define T_L9INT 0x19 /* (19) level 9 interrupt */ +#define T_L10INT 0x1a /* (18) level 10 interrupt */ +#define T_L11INT 0x1b /* (17) level 11 interrupt */ +#define T_L12INT 0x1c /* (16) level 12 interrupt */ +#define T_L13INT 0x1d /* (15) level 13 interrupt */ +#define T_L14INT 0x1e /* (14) level 14 interrupt */ +#define T_L15INT 0x1f /* (13) level 15 interrupt */ +/* 0x20 unused */ +/* through 0x23 unused */ +#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */ +/* 0x25 unused */ +/* through 0x27 unused */ +#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */ +/* 0x29 unused */ +/* through 0x7f unused */ + +/* beginning of `user' vectors (from trap instructions) - all priority 12 */ +#define T_SUN_SYSCALL 0x80 /* system call */ +#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */ +#define T_DIV0 0x82 /* division routine was handed 0 */ +#define T_FLUSHWIN 0x83 /* flush windows */ +#define T_CLEANWIN 0x84 /* provide clean windows */ +#define T_RANGECHECK 0x85 /* ? */ +#define T_FIXALIGN 0x86 /* fix up unaligned accesses */ +#define T_INTOF 0x87 /* integer overflow ? */ +#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */ +#define T_BSD_SYSCALL 0x89 /* BSD system call */ +#define T_KGDB_EXEC 0x8a /* for kernel gdb */ + +/* 0x8b..0xff are currently unallocated, except the following */ +#define T_SVR4_GETCC 0xa0 +#define T_SVR4_SETCC 0xa1 +#define T_SVR4_GETPSR 0xa2 +#define T_SVR4_SETPSR 0xa3 +#define T_SVR4_GETHRTIME 0xa4 +#define T_SVR4_GETHRVTIME 0xa5 +#define T_SVR4_GETHRESTIME 0xa7 + + +#ifdef _KERNEL /* pseudo traps for locore.s */ +#define T_RWRET -1 /* need first user window for trap return */ +#define T_AST -2 /* no-op, just needed reschedule or profile */ +#endif + +/* flags to system call (flags in %g1 along with syscall number) */ +#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */ +#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */ + +/* + * `software trap' macros to keep people happy (sparc v8 manual says not + * to set the upper bits). + */ +#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f) +#define ST_DIV0 (T_DIV0 & 0x7f) +#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f) +#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f) + +#endif /* _MACHINE_TRAP_H_ */ diff --git a/sys/arch/sparc/include/types.h b/sys/arch/sparc/include/types.h new file mode 100644 index 00000000000..a0f986ff88d --- /dev/null +++ b/sys/arch/sparc/include/types.h @@ -0,0 +1,81 @@ +/* $NetBSD: types.h,v 1.7 1995/07/05 17:46:11 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)types.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#include <sys/cdefs.h> + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +typedef struct _physadr { + short r[1]; +} *physadr; + +typedef struct label_t { + int val[2]; +} label_t; +#endif + +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#define __BIT_TYPES_DEFINED__ +typedef __signed char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; + +typedef int32_t register_t; + +#endif /* _MACHTYPES_H_ */ diff --git a/sys/arch/sparc/include/varargs.h b/sys/arch/sparc/include/varargs.h new file mode 100644 index 00000000000..9deb080ae04 --- /dev/null +++ b/sys/arch/sparc/include/varargs.h @@ -0,0 +1,77 @@ +/* $NetBSD: varargs.h,v 1.6 1994/11/20 20:53:37 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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: @(#)varargs.h 8.3 (Berkeley) 3/22/94 + */ + +#ifndef _SPARC_VARARGS_H_ +#define _SPARC_VARARGS_H_ + +#include <machine/stdarg.h> + +/* See <machine/stdarg.h> for comments. */ +#if __GNUC__ == 1 +#define __extension__ +#define va_dcl int va_alist; +#else /* gcc2 */ +#ifdef __GCC_NEW_VARARGS__ /* gcc 2.4.5 */ +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist; +#else /* gcc 2.3.3 */ +#define va_dcl int va_alist; ... +#endif +#endif + +#undef va_start +#ifdef __GCC_NEW_VARARGS__ +#define va_start(ap) ((ap) = (va_list)__builtin_saveregs()) +#else +#define va_start(ap) (__builtin_saveregs(), (ap) = (va_list)&va_alist) +#endif + +#endif /* !_SPARC_VARARGS_H_ */ diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h new file mode 100644 index 00000000000..989f8272933 --- /dev/null +++ b/sys/arch/sparc/include/vmparam.h @@ -0,0 +1,141 @@ +/* $NetBSD: vmparam.h,v 1.6 1995/07/05 18:04:48 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)vmparam.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Machine dependent constants for Sun-4c SPARC + */ + +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the top (end) of the user stack. + */ +#define USRTEXT 0x2000 /* Start of user text */ +#define USRSTACK KERNBASE /* Start of user stack */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (8*1024*1024) /* max text size */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (64*1024*1024) /* max data size */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (512*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ MAXDSIZ /* max stack size */ +#endif + +/* + * Default sizes of swap allocation chunks (see dmap.h). + * The actual values may be changed in vminit() based on MAXDSIZ. + * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. + * DMMIN should be at least ctod(1) so that vtod() works. + * vminit() insures this. + */ +#define DMMIN 32 /* smallest swap allocation */ +#define DMMAX NBPG /* largest potential swap allocation */ +#define DMTEXT 1024 /* swap allocation for text */ + +/* + * Size of shared memory map + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 1024 +#endif + +/* + * The time for a process to be blocked before being very swappable. + * This is a number of seconds which the system takes as being a non-trivial + * amount of real time. You probably shouldn't change this; + * it is used in subtle ways (fractions and multiples of it are, that is, like + * half of a ``long time'', almost a long time, etc.) + * It is related to human patience and other factors which don't really + * change over time. + */ +#define MAXSLP 20 + +/* + * A swapped in process is given a small amount of core without being bothered + * by the page replacement algorithm. Basically this says that if you are + * swapped in you deserve some resources. We protect the last SAFERSS + * pages against paging and will just swap you out rather than paging you. + * Note that each process has at least UPAGES+CLSIZE pages which are not + * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this + * number just means a swapped in process is given around 25k bytes. + * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), + * so we loan each swapped in process memory worth 100$, or just admit + * that we don't consider it worthwhile and swap it out to disk which costs + * $30/mb or about $0.75. + */ +#define SAFERSS 4 /* nominal ``small'' resident set size + protected against replacement */ + +/* + * Mach derived constants + */ + +/* + * User/kernel map constants. Note that sparc/vaddrs.h defines the + * IO space virtual base, which must be the same as VM_MAX_KERNEL_ADDRESS: + * tread with care. + */ +#define VM_MIN_ADDRESS ((vm_offset_t)0) +#define VM_MAX_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xfe000000) + +/* virtual sizes (bytes) for various kernel submaps */ +#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) + +#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ diff --git a/sys/arch/sparc/include/vuid_event.h b/sys/arch/sparc/include/vuid_event.h new file mode 100644 index 00000000000..0bb4e0015cc --- /dev/null +++ b/sys/arch/sparc/include/vuid_event.h @@ -0,0 +1,87 @@ +/* $NetBSD: vuid_event.h,v 1.2 1994/11/20 20:53:39 deraadt Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * The following is a minimal emulation of Sun's `Firm_event' structures + * and related operations necessary to make X11 happy (i.e., make it + * compile, and make old X11 binaries run). + */ +typedef struct firm_event { + u_short id; /* key or MS_* or LOC_[XY]_DELTA */ + u_short pad; /* unused, at least by X11 */ + int value; /* VKEY_{UP,DOWN} or locator delta */ + struct timeval time; +} Firm_event; + +/* + * Special `id' fields. These weird numbers simply match the old binaries. + * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!). + */ +#define MS_LEFT 0x7f20 /* left mouse button */ +#define MS_MIDDLE 0x7f21 /* middle mouse button */ +#define MS_RIGHT 0x7f22 /* right mouse button */ +#define LOC_X_DELTA 0x7f80 /* mouse delta-X */ +#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */ +#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ +#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ + +/* + * Special `value' fields. These apply to keys and mouse buttons. The + * value of a mouse delta is the delta. Note that positive deltas are + * left and up (not left and down as you might expect). + */ +#define VKEY_UP 0 /* key or button went up */ +#define VKEY_DOWN 1 /* key or button went down */ + +/* + * The following ioctls are clearly intended to take things in and out + * of `firm event' mode. Since we always run in this mode (as far as + * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to + * be in this mode and reject anything else. + */ +#define VUIDSFORMAT _IOW('v', 1, int) +#define VUIDGFORMAT _IOR('v', 2, int) +#define VUID_FIRM_EVENT 1 /* the only format we support */ |