diff options
Diffstat (limited to 'sys/arch/mvmeppc/include')
49 files changed, 5685 insertions, 0 deletions
diff --git a/sys/arch/mvmeppc/include/ansi.h b/sys/arch/mvmeppc/include/ansi.h new file mode 100644 index 00000000000..ba1e0b55b98 --- /dev/null +++ b/sys/arch/mvmeppc/include/ansi.h @@ -0,0 +1,84 @@ +/* $OpenBSD: ansi.h,v 1.1 2001/06/26 21:57:42 smurph Exp $ */ +/* $NetBSD: ansi.h,v 1.2 1996/11/15 22:38:57 jtc 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_ int /* time() */ +struct __va_list_tag; +#define _BSD_VA_LIST_ struct __va_list_tag * /* va_list */ +#define _BSD_CLOCKID_T_ int +#define _BSD_TIMER_T_ int + +/* + * 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 */ + +/* + * We describe off_t here so its declaration can be visible to + * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI. + */ +#define _BSD_OFF_T_ long long /* file offset */ + +#endif /* _ANSI_H_ */ diff --git a/sys/arch/mvmeppc/include/asm.h b/sys/arch/mvmeppc/include/asm.h new file mode 100644 index 00000000000..ed098b5a24e --- /dev/null +++ b/sys/arch/mvmeppc/include/asm.h @@ -0,0 +1,106 @@ +/* $OpenBSD: asm.h,v 1.1 2001/06/26 21:57:42 smurph Exp $ */ +/* $NetBSD: asm.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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 _PPC_ASM_H_ +#define _PPC_ASM_H_ + +/* XXX */ +#define TARGET_ELF + +#ifdef PIC +#define PIC_PROLOGUE XXX +#define PIC_EPILOGUE XXX +#ifdef __STDC__ +#define PIC_PLT(x) x ## @plt +#define PIC_GOT(x) XXX +#define PIC_GOTOFF(x) XXX +#else /* not __STDC__ */ +#define PIC_PLT(x) x/**/@plt +#define PIC_GOT(x) XXX +#define PIC_GOTOFF(x) XXX +#endif /* __STDC__ */ +#else +#define PIC_PROLOGUE +#define PIC_EPILOGUE +#define PIC_PLT(x) x +#define PIC_GOT(x) x +#define PIC_GOTOFF(x) x +#endif + +#ifdef TARGET_AOUT +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#endif + +#ifdef TARGET_ELF +# define _C_LABEL(x) x +#endif +#define _ASM_LABEL(x) x + +#ifdef __STDC__ +# define _TMP_LABEL(x) .L_ ## x +#else +# define _TMP_LABEL(x) .L_/**/x +#endif + +#define _ENTRY(x) \ + .text; .align 2; .globl x; .type x,@function; x: + +#ifdef PROF +# define _PROF_PROLOGUE(y) \ + .section ".data"; \ + .align 2; \ +_TMP_LABEL(y):; \ + .long 0; \ + .section ".text"; \ + mflr 0; \ + addis 11, 11, _TMP_LABEL(y)@ha; \ + stw 0, 4(1); \ + addi 0, 11,_TMP_LABEL(y)@l; \ + bl _mcount; +#else +# define _PROF_PROLOGUE(y) +#endif + +#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE(y) +#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE(y) + +#define ASMSTR .asciz + +#define RCSID(x) .text; .asciz x + +#endif /* !_PPC_ASM_H_ */ diff --git a/sys/arch/mvmeppc/include/autoconf.h b/sys/arch/mvmeppc/include/autoconf.h new file mode 100644 index 00000000000..d23d3cc9f0e --- /dev/null +++ b/sys/arch/mvmeppc/include/autoconf.h @@ -0,0 +1,103 @@ +/* $OpenBSD: autoconf.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ + +/* + * Copyright (c) 1997 Per Fogelstrom + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD for RTMX inc + * by Per Fogelstrom, Opsycon AB. + * 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. + * + */ +/* + * Machine-dependent structures of autoconfiguration + */ + +#ifndef _MACHINE_AUTOCONF_H_ +#define _MACHINE_AUTOCONF_H_ + +#include <machine/bus.h> + +/* + * System types. + */ +#define OFWMACH 0 /* Openfirmware drivers */ +#define POWER4e 1 /* V.I Power.4e board */ +#define PWRSTK 2 /* Motorola Powerstack series */ +#define APPL 3 /* Apple PowerMac machines (OFW?) */ +#define MVME 4 /* Motorola MVME SBCs */ + +extern int system_type; + +/**/ +struct confargs; + +typedef int (*intr_handler_t) __P((void *)); + +typedef struct bushook { + struct device *bh_dv; + int bh_type; + void (*bh_intr_establish) + __P((struct confargs *, intr_handler_t, void *)); + void (*bh_intr_disestablish) + __P((struct confargs *)); + int (*bh_matchname) + __P((struct confargs *, char *)); +} bushook_t; + +#define BUS_MAIN 1 /* mainbus */ +#define BUS_ISABR 2 /* ISA Bridge Bus */ +#define BUS_PCIBR 3 /* PCI bridge */ +#define BUS_VMEBR 4 /* VME bridge */ + +#define BUS_INTR_ESTABLISH(ca, handler, val) \ + (*(ca)->ca_bus->bh_intr_establish)((ca), (handler), (val)) +#define BUS_INTR_DISESTABLISH(ca) \ + (*(ca)->ca_bus->bh_intr_establish)(ca) +#define BUS_CVTADDR(ca) \ + (*(ca)->ca_bus->bh_cvtaddr)(ca) +#define BUS_MATCHNAME(ca, name) \ + (*(ca)->ca_bus->bh_matchname)((ca), (name)) + +struct confargs { + char *ca_name; /* Device name. */ + bushook_t *ca_bus; /* bus device resides on. */ + /* macobio hooks ?? */ + bus_space_tag_t ca_iot; + bus_space_tag_t ca_memt; /* XXX */ + u_int32_t ca_node; + int ca_nreg; + u_int32_t *ca_reg; + int ca_nintr; + int32_t *ca_intr; + u_int ca_baseaddr; + +}; + +void set_clockintr __P((void (*)(struct clockframe *))); +void set_iointr __P((void (*)(void *, int))); +int badaddr __P((void *, u_int32_t)); + +#endif /* _MACHINE_AUTOCONF_H_ */ diff --git a/sys/arch/mvmeppc/include/bat.h b/sys/arch/mvmeppc/include/bat.h new file mode 100644 index 00000000000..b2938749e9f --- /dev/null +++ b/sys/arch/mvmeppc/include/bat.h @@ -0,0 +1,54 @@ +/* $OpenBSD: bat.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_BAT_H_ +#define _MACHINE_BAT_H_ + +struct bat { + u_int32_t batu; + u_int32_t batl; +}; + +#define BATU(vaddr) (((vaddr)&0xf0000000)|0x1ffe) +#define BATL(raddr,wimg) (((raddr)&0xf0000000)|(wimg)|0x2) + +#define BAT_W 0x40 +#define BAT_I 0x20 +#define BAT_M 0x10 +#define BAT_G 0x08 + +#ifdef _KERNEL +extern struct bat battable[16]; +#endif + +#endif /* _MACHINE_BAT_H_ */ diff --git a/sys/arch/mvmeppc/include/bus.h b/sys/arch/mvmeppc/include/bus.h new file mode 100644 index 00000000000..454930f24a1 --- /dev/null +++ b/sys/arch/mvmeppc/include/bus.h @@ -0,0 +1,128 @@ +/* $NetBSD: bus.h,v 1.6 2001/06/15 15:50:05 nonaka Exp $ */ +/* $OpenBSD: bus.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ + +/*- + * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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. + */ + +/* + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. + * Copyright (c) 1996 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 + * for the NetBSD Project. + * 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. + */ + +/* + * Copyright (c) 1997 Per Fogelstrom. All rights reserved. + * Copyright (c) 1996 Niklas Hallqvist. 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 + * for the NetBSD Project. + * 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 _PREP_BUS_H_ +#define _PREP_BUS_H_ + +#define _POWERPC_BUS_DMA_PRIVATE +#include <machine/bus_mi.h> + +/* + * Values for the Be bus space tag, not to be used directly by MI code. + */ +#define PREP_BUS_SPACE_IO 0x80000000 /* i/o space */ +#define PREP_BUS_SPACE_MEM 0xC0000000 /* mem space */ + +/* + * Address conversion as seen from a PCI master. + */ +#define MPC105_DIRECT_MAPPED_SPACE 0x80000000 +#define PHYS_TO_PCI_MEM(x) ((x) | MPC105_DIRECT_MAPPED_SPACE) +#define PCI_MEM_TO_PHYS(x) ((x) & ~MPC105_DIRECT_MAPPED_SPACE) + +extern const struct ppc_bus_space prep_io_space_tag; +extern const struct ppc_bus_space prep_isa_io_space_tag; +extern const struct ppc_bus_space prep_mem_space_tag; +extern const struct ppc_bus_space prep_isa_mem_space_tag; + +#endif /* _PREP_BUS_H_ */ diff --git a/sys/arch/mvmeppc/include/bus_mi.h b/sys/arch/mvmeppc/include/bus_mi.h new file mode 100644 index 00000000000..b7ec2089081 --- /dev/null +++ b/sys/arch/mvmeppc/include/bus_mi.h @@ -0,0 +1,1146 @@ +/* $NetBSD: bus.h,v 1.1 2001/06/06 17:37:37 matt Exp $ */ +/* $OpenBSD: bus_mi.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ + +/*- + * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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. + */ + +/* + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. + * Copyright (c) 1996 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 + * for the NetBSD Project. + * 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. + */ + +/* + * Copyright (c) 1997 Per Fogelstrom. All rights reserved. + * Copyright (c) 1996 Niklas Hallqvist. 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 + * for the NetBSD Project. + * 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 _POWERPC_BUS_H_ +#define _POWERPC_BUS_H_ + +#include <machine/pio.h> + +typedef enum { + BUS_DMASYNC_POSTREAD, + BUS_DMASYNC_POSTWRITE, + BUS_DMASYNC_PREREAD, + BUS_DMASYNC_PREWRITE +} bus_dmasync_op_t; + +/* + * Bus access types. + */ +typedef u_int32_t bus_addr_t; +typedef u_int32_t bus_size_t; +typedef u_int32_t bus_space_handle_t; +typedef const struct ppc_bus_space *bus_space_tag_t; + +struct ppc_bus_space { + u_int32_t pbs_type; + bus_addr_t pbs_offset; + bus_addr_t pbs_base; + bus_addr_t pbs_limit; + int (*pbs_map) __P((bus_space_tag_t, bus_addr_t, bus_size_t, int, + bus_space_handle_t *)); + void (*pbs_unmap) __P((bus_space_tag_t, bus_space_handle_t, + bus_size_t)); + int (*pbs_alloc) __P((bus_space_tag_t, bus_addr_t, bus_addr_t, + bus_size_t, bus_size_t align, bus_size_t, int, bus_addr_t *, + bus_space_handle_t *)); + void (*pbs_free) __P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); +}; + +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 + +#ifdef __STDC__ +#define CAT(a,b) a##b +#define CAT3(a,b,c) a##b##c +#else +#define CAT(a,b) a/**/b +#define CAT3(a,b,c) a/**/b/**/c +#endif + +/* + * Access methods for bus resources + */ + +#define __BUS_SPACE_HAS_STREAM_METHODS + +/* + * int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr, + * bus_size_t size, int flags, bus_space_handle_t *bshp)); + * + * Map a region of bus space. + */ + +#define bus_space_map(t, a, s, f, hp) \ + ((*(t)->pbs_map)((t), (a), (s), (f), (hp))) + +/* + * int bus_space_unmap __P((bus_space_tag_t t, + * bus_space_handle_t bsh, bus_size_t size)); + * + * Unmap a region of bus space. + */ + +#define bus_space_unmap(t, h, s) \ + ((void)(*(t)->pbs_unmap)((t), (h), (s))) + +/* + * int bus_space_subregion __P((bus_space_tag_t t, + * bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, + * bus_space_handle_t *nbshp)); + * + * Get a new handle for a subregion of an already-mapped area of bus space. + */ + +#define bus_space_subregion(t, h, o, s, hp) \ + ((*(hp) = (h) + (o)), 0) + +/* + * int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t rstart, + * bus_addr_t rend, bus_size_t size, bus_size_t align, + * bus_size_t boundary, int flags, bus_addr_t *bpap, + * bus_space_handle_t *bshp)); + * + * Allocate a region of bus space. + */ + +#define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \ + ((*(t)->pbs_alloc)((t), (rs), (re), (s), (a), (b), (f), (ap), (hp))) + +/* + * int bus_space_free __P((bus_space_tag_t t, + * bus_space_handle_t bsh, bus_size_t size)); + * + * Free a region of bus space. + */ + +#define bus_space_free(t, h, s) \ + ((void)(*(t)->pbs_free)((t), (h), (s))) + +/* + * u_intN_t bus_space_read_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset)); + * + * Read a 1, 2, 4, or 8 byte quantity from bus space + * described by tag/handle/offset. + */ + +#define bus_space_read(n,m) \ +static __inline CAT3(u_int,m,_t) \ +CAT(bus_space_read_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset) \ +{ \ + return CAT3(in,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (offset))); \ +} + +bus_space_read(1,8) +bus_space_read(2,16) +bus_space_read(4,32) +#define bus_space_read_8 !!! bus_space_read_8 unimplemented !!! + +/* + * u_intN_t bus_space_read_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset)); + * + * Read a 2, 4, or 8 byte stream quantity from bus space + * described by tag/handle/offset. + */ + +#define bus_space_read_stream(n,m) \ +static __inline CAT3(u_int,m,_t) \ +CAT(bus_space_read_stream_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset) \ +{ \ + return CAT(in,m)((volatile CAT3(u_int,m,_t) *)(bsh + (offset))); \ +} + +bus_space_read_stream(2,16) +bus_space_read_stream(4,32) +#define bus_space_read_stream_8 !!! bus_space_read_stream_8 unimplemented !!! + +/* + * void bus_space_read_multi_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t *addr, size_t count)); + * + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle/offset and copy into buffer provided. + */ + +#define bus_space_read_multi(n,m) \ +static __inline void \ +CAT(bus_space_read_multi_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset, CAT3(u_int,m,_t) *addr, size_t count) \ +{ \ + CAT3(ins,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), \ + (CAT3(u_int,m,_t) *)addr, (size_t)count); \ +} + +bus_space_read_multi(1,8) +bus_space_read_multi(2,16) +bus_space_read_multi(4,32) +#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! + +/* + * void bus_space_read_multi_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t *addr, size_t count)); + * + * Read `count' 2, 4, or 8 byte stream quantities from bus space + * described by tag/handle/offset and copy into buffer provided. + */ + +#define bus_space_read_multi_stream(n,m) \ +static __inline void \ +CAT(bus_space_read_multi_stream_,n)(bus_space_tag_t tag, \ + bus_space_handle_t bsh, \ + bus_size_t offset, CAT3(u_int,m,_t) *addr, size_t count) \ +{ \ + CAT(ins,m)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), \ + (CAT3(u_int,m,_t) *)addr, (size_t)count); \ +} + +bus_space_read_multi_stream(2,16) +bus_space_read_multi_stream(4,32) +#define bus_space_read_multi_stream_8 \ + !!! bus_space_read_multi_stream_8 not implemented !!! + +/* + * void bus_space_write_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t value)); + * + * Write the 1, 2, 4, or 8 byte value `value' to bus space + * described by tag/handle/offset. + */ + +#define bus_space_write(n,m) \ +static __inline void \ +CAT(bus_space_write_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset, CAT3(u_int,m,_t) x) \ +{ \ + CAT3(out,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), x); \ +} + +bus_space_write(1,8) +bus_space_write(2,16) +bus_space_write(4,32) +#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!! + +/* + * void bus_space_write_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t value)); + * + * Write the 2, 4, or 8 byte stream value `value' to bus space + * described by tag/handle/offset. + */ + +#define bus_space_write_stream(n,m) \ +static __inline void \ +CAT(bus_space_write_stream_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset, CAT3(u_int,m,_t) x) \ +{ \ + CAT(out,m)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), x); \ +} + +bus_space_write_stream(2,16) +bus_space_write_stream(4,32) +#define bus_space_write_stream_8 !!! bus_space_write_stream_8 unimplemented !!! + +/* + * void bus_space_write_multi_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * const u_intN_t *addr, size_t count)); + * + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer + * provided to bus space described by tag/handle/offset. + */ + +#define bus_space_write_multi(n,m) \ +static __inline void \ +CAT(bus_space_write_multi_,n)(bus_space_tag_t tag, bus_space_handle_t bsh, \ + bus_size_t offset, const CAT3(u_int,m,_t) *addr, size_t count) \ +{ \ + CAT3(outs,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), \ + (CAT3(u_int,m,_t) *)addr, (size_t)count); \ +} + +bus_space_write_multi(1,8) +bus_space_write_multi(2,16) +bus_space_write_multi(4,32) +#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! + +/* + * void bus_space_write_multi_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * const u_intN_t *addr, size_t count)); + * + * Write `count' 2, 4, or 8 byte stream quantities from the buffer + * provided to bus space described by tag/handle/offset. + */ + +#define bus_space_write_multi_stream(n,m) \ +static __inline void \ +CAT(bus_space_write_multi_stream_,n)(bus_space_tag_t tag, \ + bus_space_handle_t bsh, \ + bus_size_t offset, const CAT3(u_int,m,_t) *addr, size_t count) \ +{ \ + CAT(outs,m)((volatile CAT3(u_int,m,_t) *)(bsh + (offset)), \ + (CAT3(u_int,m,_t) *)addr, (size_t)count); \ +} + +bus_space_write_multi_stream(2,16) +bus_space_write_multi_stream(4,32) +#define bus_space_write_multi_stream_8 \ + !!! bus_space_write_multi_stream_8 not implemented !!! + +/* + * void bus_space_read_region_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t *addr, size_t count)); + * + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ +static __inline void bus_space_read_region_1 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int8_t *, size_t)); +static __inline void bus_space_read_region_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t *, size_t)); +static __inline void bus_space_read_region_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t *, size_t)); + +static __inline void +bus_space_read_region_1(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int8_t *addr; + size_t count; +{ + volatile u_int8_t *s; + + s = (volatile u_int8_t *)(bsh + offset); + while (count--) + *addr++ = *s++; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_read_region_2(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t *addr; + size_t count; +{ + volatile u_int16_t *s; + + s = (volatile u_int16_t *)(bsh + offset); + while (count--) + __asm__ volatile("lhbrx %0, 0, %1" : + "=r"(*addr++) : "r"(s++)); + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_read_region_4(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t *addr; + size_t count; +{ + volatile u_int32_t *s; + + s = (volatile u_int32_t *)(bsh + offset); + while (count--) + __asm__ volatile("lwbrx %0, 0, %1" : + "=r"(*addr++) : "r"(s++)); + __asm__ volatile("eieio; sync"); +} + +#define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!! + +/* + * void bus_space_read_region_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t *addr, size_t count)); + * + * Read `count' 2, 4, or 8 byte stream quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ +static __inline void bus_space_read_region_stream_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t *, size_t)); +static __inline void bus_space_read_region_stream_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t *, size_t)); + +static __inline void +bus_space_read_region_stream_2(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t *addr; + size_t count; +{ + volatile u_int16_t *s; + + s = (volatile u_int16_t *)(bsh + offset); + while (count--) + *addr++ = *s++; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_read_region_stream_4(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t *addr; + size_t count; +{ + volatile u_int32_t *s; + + s = (volatile u_int32_t *)(bsh + offset); + while (count--) + *addr++ = *s++; + __asm__ volatile("eieio; sync"); +} + +#define bus_space_read_region_stream_8 \ + !!! bus_space_read_region_stream_8 unimplemented !!! + +/* + * void bus_space_write_region_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * const u_intN_t *addr, size_t count)); + * + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided + * to bus space described by tag/handle starting at `offset'. + */ +static __inline void bus_space_write_region_1 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, const u_int8_t *, size_t)); +static __inline void bus_space_write_region_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, const u_int16_t *, size_t)); +static __inline void bus_space_write_region_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, const u_int32_t *, size_t)); + +static __inline void +bus_space_write_region_1(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + const u_int8_t *addr; + size_t count; +{ + volatile u_int8_t *d; + + d = (volatile u_int8_t *)(bsh + offset); + while (count--) + *d++ = *addr++; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_write_region_2(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + const u_int16_t *addr; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + __asm__ volatile("sthbrx %0, 0, %1" :: + "r"(*addr++), "r"(d++)); + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_write_region_4(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + const u_int32_t *addr; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + __asm__ volatile("stwbrx %0, 0, %1" :: + "r"(*addr++), "r"(d++)); + __asm__ volatile("eieio; sync"); +} + +#define bus_space_write_region_8 !!! bus_space_write_region_8 unimplemented !!! + +/* + * void bus_space_write_region_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * const u_intN_t *addr, size_t count)); + * + * Write `count' 2, 4, or 8 byte stream quantities from the buffer provided + * to bus space described by tag/handle starting at `offset'. + */ +static __inline void bus_space_write_region_stream_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, const u_int16_t *, size_t)); +static __inline void bus_space_write_region_stream_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, const u_int32_t *, size_t)); + +static __inline void +bus_space_write_region_stream_2(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + const u_int16_t *addr; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + *d++ = *addr++; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_write_region_stream_4(tag, bsh, offset, addr, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + const u_int32_t *addr; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + *d++ = *addr++; + __asm__ volatile("eieio; sync"); +} + +#define bus_space_write_region_stream_8 \ + !!! bus_space_write_region_stream_8 unimplemented !!! + +/* + * void bus_space_set_multi_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * size_t count)); + * + * Write the 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle/offset `count' times. + */ +static __inline void bus_space_set_multi_1 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int8_t, size_t)); +static __inline void bus_space_set_multi_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t, size_t)); +static __inline void bus_space_set_multi_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t, size_t)); + +static __inline void +bus_space_set_multi_1(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int8_t val; + size_t count; +{ + volatile u_int8_t *d; + + d = (volatile u_int8_t *)(bsh + offset); + while (count--) + *d = val; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_multi_2(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t val; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + __asm__ volatile("sthbrx %0, 0, %1" :: + "r"(val), "r"(d)); + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_multi_4(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t val; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + __asm__ volatile("stwbrx %0, 0, %1" :: + "r"(val), "r"(d)); + __asm__ volatile("eieio; sync"); +} + +#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!! + +/* + * void bus_space_set_multi_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * size_t count)); + * + * Write the 2, 4, or 8 byte stream value `val' to bus space described + * by tag/handle/offset `count' times. + */ +static __inline void bus_space_set_multi_stream_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t, size_t)); +static __inline void bus_space_set_multi_stream_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t, size_t)); + +static __inline void +bus_space_set_multi_stream_2(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t val; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + *d = val; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_multi_stream_4(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t val; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + *d = val; + __asm__ volatile("eieio; sync"); +} + +#define bus_space_set_multi_stream_8 \ + !!! bus_space_set_multi_stream_8 unimplemented !!! + +/* + * void bus_space_set_region_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * size_t count)); + * + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ +static __inline void bus_space_set_region_1 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int8_t, size_t)); +static __inline void bus_space_set_region_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t, size_t)); +static __inline void bus_space_set_region_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t, size_t)); + +static __inline void +bus_space_set_region_1(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int8_t val; + size_t count; +{ + volatile u_int8_t *d; + + d = (volatile u_int8_t *)(bsh + offset); + while (count--) + *d++ = val; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_region_2(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t val; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + __asm__ volatile("sthbrx %0, 0, %1" :: + "r"(val), "r"(d++)); + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_region_4(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t val; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + __asm__ volatile("stwbrx %0, 0, %1" :: + "r"(val), "r"(d++)); + __asm__ volatile("eieio; sync"); +} + +#define bus_space_set_region_8 !!! bus_space_set_region_8 unimplemented !!! + +/* + * void bus_space_set_region_stream_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, + * size_t count)); + * + * Write `count' 2, 4, or 8 byte stream value `val' to bus space described + * by tag/handle starting at `offset'. + */ +static __inline void bus_space_set_region_stream_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int16_t, size_t)); +static __inline void bus_space_set_region_stream_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, u_int32_t, size_t)); + + +static __inline void +bus_space_set_region_stream_2(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int16_t val; + size_t count; +{ + volatile u_int16_t *d; + + d = (volatile u_int16_t *)(bsh + offset); + while (count--) + *d++ = val; + __asm__ volatile("eieio; sync"); +} + +static __inline void +bus_space_set_region_stream_4(tag, bsh, offset, val, count) + bus_space_tag_t tag; + bus_space_handle_t bsh; + bus_size_t offset; + u_int32_t val; + size_t count; +{ + volatile u_int32_t *d; + + d = (volatile u_int32_t *)(bsh + offset); + while (count--) + *d++ = val; + __asm__ volatile("eieio; sync"); +} + +#define bus_space_set_region_stream_8 \ + !!! bus_space_set_region_stream_8 unimplemented !!! + +/* + * void bus_space_copy_region_N __P((bus_space_tag_t tag, + * bus_space_handle_t bsh1, bus_size_t off1, + * bus_space_handle_t bsh2, bus_size_t off2, + * size_t count)); + * + * Copy `count' 1, 2, 4, or 8 byte values from bus space starting + * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. + */ + +static __inline void bus_space_copy_region_1 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, bus_space_handle_t, + bus_size_t, size_t)); +static __inline void bus_space_copy_region_2 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, bus_space_handle_t, + bus_size_t, size_t)); +static __inline void bus_space_copy_region_4 __P((bus_space_tag_t, + bus_space_handle_t, bus_size_t, bus_space_handle_t, + bus_size_t, size_t)); + +static __inline void +bus_space_copy_region_1(t, h1, o1, h2, o2, c) + bus_space_tag_t t; + bus_space_handle_t h1; + bus_size_t o1; + bus_space_handle_t h2; + bus_size_t o2; + size_t c; +{ + bus_addr_t addr1 = h1 + o1; + bus_addr_t addr2 = h2 + o2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; c != 0; c--, addr1++, addr2++) + *(volatile u_int8_t *)(addr2) = + *(volatile u_int8_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += (c - 1), addr2 += (c - 1); + c != 0; c--, addr1--, addr2--) + *(volatile u_int8_t *)(addr2) = + *(volatile u_int8_t *)(addr1); + } +} + +static __inline void +bus_space_copy_region_2(t, h1, o1, h2, o2, c) + bus_space_tag_t t; + bus_space_handle_t h1; + bus_size_t o1; + bus_space_handle_t h2; + bus_size_t o2; + size_t c; +{ + bus_addr_t addr1 = h1 + o1; + bus_addr_t addr2 = h2 + o2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; c != 0; c--, addr1 += 2, addr2 += 2) + *(volatile u_int16_t *)(addr2) = + *(volatile u_int16_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += 2 * (c - 1), addr2 += 2 * (c - 1); + c != 0; c--, addr1 -= 2, addr2 -= 2) + *(volatile u_int16_t *)(addr2) = + *(volatile u_int16_t *)(addr1); + } +} + +static __inline void +bus_space_copy_region_4(t, h1, o1, h2, o2, c) + bus_space_tag_t t; + bus_space_handle_t h1; + bus_size_t o1; + bus_space_handle_t h2; + bus_size_t o2; + size_t c; +{ + bus_addr_t addr1 = h1 + o1; + bus_addr_t addr2 = h2 + o2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; c != 0; c--, addr1 += 4, addr2 += 4) + *(volatile u_int32_t *)(addr2) = + *(volatile u_int32_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += 4 * (c - 1), addr2 += 4 * (c - 1); + c != 0; c--, addr1 -= 4, addr2 -= 4) + *(volatile u_int32_t *)(addr2) = + *(volatile u_int32_t *)(addr1); + } +} + +#define bus_space_copy_region_8 !!! bus_space_copy_region_8 unimplemented !!! + +/* + * Bus read/write barrier methods. + * + * void bus_space_barrier __P((bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * bus_size_t len, int flags)); + * + */ +#define bus_space_barrier(t, h, o, l, f) \ + ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f))) +#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ +#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ + +#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) + +/* + * Bus DMA methods. + */ + +/* + * Flags used in various bus DMA methods. + */ +#define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */ +#define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */ +#define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */ +#define BUS_DMA_COHERENT 0x04 /* hint: map memory DMA coherent */ +#define BUS_DMA_STREAMING 0x08 /* hint: sequential, unidirectional */ +#define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */ +#define BUS_DMA_BUS2 0x20 +#define BUS_DMA_BUS3 0x40 +#define BUS_DMA_BUS4 0x80 + +/* Forwards needed by prototypes below. */ +struct mbuf; +struct uio; + +/* + * Operations performed by bus_dmamap_sync(). + */ +#define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */ +#define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */ +#define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */ +#define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */ + +typedef struct powerpc_bus_dma_tag *bus_dma_tag_t; +typedef struct powerpc_bus_dmamap *bus_dmamap_t; + +/* + * bus_dma_segment_t + * + * Describes a single contiguous DMA transaction. Values + * are suitable for programming into DMA registers. + */ +struct powerpc_bus_dma_segment { + bus_addr_t ds_addr; /* DMA address */ + bus_size_t ds_len; /* length of transfer */ +}; +typedef struct powerpc_bus_dma_segment bus_dma_segment_t; + +/* + * bus_dma_tag_t + * + * A machine-dependent opaque type describing the implementation of + * DMA for a given bus. + */ + +struct powerpc_bus_dma_tag { + /* + * The `bounce threshold' is checked while we are loading + * the DMA map. If the physical address of the segment + * exceeds the threshold, an error will be returned. The + * caller can then take whatever action is necessary to + * bounce the transfer. If this value is 0, it will be + * ignored. + */ + bus_addr_t _bounce_thresh; + + /* + * DMA mapping methods. + */ + int (*_dmamap_create) __P((bus_dma_tag_t, bus_size_t, int, + bus_size_t, bus_size_t, int, bus_dmamap_t *)); + void (*_dmamap_destroy) __P((bus_dma_tag_t, bus_dmamap_t)); + int (*_dmamap_load) __P((bus_dma_tag_t, bus_dmamap_t, void *, + bus_size_t, struct proc *, int)); + int (*_dmamap_load_mbuf) __P((bus_dma_tag_t, bus_dmamap_t, + struct mbuf *, int)); + int (*_dmamap_load_uio) __P((bus_dma_tag_t, bus_dmamap_t, + struct uio *, int)); + int (*_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t, + bus_dma_segment_t *, int, bus_size_t, int)); + void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t)); + void (*_dmamap_sync) __P((bus_dma_tag_t , bus_dmamap_t, bus_dmasync_op_t)); + + /* + * DMA memory utility functions. + */ + int (*_dmamem_alloc) __P((bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int)); + void (*_dmamem_free) __P((bus_dma_tag_t, + bus_dma_segment_t *, int)); + int (*_dmamem_map) __P((bus_dma_tag_t, bus_dma_segment_t *, + int, size_t, caddr_t *, int)); + void (*_dmamem_unmap) __P((bus_dma_tag_t, caddr_t, size_t)); + paddr_t (*_dmamem_mmap) __P((bus_dma_tag_t, bus_dma_segment_t *, + int, off_t, int, int)); +}; + +#define bus_dmamap_create(t, s, n, m, b, f, p) \ + (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p)) +#define bus_dmamap_destroy(t, p) \ + (*(t)->_dmamap_destroy)((t), (p)) +#define bus_dmamap_load(t, m, b, s, p, f) \ + (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f)) +#define bus_dmamap_load_mbuf(t, m, b, f) \ + (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f)) +#define bus_dmamap_load_uio(t, m, u, f) \ + (*(t)->_dmamap_load_uio)((t), (m), (u), (f)) +#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ + (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) +#define bus_dmamap_unload(t, p) \ + (*(t)->_dmamap_unload)((t), (p)) +#define bus_dmamap_sync(t, p, o) \ + (void)((t)->_dmamap_sync ? \ + (*(t)->_dmamap_sync)((t), (p), (o)) : (void)0) + +#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ + (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) +#define bus_dmamem_free(t, sg, n) \ + (*(t)->_dmamem_free)((t), (sg), (n)) +#define bus_dmamem_map(t, sg, n, s, k, f) \ + (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f)) +#define bus_dmamem_unmap(t, k, s) \ + (*(t)->_dmamem_unmap)((t), (k), (s)) +#define bus_dmamem_mmap(t, sg, n, o, p, f) \ + (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) + +/* + * bus_dmamap_t + * + * Describes a DMA mapping. + */ +struct powerpc_bus_dmamap { + /* + * PRIVATE MEMBERS: not for use my machine-independent code. + */ + bus_size_t _dm_size; /* largest DMA transfer mappable */ + int _dm_segcnt; /* number of segs this map can map */ + bus_size_t _dm_maxsegsz; /* largest possible segment */ + bus_size_t _dm_boundary; /* don't cross this */ + bus_addr_t _dm_bounce_thresh; /* bounce threshold; see tag */ + int _dm_flags; /* misc. flags */ + + void *_dm_cookie; /* cookie for bus-specific functions */ + + /* + * PUBLIC MEMBERS: these are used by machine-independent code. + */ + bus_size_t dm_mapsize; /* size of the mapping */ + int dm_nsegs; /* # valid segments in mapping */ + bus_dma_segment_t dm_segs[1]; /* segments; variable length */ +}; + +#ifdef _POWERPC_BUS_DMA_PRIVATE +int _bus_dmamap_create __P((bus_dma_tag_t, bus_size_t, int, bus_size_t, + bus_size_t, int, bus_dmamap_t *)); +void _bus_dmamap_destroy __P((bus_dma_tag_t, bus_dmamap_t)); +int _bus_dmamap_load __P((bus_dma_tag_t, bus_dmamap_t, void *, + bus_size_t, struct proc *, int)); +int _bus_dmamap_load_mbuf __P((bus_dma_tag_t, bus_dmamap_t, + struct mbuf *, int)); +int _bus_dmamap_load_uio __P((bus_dma_tag_t, bus_dmamap_t, + struct uio *, int)); +int _bus_dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, + bus_dma_segment_t *, int, bus_size_t, int)); +void _bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); +void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t)); + +int _bus_dmamem_alloc __P((bus_dma_tag_t tag, bus_size_t size, + bus_size_t alignment, bus_size_t boundary, + bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags)); +void _bus_dmamem_free __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs)); +int _bus_dmamem_map __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs, size_t size, caddr_t *kvap, int flags)); +void _bus_dmamem_unmap __P((bus_dma_tag_t tag, caddr_t kva, + size_t size)); +paddr_t _bus_dmamem_mmap __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs, off_t off, int prot, int flags)); + +int _bus_dmamem_alloc_range __P((bus_dma_tag_t tag, bus_size_t size, + bus_size_t alignment, bus_size_t boundary, + bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, + paddr_t low, paddr_t high)); +#endif /* _POWERPC_BUS_DMA_PRIVATE */ +#endif /* _POWERPC_BUS_H_ */ diff --git a/sys/arch/mvmeppc/include/cdefs.h b/sys/arch/mvmeppc/include/cdefs.h new file mode 100644 index 00000000000..aefb56bbc02 --- /dev/null +++ b/sys/arch/mvmeppc/include/cdefs.h @@ -0,0 +1,43 @@ +/* $OpenBSD: cdefs.h,v 1.1 2001/06/26 21:57:43 smurph Exp $ */ +/* $NetBSD: cdefs.h,v 1.1 1996/09/30 16:34:21 ws 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 + +#if 0 +#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 +#else +#define __warn_references(sym,msg) +/* +#define __indr_reference(sym,alias) +*/ +#endif + +#endif /* !_MACHINE_CDEFS_H_ */ diff --git a/sys/arch/mvmeppc/include/cpu.h b/sys/arch/mvmeppc/include/cpu.h new file mode 100644 index 00000000000..f2fe9897e39 --- /dev/null +++ b/sys/arch/mvmeppc/include/cpu.h @@ -0,0 +1,100 @@ +/* $OpenBSD: cpu.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_CPU_H_ +#define _MACHINE_CPU_H_ + +#include <machine/frame.h> + +#include <machine/psl.h> + +#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) +#define CLKF_BASEPRI(frame) ((frame)->pri == 0) +#define CLKF_PC(frame) ((frame)->srr0) +#define CLKF_INTR(frame) ((frame)->depth != 0) + +#define cpu_swapout(p) +#define cpu_wait(p) + +extern void delay __P((unsigned)); +#define DELAY(n) delay(n) + +extern volatile int want_resched; +extern volatile int astpending; + +#define need_resched() (want_resched = 1, astpending = 1) +#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) +#define signotify(p) (astpending = 1) + +#define CACHELINESIZE 32 /* For now XXX */ + +extern __inline void +syncicache(from, len) + void *from; + int len; +{ + int l = len; + char *p = from; + + do { + __asm__ __volatile__ ("dcbst 0,%0" :: "r"(p)); + p += CACHELINESIZE; + } while ((l -= CACHELINESIZE) > 0); + __asm__ __volatile__ ("sync"); + p = from; + l = len; + do { + __asm__ __volatile__ ("icbi 0,%0" :: "r"(p)); + p += CACHELINESIZE; + } while ((l -= CACHELINESIZE) > 0); + __asm__ __volatile__ ("isync"); +} + +extern __inline void +invdcache(from, len) + void *from; + int len; +{ + int l = len; + char *p = from; + + do { + __asm__ __volatile__ ("dcbi 0,%0" :: "r"(p)); + p += CACHELINESIZE; + } while ((l -= CACHELINESIZE) > 0); + __asm__ __volatile__ ("sync"); +} + +extern char *bootpath; + +#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/mvmeppc/include/db_machdep.h b/sys/arch/mvmeppc/include/db_machdep.h new file mode 100644 index 00000000000..447ef91ece6 --- /dev/null +++ b/sys/arch/mvmeppc/include/db_machdep.h @@ -0,0 +1,103 @@ +/* $OpenBSD: db_machdep.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $NetBSD: db_machdep.h,v 1.13 1996/04/29 20:50:08 leo Exp $ */ + +/* + * Mach Operating System + * Copyright (c) 1992 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. + */ + +/* + * Machine-dependent defines for new kernel debugger. + */ +#ifndef _PPC_DB_MACHDEP_H_ +#define _PPC_DB_MACHDEP_H_ + +#include <vm/vm_prot.h> +#include <vm/vm_param.h> +#include <vm/vm_inherit.h> +#include <machine/trap.h> + +/* ELF symbols in ddb */ +#define DB_ELF_SYMBOLS +#define DB_ELFSIZE 32 + +typedef vm_offset_t db_addr_t; /* address - unsigned */ +typedef int db_expr_t; /* expression - signed */ +struct powerpc_saved_state { + u_int32_t r[32]; /* data registers */ + u_int32_t iar; + u_int32_t msr; +}; + + +typedef struct powerpc_saved_state db_regs_t; +db_regs_t ddb_regs; /* register state */ +#define DDB_REGS (&ddb_regs) + +#define PC_REGS(regs) ((regs)->iar) + +#define BKPT_INST 0x7C810808 /* breakpoint instruction */ + +#define BKPT_SIZE (4) /* size of breakpoint inst */ +#define BKPT_SET(inst) (BKPT_INST) + +#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->iar -= 4) + +#define SR_SINGLESTEP 0x8000 +#define db_clear_single_step(regs) ((regs)->msr &= ~SR_SINGLESTEP) +#define db_set_single_step(regs) ((regs)->msr |= SR_SINGLESTEP) + +#define T_BREAKPOINT 0xffff +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT) + +#ifdef T_WATCHPOINT +#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT) +#else +#define IS_WATCHPOINT_TRAP(type, code) 0 +#endif + +#define M_RTS 0xfc0007fe +#define I_RTS 0x4c000020 +#define M_BC 0xfc000000 +#define I_BC 0x40000000 +#define M_B 0xfc000000 +#define I_B 0x50000000 +#define M_RFI 0xfc0007fe +#define I_RFI 0x4c000064 + +#define inst_trap_return(ins) (((ins)&M_RFI) == I_RFI) +#define inst_return(ins) (((ins)&M_RTS) == I_RTS) +#define inst_call(ins) (((ins)&M_BC ) == I_BC || \ + ((ins)&M_B ) == I_B ) +#define inst_load(ins) 0 +#define inst_store(ins) 0 + +#ifdef _KERNEL + +void kdb_kintr __P((void *)); +int kdb_trap __P((int, void *)); + +#endif /* _KERNEL */ + +#endif /* _PPC_DB_MACHDEP_H_ */ diff --git a/sys/arch/mvmeppc/include/disklabel.h b/sys/arch/mvmeppc/include/disklabel.h new file mode 100644 index 00000000000..61ccca25afe --- /dev/null +++ b/sys/arch/mvmeppc/include/disklabel.h @@ -0,0 +1,113 @@ +/* $OpenBSD: disklabel.h,v 1.1 2001/06/26 21:57:44 smurph 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 1 /* sector containing label */ +#define LABELOFFSET 0 /* offset of label in sector */ +#define MAXPARTITIONS 16 /* number of partitions */ +#define RAW_PART 2 /* raw partition: ie. rsd0c */ + +/* MBR partition table */ +#define DOSBBSECTOR 0 /* MBR sector number */ +#define DOSPARTOFF 446 /* Offset of MBR partition table */ +#define NDOSPART 4 /* # of partitions in MBR */ +#define DOSMAGICOFF 510 /* Offset of magic number */ +#define DOSMAGIC 0xaa55 /* Actual magic number */ +#define MBRMAGIC DOSMAGIC +#define DOSMBR_SIGNATURE MBRMAGIC +#define DOSMBR_SIGNATURE_OFF DOSMAGICOFF +#define DOSACTIVE 0x80 + +struct dos_partition { + unsigned char dp_flag; /* default boot flag */ + unsigned char dp_shd; /* start head, IsN't Always Meaningful */ + unsigned char dp_ssect; /* start sector, INAM */ + unsigned char dp_scyl; /* start cylinder, INAM */ + unsigned char dp_typ; /* partition type */ + unsigned char dp_ehd; /* end head, INAM */ + unsigned char dp_esect; /* end sector, INAM */ + unsigned char dp_ecyl; /* end cylinder, INAM */ + unsigned long dp_start; /* absolute start sector number */ + unsigned long dp_size; /* partition size in sectors */ +}; + +/* Known DOS partition types. */ +#define DOSPTYP_UNUSED 0x00 /* Unused partition */ +#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */ +#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */ +#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */ +#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */ +#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */ +#define DOSPTYP_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */ +#define DOSPTYP_FAT16C 0x0e /* 16-bit FAT, CHS-mapped */ +#define DOSPTYP_EXTENDL 0x0f /* Extended, LBA-mapped; contains sub-partitions */ +#define DOSPTYP_ONTRACK 0x54 +#define DOSPTYP_LINUX 0x83 /* That other thing */ +#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */ +#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ +#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */ + +#include <sys/dkbad.h> +struct cpu_disklabel { + struct dos_partition dosparts[NDOSPART]; + struct dkbad bad; +}; + +#define DKBAD(x) ((x)->bad) + +/* Isolate the relevant bits to get sector and cylinder. */ +#define DPSECT(s) ((s) & 0x3f) +#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) + +static __inline u_int32_t get_le __P((void *p)); + +static __inline u_int32_t +#ifdef __cplusplus +get_le(void *p) +#else +get_le(p) + void *p; +#endif +{ + u_int32_t c; + u_int8_t *_p = (u_int8_t *)p; + int x; + x = _p[0]; + x |= _p[1] << 8; + x |= _p[2] << 16; + x |= _p[3] << 24; + return x; +} + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/mvmeppc/include/dlfcn.h b/sys/arch/mvmeppc/include/dlfcn.h new file mode 100644 index 00000000000..51d6520ba15 --- /dev/null +++ b/sys/arch/mvmeppc/include/dlfcn.h @@ -0,0 +1,63 @@ +/* $OpenBSD: dlfcn.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ +/* $NetBSD: dlfcn.h,v 1.2 1995/06/05 19:38:00 pk Exp $ */ + +/* + * Copyright (c) 1995 Paul Kranenburg + * 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 Paul Kranenburg. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software withough 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 _DLFCN_H_ +#define _DLFCN_H_ + +#include <sys/cdefs.h> + +/* + * User interface to the run-time linker. + */ +__BEGIN_DECLS +extern void *dlopen __P((const char *, int)); +extern int dlclose __P((void *)); +extern void *dlsym __P((void *, const char *)); +extern int dlctl __P((void *, int, void *)); +extern const char *dlerror __P((void)); +__END_DECLS + +/* Values for dlopen `mode'. */ +#define DL_LAZY 1 +#define RTLD_LAZY DL_LAZY /* SunOS Compat */ + +/* + * dlctl() commands + */ +#define DL_GETERRNO 1 +#define DL_SETSRCHPATH x +#define DL_GETLIST x +#define DL_GETREFCNT x +#define DL_GETLOADADDR x + +#endif /* _DLFCN_H_ */ diff --git a/sys/arch/mvmeppc/include/elf_abi.h b/sys/arch/mvmeppc/include/elf_abi.h new file mode 100644 index 00000000000..8655664c0ec --- /dev/null +++ b/sys/arch/mvmeppc/include/elf_abi.h @@ -0,0 +1,48 @@ +/* $OpenBSD: elf_abi.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ + +/* + * Copyright (c) 1996 Per Fogelstrom + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Per Fogelstrom. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _POWERPC_ELF_ABI_H +#define _POWERPC_ELF_ABI_H + +/* From MIPS ABI supplemental */ + +/* Architecture dependent Segment types - p_type */ +/* ??NONE?? */ + +/* Architecture dependent d_tag field for Elf32_Dyn. */ +/* ??NONE?? */ + +#define DT_PROCNUM 0 + +#endif /* _POWERPC_ELF_ABI_H */ diff --git a/sys/arch/mvmeppc/include/endian.h b/sys/arch/mvmeppc/include/endian.h new file mode 100644 index 00000000000..92b7ec3163b --- /dev/null +++ b/sys/arch/mvmeppc/include/endian.h @@ -0,0 +1,40 @@ +/* $OpenBSD: endian.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ + +/*- + * Copyright (c) 1997 Niklas Hallqvist. 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 Niklas Hallqvist. + * 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 _POWERPC_ENDIAN_H_ +#define _POWERPC_ENDIAN_H_ + +#define BYTE_ORDER BIG_ENDIAN +#include <sys/endian.h> + +#define __STRICT_ALIGNMENT + +#endif /* _POWERPC_ENDIAN_H_ */ diff --git a/sys/arch/mvmeppc/include/exec.h b/sys/arch/mvmeppc/include/exec.h new file mode 100644 index 00000000000..e4a723216e1 --- /dev/null +++ b/sys/arch/mvmeppc/include/exec.h @@ -0,0 +1,57 @@ +/* $OpenBSD: exec.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ */ + +/* + * Copyright (c) 1997 Per Fogelstrom, Opsycon AB. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD for RTMX Inc, + * North Carolina, USA, by Per Fogelstrom, Opsycon AB, Sweden. + * 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. + * + * $Id: exec.h,v 1.1 2001/06/26 21:57:44 smurph Exp $ + */ + +#ifndef _MACHINE_EXEC_H_ +#define _MACHINE_EXEC_H_ + +#define __LDPGSZ 4096 /* linker page size */ + +/* + * Define what exec "formats" we should handle. + */ +#define NATIVE_EXEC_ELF +#define EXEC_SCRIPT + +#define ARCH_ELFSIZE 32 + +#define ELF_TARG_CLASS ELFCLASS32 +#define ELF_TARG_DATA ELFDATA2MSB +#define ELF_TARG_MACH EM_PPC + +#define _NLIST_DO_ELF + +#define _KERN_DO_ELF + +#endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/mvmeppc/include/float.h b/sys/arch/mvmeppc/include/float.h new file mode 100644 index 00000000000..6c68fce847c --- /dev/null +++ b/sys/arch/mvmeppc/include/float.h @@ -0,0 +1,80 @@ +/* $OpenBSD: float.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ + +/* + * Copyright (c) 1989 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. + * + * @(#)float.h 7.1 (Berkeley) 5/8/90 + */ + +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int __flt_rounds __P((void)); +__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 /* _MACHINE_FLOAT_H_ */ diff --git a/sys/arch/mvmeppc/include/fpu.h b/sys/arch/mvmeppc/include/fpu.h new file mode 100644 index 00000000000..34a4cda8070 --- /dev/null +++ b/sys/arch/mvmeppc/include/fpu.h @@ -0,0 +1,69 @@ +/* $OpenBSD: fpu.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ + +/*- + * Copyright (C) 1996 Wolfgang Solfrank. + * Copyright (C) 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_FPU_H_ +#define _MACHINE_FPU_H_ + +#define FPCSR_FX 0x80000000 +#define FPCSR_FEX 0x40000000 +#define FPCSR_VX 0x20000000 +#define FPCSR_OX 0x10000000 +#define FPCSR_UX 0x08000000 +#define FPCSR_ZX 0x04000000 +#define FPCSR_XX 0x02000000 +#define FPCSR_VXSNAN 0x01000000 +#define FPCSR_VXISI 0x00800000 +#define FPCSR_VXIDI 0x00400000 +#define FPCSR_VXZDZ 0x00200000 +#define FPCSR_VXIMZ 0x00100000 +#define FPCSR_VXVC 0x00080000 +#define FPCSR_FR 0x00040000 +#define FPCSR_FI 0x00020000 +#define FPCSR_FPRF 0x0001f000 +#define FPCSR_C 0x00010000 +#define FPCSR_FPCC 0x0000f000 +#define FPCSR_FL 0x00008000 +#define FPCSR_FG 0x00004000 +#define FPCSR_FE 0x00002000 +#define FPCSR_FU 0x00001000 +#define FPCSR_VXSOFT 0x00000400 +#define FPCSR_VXSQRT 0x00000200 +#define FPCSR_VXCVI 0x00000100 +#define FPCSR_VE 0x00000080 +#define FPCSR_OE 0x00000040 +#define FPCSR_UE 0x00000020 +#define FPCSR_ZE 0x00000010 +#define FPCSR_XE 0x00000008 +#define FPCSR_NI 0x00000004 +#define FPCSR_RN 0x00000003 + +#endif /* _MACHINE_FPU_H_ */ diff --git a/sys/arch/mvmeppc/include/frame.h b/sys/arch/mvmeppc/include/frame.h new file mode 100644 index 00000000000..2a12f8dea7b --- /dev/null +++ b/sys/arch/mvmeppc/include/frame.h @@ -0,0 +1,76 @@ +/* $OpenBSD: frame.h,v 1.1 2001/06/26 21:57:45 smurph Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_FRAME_H_ +#define _MACHINE_FRAME_H_ + +#include <machine/types.h> + +/* + * This is to ensure alignment of the stackpointer + */ +#define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) +#define trapframe(p) ((struct trapframe *)((void *)(p)->p_addr + USPACE - FRAMELEN + 8)) + +struct switchframe { + register_t sp; + int fill; + int user_sr; + int cr; + register_t fixreg2; + register_t fixreg[19]; /* R13-R31 */ +}; + +struct clockframe { + register_t srr1; + register_t srr0; + int pri; + int depth; +}; + +/* + * Call frame for PowerPC used during fork. + */ +struct callframe { + register_t sp; + register_t lr; + register_t r30; + register_t r31; +}; + +struct sigframe { + int sf_signum; + siginfo_t *sf_sip; + struct sigcontext sf_sc; + siginfo_t sf_si; +}; +#endif /* _MACHINE_FRAME_H_ */ diff --git a/sys/arch/mvmeppc/include/ieee.h b/sys/arch/mvmeppc/include/ieee.h new file mode 100644 index 00000000000..8552f21f957 --- /dev/null +++ b/sys/arch/mvmeppc/include/ieee.h @@ -0,0 +1,136 @@ +/* $OpenBSD: ieee.h,v 1.1 2001/06/26 21:57:45 smurph 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 + +#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/mvmeppc/include/ieeefp.h b/sys/arch/mvmeppc/include/ieeefp.h new file mode 100644 index 00000000000..71a4c0153c1 --- /dev/null +++ b/sys/arch/mvmeppc/include/ieeefp.h @@ -0,0 +1,23 @@ +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public domain. + */ + +#ifndef _MACHINE_IEEEFP_H_ +#define _MACHINE_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 /* _MACHINE_IEEEFP_H_ */ diff --git a/sys/arch/mvmeppc/include/intr.h b/sys/arch/mvmeppc/include/intr.h new file mode 100644 index 00000000000..0093a81410a --- /dev/null +++ b/sys/arch/mvmeppc/include/intr.h @@ -0,0 +1,172 @@ +/* $OpenBSD: intr.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ + +/* + * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Per Fogelstrom, Opsycon AB, Sweden for RTMX Inc, North Carolina USA. + * 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_INTR_H_ +#define _MACHINE_INTR_H_ + +#define IPL_BIO 0 +#define IPL_NET 1 +#define IPL_TTY 2 +#define IPL_IMP 3 +#define IPL_CLOCK 4 +#define IPL_NONE 5 +#define IPL_HIGH 6 + +#define IST_NONE 0 +#define IST_PULSE 1 +#define IST_EDGE 2 +#define IST_LEVEL 3 + +#ifndef _LOCORE + +#define PPC_NIRQ 65 +#define PPC_CLK_IRQ 64 +extern int intrcnt[PPC_NIRQ]; + +void setsoftclock __P((void)); +void clearsoftclock __P((void)); +int splsoftclock __P((void)); +void setsoftnet __P((void)); +void clearsoftnet __P((void)); +int splsoftnet __P((void)); + +void do_pending_int __P((void)); + + +volatile int cpl, ipending, astpending, tickspending; +int imask[7]; + +/* + * Reorder protection in the following inline functions is + * achived with the "eieio" instruction which the assembler + * seems to detect and then doen't move instructions past.... + */ +static __inline int +splraise(newcpl) + int newcpl; +{ + int oldcpl; + + __asm__ volatile("sync; eieio\n"); /* don't reorder.... */ + oldcpl = cpl; + cpl = oldcpl | newcpl; + __asm__ volatile("sync; eieio\n"); /* reorder protect */ + return(oldcpl); +} + +static __inline void +splx(newcpl) + int newcpl; +{ + __asm__ volatile("sync; eieio\n"); /* reorder protect */ + cpl = newcpl; + if(ipending & ~newcpl) + do_pending_int(); + __asm__ volatile("sync; eieio\n"); /* reorder protect */ +} + +static __inline int +spllower(newcpl) + int newcpl; +{ + int oldcpl; + + __asm__ volatile("sync; eieio\n"); /* reorder protect */ + oldcpl = cpl; + cpl = newcpl; + if(ipending & ~newcpl) + do_pending_int(); + __asm__ volatile("sync; eieio\n"); /* reorder protect */ + return(oldcpl); +} + +/* Following code should be implemented with lwarx/stwcx to avoid + * the disable/enable. i need to read the manual once more.... */ +static __inline void +set_sint(pending) + int pending; +{ + int msrsave; + + __asm__ ("mfmsr %0" : "=r"(msrsave)); + __asm__ volatile ("mtmsr %0" :: "r"(msrsave & ~PSL_EE)); + ipending |= pending; + __asm__ volatile ("mtmsr %0" :: "r"(msrsave)); +} + +#define SINT_CLOCK 0x10000000 +#define SINT_NET 0x20000000 +#define SINT_TTY 0x40000000 +#define SPL_CLOCK 0x80000000 +#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_TTY) + +#define splbio() splraise(imask[IPL_BIO]) +#define splnet() splraise(imask[IPL_NET]) +#define spltty() splraise(imask[IPL_TTY]) +#define splclock() splraise(SPL_CLOCK|SINT_MASK) +#define splimp() splraise(imask[IPL_IMP]) +#define splstatclock() splhigh() +#define spllowersoftclock() spllower(SINT_CLOCK) +#define splsoftclock() splraise(SINT_CLOCK) +#define splsoftnet() splraise(SINT_NET) +#define splsofttty() splraise(SINT_TTY) + +#define setsoftclock() set_sint(SINT_CLOCK); +#define setsoftnet() set_sint(SINT_NET); +#define setsofttty() set_sint(SINT_TTY); + +#define splhigh() splraise(0xffffffff) +#define spl0() spllower(0) + +/* + * Interrupt control struct used to control the ICU setup. + */ + +struct intrhand { + struct intrhand *ih_next; + int (*ih_fun) __P((void *)); + void *ih_arg; + u_long ih_count; + int ih_level; + int ih_irq; + char *ih_what; +}; +extern int ppc_configed_intr_cnt; +#define MAX_PRECONF_INTR 16 +extern struct intrhand ppc_configed_intr[MAX_PRECONF_INTR]; + +#endif /* _LOCORE */ + + +#endif /* _MACHINE_INTR_H_ */ diff --git a/sys/arch/mvmeppc/include/ipkdb.h b/sys/arch/mvmeppc/include/ipkdb.h new file mode 100644 index 00000000000..499d249a160 --- /dev/null +++ b/sys/arch/mvmeppc/include/ipkdb.h @@ -0,0 +1,80 @@ +/* $OpenBSD: ipkdb.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ +/* register array */ +#define FIX 0 +#define LR 32 +#define CR 33 +#define CTR 34 +#define XER 35 +#define PC 36 +#define MSR 37 +#define NREG 38 + +#ifndef _LOCORE +extern int ipkdbregs[NREG]; + +/* Doesn't handle overlapping regions */ +__inline extern void +ipkdbcopy(s,d,n) + void *s, *d; + int n; +{ + char *sp = s, *dp = d; + + while (--n >= 0) + *dp++ = *sp++; +} + +__inline extern void +ipkdbzero(d,n) + void *d; + int n; +{ + char *dp = d; + + while (--n >= 0) + *dp++ = 0; +} + +__inline extern int +ipkdbcmp(s,d,n) + void *s, *d; +{ + char *sp = s, *dp = d; + + while (--n >= 0) + if (*sp++ != *dp++) + return *--dp - *--sp; + return 0; +} +#endif /* _LOCORE */ diff --git a/sys/arch/mvmeppc/include/kbio.h b/sys/arch/mvmeppc/include/kbio.h new file mode 100644 index 00000000000..af8d95c6038 --- /dev/null +++ b/sys/arch/mvmeppc/include/kbio.h @@ -0,0 +1,118 @@ +/* $OpenBSD: kbio.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ +/* $NetBSD: kbio.h,v 1.1 1996/04/12 01:45:45 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. + * + * @(#)kbio.h 8.1 (Berkeley) 6/11/93 + */ + +#if 0 /* XXX */ +/* + * 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 */ +#endif /* 0 XXX */ +#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */ +#if 0 /* XXX */ +#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 +#endif /* 0 XXX */ diff --git a/sys/arch/mvmeppc/include/kcore.h b/sys/arch/mvmeppc/include/kcore.h new file mode 100644 index 00000000000..d8d2fce296d --- /dev/null +++ b/sys/arch/mvmeppc/include/kcore.h @@ -0,0 +1,46 @@ +/* $OpenBSD: kcore.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ +/* $NetBSD: kcore.h,v 1.1 1996/09/30 16:34:26 ws Exp $ */ + +/*- + * Copyright (C) 1996 Wolfgang Solfrank. + * Copyright (C) 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_KCORE_H_ +#define _MACHINE_KCORE_H_ + +#define NPHYS_RAM_SEGS 4 + +typedef struct cpu_kcore_hdr { + vm_offset_t ptable; /* Phys address of page table */ + vm_offset_t potable; /* Phys address of page overflow table */ + phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS]; +} cpu_kcore_hdr_t; + +#endif /* _MACHINE_KCORE_H_ */ diff --git a/sys/arch/mvmeppc/include/limits.h b/sys/arch/mvmeppc/include/limits.h new file mode 100644 index 00000000000..7f56856521c --- /dev/null +++ b/sys/arch/mvmeppc/include/limits.h @@ -0,0 +1,88 @@ +/* $OpenBSD: limits.h,v 1.1 2001/06/26 21:57:46 smurph Exp $ */ +/* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_LIMITS_H_ +#define _MACHINE_LIMITS_H_ + +#define CHAR_BIT 8 /* bits per char */ +#define MB_LEN_MAX 1 /* no multibyte characters */ +#define CHAR_MIN 0 /* min value in char */ +#define CHAR_MAX 0xff /* max value in char */ +#define UCHAR_MAX 0xff /* max value in unsigned char */ +#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ +#define SCHAR_MAX 0x7f /* max value for a signed char */ + +#define SHRT_MIN (-0x7fff-1) /* min value in short */ +#define SHRT_MAX 0x7fff /* max value in short */ +#define USHRT_MAX 0xffff /* max value in unsigned short */ + +#define INT_MIN (-0x7fffffff-1) /* min value in int */ +#define INT_MAX 0x7fffffff /* max value in int */ +#define UINT_MAX 0xffffffff /* max value in unsigned int */ + +#define LONG_MIN (-0x7fffffff-1) /* min value in long */ +#define LONG_MAX 0x7fffffff /* max value in long */ +#define ULONG_MAX 0xffffffff /* max value in unsigned 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 */ + +#define UID_MAX UINT_MAX /* max value for a uid_t */ +#define GID_MAX UINT_MAX /* max value for a gid_t */ + +#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */ +#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ +#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ +#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */ +#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */ +#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */ +#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 +#endif /* _MACHINE_LIMITS_H_ */ diff --git a/sys/arch/mvmeppc/include/link.h b/sys/arch/mvmeppc/include/link.h new file mode 100644 index 00000000000..c8ede7dd33d --- /dev/null +++ b/sys/arch/mvmeppc/include/link.h @@ -0,0 +1,183 @@ +/* $OpenBSD: link.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ + +/* + * Copyright (c) 1996 Per Fogelstrom + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Per Fogelstrom. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _POWERPC_LINK_H +#define _POWERPC_LINK_H + +#include <elf_abi.h> +#include <machine/elf_abi.h> + +/* + * Debug rendezvous struct. Pointer to this is set up in the + * target code pointed by the DT_MIPS_RLD_MAP tag. If it is + * defined. + */ + +struct r_debug { + int r_version; /* Protocol version. */ + struct link_map *r_map; /* Head of list of loaded objects. */ + + /* This is the address of a function internal to the run-time linker, + that will always be called when the linker begins to map in a + library or unmap it, and again when the mapping change is complete. + The debugger can set a breakpoint at this address if it wants to + notice shared object mapping changes. */ + Elf32_Addr r_brk; + enum { + /* This state value describes the mapping change taking place when + the `r_brk' address is called. */ + RT_CONSISTENT, /* Mapping change is complete. */ + RT_ADD, /* Adding a new object. */ + RT_DELETE, /* Removing an object mapping. */ + } r_state; + + Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */ + }; + +/* This symbol refers to the "dynamic structure" in the `.dynamic' section + of whatever module refers to `_DYNAMIC'. So, to find its own + `struct r_debug', a program could do: + for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL) + if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr; + */ + +extern Elf32_Dyn _DYNAMIC[]; + + +/* Structure describing a loaded shared object. The `l_next' and `l_prev' + members form a chain of all the shared objects loaded at startup. + + These data structures exist in space used by the run-time dynamic linker; + modifying them may have disastrous results. */ + +struct link_map + { + /* These first few members are part of the protocol with the debugger. + This is the same format used in SVR4. */ + + Elf32_Addr l_addr; /* Base address shared object is loaded at. */ + Elf32_Addr l_offs; /* Offset */ + char *l_name; /* Absolute file name object was found in. */ + Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */ + struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ + + /* All following members are internal to the dynamic linker. + They may change without notice. */ + + const char *l_libname; /* Name requested (before search). */ + + /* Indexed pointers to dynamic section. */ + Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM]; + + const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */ + Elf32_Word l_phnum; /* Number of program header entries. */ + Elf32_Addr l_entry; /* Entry point location. */ + + /* Symbol hash table. */ + Elf32_Word l_nbuckets; + const Elf32_Word *l_buckets, *l_chain; + + unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ + enum /* Where this object came from. */ + { + lt_executable, /* The main executable program. */ + lt_interpreter, /* The interpreter: the dynamic linker. */ + lt_library, /* Library needed by main executable. */ + lt_loaded, /* Extra run-time loaded shared object. */ + } l_type:2; + unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */ + unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ + unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ + unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */ + }; + +/* SOD information used by ldconfig and ld.so */ +/* + * Maximum number of recognized shared object version numbers. + */ +#define MAXDEWEY 8 + +/* + * Header of the hints file. + */ +struct hints_header { + long hh_magic; +#define HH_MAGIC 011421044151 + long hh_version; /* Interface version number */ +#define LD_HINTS_VERSION_1 1 +#define LD_HINTS_VERSION_2 2 + long hh_hashtab; /* Location of hash table */ + long hh_nbucket; /* Number of buckets in hashtab */ + long hh_strtab; /* Location of strings */ + long hh_strtab_sz; /* Size of strings */ + long hh_ehints; /* End of hints (max offset in file) */ + long hh_dirlist; /* Colon-separated list of srch dirs */ +}; + +#define HH_BADMAG(hdr) ((hdr).hh_magic != HH_MAGIC) + +/* + * Hash table element in hints file. + */ +struct hints_bucket { + /* namex and pathx are indices into the string table */ + int hi_namex; /* Library name */ + int hi_pathx; /* Full path */ + int hi_dewey[MAXDEWEY]; /* The versions */ + int hi_ndewey; /* Number of version numbers */ +#define hi_major hi_dewey[0] +#define hi_minor hi_dewey[1] + int hi_next; /* Next in this bucket */ +}; + +#define _PATH_LD_HINTS "/var/run/ld.so.hints" + +/* + * A `Shared Object Descriptor' describes a shared object that is needed + * to complete the link edit process of the object containing it. + * A list of such objects (chained through `sod_next') is pointed at + * by `sdt_sods' in the section_dispatch_table structure. + */ + +struct sod { /* Shared Object Descriptor */ + long sod_name; /* name (relative to load address) */ + u_int sod_library : 1, /* Searched for by library rules */ + sod_reserved : 31; + short sod_major; /* major version number */ + short sod_minor; /* minor version number */ + long sod_next; /* next sod */ +}; + + +#endif /* !_POWERPC_LINK_H */ diff --git a/sys/arch/mvmeppc/include/param.h b/sys/arch/mvmeppc/include/param.h new file mode 100644 index 00000000000..54408b50ec1 --- /dev/null +++ b/sys/arch/mvmeppc/include/param.h @@ -0,0 +1,149 @@ +/* $OpenBSD: param.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ + +#ifdef _KERNEL +#ifndef _LOCORE +#include <machine/cpu.h> +#endif /* _LOCORE */ +#endif + +/* + * Machine dependent constants for PowerPC (32-bit only currently) + */ +#define MACHINE "mvmeppc" +#define _MACHINE mvmeppc +#define MACHINE_ARCH "powerpc" +#define _MACHINE_ARCH powerpc + +#define MID_MACHINE 0 /* None but has to be defined */ + +#define ALIGNBYTES (sizeof(double) - 1) +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) + +#define PGSHIFT 12 +#define NBPG 4096 +#define PGOFSET (NBPG - 1) +#define PAGE_SIZE NBPG +#define PAGE_MASK PGOFSET +#define PAGE_SHIFT PGSHIFT + +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define DEV_BSIZE (1 << DEV_BSHIFT) +#define BLKDEV_IOSIZE NBPG +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define UPAGES 4 +#define USPACE (UPAGES * NBPG) + +#define KERNBASE 0x100000 + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than 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 MCLSHIFT 11 /* convert bytes to m_buf clusters */ +#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ +#define MCLOFSET (MCLBYTES - 1) + +#ifndef NMBCLUSTERS +#ifdef GATEWAY +#define NMBCLUSTERS 2048 /* map size, max cluster allocation */ +#else +#define NMBCLUSTERS 1024 /* map size, max cluster allocation */ +#endif +#endif + +#define MSGBUFSIZE (NBPG*2) + +/* + * Size of kernel malloc arena in logical pages. + */ +#ifndef NKMEMCLUSTERS +#define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE) +#endif + +/* + * pages ("clicks") to disk blocks + */ +#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) +/* + * bytes to pages + */ +#define ctob(x) ((x) << PGSHIFT) +#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) + +/* + * bytes to disk blocks + */ +#define dbtob(x) ((x) << DEV_BSHIFT) +#define btodb(x) ((x) >> DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define powerpc_btop(x) ((unsigned)(x) >> PGSHIFT) +#define powerpc_ptob(x) ((unsigned)(x) << PGSHIFT) + +/* + * Segment handling stuff + */ +#define SEGMENT_LENGTH 0x10000000 +#define SEGMENT_MASK 0xf0000000 + +/* + * Fixed segments + */ +#define USER_SR 13 +#define KERNEL_SR 14 +#define KERNEL_SEGMENT (0xfffff0 + KERNEL_SR) +#define EMPTY_SEGMENT 0xfffff0 +#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT)) + +/* + * Some system constants + */ +#ifndef NPMAPS +#define NPMAPS 32768 /* Number of pmaps in system */ +#endif + +/* + * Temporary kludge till we do (ov)bcopy in assembler + */ +#define ovbcopy bcopy diff --git a/sys/arch/mvmeppc/include/pcb.h b/sys/arch/mvmeppc/include/pcb.h new file mode 100644 index 00000000000..dab951bb04a --- /dev/null +++ b/sys/arch/mvmeppc/include/pcb.h @@ -0,0 +1,71 @@ +/* $OpenBSD: pcb.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $NetBSD: pcb.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_PCB_H_ +#define _MACHINE_PCB_H_ + +#include <machine/reg.h> + + +typedef struct __faultbuf { + int pc; + int sr; + int sp; + int cr; + int regs[20]; +} faultbuf; + +struct pcb { + struct pmap *pcb_pm; /* pmap of our vmspace */ + struct pmap *pcb_pmreal; /* real address of above */ + register_t pcb_sp; /* saved SP */ + int pcb_spl; /* saved SPL */ + faultbuf *pcb_onfault; /* For use during copyin/copyout */ + int pcb_flags; +#define PCB_FPU 1 /* Process had FPU initialized */ + struct fpu { + double fpr[32]; + double fpcsr; /* FPCSR stored as double for easier access */ + } pcb_fpu; /* Floating point processor */ +}; + +struct md_coredump { + struct reg regs; +}; + +#ifdef _KERNEL +extern struct pcb *curpcb; +extern struct pmap *curpm; +extern struct proc *fpuproc; +#endif +#endif /* _MACHINE_PCB_H_ */ diff --git a/sys/arch/mvmeppc/include/pio.h b/sys/arch/mvmeppc/include/pio.h new file mode 100644 index 00000000000..5373eebcc84 --- /dev/null +++ b/sys/arch/mvmeppc/include/pio.h @@ -0,0 +1,195 @@ +/* $OpenBSD: pio.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ + +/* + * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Per Fogelstrom Opsycon AB for RTMX Inc, North Carolina, USA. + * 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_PIO_H_ +#define _MACHINE_PIO_H_ +/* + * I/O macros. + */ +void *mapiodev(paddr_t pa, psize_t len); + +static __inline void +__outb(a,v) + volatile u_int8_t *a; + int v; +{ + *a = v; + __asm__ volatile("eieio"); +} + +static __inline void +__outw(a,v) + volatile u_int16_t *a; + u_int16_t v; +{ + *a = v; + __asm__ volatile("eieio"); +} + +static __inline void +__outl(a,v) + volatile u_int32_t *a; + int v; +{ + *a = v; + __asm__ volatile("eieio"); +} + +static __inline void +__outwrb(a,v) + volatile u_int16_t *a; + u_int16_t v; +{ + u_int32_t _p_ = (u_int32_t)a; + + __asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio"); +} + +static __inline void +__outlrb(a,v) + volatile u_int32_t *a; + u_int32_t v; +{ + u_int32_t _p_ = (u_int32_t)a; + + __asm__ volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio"); +} + +static __inline u_int8_t +__inb(a) + volatile u_int8_t *a; +{ + u_int8_t _v_; + + __asm__ volatile("eieio"); + _v_ = *a; + return _v_; +} + +static __inline u_int16_t +__inw(a) + volatile u_int16_t *a; +{ + u_int16_t _v_; + + __asm__ volatile("eieio"); + _v_ = *a; + return _v_; +} + +static __inline u_int32_t +__inl(a) + volatile u_int32_t *a; +{ + u_int32_t _v_; + + __asm__ volatile("eieio"); + _v_ = *a; + return _v_; +} + +static __inline u_int16_t +__inwrb(a) + volatile u_int16_t *a; +{ + u_int16_t _v_; + u_int32_t _p_ = (u_int32_t)a; + + __asm__ volatile("eieio"); + __asm__ volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); + return _v_; +} + +static __inline u_int32_t +__inlrb(a) + volatile u_int32_t *a; +{ + u_int32_t _v_; + u_int32_t _p_ = (u_int32_t)a; + + __asm__ volatile("eieio"); + __asm__ volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); + return _v_; +} + + +#define outb(a,v) (__outb((volatile u_int8_t *)(a), v)) +#define out8(a,v) outb(a,v) +#define outw(a,v) (__outw((volatile u_int16_t *)(a), v)) +#define out16(a,v) outw(a,v) +#define outl(a,v) (__outl((volatile u_int32_t *)(a), v)) +#define out32(a,v) outl(a,v) +#define inb(a) (__inb((volatile u_int8_t *)(a))) +#define in8(a) inb(a) +#define inw(a) (__inw((volatile u_int16_t *)(a))) +#define in16(a) inw(a) +#define inl(a) (__inl((volatile u_int32_t *)(a))) +#define in32(a) inl(a) + +#define out8rb(a,v) outb(a,v) +#define outwrb(a,v) (__outwrb((volatile u_int16_t *)(a), v)) +#define out16rb(a,v) outwrb(a,v) +#define outlrb(a,v) (__outlrb((volatile u_int32_t *)(a), v)) +#define out32rb(a,v) outlrb(a,v) +#define in8rb(a) inb(a) +#define inwrb(a) (__inwrb((volatile u_int16_t *)(a))) +#define in16rb(a) inwrb(a) +#define inlrb(a) (__inlrb((volatile u_int32_t *)(a))) +#define in32rb(a) inlrb(a) + +#ifdef DEBUG_SPEC +static __inline void +__flash_led(bits, count) + int bits; +{ + int i, v = 0; + + if(bits == 0) { + v = 1; bits = 3; + } + bits &= 3; + count += count; + v |= (*(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4)) & ~3; + while(count--) { + v ^= bits; + for(i = 100000; i > 0; i--) + *(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) = v; + } + *(u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) &= ~3; +} +#endif /* DEBUG */ + +#endif /*_MACHINE_PIO_H_*/ diff --git a/sys/arch/mvmeppc/include/pmap.h b/sys/arch/mvmeppc/include/pmap.h new file mode 100644 index 00000000000..9491d97aadd --- /dev/null +++ b/sys/arch/mvmeppc/include/pmap.h @@ -0,0 +1,96 @@ +/* $OpenBSD: pmap.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_PMAP_H_ +#define _MACHINE_PMAP_H_ + +#include <machine/pte.h> + +/* + * Segment registers + */ +#ifndef _LOCORE +typedef u_int sr_t; +#endif /* _LOCORE */ +#define SR_TYPE 0x80000000 +#define SR_SUKEY 0x40000000 +#define SR_PRKEY 0x20000000 +#define SR_VSID 0x00ffffff + +#ifndef _LOCORE +/* V->P mapping data */ +typedef int pmapv_t; +#define VP_SR_SIZE 32 +#define VP_SR_MASK VP_SR_SIZE-1 +#define VP_SR_POS 27 +#define VP_IDX1_SIZE 1024 +#define VP_IDX1_MASK VP_IDX1_SIZE-1 +#define VP_IDX1_POS 17 +#define VP_IDX2_SIZE 32 +#define VP_IDX2_MASK VP_IDX2_SIZE-1 +#define VP_IDX2_POS 12 + +/* + * Pmap stuff + */ +struct pmap { + sr_t pm_sr[16]; /* segments used in this pmap */ + int pm_refs; /* ref count */ + pmapv_t *vps[VP_SR_SIZE]; /* virtual to physical table */ + struct pmap_statistics pm_stats; /* pmap statistics */ +}; + +typedef struct pmap *pmap_t; + +#ifdef _KERNEL +extern struct pmap kernel_pmap_; +#define pmap_kernel() (&kernel_pmap_) + +#define pmap_clear_modify(pa) (ptemodify((pa), PTE_CHG, 0)) +#define pmap_clear_reference(pa) (ptemodify((pa), PTE_REF, 0)) +#define pmap_is_modified(pa) (ptebits((pa), PTE_CHG)) +#define pmap_is_referenced(pa) (ptebits((pa), PTE_REF)) +#define pmap_change_wiring(pm, va, wired) + +#define pmap_unwire(pm, va) + +#define pmap_phys_address(x) (x) + +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) + +void pmap_bootstrap __P((u_int kernelstart, u_int kernelend)); + +#endif /* _KERNEL */ +#endif /* _LOCORE */ +#endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/mvmeppc/include/powerpc.h b/sys/arch/mvmeppc/include/powerpc.h new file mode 100644 index 00000000000..b79ed38d610 --- /dev/null +++ b/sys/arch/mvmeppc/include/powerpc.h @@ -0,0 +1,132 @@ +/* $OpenBSD: powerpc.h,v 1.1 2001/06/26 21:57:47 smurph Exp $ */ +/* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */ + +/* + * Copyright (C) 1996 Wolfgang Solfrank. + * Copyright (C) 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_POWERPC_H_ +#define _MACHINE_POWERPC_H_ + +struct mem_region { + vm_offset_t start; + vm_size_t size; +}; + +void mem_regions __P((struct mem_region **, struct mem_region **)); + +/* + * These two functions get used solely in boot() in machdep.c. + * + * Not sure whether boot itself should be implementation dependent instead. XXX + */ +typedef void (exit_f) __P((void)) /*__attribute__((__noreturn__))*/ ; +typedef void (boot_f) __P((char *bootspec)) /* __attribute__((__noreturn__))*/ ; +typedef void (vmon_f) __P((void)); +typedef unsigned char (nvram_rd_f) __P((unsigned long offset)); +typedef void (nvram_wr_f) __P((unsigned long offset, unsigned char val)); +typedef unsigned long (tps_f) __P((void)); + + +typedef void (mem_regions_f) __P((struct mem_region **memp, + struct mem_region **availp)); + +typedef int (clock_read_f) __P((int *sec, int *min, int *hour, int *day, + int *mon, int *yr)); +typedef int (clock_write_f) __P((int sec, int min, int hour, int day, + int mon, int yr)); +typedef int (time_read_f) __P((u_long *sec)); +typedef int (time_write_f) __P((u_long sec)); + +/* firmware interface. + * regardless of type of firmware used several items + * are need from firmware to boot up. + * these include: + * memory information + * vmsetup for firmware calls. + * default character print mechanism ??? + * firmware exit (return) + * firmware boot (reset) + * vmon - tell firmware the bsd vm is active. + */ + +struct firmware { + mem_regions_f *mem_regions; + exit_f *exit; + boot_f *boot; + vmon_f *vmon; + nvram_rd_f *nvram_rd; + nvram_wr_f *nvram_wr; + tps_f *tps; + clock_read_f *clock_read; + clock_write_f *clock_write; + time_read_f *time_read; + time_write_f *time_write; +#ifdef FW_HAS_PUTC + boot_f *putc; +#endif +}; +extern struct firmware *fw; + +#define ppc_exit() if (fw->exit != NULL) (fw->exit)() +#define ppc_boot(x) if (fw->boot != NULL) (fw->boot)(x) +#define ppc_vmon() if (fw->vmon != NULL) (fw->vmon)() +#define ppc_nvram_rd(a) ({unsigned char val; \ + if (fw->nvram_rd !=NULL) \ + val = (fw->nvram_rd)(a); \ + else \ + val = 0; \ + val;}) + +#define ppc_nvram_wr(a, v) if (fw->nvram_wr !=NULL) (fw->nvram_wr)(a, v) + +#define ppc_tps() ({unsigned long val; \ + if (fw->tps != NULL) \ + val = (fw->tps)(); \ + else \ + val = 0; \ + val;}) + +#define SPR_XER "1" +#define SPR_LR "8" +#define SPR_CTR "9" +#define SPR_DSISR "18" +#define SPR_DAR "19" +#define SPR_DEC "22" +#define SPR_SDR1 "25" +#define SPR_SRR0 "26" +#define SPR_SRR1 "27" + +#define ppc_get_spr(reg) ({u_int32_t val; \ + __asm__ volatile("mfspr %0," reg : "=r"(val)); \ + val;}) +#define ppc_set_spr(reg, val) ({ \ + __asm__ volatile("mtspr " reg ",%0" :: "r"(val));}) + +#endif /* _MACHINE_POWERPC_H_ */ diff --git a/sys/arch/mvmeppc/include/proc.h b/sys/arch/mvmeppc/include/proc.h new file mode 100644 index 00000000000..a5700e76289 --- /dev/null +++ b/sys/arch/mvmeppc/include/proc.h @@ -0,0 +1,40 @@ +/* $OpenBSD: proc.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $NetBSD: proc.h,v 1.1 1996/09/30 16:34:31 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ + +/* + * Machine-dependent part of the proc structure + */ +struct mdproc { + int dummy; +}; diff --git a/sys/arch/mvmeppc/include/profile.h b/sys/arch/mvmeppc/include/profile.h new file mode 100644 index 00000000000..f961bdbc427 --- /dev/null +++ b/sys/arch/mvmeppc/include/profile.h @@ -0,0 +1,73 @@ +/* $OpenBSD: profile.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ + +/* + * Copyright (c) 1998 Dale Rahn. 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 Dale Rahn. + * 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. + */ +#define MCOUNT \ + __asm__(" \ + .section \".text\" \n\ + .align 2 \n\ + .globl _mcount \n\ + .type _mcount,@function \n\ + _mcount: \n\ + lwz 11, 4(1) \n\ + mflr 0 \n\ + stw 0, 4(1) \n\ + stwu 1, -48(1) \n\ + stw 3, 8(1) \n\ + stw 4, 12(1) \n\ + stw 5, 16(1) \n\ + stw 6, 20(1) \n\ + stw 7, 24(1) \n\ + stw 8, 28(1) \n\ + stw 9, 32(1) \n\ + stw 10,36(1) \n\ + stw 11,40(1) \n\ + mr 4, 0 \n\ + mr 3, 11 \n\ + bl __mcount \n\ + lwz 3, 8(1) \n\ + lwz 4, 12(1) \n\ + lwz 5, 16(1) \n\ + lwz 6, 20(1) \n\ + lwz 7, 24(1) \n\ + lwz 8, 28(1) \n\ + lwz 9, 32(1) \n\ + lwz 10,36(1) \n\ + lwz 11,40(1) \n\ + addi 1, 1, 48 \n\ + lwz 0, 4(1) \n\ + mtlr 11 \n\ + stw 11, 4(1) \n\ + mtctr 0 \n\ + bctr \n\ + .Lfe2: \n\ + .size _mcount, .Lfe2-_mcount \n\ + "); +#define _MCOUNT_DECL static __mcount diff --git a/sys/arch/mvmeppc/include/prom.h b/sys/arch/mvmeppc/include/prom.h new file mode 100644 index 00000000000..21f76b68d6d --- /dev/null +++ b/sys/arch/mvmeppc/include/prom.h @@ -0,0 +1,376 @@ +/* $OpenBSD: prom.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* + * Copyright (c) 2001 Steve Murphree, Jr. + * 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 Theo de Raadt + * 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_PROM_H__ +#define __MACHINE_PROM_H__ + +#define MVMEPROM_INCHR 0x0000 +#define MVMEPROM_INSTAT 0x0001 +#define MVMEPROM_INLN 0x0002 +#define MVMEPROM_READSTR 0x0003 +#define MVMEPROM_READLN 0x0004 +#define MVMEPROM_CHKBRK 0x0005 +#define MVMEPROM_DSKRD 0x0010 +#define MVMEPROM_DSKWR 0x0011 +#define MVMEPROM_DSKCFIG 0x0012 +#define MVMEPROM_DSKFMT 0x0014 +#define MVMEPROM_DSKCTRL 0x0015 +#define MVMEPROM_NETRD 0x0018 +#define MVMEPROM_NETWR 0x0019 +#define MVMEPROM_NETCFIG 0x001a +#define MVMEPROM_NETFOPEN 0x001b +#define MVMEPROM_NETFREAD 0x001c +#define MVMEPROM_NETCTRL 0x001d +#define MVMEPROM_OUTCHR 0x0020 +#define MVMEPROM_OUTSTR 0x0021 +#define MVMEPROM_OUTLN 0x0022 +#define MVMEPROM_WRITE 0x0023 +#define MVMEPROM_WRITELN 0x0024 +#define MVMEPROM_WRITDLN 0x0025 +#define MVMEPROM_PCRLF 0x0026 +#define MVMEPROM_ERASLN 0x0027 +#define MVMEPROM_WRITD 0x0028 +#define MVMEPROM_SNDBRK 0x0029 +#define MVMEPROM_DELAY 0x0043 +#define MVMEPROM_RTC_TM 0x0050 +#define MVMEPROM_RTC_DT 0x0051 +#define MVMEPROM_RTC_DSP 0x0052 +#define MVMEPROM_RTC_RD 0x0053 +#define MVMEPROM_REDIR 0x0060 +#define MVMEPROM_REDIR_I 0x0061 +#define MVMEPROM_REDIR_O 0x0062 +#define MVMEPROM_EXIT 0x0063 +#define MVMEPROM_RETURN MVMEPROM_EXIT +#define MVMEPROM_BINDEC 0x0064 +#define MVMEPROM_CHANGEV 0x0067 +#define MVMEPROM_STRCMP 0x0068 +#define MVMEPROM_MUL32 0x0069 +#define MVMEPROM_DIV32 0x006a +#define MVMEPROM_CHKSUM 0x006b +#define MVMEPROM_BRD_ID 0x0070 +#define MVMEPROM_ENVIRON 0x0071 +#define MVMEPROM_PFLASH 0x0073 +#define MVMEPROM_DIAGFCN 0x0074 +#define MVMEPROM_SIOPEPS 0x0090 +#define MVMEPROM_FORKMPU 0x0100 +#define MVMEPROM_FORKMPUR 0x0101 +#define MVMEPROM_IDELMPU 0x0110 +#define MVMEPROM_IOINQ 0x0120 +#define MVMEPROM_IOINFORM 0x0124 +#define MVMEPROM_IOCONFIG 0x0128 +#define MVMEPROM_IODELETE 0x012c +#define MVMEPROM_SYMBOLTA 0x0130 +#define MVMEPROM_SYMBOLTD 0x0131 + +#define NETCTRLCMD_GETETHER 1 +#define ENVIRONCMD_WRITE 1 +#define ENVIRONCMD_READ 2 +#define ENVIRONTYPE_EOL 0 +#define ENVIRONTYPE_START 1 +#define ENVIRONTYPE_DISKBOOT 2 +#define ENVIRONTYPE_ROMBOOT 3 +#define ENVIRONTYPE_NETBOOT 4 +#define ENVIRONTYPE_MEMSIZE 5 + +#define NETSTATUS_SUCCESS 0x00 +#define NETSTATUS_MISALNG 0x01 +#define NETSTATUS_BUFFLMT 0x02 +#define NETSTATUS_BADLEN 0x03 +#define NETSTATUS_INITABRT 0x04 +#define NETSTATUS_TXABRT 0x05 +#define NETSTATUS_PCIADDRERR 0x06 +#define NETSTATUS_NOPORT 0x07 +#define NETSTATUS_ILLIPL 0x08 +#define NETSTATUS_USERABRT 0x09 +#define NETSTATUS_TIMEOUT 0x0A +#define NETSTATUS_SYSERR 0x10 +#define NETSTATUS_TXBABBLE 0x11 +#define NETSTATUS_TXCOL 0x12 +#define NETSTATUS_TXSTOPPED 0x13 +#define NETSTATUS_TXUNDERFL 0x14 +#define NETSTATUS_TXLATECOL 0x15 +#define NETSTATUS_TXLOSTCARR 0x16 +#define NETSTATUS_TXLINKFAIL 0x17 +#define NETSTATUS_TXNOCARR 0x18 +#define NETSTATUS_TXTOPHY 0x19 +#define NETSTATUS_RXCRCERR 0x20 +#define NETSTATUS_RXOVERFL 0x21 +#define NETSTATUS_RXFRAMEERR 0x22 +#define NETSTATUS_RXLDFNS 0x23 +#define NETSTATUS_RXFDCOL 0x24 +#define NETSTATUS_RXRUNTFRAME 0x25 +#define NETSTATUS_TXTONORM 0x28 +#define NETSTATUS_TXTOSETUP 0x29 +#define NETSTATUS_SROMERR 0x30 + +#define NETCTRLCMD_INIT 0 +#define NETCTRLCMD_GETETHER 1 +#define NETCTRLCMD_TX 2 +#define NETCTRLCMD_RX 3 +#define NETCTRLCMD_FLUSH 4 +#define NETCTRLCMD_RESET 5 + +#define NETCFG_FLAG_RD 0 +#define NETCFG_FLAG_WR 1 +#define NETCFG_FLAG_WRNV 2 + +#ifndef LOCORE +extern struct bugenviron bugenviron; +extern int bugenv_init; + +#define BUG_ENV_END 0 +#define BUG_STARTUP_PARAM 1 +struct bug_startup { + char s_mode; + char s_menu; + char s_remotestart; + char s_probe; + char s_negsysfail; + char s_resetscsi; + char s_nocfblk; + char s_scsisync; +}; + +#define BUG_AUTOBOOT_INFO 2 +struct bug_autoboot { + char b_enable; + char b_poweruponly; + char b_clun; + char b_dlun; + char b_delay; + char b_string[22]; /* 0x15 + 0x1 */ +}; + +#define BUG_ROMBOOT_INFO 3 +struct bug_romboot { + char r_enable; + char r_poweruponly; + char r_bootvme; + char r_delay; + unsigned r_start; + unsigned r_end; +}; + +#define BUG_NETBOOT_INFO 4 +struct bug_netboot { + char n_enable; + char n_poweruponly; + char n_clun; + char n_dlun; + char n_delay; + char *n_param; +}; + +#define BUG_MEMORY_INFO 5 +struct bug_memory { + char m_sizeenable; + unsigned m_start; + unsigned m_end; +}; + +struct bugenviron { + struct bug_startup s; + struct bug_autoboot b; + struct bug_romboot r; + struct bug_netboot n; + struct bug_memory m; +}; + +#define bug_localmemsize() (bugenviron.m.m_end - bugenviron.m.m_start) +#define bug_localmemstart() (bugenviron.m.m_start) +#define bug_localmemend() (bugenviron.m.m_end) + +struct mvmeprom_netio { + u_char clun; + u_char dlun; + u_short status; + void *addr; + u_long tlen; + u_long offset; + u_long ttime; + u_long tbytes; + char filename[64]; +}; + +struct mvmeprom_netfopen { + u_char clun; + u_char dlun; + u_short status; + char filename[64]; +}; + +struct mvmeprom_netfread { + u_char clun; + u_char dlun; + u_short status; + void *addr; + u_short bytes; + u_short blk; + u_long timeout; +}; + +struct mvmeprom_netctrl { + u_char clun; + u_char dlun; + u_short status; + u_long cmd; + void *addr; + u_long len; + u_long flags; +}; + +struct mvmeprom_netparam { + u_long ver; + void * nodeaddr; + void * loadaddr; + void * execaddr; + u_long delay; + u_long length; + u_long offset; + void * traceaddr; + u_long client_ip; + u_long server_ip; + u_long subnet; + u_long bcast; + u_long gateway_ip; + u_char rarp_retry; + u_char tftp_retry; + u_char rarp_cntl; + u_char update_cntl; + char filename[64]; + char args[64]; +}; + +struct mvmeprom_netcfg { + u_char clun; + u_char dlun; + u_short status; + struct mvmeprom_netparam *netparam; + u_long flag; +}; + +struct prom_environ_hdr { + u_char type; + u_char len; +}; + +struct mvmeprom_brdid { + u_long eye_catcher; /* "BDID" */ + u_char rev; + u_char month; + u_char day; + u_char year; + u_short size; /* BID packet length */ + u_short rsv1; + u_short model; /* e.g. 1603, 1604 */ + u_short suffix; /* e.g. AT */ + u_long options; /* Board options */ + u_short ctrlun; /* boot clun */ + u_short devlun; /* boot dlun */ + u_short devtype; /* boot device type */ + u_short devnum; /* boot device number */ + u_long opt2; /* reserved */ + u_char version[4]; + /* the folowing are CNFG values */ + u_char board_serial[12]; /* SBC serial number */ + u_char board_id[16]; /* SBC id */ + u_char pwa_id[16]; /* printed wiring assembly id */ + u_char old_speed[4]; /* old cpu speed field */ + u_char etheraddr[6]; /* mac address, all zero if no ether */ + u_char fill[2]; + u_char scsi_id[2]; /* local SCSI id */ + u_char speed[3]; /* cpu speed */ + u_char bus_speed[3]; /* pci bus speed */ + u_char sys_serial[16]; /* system serial (user)*/ + u_char sys_id[31]; /* system id (user)*/ + u_char license_id[9]; /* license ID (for AIX)*/ +}; + +struct mvmeprom_time { + u_char year_BCD; + u_char month_BCD; + u_char day_BCD; + u_char wday_BCD; + u_char hour_BCD; + u_char min_BCD; + u_char sec_BCD; + u_char cal_BCD; +}; + +struct mvmeprom_dskio { + u_char ctrl_lun; + u_char dev_lun; + u_short status; + void *pbuffer; + u_long blk_num; + u_short blk_cnt; + u_char flag; +#define BUG_FILE_MARK 0x80 +#define IGNORE_FILENUM 0x02 +#define END_OF_FILE 0x01 + u_char addr_mod; +}; +#define MVMEPROM_BLOCK_SIZE 256 + +struct mvmeprom_args { + u_int dev_lun; + u_int ctrl_lun; + u_int flags; + u_int ctrl_addr; + u_int entry; + u_int conf_blk; + char *arg_start; + char *arg_end; + char *nbarg_start; + char *nbarg_end; + u_int cputyp; +}; + +#endif + +#define MVMEPROM_CALL(x) \ + __asm__ __volatile__ ( __CONCAT("addi 10,0,",__STRING(x)) ); \ + __asm__ __volatile__ ("sc"); + +#define MVMEPROM_REG_CTRLLUN "3" +#define MVMEPROM_REG_DEVLUN "4" +#define MVMEPROM_REG_SCSUPP "5" +#define MVMEPROM_REG_CTRLADDR "6" +#define MVMEPROM_REG_ENTRY "7" +#define MVMEPROM_REG_IPA "8" +#define MVMEPROM_REG_ARGSTART "9" +#define MVMEPROM_REG_ARGEND "10" +#define MVMEPROM_REG_NBARGSTART "11" +#define MVMEPROM_REG_NBARGEND "12" + +#ifndef RB_NOSYM +#define RB_NOSYM 0x400 +#endif +#endif __MACHINE_PROM_H__ diff --git a/sys/arch/mvmeppc/include/psl.h b/sys/arch/mvmeppc/include/psl.h new file mode 100644 index 00000000000..ff197f9c4aa --- /dev/null +++ b/sys/arch/mvmeppc/include/psl.h @@ -0,0 +1,77 @@ +/* $OpenBSD: psl.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $NetBSD: psl.h,v 1.1 1996/09/30 16:34:32 ws Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_PSL_H_ +#define _MACHINE_PSL_H_ + +/* + * Flags in MSR: + */ +#define PSL_POW 0x00040000 +#define PSL_ILE 0x00010000 +#define PSL_EE 0x00008000 +#define PSL_PR 0x00004000 +#define PSL_FP 0x00002000 +#define PSL_ME 0x00001000 +#define PSL_FE0 0x00000800 +#define PSL_SE 0x00000400 +#define PSL_BE 0x00000200 +#define PSL_FE1 0x00000100 +#define PSL_IP 0x00000040 +#define PSL_IR 0x00000020 +#define PSL_DR 0x00000010 +#define PSL_RI 0x00000002 +#define PSL_LE 0x00000001 + +/* + * Floating-point exception modes: + */ +#define PSL_FE_DIS 0 +#define PSL_FE_NONREC PSL_FE1 +#define PSL_FE_REC PSL_FE0 +#define PSL_FE_PREC (PSL_FE0 | PSL_FE1) +#define PSL_FE_DFLT PSL_FE_DIS + +/* + * Note that PSL_POW and PSL_ILE are not in the saved copy of the MSR + */ +#define PSL_MBO 0 +#define PSL_MBZ 0 + +#define PSL_USERSET (PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR | PSL_RI) + +#define PSL_USERSTATIC (PSL_USERSET | PSL_IP | 0x87c0008c) + +#include <machine/intr.h> + +#endif /* _MACHINE_PSL_H_ */ diff --git a/sys/arch/mvmeppc/include/pte.h b/sys/arch/mvmeppc/include/pte.h new file mode 100644 index 00000000000..43becb6d73d --- /dev/null +++ b/sys/arch/mvmeppc/include/pte.h @@ -0,0 +1,113 @@ +/* $OpenBSD: pte.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $NetBSD: pte.h,v 1.1 1996/09/30 16:34:32 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_PTE_H_ +#define _MACHINE_PTE_H_ + +#include <sys/queue.h> + +/* + * Page Table Entries + */ +#ifndef _LOCORE +struct pte { + u_int pte_hi; + u_int pte_lo; +}; +#endif /* _LOCORE */ +/* High word: */ +#define PTE_VALID 0x80000000 +#define PTE_VSID_SHFT 7 +#define PTE_HID 0x00000040 +#define PTE_API 0x0000003f +/* Low word: */ +#define PTE_RPGN 0xfffff000 +#define PTE_REF 0x00000100 +#define PTE_CHG 0x00000080 +#define PTE_WIMG 0x00000078 +#define PTE_W 0x00000040 +#define PTE_I 0x00000020 +#define PTE_M 0x00000010 +#define PTE_G 0x00000008 +#define PTE_PP 0x00000003 +#define PTE_RO 0x00000003 +#define PTE_RW 0x00000002 + +#ifndef _LOCORE +typedef struct pte pte_t; +#endif /* _LOCORE */ + +/* + * Extract bits from address + */ +#define ADDR_SR_SHFT 28 +#define ADDR_PIDX 0x0ffff000 +#define ADDR_PIDX_SHFT 12 +#define ADDR_API_SHFT 22 +#define ADDR_POFF 0x00000fff + +#ifndef _LOCORE +#ifdef _KERNEL +extern pte_t *ptable; +extern int ptab_cnt; +#endif /* _KERNEL */ +#endif /* _LOCORE */ + +/* + * Bits in DSISR: + */ +#define DSISR_DIRECT 0x80000000 +#define DSISR_NOTFOUND 0x40000000 +#define DSISR_PROTECT 0x08000000 +#define DSISR_INVRX 0x04000000 +#define DSISR_STORE 0x02000000 +#define DSISR_DABR 0x00400000 +#define DSISR_SEGMENT 0x00200000 +#define DSISR_EAR 0x00100000 + +/* + * Bits in SRR1 on ISI: + */ +#define ISSRR1_NOTFOUND 0x40000000 +#define ISSRR1_DIRECT 0x10000000 +#define ISSRR1_PROTECT 0x08000000 +#define ISSRR1_SEGMENT 0x00200000 + +#ifdef _KERNEL +#ifndef _LOCORE +extern u_int dsisr __P((void)); +extern vm_offset_t dar __P((void)); +#endif /* _KERNEL */ +#endif /* _LOCORE */ +#endif /* _MACHINE_PTE_H_ */ diff --git a/sys/arch/mvmeppc/include/ptrace.h b/sys/arch/mvmeppc/include/ptrace.h new file mode 100644 index 00000000000..311a8ddcff3 --- /dev/null +++ b/sys/arch/mvmeppc/include/ptrace.h @@ -0,0 +1,48 @@ +/* $OpenBSD: ptrace.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $NetBSD: ptrace.h,v 1.7 1995/01/26 19:47:10 mycroft 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. 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 _POWERPC_PTRACE_H_ +#define _POWERPC_PTRACE_H_ + +/* + * powerpc-dependent ptrace definitions + */ +#define PT_STEP (PT_FIRSTMACH + 0) +#define PT_GETREGS (PT_FIRSTMACH + 1) +#define PT_SETREGS (PT_FIRSTMACH + 2) + +#if NOT_SUPPORTED +#define PT_GETFPREGS (PT_FIRSTMACH + 3) +#define PT_SETFPREGS (PT_FIRSTMACH + 4) +#endif + +#endif /* !_POWERPC_PTRACE_H_ */ diff --git a/sys/arch/mvmeppc/include/reg.h b/sys/arch/mvmeppc/include/reg.h new file mode 100644 index 00000000000..e65145f27e6 --- /dev/null +++ b/sys/arch/mvmeppc/include/reg.h @@ -0,0 +1,62 @@ +/* $OpenBSD: reg.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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 5.5 (Berkeley) 1/18/91 + */ + +#ifndef _POWERPC_REG_H_ +#define _POWERPC_REG_H_ + +/* + * Struct reg, used for procfs and in signal contexts + * Note that in signal contexts, it's represented as an array. + * That array has to look exactly like 'struct reg' though. + */ + +/* this table is set up to match what gdb expects */ +struct reg { + u_int32_t gpr[32]; + u_int64_t fpr[32]; + u_int32_t pc; + u_int32_t ps; + u_int32_t cnd; + u_int32_t lr; + u_int32_t cnt; + u_int32_t xer; + u_int32_t mq; +}; +#endif /* !_POWERPC_REG_H_ */ diff --git a/sys/arch/mvmeppc/include/reloc.h b/sys/arch/mvmeppc/include/reloc.h new file mode 100644 index 00000000000..210c56c2025 --- /dev/null +++ b/sys/arch/mvmeppc/include/reloc.h @@ -0,0 +1,77 @@ +/* $NetBSD: reloc.h,v 1.1 1996/09/30 16:34:33 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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 _MACH_RELOC_H_ +#define _MACH_RELOC_H_ + +/* + * Quite a number of relocation types + */ +enum reloc_type { + RELOC_NONE, + RELOC_32, + RELOC_24, + RELOC_16, + RELOC_16_LO, + RELOC_16_HI, /* RELOC_ADDIS = 5 */ + RELOC_16_HA, + RELOC_14, + RELOC_14_TAKEN, + RELOC_14_NTAKEN, + RELOC_REL24, /* RELOC_BRANCH = 10 */ + RELOC_REL14, + RELOC_REL14_TAKEN, + RELOC_REL14_NTAKEN, + RELOC_GOT16, + RELOC_GOT16_LO, + RELOC_GOT16_HI, + RELOC_GOT16_HA, + RELOC_PLT24, + RELOC_COPY, + RELOC_GLOB_DAT, + RELOC_JMP_SLOT, + RELOC_RELATIVE, + RELOC_LOCAL24PC, + RELOC_U32, + RELOC_U16, + RELOC_REL32, + RELOC_PLT32, + RELOC_PLTREL32, + RELOC_PLT16_LO, + RELOC_PLT16_HI, + RELOC_PLT16_HA, + /* ABI defines this as 32nd entry, but we ignore this, at least for now */ + RELOC_SDAREL, + RELOC_MAX +}; + +#endif /* _MACH_RELOC_H_ */ diff --git a/sys/arch/mvmeppc/include/setjmp.h b/sys/arch/mvmeppc/include/setjmp.h new file mode 100644 index 00000000000..39a1f62c9b5 --- /dev/null +++ b/sys/arch/mvmeppc/include/setjmp.h @@ -0,0 +1,3 @@ +/* $NetBSD: setjmp.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */ + +#define _JBLEN 100 diff --git a/sys/arch/mvmeppc/include/signal.h b/sys/arch/mvmeppc/include/signal.h new file mode 100644 index 00000000000..15e93672485 --- /dev/null +++ b/sys/arch/mvmeppc/include/signal.h @@ -0,0 +1,68 @@ +/* $OpenBSD: signal.h,v 1.1 2001/06/26 21:57:48 smurph Exp $ */ +/* $NetBSD: signal.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_SIGNAL_H_ +#define _MACHINE_SIGNAL_H_ + +typedef int sig_atomic_t; + +#include <machine/types.h> + +/* + * We have to save all registers on every trap, because + * 1. user could attach this process every time + * 2. we must be able to restore all user registers in case of fork + * Actually, we do not save the fp registers on trap, since + * these are not used by the kernel. They are saved only when switching + * between processes using the FPU. + * + */ +struct trapframe { + u_int32_t fixreg[32]; + u_int32_t lr; + u_int32_t cr; + u_int32_t xer; + u_int32_t ctr; + int srr0; + int srr1; + int dar; /* dar & dsisr are only filled on a DSI trap */ + int dsisr; + u_int32_t exc; +}; + +struct sigcontext { + int sc_onstack; /* saved onstack flag */ + int sc_mask; /* saved signal mask */ + struct trapframe sc_frame; /* saved registers */ +}; +#endif /* _MACHINE_SIGNAL_H_ */ diff --git a/sys/arch/mvmeppc/include/spinlock.h b/sys/arch/mvmeppc/include/spinlock.h new file mode 100644 index 00000000000..eded853cce9 --- /dev/null +++ b/sys/arch/mvmeppc/include/spinlock.h @@ -0,0 +1,10 @@ +/* $OpenBSD: spinlock.h,v 1.1 2001/06/26 21:57:49 smurph Exp $ */ + +#ifndef _MACHINE_SPINLOCK_H_ +#define _MACHINE_SPINLOCK_H_ + +#define _SPINLOCK_UNLOCKED (0) +#define _SPINLOCK_LOCKED (1) +typedef int _spinlock_lock_t; + +#endif diff --git a/sys/arch/mvmeppc/include/stdarg.h b/sys/arch/mvmeppc/include/stdarg.h new file mode 100644 index 00000000000..15e7d1deec5 --- /dev/null +++ b/sys/arch/mvmeppc/include/stdarg.h @@ -0,0 +1,50 @@ +/* $NetBSD: stdarg.h,v 1.1 1996/09/30 16:34:35 ws Exp $ */ + +/*- + * Copyright (c) 1991, 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. + * + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ + +#include <machine/ansi.h> + +#ifndef _STDARG_H +#define _STDARG_H +#endif +#include <machine/va-ppc.h> + +typedef _BSD_VA_LIST_ va_list; + +#endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/arch/mvmeppc/include/trap.h b/sys/arch/mvmeppc/include/trap.h new file mode 100644 index 00000000000..f8460494e16 --- /dev/null +++ b/sys/arch/mvmeppc/include/trap.h @@ -0,0 +1,84 @@ +/* $NetBSD: trap.h,v 1.1 1996/09/30 16:34:35 ws Exp $ */ + +/* + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_TRAP_H_ +#define _MACHINE_TRAP_H_ + +#define EXC_RSVD 0x0000 /* Reserved */ +#define EXC_RST 0x0100 /* Reset */ +#define EXC_MCHK 0x0200 /* Machine Check */ +#define EXC_DSI 0x0300 /* Data Storage Interrupt */ +#define EXC_ISI 0x0400 /* Instruction Storage Interrupt */ +#define EXC_EXI 0x0500 /* External Interrupt */ +#define EXC_ALI 0x0600 /* Alignment Interrupt */ +#define EXC_PGM 0x0700 /* Program Interrupt */ +#define EXC_FPU 0x0800 /* Floating-point Unavailable */ +#define EXC_DECR 0x0900 /* Decrementer Interrupt */ +#define EXC_SC 0x0c00 /* System Call */ +#define EXC_TRC 0x0d00 /* Trace */ +#define EXC_FPA 0x0e00 /* Floating-point Assist */ + +/* The following are only available on 604: */ +#define EXC_PERF 0x0f00 /* Performance Monitoring */ +#define EXC_BPT 0x1300 /* Instruction Breakpoint */ +#define EXC_SMI 0x1400 /* System Managment Interrupt */ + +/* And these are only on the 603: */ +#define EXC_IMISS 0x1000 /* Instruction translation miss */ +#define EXC_DLMISS 0x1100 /* Data load translation miss */ +#define EXC_DSMISS 0x1200 /* Data store translation miss */ + +#define EXC_LAST 0x2f00 /* Last possible exception vector */ + +#define EXC_AST 0x3000 /* Fake AST vector */ + +/* Trap was in user mode */ +#define EXC_USER 0x10000 + +/* + * EXC_ALI sets bits in the DSISR and DAR to provide enough + * information to recover from the unaligned access without needing to + * parse the offending instruction. This includes certain bits of the + * opcode, and information about what registers are used. The opcode + * indicator values below come from Appendix F of Book III of "The + * PowerPC Architecture". + */ + +#define EXC_ALI_OPCODE_INDICATOR(dsisr) ((dsisr >> 10) & 0x7f) +#define EXC_ALI_LFD 0x09 +#define EXC_ALI_STFD 0x0b + +/* Macros to extract register information */ +#define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ +#define EXC_ALI_RA(dsisr) (dsisr & 0x1f) + +#endif /* _MACHINE_TRAP_H_ */ diff --git a/sys/arch/mvmeppc/include/types.h b/sys/arch/mvmeppc/include/types.h new file mode 100644 index 00000000000..87af1f45243 --- /dev/null +++ b/sys/arch/mvmeppc/include/types.h @@ -0,0 +1,70 @@ +/* $NetBSD: types.h,v 1.1 1996/09/30 16:34:36 ws Exp $ */ +/* $OpenBSD: types.h,v 1.1 2001/06/26 21:57:49 smurph Exp $ */ + +/*- + * Copyright (C) 1995 Wolfgang Solfrank. + * Copyright (C) 1995 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_TYPES_H_ +#define _MACHINE_TYPES_H_ + +#include <sys/cdefs.h> + +#define __BIT_TYPES_DEFINED__ +typedef signed char int8_t; +typedef unsigned char u_int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef unsigned int uint32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; +typedef unsigned long long uint64_t; + +typedef u_int32_t register_t; + +typedef unsigned long vm_size_t; +typedef unsigned long vm_offset_t; + +typedef unsigned long vaddr_t; +typedef unsigned long paddr_t; +typedef unsigned long vsize_t; +typedef unsigned long psize_t; + +typedef struct label_t { + int val[40]; /* double check this XXX */ +} label_t; + +#define __BROKEN_INDIRECT_CONFIG + +#endif /* _MACHINE_TYPES_H_ */ diff --git a/sys/arch/mvmeppc/include/va-ppc.h b/sys/arch/mvmeppc/include/va-ppc.h new file mode 100644 index 00000000000..54486c16a94 --- /dev/null +++ b/sys/arch/mvmeppc/include/va-ppc.h @@ -0,0 +1,304 @@ +/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */ + +#ifndef _WIN32 +/* System V.4 support */ +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + +#ifndef _SYS_VA_LIST_H +#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */ + +/* Solaris decided to rename overflow_arg_area to input_arg_area, + so handle it via a macro. */ +#define __va_overflow(AP) (AP)->overflow_arg_area + +/* Note that the names in this structure are in the user's namespace, but + that the V.4 abi explicitly states that these names should be used. */ +typedef struct __va_list_tag { + char gpr; /* index into the array of 8 GPRs stored in the + register save area gpr=0 corresponds to r3, + gpr=1 to r4, etc. */ + char fpr; /* index into the array of 8 FPRs stored in the + register save area fpr=0 corresponds to f1, + fpr=1 to f2, etc. */ + char *overflow_arg_area; /* location on stack that holds the next + overflow argument */ + char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */ +} __va_list[1], __gnuc_va_list[1]; + +#else /* _SYS_VA_LIST */ + +typedef __va_list __gnuc_va_list; +#define __va_overflow(AP) (AP)->input_arg_area + +#endif /* not _SYS_VA_LIST */ +#endif /* not __GNUC_VA_LIST */ + +/* If this is for internal libc use, don't define anything but + __gnuc_va_list. */ +#if defined (_STDARG_H) || defined (_VARARGS_H) + +/* Register save area located below the frame pointer */ +#ifndef __VA_PPC_H__ +#define __VA_PPC_H__ +typedef struct { + long __gp_save[8]; /* save area for GP registers */ + double __fp_save[8]; /* save area for FP registers */ +} __va_regsave_t; + +/* Macros to access the register save area */ +/* We cast to void * and then to TYPE * because this avoids + a warning about increasing the alignment requirement. */ +#define __VA_FP_REGSAVE(AP,TYPE) \ + ((TYPE *) (void *) (&(((__va_regsave_t *) \ + (AP)->reg_save_area)->__fp_save[(int)(AP)->fpr]))) + +#define __VA_GP_REGSAVE(AP,TYPE) \ + ((TYPE *) (void *) (&(((__va_regsave_t *) \ + (AP)->reg_save_area)->__gp_save[(int)(AP)->gpr]))) +#if __GNUC_MINOR__ > 8 +#define GCC29 +#endif + +#ifndef GCC29 +/* Common code for va_start for both varargs and stdarg. This depends + on the format of rs6000_args in rs6000.h. The fields used are: + + #0 WORDS # words used for GP regs/stack values + #1 FREGNO next available FP register + #2 NARGS_PROTOTYPE # args left in the current prototype + #3 ORIG_NARGS original value of NARGS_PROTOTYPE + #4 VARARGS_OFFSET offset from frame pointer of varargs area */ +#else /* GCC29 */ +/* Common code for va_start for both varargs and stdarg. We allow all + the work to be done by __builtin_saveregs. It returns a pointer to + a va_list that was constructed on the stack; we must simply copy it + to the user's variable. */ +#endif /* GCC29 */ + +#ifndef GCC29 +#define __va_words __builtin_args_info (0) +#define __va_fregno __builtin_args_info (1) +#define __va_nargs __builtin_args_info (2) +#define __va_orig_nargs __builtin_args_info (3) +#define __va_varargs_offset __builtin_args_info (4) + +#define __va_start_common(AP, FAKE) \ +__extension__ ({ \ + register int __words = __va_words - FAKE; \ + \ + (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(struct __va_list_tag)); \ + (AP)->gpr = (__words < 8) ? __words : 8; \ + (AP)->fpr = __va_fregno - 33; \ + (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \ + + __va_varargs_offset); \ + __va_overflow(AP) = ((char *)__builtin_saveregs () \ + + (((__words >= 8) ? __words - 8 : 0) \ + * sizeof (long))); \ + (void)0; \ +}) +#else /* GCC29 */ +#define __va_start_common(AP, FAKE) \ +__extension__ ({ \ + (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ + __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list)); \ + }) +#endif /* GCC29 */ + +#ifdef _STDARG_H /* stdarg.h support */ + +/* Calling __builtin_next_arg gives the proper error message if LASTARG is + not indeed the last argument. */ +#define va_start(AP,LASTARG) \ + (__builtin_next_arg (LASTARG), __va_start_common (AP, 0)) + +#else /* varargs.h support */ + +#define va_start(AP) __va_start_common (AP, 1) +#define va_alist __va_1st_arg +#define va_dcl register int va_alist; ... + +#endif /* _STDARG_H */ + +#ifdef _SOFT_FLOAT +#define __va_float_p(TYPE) 0 +#else +#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8) +#endif + +#define __va_longlong_p(TYPE) \ + ((__builtin_classify_type(*(TYPE *)0) == 1) && (sizeof(TYPE) == 8)) + +#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12) +#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long)) + +#ifndef GCC29 +#define va_arg(AP,TYPE) \ +__extension__ (*({ \ + register TYPE *__ptr; \ + \ + if (__va_float_p (TYPE) && (AP)->fpr < 8) \ + { \ + __ptr = __VA_FP_REGSAVE (AP, TYPE); \ + (AP)->fpr++; \ + } \ + \ + else if (__va_aggregate_p (TYPE) && (AP)->gpr < 8) \ + { \ + __ptr = * __VA_GP_REGSAVE (AP, TYPE *); \ + (AP)->gpr++; \ + } \ + \ + else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ + && (AP)->gpr + __va_size(TYPE) <= 8 \ + && (!__va_longlong_p(TYPE) \ + || (AP)->gpr + __va_size(TYPE) <= 7)) \ + { \ + if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \ + (AP)->gpr++; \ + \ + __ptr = __VA_GP_REGSAVE (AP, TYPE); \ + (AP)->gpr += __va_size (TYPE); \ + } \ + \ + else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ + && (AP)->gpr < 8) \ + { \ + (AP)->gpr = 8; \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ + } \ + \ + else if (__va_aggregate_p (TYPE)) \ + { \ + __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += sizeof (TYPE *); \ + } \ + else \ + { \ + if (__va_longlong_p(TYPE) && ((long)__va_overflow(AP) & 4) != 0) \ + __va_overflow(AP) += 4; \ + \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ + } \ + \ + __ptr; \ +})) +#else /* GCC29 */ +#define va_arg(AP,TYPE) \ +__extension__ (*({ \ + register TYPE *__ptr; \ + \ + if (__va_float_p (TYPE) && (AP)->fpr < 8) \ + { \ + __ptr = __VA_FP_REGSAVE (AP, TYPE); \ + (AP)->fpr++; \ + } \ + \ + else if (__va_aggregate_p (TYPE) && (AP)->gpr < 8) \ + { \ + __ptr = * __VA_GP_REGSAVE (AP, TYPE *); \ + (AP)->gpr++; \ + } \ + \ + else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ + && (AP)->gpr + __va_size(TYPE) <= 8 \ + && (!__va_longlong_p(TYPE) \ + || (AP)->gpr + __va_size(TYPE) <= 8)) \ + { \ + if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \ + (AP)->gpr++; \ + \ + __ptr = __VA_GP_REGSAVE (AP, TYPE); \ + (AP)->gpr += __va_size (TYPE); \ + } \ + \ + else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ + && (AP)->gpr < 8) \ + { \ + (AP)->gpr = 8; \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ + } \ + \ + else if (__va_aggregate_p (TYPE)) \ + { \ + __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += sizeof (TYPE *); \ + } \ + else \ + { \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ + } \ + \ + __ptr; \ +})) +#endif /* not GCC29 */ + +#define va_end(AP) ((void)0) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) *(dest) = *(src) + +#endif /* __VA_PPC_H__ */ +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ + + +#else +/* Windows NT */ +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef char *__gnuc_va_list; +#endif /* not __GNUC_VA_LIST */ + +/* If this is for internal libc use, don't define anything but + __gnuc_va_list. */ +#if defined (_STDARG_H) || defined (_VARARGS_H) + +#define __va_start_common(AP, LASTARG, FAKE) \ + ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0) + +#ifdef _STDARG_H /* stdarg.h support */ + +/* Calling __builtin_next_arg gives the proper error message if LASTARG is + not indeed the last argument. */ +#define va_start(AP,LASTARG) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (LASTARG), \ + 0) + +#else /* varargs.h support */ + +#define va_start(AP) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \ + 0) + +#define va_alist __va_1st_arg +#define va_dcl register int __va_1st_arg; ... + +#endif /* _STDARG_H */ + +#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3) +#define __va_align(AP, TYPE) \ + ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \ + & ~((sizeof (TYPE) >= 8) ? 7 : 3)) + +#define va_arg(AP,TYPE) \ +( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \ + + __va_rounded_size(TYPE))) \ + - __va_rounded_size(TYPE))) + +#define va_end(AP) ((void)0) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +#endif /* Windows NT */ diff --git a/sys/arch/mvmeppc/include/varargs.h b/sys/arch/mvmeppc/include/varargs.h new file mode 100644 index 00000000000..ee015e0500b --- /dev/null +++ b/sys/arch/mvmeppc/include/varargs.h @@ -0,0 +1,53 @@ +/* $NetBSD: varargs.h,v 1.1 1996/09/30 16:34:37 ws Exp $ */ + +/*- + * Copyright (c) 1990, 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. + * + * 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. + * + * @(#)varargs.h 8.2 (Berkeley) 3/22/94 + */ + +#ifndef _PPC_VARARGS_H_ +#define _PPC_VARARGS_H_ + +#define _VARARGS_H + +#include <machine/ansi.h> +#include <machine/va-ppc.h> + +typedef _BSD_VA_LIST_ va_list; + +#endif /* !_PPC_VARARGS_H_ */ diff --git a/sys/arch/mvmeppc/include/vmparam.h b/sys/arch/mvmeppc/include/vmparam.h new file mode 100644 index 00000000000..4a7a8d4ee8d --- /dev/null +++ b/sys/arch/mvmeppc/include/vmparam.h @@ -0,0 +1,125 @@ +/* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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 TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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_VMPARAM_H +#define MACHINE_VMPARAM_H + +#define USRTEXT PAGE_SIZE +#define USRSTACK VM_MAXUSER_ADDRESS + +#ifndef MAXTSIZ +#define MAXTSIZ (16*1024*1024) /* max text size */ +#endif + +#ifndef DFLDSIZ +#define DFLDSIZ (32*1024*1024) /* default data size */ +#endif + +#ifndef MAXDSIZ +#define MAXDSIZ (512*1024*1024) /* max data size */ +#endif + +#ifndef DFLSSIZ +#define DFLSSIZ (1*1024*1024) /* default stack size */ +#endif + +#ifndef MAXSSIZ +#define MAXSSIZ (32*1024*1024) /* max stack size */ +#endif + +/* + * Min & Max swap space allocation chunks + */ +#define DMMIN 32 +#define DMMAX 4096 + +/* + * Size of shared memory map + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 1024 +#endif + +/* + * Size of User Raw I/O map + */ +#define USRIOSIZE 1024 + +/* + * 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 + +/* + * Would like to have MAX addresses = 0, but this doesn't (currently) work + */ +#define VM_MIN_ADDRESS ((vm_offset_t)0) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000) +#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHFT)) + +/* ppc_kvm_size is so that vm space can be stolen before vm is fully + * initialized. + */ +#define VM_KERN_ADDR_SIZE_DEF SEGMENT_LENGTH +extern vm_offset_t ppc_kvm_size; +#define VM_KERN_ADDRESS_SIZE (ppc_kvm_size) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)((KERNEL_SR << ADDR_SR_SHFT) \ + + VM_KERN_ADDRESS_SIZE)) + +#define MACHINE_NEW_NONCONTIG /* VM <=> pmap interface modifier */ + +#define VM_KMEM_SIZE (NKMEMCLUSTERS * PAGE_SIZE) +#define VM_MBUF_SIZE (NMBCLUSTERS * PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) + +struct pmap_physseg { + struct pv_entry *pvent; + char *attrs; + /* NULL ??? */ +}; + +#define VM_PHYSSEG_MAX 32 /* actually we could have this many segments */ +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH +#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ + +#define VM_NFREELIST 1 +#define VM_FREELIST_DEFAULT 0 + +#endif diff --git a/sys/arch/mvmeppc/include/vuid_event.h b/sys/arch/mvmeppc/include/vuid_event.h new file mode 100644 index 00000000000..3ecbdcb7a3a --- /dev/null +++ b/sys/arch/mvmeppc/include/vuid_event.h @@ -0,0 +1,88 @@ +/* $OpenBSD: vuid_event.h,v 1.1 2001/06/26 21:57:50 smurph Exp $ */ +/* $NetBSD: vuid_event.h,v 1.1 1996/04/12 01:45:47 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. + * + * @(#)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 */ diff --git a/sys/arch/mvmeppc/include/wsconsio.h b/sys/arch/mvmeppc/include/wsconsio.h new file mode 100644 index 00000000000..37ae8d06b5c --- /dev/null +++ b/sys/arch/mvmeppc/include/wsconsio.h @@ -0,0 +1,62 @@ +/* $OpenBSD: wsconsio.h,v 1.1 2001/06/26 21:57:50 smurph Exp $ */ +/* $NetBSD: wsconsio.h,v 1.1 1996/04/12 01:43:06 cgd Exp $ */ + +/* + * Copyright (c) 1995, 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * 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 the + * rights to redistribute these changes. + */ + +/* + * Get keyboard type. Keyboard type definitions are below. + */ +#define WSCONSIO_KBD_GTYPE _IOR('W',100,int) +#define KBD_TYPE_LK201 0 /* lk-201 */ +#define KBD_TYPE_LK401 1 /* lk-401 */ +#define KBD_TYPE_PC 2 /* pc-like */ + +/* + * If arg is one, don't process scancodes into characters + */ +#define WSCONSIO_KBD_SCANCODES _IO('W',101,int) + +/* + * Bell ioctls. + */ + +struct wsconsio_bell_data { + int wbd_flags; + int wbd_pitch; /* pitch, in Hz. */ + int wbd_period; /* period, in milliseconds. */ + int wbd_volume; /* percentage of maximum volume. */ +}; + +#define WSCONSIO_BELLDATA_PITCH 0x01 /* pitch data present */ +#define WSCONSIO_BELLDATA_PERIOD 0x02 /* period data present */ +#define WSCONSIO_BELLDATA_VOLUME 0x04 /* volume data present */ + +#define WSCONSIO_BELL _IO('W',102) +#define WSCONSIO_COMPLEXBELL _IOW('W',103,struct wsconsio_bell_data) +#define WSCONSIO_SETBELL _IOW('W',104,struct wsconsio_bell_data) +#define WSCONSIO_GETBELL _IOR('W',105,struct wsconsio_bell_data) |