summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-09-01 15:49:07 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-09-01 15:49:07 +0000
commit65997b0cdeb6b9e16cdbbb314ede217802895ade (patch)
treebc94445005d87ce5bb877ac490e9dde833e03342 /sys/arch/macppc
parentb0437314cc10bd43e476454d2df24ec3d953247f (diff)
The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code between different powerpc base platforms. Most of the work involved in the renaming process was performed by miod@ Files moved from powerpc/include to macppc/include Some files were not "moved" but wrapper files were created which include the powerpc/include version. Several of the powerpc/include files where changed to reflect that they are POWERPC_* not MACHINE_*.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/include/adbsys.h182
-rw-r--r--sys/arch/macppc/include/ansi.h3
-rw-r--r--sys/arch/macppc/include/asm.h3
-rw-r--r--sys/arch/macppc/include/autoconf.h114
-rw-r--r--sys/arch/macppc/include/bat.h3
-rw-r--r--sys/arch/macppc/include/bus.h531
-rw-r--r--sys/arch/macppc/include/cdefs.h3
-rw-r--r--sys/arch/macppc/include/conf.h39
-rw-r--r--sys/arch/macppc/include/cpu.h63
-rw-r--r--sys/arch/macppc/include/db_machdep.h103
-rw-r--r--sys/arch/macppc/include/disklabel.h166
-rw-r--r--sys/arch/macppc/include/dlfcn.h3
-rw-r--r--sys/arch/macppc/include/elf_abi.h3
-rw-r--r--sys/arch/macppc/include/endian.h3
-rw-r--r--sys/arch/macppc/include/exec.h3
-rw-r--r--sys/arch/macppc/include/float.h3
-rw-r--r--sys/arch/macppc/include/fpu.h3
-rw-r--r--sys/arch/macppc/include/frame.h3
-rw-r--r--sys/arch/macppc/include/ieee.h3
-rw-r--r--sys/arch/macppc/include/ieeefp.h3
-rw-r--r--sys/arch/macppc/include/intr.h3
-rw-r--r--sys/arch/macppc/include/ipkdb.h3
-rw-r--r--sys/arch/macppc/include/kbio.h3
-rw-r--r--sys/arch/macppc/include/kcore.h3
-rw-r--r--sys/arch/macppc/include/limits.h3
-rw-r--r--sys/arch/macppc/include/link.h3
-rw-r--r--sys/arch/macppc/include/loadfile_machdep.h57
-rw-r--r--sys/arch/macppc/include/param.h59
-rw-r--r--sys/arch/macppc/include/pcb.h3
-rw-r--r--sys/arch/macppc/include/pio.h3
-rw-r--r--sys/arch/macppc/include/pmap.h3
-rw-r--r--sys/arch/macppc/include/powerpc.h86
-rw-r--r--sys/arch/macppc/include/proc.h3
-rw-r--r--sys/arch/macppc/include/profile.h3
-rw-r--r--sys/arch/macppc/include/psl.h3
-rw-r--r--sys/arch/macppc/include/pte.h3
-rw-r--r--sys/arch/macppc/include/ptrace.h3
-rw-r--r--sys/arch/macppc/include/reg.h3
-rw-r--r--sys/arch/macppc/include/reloc.h3
-rw-r--r--sys/arch/macppc/include/setjmp.h3
-rw-r--r--sys/arch/macppc/include/signal.h3
-rw-r--r--sys/arch/macppc/include/spinlock.h3
-rw-r--r--sys/arch/macppc/include/stdarg.h3
-rw-r--r--sys/arch/macppc/include/trap.h3
-rw-r--r--sys/arch/macppc/include/types.h3
-rw-r--r--sys/arch/macppc/include/va-ppc.h3
-rw-r--r--sys/arch/macppc/include/varargs.h3
-rw-r--r--sys/arch/macppc/include/vmparam.h124
-rw-r--r--sys/arch/macppc/include/vuid_event.h3
-rw-r--r--sys/arch/macppc/include/wsconsio.h3
50 files changed, 1641 insertions, 0 deletions
diff --git a/sys/arch/macppc/include/adbsys.h b/sys/arch/macppc/include/adbsys.h
new file mode 100644
index 00000000000..c06fadaef87
--- /dev/null
+++ b/sys/arch/macppc/include/adbsys.h
@@ -0,0 +1,182 @@
+/* $OpenBSD: adbsys.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+/* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
+
+/*-
+ * Copyright (C) 1993, 1994 Allen K. Briggs, Chris P. Caputo,
+ * Michael L. Finch, Bradley A. Grantham, and
+ * Lawrence A. Kesteloot
+ * 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 Alice Group.
+ * 4. The names of the Alice Group or any of its members may not be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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 _ADBSYS_MACHINE_
+#define _ADBSYS_MACHINE_
+
+#include <sys/time.h> /* timeval stuff */
+#include <sys/ioctl.h> /* ioctls */
+
+
+/* Handy visual constants */
+#define ADB_MAX_HANDLERS 256
+#define ADB_MAX_DEVS 16
+
+
+/* Different ADB system types */
+enum adb_system_e {
+ MacIIADB,
+ MacIIsiADB,
+ MacPBADB
+};
+extern enum adb_system_e adb_system_type;
+
+
+/* an ADB event */
+typedef struct adb_event_s {
+ int addr; /* device address */
+ int hand_id; /* handler id */
+ int def_addr; /* default address */
+ int byte_count; /* number of bytes */
+ unsigned char bytes[8]; /* bytes from register 0 */
+ struct timeval timestamp; /* time event was acquired */
+ union {
+ struct adb_keydata_s{
+ int key; /* ADB key code */
+ } k;
+ struct adb_mousedata_s{
+ int dx; /* mouse delta x */
+ int dy; /* mouse delta y */
+ int buttons; /* buttons (down << (buttonnum)) */
+ } m;
+ } u; /* courtesy interpretation */
+} adb_event_t;
+
+
+/* a device on the ADB */
+typedef struct adb_dev_s{
+ int addr; /* current address */
+ int default_addr; /* startup address */
+ int handler_id; /* handler ID */
+} adb_dev_t;
+
+
+ /* Interesting default addresses */
+#define ADBADDR_SECURE 1 /* Security dongles */
+#define ADBADDR_MAP 2 /* Mapped devices (keyboards/pads) */
+#define ADBADDR_REL 3 /* Relative positioning devices
+ (mice, trackballs/pads) */
+#define ADBADDR_ABS 4 /* Absolute positioning devices
+ (graphics tablets) */
+#define ADBADDR_DATATX 5
+#define ADBADDR_RSRVD 6 /* Reserved by Apple */
+#define ADBADDR_MISC 7 /* Miscellaneous appliances */
+#define ADBADDR_DONGLE ADBADDR_SECURE
+#define ADBADDR_KBD ADBADDR_MAP
+#define ADBADDR_MS ADBADDR_REL
+#define ADBADDR_TABLET ADBADDR_ABS
+#define ADBADDR_MODEM ADBADDR_DATATX
+
+
+ /* Interesting keyboard handler IDs */
+#define ADB_STDKBD 1
+#define ADB_EXTKBD 2
+#define ADB_ISOKBD 4
+#define ADB_EXTISOKBD 5
+#define ADB_KBDII 8
+#define ADB_ISOKBDII 9
+#define ADB_PBKBD 12
+#define ADB_PBISOKBD 13
+#define ADB_ADJKPD 14
+#define ADB_ADJKBD 16
+#define ADB_ADJISOKBD 17
+#define ADB_ADJJAPKBD 18
+#define ADB_PBEXTISOKBD 20
+#define ADB_PBEXTJAPKBD 21
+#define ADB_JPKBDII 22
+#define ADB_PBEXTKBD 24
+#define ADB_DESIGNKBD 27 /* XXX Needs to be verified XXX */
+#define ADB_PBJPKBD 30
+#define ADB_PBG4KBD 195
+#define ADB_IBITISOKBD 196
+#define ADB_PBG3JPKBD 201
+
+ /* Interesting mouse handler IDs */
+#define ADBMS_100DPI 1
+#define ADBMS_200DPI 2
+#define ADBMS_MSA3 3 /* Mouse Systems A3 Mouse */
+#define ADBMS_EXTENDED 4 /* Extended mouse protocol */
+#define ADBMS_USPEED 0x2f /* MicroSpeed mouse */
+#define ADBMS_UCONTOUR 0x66 /* Contour mouse */
+#define ADBMS_TURBO 50 /* Kensington Turbo Mouse */
+
+ /* Interesting tablet handler ID */
+#define ADB_ARTPAD 58 /* WACOM ArtPad II tablet */
+
+ /* Interesting miscellaneous handler ID */
+#define ADB_POWERKEY 34 /* Sophisticated Circuits PowerKey */
+ /* (intelligent power tap) */
+
+ /* Get device info from ADB system */
+typedef struct adb_devinfo_s{
+ adb_dev_t dev[ADB_MAX_DEVS];
+ /* [addr].addr == -1 if none */
+} adb_devinfo_t;
+#define ADBIOCDEVSINFO _IOR('A', 128, adb_devinfo_t)
+
+
+ /* Event auto-repeat */
+typedef struct adb_rptinfo_s{
+ int delay_ticks; /* ticks before repeat */
+ int interval_ticks; /* ticks between repeats */
+} adb_rptinfo_t;
+#define ADBIOCGETREPEAT _IOR('A', 130, adb_rptinfo_t)
+#define ADBIOCSETREPEAT _IOW('A', 131, adb_rptinfo_t)
+
+
+ /* Reset and reinitialize */
+#define ADBIOCRESET _IO('A', 132)
+
+
+typedef struct adb_listencmd_s{
+ int address; /* device address */
+ int reg; /* register to which to send bytes */
+ int bytecnt; /* number of bytes */
+ u_char bytes[8]; /* bytes */
+} adb_listencmd_t;
+#define ADBIOCLISTENCMD _IOW('A', 133, adb_listencmd_t)
+
+void adb_init __P((void));
+
+#ifdef _KERNEL
+int adb_poweroff __P((void));
+void adb_restart __P((void));
+int CountADBs __P((void));
+void ADBReInit __P((void));
+int adb_read_date_time __P((unsigned long *));
+#endif
+
+#endif /* _ADBSYS_MACHINE_ */
diff --git a/sys/arch/macppc/include/ansi.h b/sys/arch/macppc/include/ansi.h
new file mode 100644
index 00000000000..a72d06c30f1
--- /dev/null
+++ b/sys/arch/macppc/include/ansi.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: ansi.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/ansi.h>
diff --git a/sys/arch/macppc/include/asm.h b/sys/arch/macppc/include/asm.h
new file mode 100644
index 00000000000..a2c91a90c0d
--- /dev/null
+++ b/sys/arch/macppc/include/asm.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: asm.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/asm.h>
diff --git a/sys/arch/macppc/include/autoconf.h b/sys/arch/macppc/include/autoconf.h
new file mode 100644
index 00000000000..76c44721873
--- /dev/null
+++ b/sys/arch/macppc/include/autoconf.h
@@ -0,0 +1,114 @@
+/* $OpenBSD: autoconf.h,v 1.1 2001/09/01 15:49:06 drahn 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?) */
+
+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));
+void calc_delayconst(void);
+void ofrootfound(void);
+
+typedef int mac_intr_handle_t;
+typedef void *(intr_establish_t) __P((void *, mac_intr_handle_t,
+ int, int, int (*func)(void *), void *, char *));
+typedef void (intr_disestablish_t) __P((void *, void *));
+
+intr_establish_t mac_intr_establish;
+intr_disestablish_t mac_intr_disestablish;
+extern intr_establish_t *intr_establish_func;
+extern intr_disestablish_t *intr_disestablish_func;
+
+#endif /* _MACHINE_AUTOCONF_H_ */
diff --git a/sys/arch/macppc/include/bat.h b/sys/arch/macppc/include/bat.h
new file mode 100644
index 00000000000..fad8efe22b8
--- /dev/null
+++ b/sys/arch/macppc/include/bat.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: bat.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/bat.h>
diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h
new file mode 100644
index 00000000000..eb4904a0ad5
--- /dev/null
+++ b/sys/arch/macppc/include/bus.h
@@ -0,0 +1,531 @@
+/* $OpenBSD: bus.h,v 1.1 2001/09/01 15:49:06 drahn 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 <machine/pio.h>
+
+#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_long bus_addr_t;
+typedef u_int32_t bus_size_t;
+typedef u_int32_t bus_space_handle_t;
+typedef struct ppc_bus_space *bus_space_tag_t;
+
+struct ppc_bus_space {
+ u_int32_t bus_base;
+ u_int32_t bus_size;
+ u_int8_t bus_reverse; /* Reverse bytes */
+};
+#define POWERPC_BUS_TAG_BASE(x) ((x)->bus_base)
+
+extern struct ppc_bus_space ppc_isa_io, ppc_isa_mem;
+
+/*
+ * Access methods for bus resources
+ */
+int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr,
+ bus_size_t size, int cacheable, bus_space_handle_t *bshp));
+void bus_space_unmap __P((bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t size));
+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));
+int bus_space_alloc __P((bus_space_tag_t tag, bus_addr_t rstart,
+ bus_addr_t rend, bus_size_t size, bus_size_t alignment,
+ bus_size_t boundary, int cacheable, bus_addr_t *addrp,
+ bus_space_handle_t *handlep));
+void bus_space_free __P((bus_space_tag_t tag, bus_space_handle_t handle,
+ bus_size_t 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_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_read_multi(n, m) \
+static __inline void \
+CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
+ bus_size_t ba, CAT3(u_int,m,_t) *buf, bus_size_t cnt) \
+{ \
+ while (cnt--) \
+ *buf++ = CAT(bus_space_read_,n)(bst, bsh, ba); \
+}
+
+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 !!!
+
+
+#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!!
+
+#define bus_space_write_multi(n, m) \
+static __inline void \
+CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
+ bus_size_t ba, const CAT3(u_int,m,_t) *buf, bus_size_t cnt) \
+{ \
+ while (cnt--) \
+ CAT(bus_space_write_,n)(bst, bsh, ba, *buf++); \
+}
+
+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_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.
+ */
+#define __BA(t, h, o) ((void *)((h) + (o)))
+
+static __inline void
+bus_space_read_region_1(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 = __BA(tag, bsh, offset);
+
+ while (count--)
+ *addr++ = *s++;
+ __asm __volatile("eieio; sync");
+}
+
+static __inline void
+bus_space_read_region_2(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 = __BA(tag, 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(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 = __BA(tag, bsh, offset);
+
+ while (count--)
+ __asm __volatile("lwbrx %0, 0, %1" :
+ "=r"(*addr++) : "r"(s++));
+ __asm __volatile("eieio; sync");
+}
+
+#if 0 /* Cause a link error for bus_space_read_region_8 */
+#define bus_space_read_region_8 !!! unimplemented !!!
+#endif
+
+
+/*
+ * 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(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 = __BA(tag, bsh, offset);
+
+ while (count--)
+ *d++ = *addr++;
+ __asm __volatile("eieio; sync");
+}
+
+static __inline void
+bus_space_write_region_2(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 = __BA(tag, 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(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 = __BA(tag, bsh, offset);
+
+ while (count--)
+ __asm __volatile("stwbrx %0, 0, %1" ::
+ "r"(*addr++), "r"(d++));
+ __asm __volatile("eieio; sync");
+}
+
+#if 0
+#define bus_space_write_region_8 !!! bus_space_write_region_8 unimplemented !!!
+#endif
+
+/*
+ * 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 = __BA(tag, 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 = __BA(tag, 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 = __BA(tag, 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 !!!
+
+/* These are OpenBSD extensions to the general NetBSD bus interface. */
+void
+bus_space_read_raw_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, u_int8_t *dst, bus_size_t size);
+void
+bus_space_read_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, u_int8_t *dst, bus_size_t size);
+void
+bus_space_read_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, u_int8_t *dst, bus_size_t size);
+#define bus_space_read_raw_multi_8 \
+ !!! bus_space_read_raw_multi_8 not implemented !!!
+
+void
+bus_space_write_raw_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, const u_int8_t *src, bus_size_t size);
+void
+bus_space_write_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, const u_int8_t *src, bus_size_t size);
+void
+bus_space_write_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
+ bus_addr_t ba, const u_int8_t *src, bus_size_t size);
+#define bus_space_write_raw_multi_8 \
+ !!! bus_space_write_raw_multi_8 not implemented !!!
+
+void
+bus_space_set_region_1 __P((void *v, bus_space_handle_t h, bus_size_t o,
+ u_int8_t val, bus_size_t c));
+void
+bus_space_set_region_2 __P((void *v, bus_space_handle_t h, bus_size_t o,
+ u_int16_t val, bus_size_t c));
+void
+bus_space_set_region_4 __P((void *v, bus_space_handle_t h, bus_size_t o,
+ u_int32_t val, bus_size_t c));
+#define bus_space_set_region_8 \
+ !!! bus_space_write_raw_multi_8 not implemented !!!
+
+void
+bus_space_copy_1 __P((void *v, bus_space_handle_t h1, bus_space_handle_t h2,
+ bus_size_t o1, bus_size_t o2, bus_size_t c));
+void
+bus_space_copy_2 __P((void *v, bus_space_handle_t h1, bus_space_handle_t h2,
+ bus_size_t o1, bus_size_t o2, bus_size_t c));
+void
+bus_space_copy_4 __P((void *v, bus_space_handle_t h1, bus_space_handle_t h2,
+ bus_size_t o1, bus_size_t o2, bus_size_t c));
+#define bus_space_copy_8 \
+ !!! bus_space_write_raw_multi_8 not implemented !!!
+
+/*
+ * 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));
+ *
+ * Note: powerpc does not currently implement barriers, but we must
+ * provide the flags to MI code.
+ * the processor does have eieio which is effectively the barrier
+ * operator, however due to how memory is mapped this should? not
+ * be required.
+ */
+#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 */
+/* Compatibility defines */
+#define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ
+#define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE
+
+
+#define BUS_DMA_WAITOK 0x00
+#define BUS_DMA_NOWAIT 0x01
+#define BUS_DMA_ALLOCNOW 0x02
+#define BUS_DMAMEM_NOSYNC 0x04
+#define BUS_DMA_COHERENT 0x08
+#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 proc;
+struct uio;
+
+typedef enum {
+ BUS_DMASYNC_POSTREAD,
+ BUS_DMASYNC_POSTWRITE,
+ BUS_DMASYNC_PREREAD,
+ BUS_DMASYNC_PREWRITE
+} bus_dmasync_op_t;
+
+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 {
+ void *_cookie; /* cookie used in the guts */
+
+ /*
+ * 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)->_cookie, (s), (a), (b), (sg), (n), (r), (f))
+#define bus_dmamem_free(t, sg, n) \
+ (*(t)->_dmamem_free)((t)->_cookie, (sg), (n))
+#define bus_dmamem_map(t, sg, n, s, k, f) \
+ (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f))
+#define bus_dmamem_unmap(t, k, s) \
+ (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s))
+#define bus_dmamem_mmap(t, sg, n, o, p, f) \
+ (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f))
+
+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));
+
+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));
+
+/*
+ * bus_dmamap_t
+ *
+ * Describes a DMA mapping.
+ */
+struct powerpc_bus_dmamap {
+ /*
+ * PRIVATE MEMBERS: not for use by 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 */
+ int _dm_flags; /* misc. flags */
+
+ void *_dm_cookie; /* cookie for bus-specific functions */
+
+ /*
+ * PUBLIC MEMBERS: these are used by machine-independent code.
+ */
+ int dm_nsegs; /* # valid segments in mapping */
+ bus_dma_segment_t dm_segs[1]; /* segments; variable length */
+};
+
+#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/macppc/include/cdefs.h b/sys/arch/macppc/include/cdefs.h
new file mode 100644
index 00000000000..894bf65d451
--- /dev/null
+++ b/sys/arch/macppc/include/cdefs.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: cdefs.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/cdefs.h>
diff --git a/sys/arch/macppc/include/conf.h b/sys/arch/macppc/include/conf.h
new file mode 100644
index 00000000000..d262a59c7c3
--- /dev/null
+++ b/sys/arch/macppc/include/conf.h
@@ -0,0 +1,39 @@
+/* $OpenBSD: conf.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
+
+/*
+ * Copyright (c) 1996 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas.
+ * 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.
+ */
+
+#include <sys/conf.h>
+
+#define mmread mmrw
+#define mmwrite mmrw
+cdev_decl(mm);
+
+cdev_decl(apm);
diff --git a/sys/arch/macppc/include/cpu.h b/sys/arch/macppc/include/cpu.h
new file mode 100644
index 00000000000..bc2918a4d48
--- /dev/null
+++ b/sys/arch/macppc/include/cpu.h
@@ -0,0 +1,63 @@
+/* $OpenBSD: cpu.h,v 1.1 2001/09/01 15:49:06 drahn 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 <powerpc/cpu.h>
+
+void child_return __P((struct proc *));
+
+#define CACHELINESIZE 32 /* For now XXX */
+
+static __inline void
+syncicache(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");
+}
+
+#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/macppc/include/db_machdep.h b/sys/arch/macppc/include/db_machdep.h
new file mode 100644
index 00000000000..a02ccbc1d4d
--- /dev/null
+++ b/sys/arch/macppc/include/db_machdep.h
@@ -0,0 +1,103 @@
+/* $OpenBSD: db_machdep.h,v 1.1 2001/09/01 15:49:06 drahn 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 <sys/types.h>
+#include <vm/vm_param.h>
+#include <machine/trap.h>
+
+/*
+ * We use Elf64 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 {
+ struct trapframe tf;
+};
+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)->tf.srr0)
+
+#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)->tf.srr0 -= 4)
+
+#define SR_SINGLESTEP 0x8000
+#define db_clear_single_step(regs) ((regs)->tf.srr1 &= ~SR_SINGLESTEP)
+#define db_set_single_step(regs) ((regs)->tf.srr1 |= 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 *));
+void db_save_regs(struct trapframe *frame);
+void ddb_trap __P((void));
+db_expr_t db_dumpframe __P((u_int32_t pframe));
+
+#endif /* _KERNEL */
+
+#endif /* _PPC_DB_MACHDEP_H_ */
diff --git a/sys/arch/macppc/include/disklabel.h b/sys/arch/macppc/include/disklabel.h
new file mode 100644
index 00000000000..b3e13648d3f
--- /dev/null
+++ b/sys/arch/macppc/include/disklabel.h
@@ -0,0 +1,166 @@
+/* $OpenBSD: disklabel.h,v 1.1 2001/09/01 15:49:06 drahn 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>
+
+/* 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_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;
+}
+
+/* HFS/DPME */
+
+/* partition map structure from Inside Macintosh: Devices, SCSI Manager
+ * pp. 13-14. The partition map always begins on physical block 1.
+ *
+ * With the exception of block 0, all blocks on the disk must belong to
+ * exactly one partition. The partition map itself belongs to a partition
+ * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
+ * other than available disk space. The partition map is not necessarily
+ * the first partition listed.
+ */
+struct part_map_entry {
+#define PART_ENTRY_MAGIC 0x504d
+ u_int16_t pmSig; /* partition signature */
+ u_int16_t pmSigPad; /* (reserved) */
+ u_int32_t pmMapBlkCnt; /* number of blocks in partition map */
+ u_int32_t pmPyPartStart; /* first physical block of partition */
+ u_int32_t pmPartBlkCnt; /* number of blocks in partition */
+ char pmPartName[32]; /* partition name */
+ char pmPartType[32]; /* partition type */
+ u_int32_t pmLgDataStart; /* first logical block of data area */
+ u_int32_t pmDataCnt; /* number of blocks in data area */
+ u_int32_t pmPartStatus; /* partition status information */
+ u_int32_t pmLgBootStart; /* first logical block of boot code */
+ u_int32_t pmBootSize; /* size of boot code, in bytes */
+ u_int32_t pmBootLoad; /* boot code load address */
+ u_int32_t pmBootLoad2; /* (reserved) */
+ u_int32_t pmBootEntry; /* boot code entry point */
+ u_int32_t pmBootEntry2; /* (reserved) */
+ u_int32_t pmBootCksum; /* boot code checksum */
+ char pmProcessor[16]; /* processor type (e.g. "68020") */
+ u_int8_t pmBootArgs[128]; /* A/UX boot arguments */
+ /* we do not index the disk image as an array,
+ * leave out the on disk padding
+ */
+#if 0
+ u_int8_t pad[248]; /* pad to end of block */
+#endif
+};
+
+#define PART_TYPE_DRIVER "APPLE_DRIVER"
+#define PART_TYPE_DRIVER43 "APPLE_DRIVER43"
+#define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA"
+#define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT"
+#define PART_TYPE_FWDRIVER "APPLE_FWDRIVER"
+#define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS"
+#define PART_TYPE_FREE "APPLE_FREE"
+#define PART_TYPE_MAC "APPLE_HFS"
+#define PART_TYPE_OPENBSD "OPENBSD"
+
+
+struct cpu_disklabel {
+ struct dos_partition dosparts[NDOSPART];
+ /* only store first entry and openbsd partition */
+ struct part_map_entry macparts[2];
+ struct dkbad bad;
+};
+
+#define DKBAD(x) ((x)->bad)
+
+#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/macppc/include/dlfcn.h b/sys/arch/macppc/include/dlfcn.h
new file mode 100644
index 00000000000..8c6e04499a7
--- /dev/null
+++ b/sys/arch/macppc/include/dlfcn.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: dlfcn.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/dlfcn.h>
diff --git a/sys/arch/macppc/include/elf_abi.h b/sys/arch/macppc/include/elf_abi.h
new file mode 100644
index 00000000000..285d92f192d
--- /dev/null
+++ b/sys/arch/macppc/include/elf_abi.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: elf_abi.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/elf_abi.h>
diff --git a/sys/arch/macppc/include/endian.h b/sys/arch/macppc/include/endian.h
new file mode 100644
index 00000000000..07bb123f31d
--- /dev/null
+++ b/sys/arch/macppc/include/endian.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: endian.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/endian.h>
diff --git a/sys/arch/macppc/include/exec.h b/sys/arch/macppc/include/exec.h
new file mode 100644
index 00000000000..a3aea3d5eda
--- /dev/null
+++ b/sys/arch/macppc/include/exec.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: exec.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/exec.h>
diff --git a/sys/arch/macppc/include/float.h b/sys/arch/macppc/include/float.h
new file mode 100644
index 00000000000..fd859b43d83
--- /dev/null
+++ b/sys/arch/macppc/include/float.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: float.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/float.h>
diff --git a/sys/arch/macppc/include/fpu.h b/sys/arch/macppc/include/fpu.h
new file mode 100644
index 00000000000..24b13de9abb
--- /dev/null
+++ b/sys/arch/macppc/include/fpu.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: fpu.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/fpu.h>
diff --git a/sys/arch/macppc/include/frame.h b/sys/arch/macppc/include/frame.h
new file mode 100644
index 00000000000..4029b0913c3
--- /dev/null
+++ b/sys/arch/macppc/include/frame.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: frame.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/frame.h>
diff --git a/sys/arch/macppc/include/ieee.h b/sys/arch/macppc/include/ieee.h
new file mode 100644
index 00000000000..53ba80f7a94
--- /dev/null
+++ b/sys/arch/macppc/include/ieee.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: ieee.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/ieee.h>
diff --git a/sys/arch/macppc/include/ieeefp.h b/sys/arch/macppc/include/ieeefp.h
new file mode 100644
index 00000000000..b21eda1bb04
--- /dev/null
+++ b/sys/arch/macppc/include/ieeefp.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: ieeefp.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/ieeefp.h>
diff --git a/sys/arch/macppc/include/intr.h b/sys/arch/macppc/include/intr.h
new file mode 100644
index 00000000000..b90e8aa7f79
--- /dev/null
+++ b/sys/arch/macppc/include/intr.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: intr.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/intr.h>
diff --git a/sys/arch/macppc/include/ipkdb.h b/sys/arch/macppc/include/ipkdb.h
new file mode 100644
index 00000000000..db0ddf831df
--- /dev/null
+++ b/sys/arch/macppc/include/ipkdb.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: ipkdb.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/ipkdb.h>
diff --git a/sys/arch/macppc/include/kbio.h b/sys/arch/macppc/include/kbio.h
new file mode 100644
index 00000000000..754bd3e960d
--- /dev/null
+++ b/sys/arch/macppc/include/kbio.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: kbio.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/kbio.h>
diff --git a/sys/arch/macppc/include/kcore.h b/sys/arch/macppc/include/kcore.h
new file mode 100644
index 00000000000..0ae90babbc2
--- /dev/null
+++ b/sys/arch/macppc/include/kcore.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: kcore.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/kcore.h>
diff --git a/sys/arch/macppc/include/limits.h b/sys/arch/macppc/include/limits.h
new file mode 100644
index 00000000000..2b76ef417cd
--- /dev/null
+++ b/sys/arch/macppc/include/limits.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: limits.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/limits.h>
diff --git a/sys/arch/macppc/include/link.h b/sys/arch/macppc/include/link.h
new file mode 100644
index 00000000000..d54ca2548af
--- /dev/null
+++ b/sys/arch/macppc/include/link.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: link.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/link.h>
diff --git a/sys/arch/macppc/include/loadfile_machdep.h b/sys/arch/macppc/include/loadfile_machdep.h
new file mode 100644
index 00000000000..43225874849
--- /dev/null
+++ b/sys/arch/macppc/include/loadfile_machdep.h
@@ -0,0 +1,57 @@
+/* $OpenBSD: loadfile_machdep.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.1 1999/04/29 03:17:12 tsubai Exp $ */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+
+#define BOOT_ELF
+#define ELFSIZE 32
+
+#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)
+#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
+
+#define LOADADDR(a) (((u_long)(a)) + offset)
+#define ALIGNENTRY(a) ((u_long)(a))
+#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
+#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
+#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
+#define WARN(a) (void)(printf a, \
+ printf((errno ? ": %s\n" : "\n"), \
+ strerror(errno)))
+#define PROGRESS(a) (void) printf a
+#define ALLOC(a) alloc(a)
+#define FREE(a, b) free(a, b)
+#define OKMAGIC(a) ((a) == OMAGIC)
diff --git a/sys/arch/macppc/include/param.h b/sys/arch/macppc/include/param.h
new file mode 100644
index 00000000000..a046ab6f7f1
--- /dev/null
+++ b/sys/arch/macppc/include/param.h
@@ -0,0 +1,59 @@
+/* $OpenBSD: param.h,v 1.1 2001/09/01 15:49:06 drahn 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
+
+#include <powerpc/param.h>
+
+/*
+ * Machine dependent constants for macppc (32-bit only currently)
+ */
+#define MACHINE "macppc"
+#define _MACHINE macppc
+
+#define KERNBASE 0x100000
+
+#define MSGBUFSIZE (NBPG*2)
+
+/*
+ * Size of kernel malloc arena in logical pages.
+ */
+#ifndef NKMEMCLUSTERS
+#define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE)
+#endif
+
diff --git a/sys/arch/macppc/include/pcb.h b/sys/arch/macppc/include/pcb.h
new file mode 100644
index 00000000000..19082e03bfc
--- /dev/null
+++ b/sys/arch/macppc/include/pcb.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: pcb.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/pcb.h>
diff --git a/sys/arch/macppc/include/pio.h b/sys/arch/macppc/include/pio.h
new file mode 100644
index 00000000000..bdc8c3df3c4
--- /dev/null
+++ b/sys/arch/macppc/include/pio.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: pio.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/pio.h>
diff --git a/sys/arch/macppc/include/pmap.h b/sys/arch/macppc/include/pmap.h
new file mode 100644
index 00000000000..ef0a613595a
--- /dev/null
+++ b/sys/arch/macppc/include/pmap.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: pmap.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/pmap.h>
diff --git a/sys/arch/macppc/include/powerpc.h b/sys/arch/macppc/include/powerpc.h
new file mode 100644
index 00000000000..937dab7c7f3
--- /dev/null
+++ b/sys/arch/macppc/include/powerpc.h
@@ -0,0 +1,86 @@
+/* $OpenBSD: powerpc.h,v 1.1 2001/09/01 15:49:06 drahn 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));
+
+/* 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.
+ */
+
+typedef void (mem_regions_f)__P((struct mem_region **memp,
+ struct mem_region **availp));
+
+struct firmware {
+ mem_regions_f *mem_regions;
+ exit_f *exit;
+ boot_f *boot;
+ vmon_f *vmon;
+
+#ifdef FW_HAS_PUTC
+ boot_f *putc;
+#endif
+};
+extern struct firmware *fw;
+void ofwconprobe(void);
+int ppc_open_pci_bridge __P((void));
+void ppc_close_pci_bridge __P((int));
+void install_extint __P((void (*handler) (void)));
+void ppc_intr_enable __P((int enable));
+int ppc_intr_disable __P((void));
+
+#endif /* _MACHINE_POWERPC_H_ */
diff --git a/sys/arch/macppc/include/proc.h b/sys/arch/macppc/include/proc.h
new file mode 100644
index 00000000000..8fc70f202cf
--- /dev/null
+++ b/sys/arch/macppc/include/proc.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: proc.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/proc.h>
diff --git a/sys/arch/macppc/include/profile.h b/sys/arch/macppc/include/profile.h
new file mode 100644
index 00000000000..09383464754
--- /dev/null
+++ b/sys/arch/macppc/include/profile.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: profile.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/profile.h>
diff --git a/sys/arch/macppc/include/psl.h b/sys/arch/macppc/include/psl.h
new file mode 100644
index 00000000000..fbf4953cd09
--- /dev/null
+++ b/sys/arch/macppc/include/psl.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: psl.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/psl.h>
diff --git a/sys/arch/macppc/include/pte.h b/sys/arch/macppc/include/pte.h
new file mode 100644
index 00000000000..44921f1fbb9
--- /dev/null
+++ b/sys/arch/macppc/include/pte.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: pte.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/pte.h>
diff --git a/sys/arch/macppc/include/ptrace.h b/sys/arch/macppc/include/ptrace.h
new file mode 100644
index 00000000000..dee26ef5ba5
--- /dev/null
+++ b/sys/arch/macppc/include/ptrace.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: ptrace.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/ptrace.h>
diff --git a/sys/arch/macppc/include/reg.h b/sys/arch/macppc/include/reg.h
new file mode 100644
index 00000000000..a1af184bfb9
--- /dev/null
+++ b/sys/arch/macppc/include/reg.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: reg.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/reg.h>
diff --git a/sys/arch/macppc/include/reloc.h b/sys/arch/macppc/include/reloc.h
new file mode 100644
index 00000000000..4a4ec299b27
--- /dev/null
+++ b/sys/arch/macppc/include/reloc.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: reloc.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/reloc.h>
diff --git a/sys/arch/macppc/include/setjmp.h b/sys/arch/macppc/include/setjmp.h
new file mode 100644
index 00000000000..181909705f4
--- /dev/null
+++ b/sys/arch/macppc/include/setjmp.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: setjmp.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/setjmp.h>
diff --git a/sys/arch/macppc/include/signal.h b/sys/arch/macppc/include/signal.h
new file mode 100644
index 00000000000..f3317493ecb
--- /dev/null
+++ b/sys/arch/macppc/include/signal.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: signal.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/signal.h>
diff --git a/sys/arch/macppc/include/spinlock.h b/sys/arch/macppc/include/spinlock.h
new file mode 100644
index 00000000000..e6756e8ebf8
--- /dev/null
+++ b/sys/arch/macppc/include/spinlock.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: spinlock.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/spinlock.h>
diff --git a/sys/arch/macppc/include/stdarg.h b/sys/arch/macppc/include/stdarg.h
new file mode 100644
index 00000000000..09c1b9eaa2f
--- /dev/null
+++ b/sys/arch/macppc/include/stdarg.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: stdarg.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/stdarg.h>
diff --git a/sys/arch/macppc/include/trap.h b/sys/arch/macppc/include/trap.h
new file mode 100644
index 00000000000..8d86b45aead
--- /dev/null
+++ b/sys/arch/macppc/include/trap.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: trap.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/trap.h>
diff --git a/sys/arch/macppc/include/types.h b/sys/arch/macppc/include/types.h
new file mode 100644
index 00000000000..cf88ff7f027
--- /dev/null
+++ b/sys/arch/macppc/include/types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: types.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/types.h>
diff --git a/sys/arch/macppc/include/va-ppc.h b/sys/arch/macppc/include/va-ppc.h
new file mode 100644
index 00000000000..33c345562a7
--- /dev/null
+++ b/sys/arch/macppc/include/va-ppc.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: va-ppc.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/va-ppc.h>
diff --git a/sys/arch/macppc/include/varargs.h b/sys/arch/macppc/include/varargs.h
new file mode 100644
index 00000000000..3264e7de1c4
--- /dev/null
+++ b/sys/arch/macppc/include/varargs.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: varargs.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/varargs.h>
diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h
new file mode 100644
index 00000000000..20a96a8ab22
--- /dev/null
+++ b/sys/arch/macppc/include/vmparam.h
@@ -0,0 +1,124 @@
+/* $OpenBSD: vmparam.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+/* $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 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/macppc/include/vuid_event.h b/sys/arch/macppc/include/vuid_event.h
new file mode 100644
index 00000000000..1ece71c00f2
--- /dev/null
+++ b/sys/arch/macppc/include/vuid_event.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: vuid_event.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/vuid_event.h>
diff --git a/sys/arch/macppc/include/wsconsio.h b/sys/arch/macppc/include/wsconsio.h
new file mode 100644
index 00000000000..818379958f1
--- /dev/null
+++ b/sys/arch/macppc/include/wsconsio.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: wsconsio.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */
+
+#include <powerpc/wsconsio.h>