From ef834a87737378e1dc26e0e3e32e5d1445167855 Mon Sep 17 00:00:00 2001 From: Per Fogelstrom Date: Mon, 13 Oct 1997 10:53:50 +0000 Subject: Monolithic PowerPC kernel, new include --- sys/arch/powerpc/include/aout_machdep.h | 55 ---------- sys/arch/powerpc/include/autoconf.h | 86 ++++++++++++++++ sys/arch/powerpc/include/bat.h | 3 +- sys/arch/powerpc/include/bus.h | 164 ++++++++++++++++++++++++++++++ sys/arch/powerpc/include/cpu.h | 11 +- sys/arch/powerpc/include/disklabel.h | 94 ++++++++--------- sys/arch/powerpc/include/endian.h | 64 ++++++------ sys/arch/powerpc/include/exec.h | 66 +++++------- sys/arch/powerpc/include/float.h | 9 +- sys/arch/powerpc/include/fpu.h | 3 +- sys/arch/powerpc/include/frame.h | 3 +- sys/arch/powerpc/include/ieee.h | 3 +- sys/arch/powerpc/include/ieeefp.h | 6 +- sys/arch/powerpc/include/intr.h | 149 +++++++++++++++++++++++++++ sys/arch/powerpc/include/ipkdb.h | 3 +- sys/arch/powerpc/include/irq.h | 50 ---------- sys/arch/powerpc/include/limits.h | 14 ++- sys/arch/powerpc/include/param.h | 11 +- sys/arch/powerpc/include/pio.h | 172 ++++++++++++++++++++++++++++++++ sys/arch/powerpc/include/powerpc.h | 6 +- sys/arch/powerpc/include/psl.h | 99 +----------------- sys/arch/powerpc/include/stdarg.h | 6 +- sys/arch/powerpc/include/types.h | 6 +- sys/arch/powerpc/include/vmparam.h | 2 + 24 files changed, 716 insertions(+), 369 deletions(-) delete mode 100644 sys/arch/powerpc/include/aout_machdep.h create mode 100644 sys/arch/powerpc/include/autoconf.h create mode 100644 sys/arch/powerpc/include/bus.h create mode 100644 sys/arch/powerpc/include/intr.h delete mode 100644 sys/arch/powerpc/include/irq.h create mode 100644 sys/arch/powerpc/include/pio.h diff --git a/sys/arch/powerpc/include/aout_machdep.h b/sys/arch/powerpc/include/aout_machdep.h deleted file mode 100644 index 24b8ea4440e..00000000000 --- a/sys/arch/powerpc/include/aout_machdep.h +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: aout_machdep.h,v 1.2 1996/12/28 06:24:58 rahnds Exp $ */ -/* $NetBSD: aout_machdep.h,v 1.1 1996/09/30 16:34:23 ws 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 _MACH_EXEC_H_ -#define _MACH_EXEC_H_ - -#include - -/* No special executable format (yet) */ -#define cpu_exec_aout_makecmds(a, b) ENOEXEC - -/* Relocation format. */ -struct relocation_info_ppc { - int r_address; /* offset in text or data segment */ - unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ - r_extern : 1, /* 1 if need to add symbol to value */ - : 2; /* unused bits */ - enum reloc_type r_type : 5; /* relocation type */ - long r_addend; /* relocation addend */ -}; -#define relocation_info relocation_info_ppc - -#define __LDPGSZ 4096 - -#endif /* _MACH_EXEC_H_ */ diff --git a/sys/arch/powerpc/include/autoconf.h b/sys/arch/powerpc/include/autoconf.h new file mode 100644 index 00000000000..0dc3d55d0e3 --- /dev/null +++ b/sys/arch/powerpc/include/autoconf.h @@ -0,0 +1,86 @@ +/* $OpenBSD: autoconf.h,v 1.1 1997/10/13 10:53:41 pefo 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_ + +/* + * System types. + */ +#define POWER4e 1 /* V.I Power.4e board */ + +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 /* Algorithmics PCI 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. */ +}; + +void set_clockintr __P((void (*)(struct clockframe *))); +void set_iointr __P((void (*)(void *, int))); +int badaddr __P((void *, u_int64_t)); + +#endif /* _MACHINE_AUTOCONF_H_ */ diff --git a/sys/arch/powerpc/include/bat.h b/sys/arch/powerpc/include/bat.h index 9b1f4d326eb..ef1d8cf446f 100644 --- a/sys/arch/powerpc/include/bat.h +++ b/sys/arch/powerpc/include/bat.h @@ -1,5 +1,4 @@ -/* $OpenBSD: bat.h,v 1.2 1996/12/28 06:25:00 rahnds Exp $ */ -/* $NetBSD: bat.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */ +/* $OpenBSD: bat.h,v 1.3 1997/10/13 10:53:41 pefo Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. diff --git a/sys/arch/powerpc/include/bus.h b/sys/arch/powerpc/include/bus.h new file mode 100644 index 00000000000..f6b1a911760 --- /dev/null +++ b/sys/arch/powerpc/include/bus.h @@ -0,0 +1,164 @@ +/* $OpenBSD: bus.h,v 1.1 1997/10/13 10:53:42 pefo Exp $ */ + +/* + * 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 _MACHINE_BUS_H_ +#define _MACHINE_BUS_H_ + +#include + +#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 + +/* + * 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 struct p4e_bus_space *bus_space_tag_t; + +struct p4e_bus_space { + u_int32_t bus_base; + u_int8_t bus_reverse; /* Reverse bytes */ +}; + +extern struct p4e_bus_space p4e_isa_io, p4e_isa_mem; + +/* + * Access methods for bus resources + */ +#define bus_space_map(t, addr, size, cacheable, bshp) \ + ((*(bshp) = (t)->bus_base + (addr)), 0) + +#define bus_space_unmap(t, bsh, size) + +#define bus_space_read(n,m) \ +static __inline CAT3(u_int,m,_t) \ +CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_addr_t ba) \ +{ \ + if(bst->bus_reverse) \ + return CAT3(in,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ + else \ + return CAT(in,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ +} + +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 !!! + +#define bus_space_read_multi_1(t, h, o, a, c) do { \ + insb((u_int8_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_read_multi_2(t, h, o, a, c) do { \ + insw((u_int16_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_read_multi_4(t, h, o, a, c) do { \ + insl((u_int32_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! + +#define bus_space_write(n,m) \ +static __inline void \ +CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_addr_t ba, CAT3(u_int,m,_t) x) \ +{ \ + if(bst->bus_reverse) \ + CAT3(out,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), x); \ + else \ + CAT(out,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), 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 !!! + + +#define bus_space_write_multi_1(t, h, o, a, c) do { \ + outsb((u_int8_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_write_multi_2(t, h, o, a, c) do { \ + outsw((u_int16_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_write_multi_4(t, h, o, a, c) do { \ + outsl((u_int32_t *)((h) + (o)), (a), (c)); \ + } while(0) + +#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! + +/* These are OpenBSD extensions to the general NetBSD bus interface. */ +#define bus_space_read_raw_multi(n,m,l) \ +static __inline void \ +CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_addr_t ba, u_int8_t *buf, bus_size_t cnt) \ +{ \ + CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf, \ + cnt >> l); \ +} + +bus_space_read_raw_multi(2,16,1) +bus_space_read_raw_multi(4,32,2) + +#define bus_space_read_raw_multi_8 \ + !!! bus_space_read_raw_multi_8 not implemented !!! + +#define bus_space_write_raw_multi(n,m,l) \ +static __inline void \ +CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\ + bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt) \ +{ \ + CAT(bus_space_write_multi_,n)(bst, bsh, ba, \ + (const CAT3(u_int,m,_t) *)buf, cnt >> l); \ +} + +bus_space_write_raw_multi(2,16,1) +bus_space_write_raw_multi(4,32,2) + +#define bus_space_write_raw_multi_8 \ + !!! bus_space_write_raw_multi_8 not implemented !!! + +#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h index 6c947c0c26e..964844e92ee 100644 --- a/sys/arch/powerpc/include/cpu.h +++ b/sys/arch/powerpc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.2 1996/12/28 06:25:03 rahnds Exp $ */ +/* $OpenBSD: cpu.h,v 1.3 1997/10/13 10:53:42 pefo Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -36,17 +36,8 @@ #include -struct machvec { - void (*splx) __P((int)); - void (*irq_establish) __P((int, int, void (*)(void *), void *)); -}; -extern struct machvec machine_interface; - #include -#define irq_establish(irq, level, handler, arg) \ - ((*machine_interface.irq_establish)((irq), (level), (handler), (arg))) - #define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) #define CLKF_BASEPRI(frame) ((frame)->pri == 0) #define CLKF_PC(frame) ((frame)->srr0) diff --git a/sys/arch/powerpc/include/disklabel.h b/sys/arch/powerpc/include/disklabel.h index 77357753562..12fc143328a 100644 --- a/sys/arch/powerpc/include/disklabel.h +++ b/sys/arch/powerpc/include/disklabel.h @@ -1,9 +1,7 @@ -/* $OpenBSD: disklabel.h,v 1.5 1997/09/29 18:55:13 deraadt Exp $ */ -/* $NetBSD: disklabel.h,v 1.1 1996/09/30 16:34:22 ws Exp $ */ +/* $OpenBSD: disklabel.h,v 1.6 1997/10/13 10:53:42 pefo Exp $ */ -/*- - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. +/* + * Copyright (c) 1994 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -16,29 +14,29 @@ * 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 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 TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * 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 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. + * 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_ +#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: XX?c */ +#define RAW_PART 2 /* raw partition: ie. rsd0c */ /* MBR partition table */ #define MBRSECTOR 0 /* MBR sector number */ @@ -61,39 +59,43 @@ struct mbr_partition { unsigned long mbr_size; /* partition size in sectors */ }; -/* Known partition types: */ -#define MBR_EXTENDED 0x05 /* Extended partition */ -#define MBR_NETBSD_LE 0xa5 /* NetBSD little endian partition */ -#define MBR_NETBSD_BE 0xa6 /* NetBSD big endian partition */ -#define MBR_NETBSD MBR_NETBSD_BE /* on this machine, we default to BE */ - -/* For compatibility reasons (mainly for fdisk): */ -#define dos_partition mbr_partition -#define dp_flag mbr_flag -#define dp_shd mbr_shd -#define dp_ssect mbr_ssect -#define dp_scyl mbr_scyl -#define dp_typ mbr_type -#define dp_ehd mbr_ehd -#define dp_esect mbr_esect -#define dp_ecyl mbr_ecyl -#define dp_start mbr_start -#define dp_size mbr_size - -#define DOSPARTOFF MBRPARTOFF -#define NDOSPART NMBRPART - +/* 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_386BSD MBR_NETBSD -#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ -#define DOSACTIVE 0x80 +#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */ +#define DOSPTYP_FAT16C 0x0e /* 16-bit FAT, CHS-mapped */ +#define DOSPTYP_ONTRACK 0x54 +#define DOSPTYP_LINUX 0x83 /* That other thing */ +#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ +#define DOSPTYP_NETBSD DOSPTYP_386BSD /* NetBSD partition type (XXX) */ +#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ +#include struct cpu_disklabel { - int cd_start; /* Offset to NetBSD partition in blocks */ + 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)) -#endif /* _MACHINE_DISKLABEL_H_ */ +static __inline u_int32_t +get_le(p) + void *p; +{ + 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/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h index b8e1eaaacc7..979a90f125d 100644 --- a/sys/arch/powerpc/include/endian.h +++ b/sys/arch/powerpc/include/endian.h @@ -1,11 +1,8 @@ -/* $OpenBSD: endian.h,v 1.7 1997/06/25 12:41:43 grr Exp $ */ -/* $NetBSD: endian.h,v 1.2 1996/10/13 03:16:41 christos Exp $ */ +/* $OpenBSD: endian.h,v 1.8 1997/10/13 10:53:43 pefo Exp $ */ -/*- - * Copyright (C) 1995 Wolfgang Solfrank. - * Copyright (C) 1995 TooLs GmbH. - * All rights reserved. - * +/* + * 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: @@ -16,24 +13,27 @@ * 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 + * This product includes software developed under OpenBSD 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 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. + * 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 _PPC_ENDIAN_H_ -#define _PPC_ENDIAN_H_ +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ #ifndef _POSIX_SOURCE @@ -41,14 +41,13 @@ #define _QUAD_LOWWORD 1 /* - * Definitions for byte order, according to byte significance from low - * address to high. + * Byte order definition. Byte numbers given in increasing address order. */ -#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, NS32K */ +#define BIG_ENDIAN 4321 /* MSB first: M68K */ #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ -#define BYTE_ORDER BIG_ENDIAN /* for now */ +#define BYTE_ORDER BIG_ENDIAN #include @@ -63,14 +62,11 @@ u_int16_t ntohs __P((u_int16_t)); __END_DECLS /* - * Macros for network/external number representation conversion. + * Macros for network/external number representation conversion where + * network/external is defined to be in BIG_ENDIAN byte order. * - * The way this works is that HTONS(x) modifies x and *can't* be used as - * and rvalue i.e. foo=HTONS(bar) is wrong. Likewise x=htons(x) should - * never be used where HTONS(x) will serve i.e. foo=htons(foo) is wrong. - * Failing to observe these rule will result in code that appears to work - * and probably does work, but generates gcc warnings on architectures - * where the macros are used to optimize away an unneeded conversion. + * *NOTE* That the macros are supposed to work on the arrgument (x) and + * thus should *NOT* be used in assignments such as 'foo=HTONS(bar)'. */ #if BYTE_ORDER == BIG_ENDIAN && !defined(lint) #define ntohl(x) (x) @@ -92,4 +88,4 @@ __END_DECLS #endif #endif /* _POSIX_SOURCE */ -#endif /* _PPC_ENDIAN_H_ */ +#endif /* _MACHINE_ENDIAN_H_ */ diff --git a/sys/arch/powerpc/include/exec.h b/sys/arch/powerpc/include/exec.h index 0eb7db7a818..b1a9f31d984 100644 --- a/sys/arch/powerpc/include/exec.h +++ b/sys/arch/powerpc/include/exec.h @@ -1,8 +1,8 @@ -/* $OpenBSD: exec.h,v 1.4 1997/01/09 03:03:44 rahnds Exp $ */ +/* $OpenBSD: exec.h,v 1.5 1997/10/13 10:53:43 pefo Exp $ */ + /* - * Copyright (c) 1993 Christopher G. Demetriou - * All rights reserved. - * + * 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: @@ -11,59 +11,45 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission + * 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. + * 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.4 1997/01/09 03:03:44 rahnds Exp $ + * $Id: exec.h,v 1.5 1997/10/13 10:53:43 pefo Exp $ */ -#ifndef _PPC_EXEC_H_ -#define _PPC_EXEC_H_ +#ifndef _MACHINE_EXEC_H_ +#define _MACHINE_EXEC_H_ #define __LDPGSZ 4096 /* linker page size */ -enum reloc_type { - rubbish -}; - -/* Relocation format (from PMAX?) */ -struct relocation_info_powerpc { - /* Rubbish for "a.out" compatibility, not used for ELF */ - int r_address; /* offset in text or data segment */ - unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ - r_pcrel : 1, /* 1 if value should be pc-relative */ - r_length : 2, /* log base 2 of value's width */ - r_extern : 1, /* 1 if need to add symbol to value */ - r_baserel : 1, /* linkage table relative */ - r_jmptable : 1, /* relocate to jump table */ - r_relative : 1, /* load address relative */ - r_copy : 1; /* run time copy */ -}; -#define relocation_info relocation_info_powerpc - /* * Define what exec "formats" we should handle. */ #define NATIVE_EXEC_ELF +#define EXEC_SCRIPT #define ELF_TARG_CLASS ELFCLASS32 #define ELF_TARG_DATA ELFDATA2MSB #define ELF_TARG_MACH EM_PPC -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF #define _KERN_DO_ELF -#endif /* _PPC_EXEC_H_ */ +#endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/powerpc/include/float.h b/sys/arch/powerpc/include/float.h index 1084cf7350f..9067ea0926e 100644 --- a/sys/arch/powerpc/include/float.h +++ b/sys/arch/powerpc/include/float.h @@ -1,5 +1,4 @@ -/* $OpenBSD: float.h,v 1.3 1997/08/01 21:35:33 deraadt Exp $ */ -/* $NetBSD: float.h,v 1.1 1996/09/30 16:34:24 ws Exp $ */ +/* $OpenBSD: float.h,v 1.4 1997/10/13 10:53:43 pefo Exp $ */ /* * Copyright (c) 1989 Regents of the University of California. @@ -36,8 +35,8 @@ * @(#)float.h 7.1 (Berkeley) 5/8/90 */ -#ifndef _PPC_FLOAT_H_ -#define _PPC_FLOAT_H_ +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ #include @@ -78,4 +77,4 @@ __END_DECLS #define LDBL_MAX DBL_MAX #define LDBL_MAX_10_EXP DBL_MAX_10_EXP -#endif /* _PPC_FLOAT_H_ */ +#endif /* _MACHINE_FLOAT_H_ */ diff --git a/sys/arch/powerpc/include/fpu.h b/sys/arch/powerpc/include/fpu.h index b9c7aa2670d..bf0c8adf9b8 100644 --- a/sys/arch/powerpc/include/fpu.h +++ b/sys/arch/powerpc/include/fpu.h @@ -1,5 +1,4 @@ -/* $OpenBSD: fpu.h,v 1.2 1996/12/28 06:25:08 rahnds Exp $ */ -/* $NetBSD: fpu.h,v 1.1 1996/09/30 16:34:24 ws Exp $ */ +/* $OpenBSD: fpu.h,v 1.3 1997/10/13 10:53:44 pefo Exp $ */ /*- * Copyright (C) 1996 Wolfgang Solfrank. diff --git a/sys/arch/powerpc/include/frame.h b/sys/arch/powerpc/include/frame.h index 3c184262d0f..4d958a3ce28 100644 --- a/sys/arch/powerpc/include/frame.h +++ b/sys/arch/powerpc/include/frame.h @@ -1,5 +1,4 @@ -/* $OpenBSD: frame.h,v 1.3 1997/02/05 01:33:51 rahnds Exp $ */ -/* $NetBSD: frame.h,v 1.1 1996/09/30 16:34:25 ws Exp $ */ +/* $OpenBSD: frame.h,v 1.4 1997/10/13 10:53:44 pefo Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. diff --git a/sys/arch/powerpc/include/ieee.h b/sys/arch/powerpc/include/ieee.h index a91dcaeab43..67ab104196e 100644 --- a/sys/arch/powerpc/include/ieee.h +++ b/sys/arch/powerpc/include/ieee.h @@ -1,5 +1,4 @@ -/* $OpenBSD: ieee.h,v 1.2 1996/12/28 06:25:11 rahnds Exp $ */ -/* $NetBSD: ieee.h,v 1.1 1996/09/30 16:34:25 ws Exp $ */ +/* $OpenBSD: ieee.h,v 1.3 1997/10/13 10:53:45 pefo Exp $ */ /* * Copyright (c) 1992, 1993 diff --git a/sys/arch/powerpc/include/ieeefp.h b/sys/arch/powerpc/include/ieeefp.h index a6612d66671..71a4c0153c1 100644 --- a/sys/arch/powerpc/include/ieeefp.h +++ b/sys/arch/powerpc/include/ieeefp.h @@ -3,8 +3,8 @@ * Public domain. */ -#ifndef _POWERPC_IEEEFP_H_ -#define _POWERPC_IEEEFP_H_ +#ifndef _MACHINE_IEEEFP_H_ +#define _MACHINE_IEEEFP_H_ typedef int fp_except; #define FP_X_IMP 0x01 /* imprecise (loss of precision) */ @@ -20,4 +20,4 @@ typedef enum { FP_RP=3 /* round toward positive infinity */ } fp_rnd; -#endif /* _POWERPC_IEEEFP_H_ */ +#endif /* _MACHINE_IEEEFP_H_ */ diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h new file mode 100644 index 00000000000..1ebaa73c96f --- /dev/null +++ b/sys/arch/powerpc/include/intr.h @@ -0,0 +1,149 @@ +/* $OpenBSD: intr.h,v 1.1 1997/10/13 10:53:45 pefo 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 + +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_CLOCK|SINT_NET) +#define splimp() splraise(imask[IPL_IMP]) +#define splstatclock() splhigh() +#define splsoftclock() spllower(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) + +#endif /* _LOCORE */ + +#endif /* _MACHINE_INTR_H_ */ diff --git a/sys/arch/powerpc/include/ipkdb.h b/sys/arch/powerpc/include/ipkdb.h index dab68c29d07..d677e74192c 100644 --- a/sys/arch/powerpc/include/ipkdb.h +++ b/sys/arch/powerpc/include/ipkdb.h @@ -1,5 +1,4 @@ -/* $OpenBSD: ipkdb.h,v 1.2 1996/12/28 06:25:12 rahnds Exp $ */ -/* $NetBSD: ipkdb.h,v 1.1 1996/10/16 19:33:04 ws Exp $ */ +/* $OpenBSD: ipkdb.h,v 1.3 1997/10/13 10:53:46 pefo Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. diff --git a/sys/arch/powerpc/include/irq.h b/sys/arch/powerpc/include/irq.h deleted file mode 100644 index 60ea2933c0a..00000000000 --- a/sys/arch/powerpc/include/irq.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: irq.h,v 1.2 1996/12/28 06:25:14 rahnds Exp $ */ -/* $NetBSD: irq.h,v 1.1 1996/09/30 16:34:26 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_IRQ_H_ -#define _MACHINE_IRQ_H_ - -#define NINT 32 /* Maximum number of interrupt handlers */ - -#ifndef _LOCORE -struct intrhand { - void (*handler)(); /* established handler */ - void *arg; /* established arg */ - u_long count; /* statistics */ -}; - -extern struct intrhand irqvec[NINT]; -#endif /* _LOCORE */ - -#endif /* _MACHINE_IRQ_H_ */ diff --git a/sys/arch/powerpc/include/limits.h b/sys/arch/powerpc/include/limits.h index 4ced24995c8..5a56779647c 100644 --- a/sys/arch/powerpc/include/limits.h +++ b/sys/arch/powerpc/include/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.3 1997/07/24 14:48:54 deraadt Exp $ */ +/* $OpenBSD: limits.h,v 1.4 1997/10/13 10:53:46 pefo Exp $ */ /* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -66,4 +66,16 @@ #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.797693134862316E+308 +#define DBL_MIN 2.225073858507201E-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/powerpc/include/param.h b/sys/arch/powerpc/include/param.h index 5fcf64326d5..b68dd5d1c4c 100644 --- a/sys/arch/powerpc/include/param.h +++ b/sys/arch/powerpc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.4 1997/02/28 22:57:40 niklas Exp $ */ +/* $OpenBSD: param.h,v 1.5 1997/10/13 10:53:47 pefo Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -45,15 +45,11 @@ #define _MACHINE powerpc #define MACHINE_ARCH "powerpc" #define _MACHINE_ARCH powerpc -#define MID_MACHINE MID_ZERO #define ALIGNBYTES (sizeof(double) - 1) #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) #define PGSHIFT 12 -#if 0 -#define NBPG (1 << PGSHIFT) /* Page size */ -#endif #define NBPG 4096 #define PGOFSET (NBPG - 1) @@ -80,12 +76,13 @@ #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 512 /* map size, max cluster allocation */ +#define NMBCLUSTERS 2048 /* map size, max cluster allocation */ #else -#define NMBCLUSTERS 256 /* map size, max cluster allocation */ +#define NMBCLUSTERS 1024 /* map size, max cluster allocation */ #endif #endif diff --git a/sys/arch/powerpc/include/pio.h b/sys/arch/powerpc/include/pio.h new file mode 100644 index 00000000000..c5e767c6de1 --- /dev/null +++ b/sys/arch/powerpc/include/pio.h @@ -0,0 +1,172 @@ +/* $OpenBSD: pio.h,v 1.1 1997/10/13 10:53:47 pefo 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. + */ + +static __inline void +__outb(a,v) + volatile u_int8_t *a; + int v; +{ + *a = v; + __asm__ volatile("eieio\n sync"); +} + +static __inline void +__outw(a,v) + volatile u_int16_t *a; + u_int16_t v; +{ + *a = v; + __asm__ volatile("eieio\n sync"); +} + +static __inline void +__outl(a,v) + volatile u_int32_t *a; + int v; +{ + *a = v; + __asm__ volatile("eieio\n sync"); +} + +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\n" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio\n sync"); +} + +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\n" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio\n sync"); +} + +static __inline u_int8_t +__inb(a) + volatile u_int8_t *a; +{ + u_int8_t _v_; + + _v_ = *a; + __asm__ volatile("eieio\n sync"); + return _v_; +} + +static __inline u_int16_t +__inw(a) + volatile u_int16_t *a; +{ + u_int16_t _v_; + + _v_ = *a; + __asm__ volatile("eieio\n sync"); + return _v_; +} + +static __inline u_int32_t +__inl(a) + volatile u_int32_t *a; +{ + u_int32_t _v_; + + _v_ = *a; + __asm__ volatile("eieio\n sync"); + 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("lhbrx %0, 0, %1\n" : "=r"(_v_) : "r"(_p_)); + __asm__ volatile("eieio\n sync"); + 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("lwbrx %0, 0, %1\n" : "=r"(_v_) : "r"(_p_)); + __asm__ volatile("eieio\n sync"); + 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) + +#endif /*_MACHINE_PIO_H_*/ diff --git a/sys/arch/powerpc/include/powerpc.h b/sys/arch/powerpc/include/powerpc.h index 3082c6593b5..c546a449b91 100644 --- a/sys/arch/powerpc/include/powerpc.h +++ b/sys/arch/powerpc/include/powerpc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: powerpc.h,v 1.2 1996/12/28 06:25:21 rahnds Exp $ */ +/* $OpenBSD: powerpc.h,v 1.3 1997/10/13 10:53:48 pefo Exp $ */ /* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */ /* @@ -49,8 +49,4 @@ void mem_regions __P((struct mem_region **, struct mem_region **)); void ppc_exit __P((void)) __attribute__((__noreturn__)); void ppc_boot __P((char *bootspec)) __attribute__((__noreturn__)); -int dk_match __P((char *name)); - -void ofrootfound __P((void)); - #endif /* _MACHINE_POWERPC_H_ */ diff --git a/sys/arch/powerpc/include/psl.h b/sys/arch/powerpc/include/psl.h index 20182170cc1..be357039b71 100644 --- a/sys/arch/powerpc/include/psl.h +++ b/sys/arch/powerpc/include/psl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: psl.h,v 1.2 1996/12/28 06:25:23 rahnds Exp $ */ +/* $OpenBSD: psl.h,v 1.3 1997/10/13 10:53:48 pefo Exp $ */ /* $NetBSD: psl.h,v 1.1 1996/09/30 16:34:32 ws Exp $ */ /* @@ -72,101 +72,6 @@ #define PSL_USERSTATIC (PSL_USERSET | PSL_IP | 0x87c0008c) +#include -#ifdef _KERNEL -/* - * Current processor level. - */ -#ifndef _LOCORE -extern int cpl; -extern int clockpending, softclockpending, softnetpending; -#endif -#define SPLBIO 0x01 -#define SPLNET 0x02 -#define SPLTTY 0x04 -#define SPLIMP 0x08 -#define SPLSOFTCLOCK 0x10 -#define SPLSOFTNET 0x20 -#define SPLCLOCK 0x80 -#define SPLMACHINE 0x0f /* levels handled by machine interface */ - -#ifndef _LOCORE -extern int splx __P((int)); - -extern int splraise __P((int)); - -extern __inline int -splhigh() -{ - return splraise(-1); -} - -extern __inline int -spl0() -{ - return splx(0); -} - -extern __inline int -splbio() -{ - return splraise(SPLBIO | SPLSOFTCLOCK | SPLSOFTNET); -} - -extern __inline int -splnet() -{ - return splraise(SPLNET | SPLSOFTCLOCK | SPLSOFTNET); -} - -extern __inline int -spltty() -{ - return splraise(SPLTTY | SPLSOFTCLOCK | SPLSOFTNET); -} - -extern __inline int -splimp() -{ - return splraise(SPLIMP | SPLSOFTCLOCK | SPLSOFTNET); -} -extern __inline int -splclock() -{ - return splraise(SPLCLOCK | SPLSOFTCLOCK | SPLSOFTNET); -} - -extern __inline int -splsoftclock() -{ - return splraise(SPLSOFTCLOCK); -} - -extern __inline int -splsoftnet() -{ - return splraise(SPLSOFTNET); -} - -extern __inline void -setsoftclock() -{ - softclockpending = 1; - if (!(cpl & SPLSOFTCLOCK)) - splx(cpl); -} - -extern __inline void -setsoftnet() -{ - softnetpending = 1; - if (!(cpl & SPLSOFTNET)) - splx(cpl); -} - -#endif /* !_LOCORE */ - -#define splstatclock() splclock() - -#endif /* _KERNEL */ #endif /* _MACHINE_PSL_H_ */ diff --git a/sys/arch/powerpc/include/stdarg.h b/sys/arch/powerpc/include/stdarg.h index 1f88825b79b..15e7d1deec5 100644 --- a/sys/arch/powerpc/include/stdarg.h +++ b/sys/arch/powerpc/include/stdarg.h @@ -35,8 +35,8 @@ * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 */ -#ifndef _PPC_STDARG_H_ -#define _PPC_STDARG_H_ +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ #include @@ -47,4 +47,4 @@ typedef _BSD_VA_LIST_ va_list; -#endif /* !_PPC_STDARG_H_ */ +#endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h index f8198aee5b2..85d5079bbaf 100644 --- a/sys/arch/powerpc/include/types.h +++ b/sys/arch/powerpc/include/types.h @@ -31,8 +31,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _MACHTYPES_H_ -#define _MACHTYPES_H_ +#ifndef _MACHINE_TYPES_H_ +#define _MACHINE_TYPES_H_ #include @@ -55,4 +55,4 @@ typedef struct label_t { int val[40]; /* double check this XXX */ } label_t; -#endif /* _MACHTYPES_H_ */ +#endif /* _MACHINE_TYPES_H_ */ diff --git a/sys/arch/powerpc/include/vmparam.h b/sys/arch/powerpc/include/vmparam.h index f06f3d536eb..234dc1ba566 100644 --- a/sys/arch/powerpc/include/vmparam.h +++ b/sys/arch/powerpc/include/vmparam.h @@ -93,6 +93,8 @@ #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)((KERNEL_SR << ADDR_SR_SHFT) \ + SEGMENT_LENGTH)) +#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ + #define VM_KMEM_SIZE (NKMEMCLUSTERS * CLBYTES) #define VM_MBUF_SIZE (NMBCLUSTERS * CLBYTES) #define VM_PHYS_SIZE (USRIOSIZE * CLBYTES) -- cgit v1.2.3