Add IBM Network Station 1000 port. From John Gordon and updated by me. trunk
authormatt <matt@NetBSD.org>
Sun, 19 Oct 2003 03:33:49 +0000
branchtrunk
changeset 119082 9764a4f510e4
parent 119081 9ff9093b247e
child 119083 c4af523176dd
Add IBM Network Station 1000 port. From John Gordon and updated by me.
sys/arch/ibmnws/Makefile
sys/arch/ibmnws/compile/Makefile
sys/arch/ibmnws/conf/GENERIC
sys/arch/ibmnws/conf/files.ibmnws
sys/arch/ibmnws/conf/majors.ibmnws
sys/arch/ibmnws/conf/std.ibmnws
sys/arch/ibmnws/ibmnws/autoconf.c
sys/arch/ibmnws/ibmnws/clock.c
sys/arch/ibmnws/ibmnws/clockvar.h
sys/arch/ibmnws/ibmnws/consinit.c
sys/arch/ibmnws/ibmnws/cpu.c
sys/arch/ibmnws/ibmnws/extintr.c
sys/arch/ibmnws/ibmnws/locore.S
sys/arch/ibmnws/ibmnws/machdep.c
sys/arch/ibmnws/ibmnws/mainbus.c
sys/arch/ibmnws/include/Makefile
sys/arch/ibmnws/include/ansi.h
sys/arch/ibmnws/include/aout_machdep.h
sys/arch/ibmnws/include/asm.h
sys/arch/ibmnws/include/autoconf.h
sys/arch/ibmnws/include/bat.h
sys/arch/ibmnws/include/bswap.h
sys/arch/ibmnws/include/bus.h
sys/arch/ibmnws/include/cdefs.h
sys/arch/ibmnws/include/cpu.h
sys/arch/ibmnws/include/cpu_counter.h
sys/arch/ibmnws/include/cpufunc.h
sys/arch/ibmnws/include/darwin_machdep.h
sys/arch/ibmnws/include/db_machdep.h
sys/arch/ibmnws/include/disklabel.h
sys/arch/ibmnws/include/elf_machdep.h
sys/arch/ibmnws/include/endian.h
sys/arch/ibmnws/include/endian_machdep.h
sys/arch/ibmnws/include/float.h
sys/arch/ibmnws/include/fpu.h
sys/arch/ibmnws/include/frame.h
sys/arch/ibmnws/include/ieee.h
sys/arch/ibmnws/include/ieeefp.h
sys/arch/ibmnws/include/int_const.h
sys/arch/ibmnws/include/int_fmtio.h
sys/arch/ibmnws/include/int_limits.h
sys/arch/ibmnws/include/int_mwgwtypes.h
sys/arch/ibmnws/include/int_types.h
sys/arch/ibmnws/include/intr.h
sys/arch/ibmnws/include/ipkdb.h
sys/arch/ibmnws/include/isa_machdep.h
sys/arch/ibmnws/include/isapnp_machdep.h
sys/arch/ibmnws/include/kcore.h
sys/arch/ibmnws/include/kgdb.h
sys/arch/ibmnws/include/limits.h
sys/arch/ibmnws/include/lock.h
sys/arch/ibmnws/include/macho_machdep.h
sys/arch/ibmnws/include/math.h
sys/arch/ibmnws/include/mcontext.h
sys/arch/ibmnws/include/openpicreg.h
sys/arch/ibmnws/include/param.h
sys/arch/ibmnws/include/pcb.h
sys/arch/ibmnws/include/pci_machdep.h
sys/arch/ibmnws/include/pio.h
sys/arch/ibmnws/include/pmap.h
sys/arch/ibmnws/include/pmc.h
sys/arch/ibmnws/include/pnp.h
sys/arch/ibmnws/include/powerpc.h
sys/arch/ibmnws/include/proc.h
sys/arch/ibmnws/include/profile.h
sys/arch/ibmnws/include/psl.h
sys/arch/ibmnws/include/pte.h
sys/arch/ibmnws/include/ptrace.h
sys/arch/ibmnws/include/reg.h
sys/arch/ibmnws/include/reloc.h
sys/arch/ibmnws/include/setjmp.h
sys/arch/ibmnws/include/signal.h
sys/arch/ibmnws/include/stdarg.h
sys/arch/ibmnws/include/trap.h
sys/arch/ibmnws/include/types.h
sys/arch/ibmnws/include/varargs.h
sys/arch/ibmnws/include/vmparam.h
sys/arch/ibmnws/pci/ibmnws_pciconf_indirect.c
sys/arch/ibmnws/pci/pchb.c
sys/arch/ibmnws/pci/pci_machdep.c
sys/arch/ibmnws/pci/pcib.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/Makefile	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile,v 1.1 2003/10/19 03:33:49 matt Exp $
+
+SUBDIR=	compile include
+
+.include <bsd.subdir.mk>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/compile/Makefile	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+#	$NetBSD: Makefile,v 1.1 2003/10/19 03:33:49 matt Exp $
+
+.include <bsd.prog.mk>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/conf/GENERIC	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,253 @@
+#	$NetBSD: GENERIC,v 1.1 2003/10/19 03:33:49 matt Exp $
+#
+#
+
+include "arch/ibmnws/conf/std.ibmnws"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#makeoptions	COPTS="-Os -mmultiple"	# -Os -mmultiple to reduce size.
+
+# Console settings
+options		CONSOLE="\"com\""
+options		CONSOLE_SPEED=9600
+options		CONSOLE_ADDR=0x3f8
+
+# Enable the hooks used for initializing the ram-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT		# Force root on ram-disk
+options 	MEMORY_DISK_ROOT_SIZE=4096	# 2 Megabytes
+
+maxusers	8
+
+# Compatibility options
+#options 	COMPAT_13	# NetBSD 1.3,
+#options 	COMPAT_14	# NetBSD 1.4,
+#options 	COMPAT_43	# and 4.3BSD
+
+# File systems
+file-system 	FFS		# UFS
+#file-system	EXT2FS		# second extended file system (linux)
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+#file-system 	MSDOSFS		# MS-DOS file system
+
+# File system options
+options 	VNODE_OP_NOINLINE # Save space by not inlining vnode op calls
+#options 	FFS_EI		# FFS Endian Independant support
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+ 				# immutable) behave as system flags.
+
+#options 	USERCONF	# userconf(4) support
+#options	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+
+# Networking options
+options 	INET		# IP + ICMP + TCP + UDP
+# options 	NFS_BOOT_BOOTPARAM
+# options 	NFS_BOOT_DHCP
+
+#
+# wscons options
+#
+# builtin terminal emulations
+#options 	WSEMUL_VT100		# VT100 / VT220 emulation
+# different kernel output - see dev/wscons/wsdisplayvar.h
+#options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+# see dev/pckbc/wskbdmap_mfii.c for implemented layouts
+#options 	PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
+# allocate a number of virtual screens at autoconfiguration time
+#options 	WSDISPLAY_DEFAULTSCREENS=4
+# use a large software cursor that doesn't blink
+#options 	PCDISPLAY_SOFTCURSOR
+
+# Kernel root file system and dump configuration.
+config	netbsd	root on ? type ?
+
+
+#
+# Device configuration
+#
+
+mainbus0 at root
+cpu0	at mainbus0
+
+
+# Basic Bus Support
+
+# PCI bus support
+pci0	at mainbus0 bus ?
+pci*	at pchb? bus ?
+
+options 	PCI_NETBSD_CONFIGURE
+#options 	PCIVERBOSE
+
+# PCI bridges
+pchb*	at pci? dev ? function ?	# PCI-Host bridges
+pcib*	at pci? dev ? function ?	# PCI-ISA bridges
+
+# ISA bus support
+isa*	at pcib?			# ISA on PCI-ISA bridge
+
+# PCMCIA bus support
+# pcmcia* at pcic? controller ? socket ?
+
+# ISA PCMCIA controllers
+# pcic0	at isa? port 0x3e0 iomem 0xd0000 iosiz 0x10000
+
+#options 	PCIC_ISA_INTR_ALLOC_MASK=0x4a00 # free irq 9,11,14
+#options 	PCIC_ISA_ALLOC_IOBASE=0x0400
+#options 	PCIC_ISA_ALLOC_IOSIZE=0x0100
+
+# ISA Plug-and-Play bus support
+# isapnp0 at isa?
+
+# on-board I/O for IBM Personal Power Series 830 IDE controller
+# obio0	at mainbus0
+
+
+# Console Devices
+
+# wscons
+# pckbc0		at isa?			# pc keyboard controller
+# pckbd*		at pckbc?		# PC keyboard
+# pms*		at pckbc?		# PS/2 mouse for wsmouse
+# vga*		at pci?
+# wsdisplay*	at vga? console ?
+# wskbd*		at pckbd? console ?
+# wsmouse*	at pms? mux 0
+
+# pcppi0	at isa?				# PC prog. periph. interface
+# isabeep0 at pcppi?			# "keyboard" beep
+
+# mcclock0 at isa? port 0x70		# mc146818 and compatible
+
+
+# Serial Devices
+
+# ISA serial interfaces
+com0	at isa? port 0x3f8 irq 4	# standard PC serial ports
+com1	at isa? port 0x2f8 irq 3
+
+# Parallel Printer Interfaces
+
+# ISA parallel printer interfaces
+# lpt0	at isa? port 0x3bc irq 7	# standard PC parallel ports
+
+
+# SCSI Controllers and Devices
+
+# PCI SCSI controllers
+# adw*	at pci? dev ? function ?	# AdvanSys 9x0UW[D], 3940U[2,3]W SCSI
+# ahc*	at pci? dev ? function ?	# Adaptec [23]94x, aic78x0 SCSI
+# iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
+# pcscp*	at pci? dev ? function ?	# AMD 53c974 PCscsi-PCI SCSI
+# siop*	at pci? dev ? function ?	# Symbios 53c8xx SCSI
+
+# PCMCIA SCSI controllers
+# aic*	at pcmcia? function ?		# Adaptec APA-1460 SCSI
+
+# SCSI bus support
+# scsibus* at adw?
+# scsibus* at ahc?
+# scsibus* at aic?
+# scsibus* at iha?
+# scsibus* at pcscp?
+# scsibus* at siop?
+
+# SCSI devices
+# sd*	at scsibus? target ? lun ?	# SCSI disk drives
+# st*	at scsibus? target ? lun ?	# SCSI tape drives
+# cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
+
+
+# IDE and related devices
+
+# IBM Personal Power Series 830 IDE controller
+# wdc0	at obio? port 0x1f0 irq 13
+# wdc1	at obio? port 0x170 irq 13
+
+# ISA Plug-and-Play IDE controllers
+# wdc*	at isapnp?
+
+# PCMCIA IDE controllers
+# wdc*	at pcmcia? function ?
+
+# IDE drives
+# Flags are used only with controllers that support DMA operations
+# and mode settings (e.g. some pciide controllers)
+# The lowest order four bits (rightmost digit) of the flags define the PIO
+# mode to use, the next set of four bits the DMA mode and the third set the
+# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
+# to use, and the last bit must be 1 for this setting to be used.
+# For DMA and UDMA, 0xf (1111) means 'disable'.
+# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
+# (0xc=1100, 0xa=1010, 0xf=1111)
+# 0x0000 means "use whatever the drive claims to support".
+# wd*	at wdc? channel ? drive ? flags 0x0000
+
+# ATAPI bus support
+# atapibus* at wdc? channel ?
+
+# ATAPI devices
+# flags have the same meaning as for IDE drives.
+# cd*	at atapibus? drive ? flags 0x0000	# ATAPI CD-ROM drives
+# sd*	at atapibus? drive ? flags 0x0000	# ATAPI disk drives
+
+# Miscellaneous mass storage devices
+
+# ISA floppy
+# fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
+# fd*	at fdc? drive ?
+
+# Network Interfaces
+
+# PCI network interfaces
+pcn*	at pci? dev ? function ?	# AMD PCnet-PCI Ethernet
+options 	PCN_NO_PROM		# PROM not used for ethernet addr
+
+# PCMCIA network interfaces
+# ep*	at pcmcia? function ?		# 3Com 3c589 and 3c562 Ethernet
+# ne*	at pcmcia? function ?		# NE2000-compatible Ethernet
+
+# MII/PHY support
+#acphy*  at mii? phy ?                   # DAltima AC101 and AMD Am79c874 PHYs
+#amhphy* at mii? phy ?                   # AMD 79c901 Ethernet PHYs
+#bmtphy* at mii? phy ?                   # Broadcom BCM5201 and BCM5202 PHYs
+#brgphy* at mii? phy ?                   # Broadcom BCM5400-family PHYs
+#dmphy*  at mii? phy ?                   # Davicom DM9101 PHYs
+#exphy*  at mii? phy ?                   # 3Com internal PHYs
+#gentbi* at mii? phy ?                   # Generic Ten-Bit 1000BASE-[CLS]X PHYs
+#glxtphy* at mii? phy ?                  # Level One LXT-1000 PHYs
+#gphyter* at mii? phy ?                  # NS83861 Gig-E PHY
+icsphy* at mii? phy ?                   # Integrated Circuit Systems ICS189x
+#inphy*  at mii? phy ?                   # Intel 82555 PHYs
+#iophy*  at mii? phy ?                   # Intel 82553 PHYs
+#lxtphy* at mii? phy ?                   # Level One LXT-970 PHYs
+#makphy* at mii? phy ?                   # Marvell Semiconductor 88E1000 PHYs
+#nsphy*  at mii? phy ?                   # NS83840 PHYs
+#nsphyter* at mii? phy ?                 # NS83843 PHYs
+#pnaphy* at mii? phy ?                   # generic HomePNA PHYs
+#qsphy*  at mii? phy ?                   # Quality Semiconductor QS6612 PHYs
+#sqphy*  at mii? phy ?                   # Seeq 80220/80221/80223 PHYs
+#tlphy*  at mii? phy ?                   # ThunderLAN PHYs
+#tqphy*  at mii? phy ?                   # TDK Semiconductor PHYs
+#ukphy*  at mii? phy ?                   # generic unknown PHYs
+#urlphy* at mii? phy ?                   # Realtek RTL8150L internal PHYs
+
+# Pseudo-Devices
+
+# disk/mass storage pseudo-devices
+pseudo-device	md		1	# memory disk device (ramdisk)
+
+# network pseudo-devices
+pseudo-device	bpfilter	8	# network tap
+pseudo-device	loop			# network loopback
+
+# miscellaneous pseudo-devices
+pseudo-device	pty			# pseudo-terminals
+pseudo-device	rnd			# /dev/random and in-kernel generator
+#options 	RND_COM			# use "com" randomness as well
+pseudo-device	ksyms
+pseudo-device	clockctl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/conf/files.ibmnws	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,148 @@
+#	$NetBSD: files.ibmnws,v 1.1 2003/10/19 03:33:49 matt Exp $
+#
+# ibmnws-specific configuration info
+#
+maxpartitions 8
+
+maxusers 2 8 64
+
+file	arch/ibmnws/ibmnws/autoconf.c
+file	arch/ibmnws/ibmnws/clock.c
+file	arch/ibmnws/ibmnws/consinit.c
+file	arch/ibmnws/ibmnws/extintr.c
+file	arch/ibmnws/ibmnws/machdep.c
+
+file	arch/powerpc/powerpc/bus_dma.c
+file	arch/powerpc/powerpc/bus_space.c
+file	arch/powerpc/powerpc/procfs_machdep.c	procfs
+
+# General files
+file	dev/cons.c
+file	dev/md_root.c				memory_disk_hooks
+file	kern/subr_disk_mbr.c			disk
+
+#
+# Compatibility modules
+#
+
+# OSS audio driver compatibility
+# include "compat/ossaudio/files.ossaudio"
+
+#
+# Machine-independent I2O drivers
+#
+include "dev/i2o/files.i2o"
+
+#
+# Machine-independent SCSI drivers
+#
+include "dev/scsipi/files.scsipi"
+
+#
+# Machine-independent ATA drivers
+#
+include "dev/ata/files.ata"
+
+#
+# System bus types
+#
+define	mainbus {}
+device	mainbus: pcibus, mainbus
+attach	mainbus at root
+file	arch/ibmnws/ibmnws/mainbus.c		mainbus
+
+device	cpu
+attach	cpu at mainbus
+file	arch/ibmnws/ibmnws/cpu.c		cpu
+
+include "dev/wscons/files.wscons"
+include "dev/wsfont/files.wsfont"
+include "dev/rasops/files.rasops"
+
+#
+# PCI-only drivers
+# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches
+# XXX devices to 'pci'.
+#
+include "dev/pci/files.pci"
+file	arch/ibmnws/pci/pci_machdep.c		pci
+# file	arch/ibmnws/pci/ibmnws_pciconf_direct.c	pci
+file	arch/ibmnws/pci/ibmnws_pciconf_indirect.c	pci
+
+# PCI-Host bridge chipsets
+device	pchb: pcibus
+attach	pchb at pci
+file	arch/ibmnws/pci/pchb.c			pchb
+
+# PCI-ISA bridges
+device	pcib: isabus
+attach	pcib at pci
+file	arch/ibmnws/pci/pcib.c			pcib
+
+#
+# ISA and mixed ISA+PCI drivers
+#
+
+include "dev/isa/files.isa"
+file	arch/prep/isa/isa_machdep.c		isa
+file	arch/powerpc/isa/isadma_machdep.c	isadma
+
+# ISA Plug 'n Play devices
+file	arch/prep/isa/isapnp_machdep.c		isapnp
+
+#
+# clock
+#
+# No RTC on the IBM NetStations
+
+# attribute used to represent the "keyboard controller"
+# XXX should be a real device
+define pckbcport { [irq = -1], [port = -1] }
+
+# PC console support a la "pccons"
+device	pc: tty, pckbcport
+attach	pc at isa
+device	pcconskbd
+attach	pcconskbd at pckbc
+file	arch/prep/isa/pccons.c			pc | pcconskbd needs-flag
+
+include "dev/pckbc/files.pckbc"
+
+# ISA speaker generates keyboard beep
+device	isabeep
+attach	isabeep at pcppi
+file	arch/prep/isa/isabeep.c
+
+# Floppy disk controller
+device  fdc { drive = -1 }: isadma
+file    dev/isa/fd.c                    fdc needs-flag
+
+attach  fdc at isa with fdc_isa
+file    dev/isa/fdc_isa.c               fdc_isa
+# Floppy disk controller
+device  fd: disk
+attach  fd at fdc
+
+# PCMCIA drivers/support
+defparam	PCIC_ISA_ALLOC_IOBASE
+defparam	PCIC_ISA_ALLOC_IOSIZE
+defparam	PCIC_ISA_INTR_ALLOC_MASK
+
+device	pcic: pcmciabus
+file	dev/ic/i82365.c			pcic
+attach	pcic at isa with pcic_isa
+file	dev/isa/i82365_isa.c		pcic_isa
+file	dev/isa/i82365_isasubr.c	pcic_isa
+
+include "dev/pcmcia/files.pcmcia"
+
+# on-board I/O
+# define obio {[port = -1], [size = 0], [iomem = -1], [iosiz = 0], [irq = -1]}
+# device obio: obio
+# attach obio at mainbus
+# file arch/prep/dev/obio.c		obio needs-flag
+
+# attach wdc at obio with wdc_obio
+# file arch/prep/dev/wdc_obio.c		wdc_obio needs-flag
+
+include "arch/ibmnws/conf/majors.ibmnws"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/conf/majors.ibmnws	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,49 @@
+#	$NetBSD: majors.ibmnws,v 1.1 2003/10/19 03:33:49 matt Exp $
+#
+# Device majors for ibmnws
+#
+
+device-major	cons		char 0
+device-major	ctty		char 1
+device-major	mem		char 2
+
+device-major	swap		char 4   block 1
+device-major	pts		char 5			pty
+device-major	ptc		char 6			pty
+device-major	log		char 7
+device-major	com		char 8			com
+
+device-major	sd		char 13  block 4	sd
+device-major	st		char 14  block 5	st
+device-major	cd		char 15  block 6	cd
+device-major	lpt		char 16			lpt
+device-major	ch		char 17			ch
+device-major	ccd		char 18  block 16	ccd
+device-major	ss		char 19			ss
+device-major	uk		char 20			uk
+
+device-major	filedesc	char 22
+device-major	bpf		char 23			bpfilter
+device-major	md		char 24  block 17	md
+
+device-major	lkm		char 28			lkm
+
+device-major	tun		char 40			tun
+device-major	vnd		char 41  block 14	vnd
+
+device-major	svr4_net	char 43			compat_svr4
+device-major	ipl		char 44			ipfilter
+device-major	satlink		char 45			satlink
+device-major	rnd		char 46			rnd
+
+device-major	scsibus		char 50			scsibus
+device-major	raid		char 51  block 18	raid
+
+device-major	isdn		char 53			isdn
+device-major	isdnctl		char 54			isdnctl
+device-major	isdnbchan	char 55			isdnbchan
+device-major	isdntrc		char 56			isdntrc
+device-major	isdntel		char 57			isdntel
+device-major	clockctl	char 58			clockctl
+device-major	systrace	char 59			systrace
+device-major	cgd		char 60  block 19	cgd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/conf/std.ibmnws	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,15 @@
+#	$NetBSD: std.ibmnws,v 1.1 2003/10/19 03:33:49 matt Exp $
+#
+# standard, required NetBSD/ibmnws 'options'
+
+machine		ibmnws powerpc
+
+options 	EXEC_SCRIPT	# exec #! scripts
+options 	EXEC_ELF32	# exec ELF binaries
+
+options         PPC_OEA         # Support Motorola PPC60x CPUs
+makeoptions     PPCDIR="oea"    # Tell Makefile.powerpc what dir to use
+
+makeoptions     TEXTADDR=0x100000
+
+options         INTSTK=0x4000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/autoconf.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,133 @@
+/*	$NetBSD: autoconf.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)autoconf.c	7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * Setup the system to run on the current machine.
+ *
+ * Configure() is called at boot time and initializes the vba 
+ * device tables and the memory controller monitoring.  Available
+ * devices are determined (from possibilities mentioned in ioconf.c),
+ * and the drivers are initialized.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/dkstat.h>
+#include <sys/disklabel.h>
+#include <sys/conf.h>
+#include <sys/reboot.h>
+#include <sys/device.h>
+
+#include <machine/pte.h>
+#include <machine/intr.h>
+
+struct device *booted_device;
+int booted_partition;
+
+static void findroot __P((void));
+
+/*
+ * Determine i/o configuration for a machine.
+ */
+void
+cpu_configure()
+{
+	/* startrtclock(); */
+
+	if (config_rootfound("mainbus", NULL) == NULL)
+		panic("configure: mainbus not configured");
+
+	printf("biomask %x netmask %x ttymask %x\n",
+	    imask[IPL_BIO] & 0x1fffffff,
+	    imask[IPL_NET] & 0x1fffffff,
+	    imask[IPL_TTY] & 0x1fffffff);
+
+	spl0();
+}
+
+void
+cpu_rootconf()
+{
+	findroot();
+
+	printf("boot device: %s\n",
+	    booted_device ? booted_device->dv_xname : "<unknown>");
+
+	setroot(booted_device, booted_partition);
+}
+
+u_long	bootdev = 0;		/* should be dev_t, but not until 32 bits */
+
+/*
+ * Attempt to find the device from which we were booted.
+ * If we can do so, and not instructed not to do so,
+ * change rootdev to correspond to the load device.
+ */
+void
+findroot(void)
+{
+	int unit, part;
+	struct device *dv;
+	char buf[32];
+	const char *name;
+
+#if 0
+	printf("howto %x bootdev %x ", boothowto, bootdev);
+#endif
+
+	if ((bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
+		return;
+
+	name = devsw_blk2name((bootdev >> B_TYPESHIFT) & B_TYPEMASK);
+	if (name == NULL)
+		return;
+
+	part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
+	unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
+
+	sprintf(buf, "%s%d", name, unit);
+	for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+		if (strcmp(buf, dv->dv_xname) == 0) {
+			booted_device = dv;
+			booted_partition = part;
+			return;
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/clock.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,359 @@
+/*	$NetBSD: clock.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+/*      $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo 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.
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <dev/clock_subr.h>
+
+#include <ibmnws/ibmnws/clockvar.h>
+
+#define	MINYEAR	1990
+
+void decr_intr __P((struct clockframe *));
+
+/*
+ * Initially we assume a processor with a bus frequency of 12.5 MHz.
+ */
+u_long ticks_per_sec;
+u_long ns_per_tick;
+static long ticks_per_intr;
+static volatile u_long lasttb;
+
+struct device *clockdev;
+const struct clockfns *clockfns;
+int clockinitted;
+
+static void ns1000_clock_init __P((struct device *));
+static void ns1000_clock_get __P((struct device *, time_t, struct clocktime *));
+static void ns1000_clock_set __P((struct device *, struct clocktime *));
+
+const struct clockfns ns1000_clockfns = {
+	ns1000_clock_init,
+	ns1000_clock_get,
+	ns1000_clock_set
+};
+
+void
+ns1000_clock_init (dev)
+        struct device *dev;
+{
+}
+
+void
+ns1000_clock_get(dev, base, ct)
+        struct device *dev;
+        time_t base;
+        struct clocktime *ct;
+{
+        ct->sec		= 0;
+        ct->min		= 0;
+        ct->hour	= 0;
+        ct->dow  	= 0;
+        ct->day  	= 0;
+        ct->mon  	= 0;
+        ct->year  	= 0;
+}
+
+void
+ns1000_clock_set(dev, ct)
+        struct device *dev;
+        struct clocktime *ct;
+{
+}
+
+void
+clockattach(dev, fns)
+        struct device *dev;
+        const struct clockfns *fns;
+{
+
+	printf("\n");
+
+	if (clockfns != NULL)
+		panic("clockattach: multiple clocks");
+
+	clockdev = dev;
+	clockfns = fns;
+}
+
+/*
+ * Start the real-time and statistics clocks. Leave stathz 0 since there
+ * are no other timers available.
+ */
+void
+cpu_initclocks()
+{
+
+	ticks_per_intr = ticks_per_sec / hz;
+	asm volatile ("mftb %0" : "=r"(lasttb));
+	asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
+
+	/*
+	 * The NS 1000 has no RTC hardware, so fake the clock functions
+	 * to prevent odd failures...
+	 */
+
+	clockattach (NULL, &ns1000_clockfns);
+}
+
+/*
+ * Initialize the time of day register, based on the time base which is, e.g.
+ * from a filesystem.
+ */
+void
+inittodr(base)
+	time_t base;
+{
+	struct clocktime ct;
+	int year;
+	struct clock_ymdhms dt;
+	time_t deltat;
+	int badbase = 0;
+
+	if (base < (MINYEAR - 1970) * SECYR) {
+		printf("WARNING: preposterous time in file system");
+		/* read the system clock anyway */
+		base = (MINYEAR - 1970) * SECYR + 186 * SECDAY + SECDAY / 2;
+		badbase = 1;
+	}
+
+	(*clockfns->cf_get)(clockdev, base, &ct);
+#ifdef DEBUG
+	printf("readclock: %d/%d/%d/%d/%d/%d\n", ct.year, ct.mon, ct.day,
+	    ct.hour, ct.min, ct.sec);
+#endif
+	clockinitted = 1;
+
+	year = 1900 + ct.year;
+	if (year < 1970)
+		year += 100;
+
+	/* simple sanity checks (2037 = time_t overflow) */
+	if (year < MINYEAR || year > 2037 ||
+	    ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
+	    ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) {
+		/*
+		 * Believe the time in the file system for lack of
+		 * anything better, resetting the TODR.
+		 */
+		time.tv_sec = base;
+		if (!badbase) {
+			printf("WARNING: preposterous clock chip time\n");
+			resettodr();
+		}
+		goto bad;
+	}
+
+	dt.dt_year = year;
+	dt.dt_mon = ct.mon;
+	dt.dt_day = ct.day;
+	dt.dt_hour = ct.hour;
+	dt.dt_min = ct.min;
+	dt.dt_sec = ct.sec;
+	time.tv_sec = clock_ymdhms_to_secs(&dt);
+#ifdef DEBUG
+	printf("=>%ld (%d)\n", (long int)time.tv_sec, (int)base);
+#endif
+
+	if (!badbase) {
+		/*
+		 * See if we gained/lost two or more days;
+		 * if so, assume something is amiss.
+		 */
+		deltat = time.tv_sec - base;
+		if (deltat < 0)
+			deltat = -deltat;
+		if (deltat < 2 * SECDAY)
+			return;
+		printf("WARNING: clock %s %ld days",
+		    time.tv_sec < base ? "lost" : "gained",
+		    (long)deltat / SECDAY);
+	}
+bad:
+	printf(" -- CHECK AND RESET THE DATE!\n");
+}
+
+/*
+ * Reset the TODR based on the time value; used when the TODR
+ * has a preposterous value and also when the time is reset
+ * by the stime system call.  Also called when the TODR goes past
+ * TODRZERO + 100*(SECYEAR+2*SECDAY) (e.g. on Jan 2 just after midnight)
+ * to wrap the TODR around.
+ */
+void
+resettodr()
+{
+	struct clock_ymdhms dt;
+	struct clocktime ct;
+
+	if (!clockinitted)
+		return;
+
+	clock_secs_to_ymdhms(time.tv_sec, &dt);
+
+	/* rt clock wants 2 digits */
+	ct.year = dt.dt_year % 100;
+	ct.mon = dt.dt_mon;
+	ct.day = dt.dt_day;
+	ct.hour = dt.dt_hour;
+	ct.min = dt.dt_min;
+	ct.sec = dt.dt_sec;
+	ct.dow = dt.dt_wday;
+#ifdef DEBUG
+	printf("setclock: %d/%d/%d/%d/%d/%d\n", ct.year, ct.mon, ct.day,
+	    ct.hour, ct.min, ct.sec);
+#endif
+
+	(*clockfns->cf_set)(clockdev, &ct);
+}
+
+/*
+ * We assume newhz is either stathz or profhz, and that neither will
+ * change after being set up above.  Could recalculate intervals here
+ * but that would be a drag.
+ */
+void
+setstatclockrate(arg)
+	int arg;
+{
+
+	/* Nothing we can do */
+}
+
+void
+decr_intr(frame)
+	struct clockframe *frame;
+{
+	int msr;
+	int pri;
+	u_long tb;
+	long tick;
+	int nticks;
+	extern long intrcnt[];
+
+	/*
+	 * Check whether we are initialized.
+	 */
+	if (!ticks_per_intr)
+		return;
+
+	/*
+	 * Based on the actual time delay since the last decrementer reload,
+	 * we arrange for earlier interrupt next time.
+	 */
+	asm ("mftb %0; mfdec %1" : "=r"(tb), "=r"(tick));
+	for (nticks = 0; tick < 0; nticks++)
+		tick += ticks_per_intr;
+	asm volatile ("mtdec %0" :: "r"(tick));
+
+	/*
+	 * lasttb is used during microtime. Set it to the virtual
+	 * start of this tick interval.
+	 */
+	lasttb = tb + tick - ticks_per_intr;
+
+	intrcnt[CNT_CLOCK]++;
+
+	pri = splclock();
+	if (pri & SPL_CLOCK)
+		tickspending += nticks;
+	else {
+		nticks += tickspending;
+		tickspending = 0;
+
+		/*
+		 * Reenable interrupts
+		 */
+		asm volatile ("mfmsr %0; ori %0, %0, %1; mtmsr %0"
+			      : "=r"(msr) : "K"(PSL_EE));
+		
+		/*
+		 * Do standard timer interrupt stuff.
+		 * Do softclock stuff only on the last iteration.
+		 */
+		frame->pri = pri | SINT_CLOCK;
+		while (--nticks > 0)
+			hardclock(frame);
+		frame->pri = pri;
+		hardclock(frame);
+	}
+	splx(pri);
+}
+
+/*
+ * Fill in *tvp with current time with microsecond resolution.
+ */
+void
+microtime(tvp)
+	struct timeval *tvp;
+{
+	u_long tb;
+	u_long ticks;
+	int msr, scratch;
+	
+	asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
+		      : "=r"(msr), "=r"(scratch) : "K"((u_short)~PSL_EE));
+	asm ("mftb %0" : "=r"(tb));
+	ticks = (tb - lasttb) * ns_per_tick;
+	*tvp = time;
+	asm volatile ("mtmsr %0" :: "r"(msr));
+	ticks /= 1000;
+	tvp->tv_usec += ticks;
+	while (tvp->tv_usec >= 1000000) {
+		tvp->tv_usec -= 1000000;
+		tvp->tv_sec++;
+	}
+}
+
+/*
+ * Wait for about n microseconds (at least!).
+ */
+void
+delay(n)
+	unsigned int n;
+{
+	u_quad_t tb;
+	u_long tbh, tbl, scratch;
+	
+	tb = mftb();
+	tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
+	tbh = tb >> 32;
+	tbl = tb;
+	asm volatile ("1: mftbu %0; cmplw %0,%1; blt 1b; bgt 2f;"
+		      "mftb %0; cmplw %0,%2; blt 1b; 2:"
+		      : "=r"(scratch) : "r"(tbh), "r"(tbl));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/clockvar.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,62 @@
+/*	$NetBSD: clockvar.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Definitions for cpu-independent clock handling for the alpha and pmax.
+ */
+
+/*
+ * clocktime structure:
+ *
+ * structure passed to TOY clocks when setting them.  broken out this
+ * way, so that the time_t -> field conversion can be shared.
+ */
+struct clocktime {
+	int	year;			/* year - 1900 */
+	int	mon;			/* month (1 - 12) */
+	int	day;			/* day (1 - 31) */
+	int	hour;			/* hour (0 - 23) */
+	int	min;			/* minute (0 - 59) */
+	int	sec;			/* second (0 - 59) */
+	int	dow;			/* day of week (0 - 6; 0 = Sunday) */
+};
+
+/*
+ * clockfns structure:
+ *
+ * function switch used by chip-independent clock code, to access
+ * chip-dependent routines.
+ */
+struct clockfns {
+	void	(*cf_init) __P((struct device *));
+	void	(*cf_get) __P((struct device *, time_t, struct clocktime *));
+	void	(*cf_set) __P((struct device *, struct clocktime *));
+};
+
+void clockattach __P((struct device *, const struct clockfns *));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/consinit.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,115 @@
+/*	$NetBSD: consinit.c,v 1.1 2003/10/19 03:33:50 matt 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/cons.h>
+
+#include "vga.h"
+#if (NVGA > 0)
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#endif
+
+#include "pckbc.h"
+#if (NPCKBC > 0)
+#include <dev/isa/isareg.h>
+#include <dev/ic/i8042reg.h>
+#include <dev/ic/pckbcvar.h>
+#endif
+
+#include "com.h"
+#if (NCOM > 0)
+#include <sys/termios.h>
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+void comsoft(void);
+#endif
+
+/*
+ * consinit
+ * Initialize system console.
+ */
+void
+consinit(void)
+{
+	static int initted = 0;
+
+	if (initted)
+		return;
+	initted = 1;
+
+#if (NPFB > 0)
+	if (!strcmp(CONSOLE, "fb")) {
+		pfb_cnattach(CONSOLE_ADDR);
+#if (NPCKBC > 0)
+		pckbc_cnattach(&isa_io_bus_space_tag, IO_KBD, KBCMDP,
+		    PCKBC_KBD_SLOT);
+#endif
+		return;
+	}
+#endif
+
+#if (NVGA > 0)
+	if (!strcmp(CONSOLE, "vga")) {
+#if (NVGA > 0)
+		if (!vga_cnattach(&io_bus_space_tag, &mem_bus_space_tag, -1, 1))
+			goto dokbd;
+#endif
+dokbd:
+#if (NPCKBC > 0)
+		pckbc_cnattach(&isa_io_bus_space_tag, IO_KBD, KBCMDP,
+		    PCKBC_KBD_SLOT);
+#endif
+		return;
+	}
+#endif /* VGA */
+
+#if (NCOM > 0)
+ 	if (!strcmp(CONSOLE, "com")) {
+		if (comcnattach(&isa_io_bus_space_tag, CONSOLE_ADDR,
+			    CONSOLE_SPEED, COM_FREQ, COM_TYPE_NORMAL,
+			    (TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8))
+			panic("can't init serial console");
+
+		return;
+	}
+#endif
+	panic("invalid console device " CONSOLE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/cpu.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,73 @@
+/*	$NetBSD: cpu.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by NONAKA Kimihiro.
+ *
+ * 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+int cpumatch(struct device *, struct cfdata *, void *);
+void cpuattach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(cpu, sizeof(struct device),
+    cpumatch, cpuattach, NULL, NULL);
+
+extern struct cfdriver cpu_cd;
+
+int
+cpumatch(struct device *parent, struct cfdata *cfdata, void *aux)
+{
+	struct confargs *ca = aux;
+
+	if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
+		return (0);
+	if (cpu_info[0].ci_dev != NULL)
+		return (0);
+	return (1);
+}
+
+void
+cpuattach(struct device *parent, struct device *self, void *aux)
+{
+	cpu_attach_common(self, 0);
+
+	/* cpu_setup(self); */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/extintr.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,496 @@
+/*	$NetBSD: extintr.c,v 1.1 2003/10/19 03:33:50 matt Exp $ */
+
+/*-
+ * Copyright (c) 1995 Per Fogelstrom
+ * Copyright (c) 1993, 1994 Charles Hannum.
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz and Don Ahn.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)isa.c	7.2 (Berkeley) 5/12/91
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+  Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
+
+		All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appears in all
+copies and that both the copyright notice and this permission notice
+appear in supporting documentation, and that the name of Intel
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
+NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+
+#include <net/netisr.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/intr.h>
+#include <machine/psl.h>
+#include <machine/trap.h>
+
+#include <dev/isa/isavar.h>
+
+static void intr_calculatemasks(void);
+static int fakeintr(void *);
+static void ext_intr_ivr(void);
+static void install_extint(void (*)(void));
+
+int imen = 0xffffffff;
+volatile int cpl, ipending, tickspending;
+int imask[NIPL];
+int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
+struct intrhand *intrhand[ICU_LEN];
+unsigned intrcnt2[ICU_LEN];
+
+static int
+fakeintr(void *arg)
+{
+
+	return 0;
+}
+
+/*
+ *  Process an interrupt from the ISA bus.
+ *  When we get here remember we have "delayed" ipl mask
+ *  settings from the spl<foo>() calls. Yes it's faster
+ *  to do it like this because SPL's are done so frequently
+ *  and interrupts are likely to *NOT* happen most of the
+ *  times the spl level is changed.
+ */
+static void
+ext_intr(void)
+{
+	u_int8_t irq;
+	int r_imen;
+	int pcpl;
+	struct intrhand *ih;
+
+	/* what about enabling external interrupt in here? */
+	pcpl = splhigh();	/* Turn off all */
+
+	irq = isa_intr();
+	intrcnt2[irq]++;
+
+	r_imen = 1 << irq;
+
+	if ((pcpl & r_imen) != 0) {
+		ipending |= r_imen;	/* Masked! Mark this as pending */
+		imen |= r_imen;
+		isa_intr_mask(imen);
+	} else {
+		ih = intrhand[irq];
+		if (ih == NULL)
+			printf("spurious interrupt %d\n", irq);
+		while (ih) {
+			(*ih->ih_fun)(ih->ih_arg);
+			ih = ih->ih_next;
+		}
+
+		isa_intr_clr(irq);
+
+		uvmexp.intrs++;
+		intrcnt[irq]++;
+	}
+
+	splx(pcpl);	/* Process pendings. */
+}
+
+/*
+ * Same as the above, but using the board's interrupt vector register.
+ */
+static void
+ext_intr_ivr(void)
+{
+	u_int8_t irq;
+	int r_imen;
+	int pcpl;
+	struct intrhand *ih;
+
+	/* what about enabling external interrupt in here? */
+	pcpl = splhigh();	/* Turn off all */
+
+	irq = *((u_char *)prep_intr_reg + INTR_VECTOR_REG);
+	intrcnt2[irq]++;
+
+	r_imen = 1 << irq;
+
+	if ((pcpl & r_imen) != 0) {
+		ipending |= r_imen;	/* Masked! Mark this as pending */
+		imen |= r_imen;
+		isa_intr_mask(imen);
+	} else {
+		ih = intrhand[irq];
+		if (ih == NULL)
+			printf("spurious interrupt %d\n", irq);
+		while (ih) {
+			(*ih->ih_fun)(ih->ih_arg);
+			ih = ih->ih_next;
+		}
+
+		isa_intr_clr(irq);
+
+		uvmexp.intrs++;
+		intrcnt[irq]++;
+	}
+
+	splx(pcpl);	/* Process pendings. */
+}
+
+void *
+intr_establish(int irq, int type, int level, int (*ih_fun)(void *), void *ih_arg)
+{
+	struct intrhand **p, *q, *ih;
+	static struct intrhand fakehand = {fakeintr};
+
+	/* no point in sleeping unless someone can free memory. */
+	ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
+	if (ih == NULL)
+		panic("intr_establish: can't malloc handler info");
+
+	if (!LEGAL_IRQ(irq) || type == IST_NONE)
+		panic("intr_establish: bogus irq or type");
+
+	switch (intrtype[irq]) {
+	case IST_NONE:
+		intrtype[irq] = type;
+		break;
+	case IST_LEVEL:
+	case IST_EDGE:
+		if (type == intrtype[irq])
+			break;
+	case IST_PULSE:
+		if (type != IST_NONE)
+			panic("intr_establish: can't share %s with %s irq %d",
+			    isa_intr_typename(intrtype[irq]),
+			    isa_intr_typename(type), irq);
+		break;
+	}
+
+	/*
+	 * Figure out where to put the handler.
+	 * This is O(N^2), but we want to preserve the order, and N is
+	 * generally small.
+	 */
+	for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next)
+		continue;
+
+	/*
+	 * Actually install a fake handler momentarily, since we might be doing
+	 * this with interrupts enabled and don't want the real routine called
+	 * until masking is set up.
+	 */
+	fakehand.ih_level = level;
+	*p = &fakehand;
+
+	intr_calculatemasks();
+
+	/*
+	 * Poke the real handler in now.
+	 */
+	ih->ih_fun = ih_fun;
+	ih->ih_arg = ih_arg;
+	ih->ih_count = 0;
+	ih->ih_next = NULL;
+	ih->ih_level = level;
+	ih->ih_irq = irq;
+	*p = ih;
+
+	if (irq < I8259_INTR_NUM)
+		isa_setirqstat(irq, 1, type);
+
+	return (ih);
+}
+
+void
+intr_disestablish(void *arg)
+{
+	struct intrhand *ih = arg;
+	int irq = ih->ih_irq;
+	struct intrhand **p, *q;
+
+	if (!LEGAL_IRQ(irq))
+		panic("intr_disestablish: bogus irq");
+
+	/*
+	 * Remove the handler from the chain.
+	 * This is O(n^2), too.
+	 */
+	for (p = &intrhand[irq]; (q = *p) != NULL && q != ih; p = &q->ih_next)
+		continue;
+	if (q == NULL)
+		panic("intr_disestablish: handler not registered");
+
+	*p = q->ih_next;
+
+	free((void *)ih, M_DEVBUF);
+
+	intr_calculatemasks();
+
+	if (intrhand[irq] == NULL)
+		intrtype[irq] = IST_NONE;
+}
+
+/*
+ * Recalculate the interrupt masks from scratch.
+ * We could code special registry and deregistry versions of this function that
+ * would be faster, but the code would be nastier, and we don't expect this to
+ * happen very much anyway.
+ */
+static void
+intr_calculatemasks(void)
+{
+	int irq, level;
+	struct intrhand *q;
+
+	/* First, figure out which levels each IRQ uses. */
+	for (irq = 0; irq < ICU_LEN; irq++) {
+		register int levels = 0;
+		for (q = intrhand[irq]; q; q = q->ih_next)
+			levels |= 1 << q->ih_level;
+		intrlevel[irq] = levels;
+	}
+
+	/* Then figure out which IRQs use each level. */
+	for (level = 0; level < NIPL; level++) {
+		register int irqs = 0;
+		for (irq = 0; irq < ICU_LEN; irq++)
+			if (intrlevel[irq] & (1 << level))
+				irqs |= 1 << irq;
+		imask[level] = irqs;
+	}
+
+	/*
+	 * Initialize the soft interrupt masks to block themselves.
+	 */
+	imask[IPL_SOFTCLOCK] = SINT_CLOCK;
+	imask[IPL_SOFTNET] = SINT_NET;
+	imask[IPL_SOFTSERIAL] = SINT_SERIAL;
+
+	/*
+	 * IPL_NONE is used for hardware interrupts that are never blocked,
+         * and do not block anything else.
+	 */
+	imask[IPL_NONE] = 0;
+
+	/*
+	 * Enforce a hierarchy that gives slow devices a better chance at not
+	 * dropping data.
+	 */
+	imask[IPL_SOFTCLOCK] |= imask[IPL_NONE];
+	imask[IPL_SOFTNET] |= imask[IPL_SOFTCLOCK];
+	imask[IPL_BIO] |= imask[IPL_SOFTNET];
+	imask[IPL_NET] |= imask[IPL_BIO];
+	imask[IPL_SOFTSERIAL] |= imask[IPL_NET];
+	imask[IPL_TTY] |= imask[IPL_SOFTSERIAL];
+
+	/*
+	 * There are tty, network and disk drivers that use free() at interrupt
+	 * time, so imp > (tty | net | bio).
+	 */
+	imask[IPL_IMP] |= imask[IPL_TTY];
+
+	imask[IPL_AUDIO] |= imask[IPL_IMP];
+
+	/*
+	 * Since run queues may be manipulated by both the statclock and tty,
+	 * network, and disk drivers, clock > imp.
+	 */
+	imask[IPL_CLOCK] |= SPL_CLOCK;          /* block the clock */
+	imask[IPL_CLOCK] |= imask[IPL_AUDIO];
+
+	/*
+	 * IPL_HIGH must block everything that can manipulate a run queue.
+	 */
+	imask[IPL_HIGH] |= imask[IPL_CLOCK];
+
+	/*
+	 * We need serial drivers to run at the absolute highest priority to
+	 * avoid overruns, so serial > high.
+	 */
+	imask[IPL_SERIAL] |= imask[IPL_HIGH];
+
+	/* And eventually calculate the complete masks. */
+	for (irq = 0; irq < ICU_LEN; irq++) {
+		register int irqs = 1 << irq;
+		for (q = intrhand[irq]; q; q = q->ih_next)
+			irqs |= imask[q->ih_level];
+		intrmask[irq] = irqs;
+	}
+
+	{
+		register int irqs = 0;
+		for (irq = 0; irq < I8259_INTR_NUM; irq++)
+			if (intrhand[irq])
+				irqs |= 1 << irq;
+		if (irqs >= 0x100)	/* any IRQs >= 8 in use */
+			irqs |= 1 << IRQ_SLAVE;
+		imen = ~irqs;
+		isa_intr_mask(imen);
+	}
+}
+
+void
+do_pending_int(void)
+{
+	struct intrhand *ih;
+	int irq;
+	int pcpl;
+	int hwpend;
+	int emsr, dmsr;
+	static int processing;
+
+	if (processing)
+		return;
+
+	processing = 1;
+	asm volatile("mfmsr %0" : "=r"(emsr));
+	dmsr = emsr & ~PSL_EE;
+	asm volatile("mtmsr %0" :: "r"(dmsr));
+
+	pcpl = splhigh();		/* Turn off all */
+	hwpend = ipending & ~pcpl;	/* Do now unmasked pendings */
+	imen &= ~hwpend;
+	hwpend &= ~SINT_MASK;
+	while (hwpend) {
+		irq = ffs(hwpend) - 1;
+		hwpend &= ~(1L << irq);
+		ih = intrhand[irq];
+		while (ih) {
+			(*ih->ih_fun)(ih->ih_arg);
+			ih = ih->ih_next;
+		}
+
+		isa_intr_clr(irq);
+
+		uvmexp.intrs++;
+		intrcnt[irq]++;
+	}
+	if ((ipending & ~pcpl) & SINT_CLOCK) {
+		ipending &= ~SINT_CLOCK;
+		softclock(NULL);
+	}
+	if ((ipending & ~pcpl) & SINT_NET) {
+		int pisr = netisr;
+		netisr = 0;
+		ipending &= ~SINT_NET;
+		softnet(pisr);
+	}
+	if ((ipending & ~pcpl) & SINT_SERIAL) {
+		ipending &= ~SINT_SERIAL;
+		softserial();
+	}
+
+	ipending &= pcpl;
+	cpl = pcpl;	/* Don't use splx... we are here already! */
+
+	isa_intr_mask(imen);
+
+	asm volatile("mtmsr %0" :: "r"(emsr));
+	processing = 0;
+}
+
+static void
+install_extint(void (*handler)(void))
+{
+	extern u_char extint[];
+	extern u_long extsize;
+	extern u_long extint_call;
+	u_long offset = (u_long)handler - (u_long)&extint_call;
+	int omsr, msr;
+
+#ifdef DIAGNOSTIC
+	if (offset > 0x1ffffff)
+		panic("install_extint: too far away");
+#endif
+	asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
+		      : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
+	extint_call = (extint_call & 0xfc000003) | offset;
+	memcpy((void *)EXC_EXI, &extint, (size_t)&extsize);
+	__syncicache((void *)&extint_call, sizeof extint_call);
+	__syncicache((void *)EXC_EXI, (int)&extsize);
+	asm volatile ("mtmsr %0" :: "r"(omsr));
+}
+
+void
+init_intr(void)
+{
+	install_extint(ext_intr);
+}
+
+void
+init_intr_ivr(void)
+{
+	install_extint(ext_intr_ivr);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/locore.S	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,198 @@
+/*	$NetBSD: locore.S,v 1.1 2003/10/19 03:33:50 matt 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.
+ */
+
+#define _NOREGNAMES
+
+#include "opt_ddb.h"
+#include "fs_kernfs.h"
+#include "opt_ipkdb.h"
+#include "opt_lockdebug.h"
+#include "opt_multiprocessor.h"
+#include "opt_ppcparam.h"
+#include "assym.h"
+
+#include <sys/syscall.h>
+
+#include <machine/param.h>
+#include <machine/vmparam.h>
+#include <machine/pmap.h>
+#include <machine/psl.h>
+#include <machine/trap.h>
+#include <machine/asm.h>
+
+#include <powerpc/spr.h>
+#include <powerpc/oea/hid.h>
+
+/*
+ * Some instructions gas doesn't understand (yet?)
+ */
+#define	bdneq	bdnzf 2,
+
+/*
+ * Globals
+ */
+GLOBAL(startsym)
+	.long	0			/* start symbol table */
+GLOBAL(endsym)
+	.long	0			/* end symbol table */
+GLOBAL(proc0paddr)
+	.long	0			/* proc0 p_addr */
+
+GLOBAL(intrnames)
+	.asciz	"clock", "irq1", "irq2", "irq3"
+	.asciz	"irq4", "irq5", "irq6", "irq7"
+	.asciz	"irq8", "irq9", "irq10", "irq11"
+	.asciz	"irq12", "irq13", "irq14", "irq15"
+	.asciz	"irq16", "irq17", "irq18", "irq19"
+	.asciz	"irq20", "irq21", "irq22", "irq23"
+	.asciz	"irq24", "irq25", "irq26", "irq27"
+	.asciz	"irq28", "softnet", "softclock", "softserial"
+GLOBAL(eintrnames)
+	.align	4
+GLOBAL(intrcnt)
+	.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+GLOBAL(eintrcnt)
+
+/*
+ * This symbol is here for the benefit of kvm_mkdb, and is supposed to
+ * mark the start of kernel text.
+ */
+	.text
+	.globl	_C_LABEL(kernel_text)
+_C_LABEL(kernel_text):
+
+/*
+ * Startup entry.  Note, this must be the first thing in the text
+ * segment!
+ */
+	.text
+	.globl	__start
+__start:
+
+        bl      __start_
+        nop
+        nop
+        .long   0x33
+        .string "XncdPPC"
+
+        /*
+         * These next two entries are patched at the end of
+         * of the build
+         */
+
+        .long   0xffff0000      /* 16 bit CRC */
+        .long   0xffffffff      /* Image size */
+
+        /* More magic numbers */
+
+        .long   0x00092214
+        .long   0x00000000
+        .long   0x39771c2a
+        .long   0x00000010
+
+__start_:
+
+	li	0,0
+	mtmsr	0			/* Disable FPU/MMU/exceptions */
+	isync
+
+/* compute end of kernel memory */
+#if defined(DDB) || defined(KERNFS)
+	lis	7,_C_LABEL(startsym)@ha
+	addi	7,7,_C_LABEL(startsym)@l
+	stw	3,0(7)
+	lis	7,_C_LABEL(endsym)@ha
+	addi	7,7,_C_LABEL(endsym)@l
+	stw	4,0(7)
+#else
+	lis	4,_C_LABEL(end)@ha
+	addi	4,4,_C_LABEL(end)@l
+#endif
+
+	INIT_CPUINFO(4,1,9,0)
+	
+	lis	3,__start@ha
+	addi	3,3,__start@l
+
+	bl	_C_LABEL(initppc)
+
+/* enable internal i/d-cache */
+
+	mfspr	11,SPR_HID0
+	andi.	0,11,HID0_DCE
+	ori	11,11,HID0_ICE|HID0_DCE
+	ori	8,11,HID0_ICFI
+	bne	1f			/* don't invalidate the D-cache */
+	ori	8,8,HID0_DCFI		/* unless it wasn't enabled */
+1:
+	sync
+	mtspr	SPR_HID0,8		/* enable and invalidate caches */
+	sync
+	mtspr	SPR_HID0,11		/* enable caches */
+	sync
+	isync
+
+	bl	_C_LABEL(main)
+
+loop:
+	b	loop			/* not reached */
+
+	.globl	_C_LABEL(enable_intr)
+_C_LABEL(enable_intr):
+	mfmsr	3
+	ori	4,3,PSL_EE@l
+	mtmsr	4
+	blr
+
+	.globl	_C_LABEL(disable_intr)
+_C_LABEL(disable_intr):
+	mfmsr	3
+	andi.	4,3,~PSL_EE@l
+	mtmsr	4
+	blr
+
+/*
+ * Pull in common switch / setfault code.
+ */
+#include <powerpc/powerpc/locore_subr.S>
+
+/*
+ * Pull in common trap vector code.
+ */
+#include <powerpc/powerpc/trap_subr.S>
+
+/*
+ * Pull in common pio / bus_space code.
+ */
+#include <powerpc/powerpc/pio_subr.S>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/machdep.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,405 @@
+/*	$NetBSD: machdep.c,v 1.1 2003/10/19 03:33:50 matt 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.
+ */
+
+#include "opt_compat_netbsd.h"
+#include "opt_ddb.h"
+
+#include <sys/param.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/exec.h>
+#include <sys/extent.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/mount.h>
+#include <sys/msgbuf.h>
+#include <sys/proc.h>
+#include <sys/reboot.h>
+#include <sys/sa.h>
+#include <sys/syscallargs.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/user.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <sys/sysctl.h>
+
+#include <net/netisr.h>
+
+#include <machine/autoconf.h>
+#include <machine/bat.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
+#include <machine/pmap.h>
+#include <machine/powerpc.h>
+#include <machine/trap.h>
+
+#include <dev/cons.h>
+
+#include "com.h"
+#if (NCOM > 0)
+#include <sys/termios.h>
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+void comsoft(void);
+#endif
+
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_extern.h>
+#endif
+
+void initppc(u_long, u_long, u_int, void *);
+void dumpsys(void);
+void strayintr(int);
+int lcsplx(int);
+void ibmnws_bus_space_init(void);
+
+vaddr_t prep_intr_reg;			/* PReP interrupt vector register */
+
+#define	OFMEMREGIONS	32
+struct mem_region physmemr[OFMEMREGIONS], availmemr[OFMEMREGIONS];
+
+paddr_t avail_end;			/* XXX temporary */
+
+#ifdef DDB
+extern void *endsym, *startsym;
+#endif
+
+void
+initppc(startkernel, endkernel, args, btinfo)
+	u_long startkernel, endkernel;
+	u_int args;
+	void *btinfo;
+{
+
+	/*
+	 * Set memory region
+	 */
+	{
+		u_long memsize;
+
+#if 0
+		/* Get the memory size from the PCI host bridge */
+
+		pci_read_config_32(0, 0x90, &ea);
+		if(ea & 0xff00)
+		    memsize = (((ea >> 8) & 0xff) + 1) << 20;
+		else
+		    memsize = ((ea & 0xff) + 1) << 20;
+#else
+		memsize = 64 * 1024 * 1024;         /* 64MB hardcoded for now */
+#endif
+
+		physmemr[0].start = 0;
+		physmemr[0].size = memsize & ~PGOFSET;
+		availmemr[0].start = (endkernel + PGOFSET) & ~PGOFSET;
+		availmemr[0].size = memsize - availmemr[0].start;
+	}
+	avail_end = physmemr[0].start + physmemr[0].size;    /* XXX temporary */
+
+	/*
+	 * Set CPU clock
+	 */
+	{
+		extern u_long ticks_per_sec, ns_per_tick;
+
+		ticks_per_sec = 16666666;		/* hardcoded */
+		ns_per_tick = 1000000000 / ticks_per_sec;
+	}
+
+	/* Initialize the CPU type */
+	/* ident_platform(); */
+
+	/*
+	 * boothowto
+	 */
+	boothowto = 0;		/* XXX - should make this an option */
+
+	/*
+	 * Initialize bus_space.
+	 */
+	ibmnws_bus_space_init();
+
+/* JG  - OK to here */
+	/*
+	 * Now setup fixed bat registers
+	 */
+	oea_batinit(
+	    PREP_BUS_SPACE_MEM, BAT_BL_256M,
+	    PREP_BUS_SPACE_IO,  BAT_BL_256M,
+	    0);
+
+	/*
+	 * i386 port says, that this shouldn't be here,
+	 * but I really think the console should be initialized
+	 * as early as possible.
+	 */
+	consinit();
+
+/* JG - Fails here */
+
+	oea_init(NULL);
+
+	/*
+	 * external interrupt handler install
+	 */
+
+	/* init_intr_ivr(); */
+	init_intr();
+
+        /*
+	 * Set the page size.
+	 */
+	uvm_setpagesize();
+
+	/*
+	 * Initialize pmap module.
+	 */
+	pmap_bootstrap(startkernel, endkernel);
+
+#ifdef DDB
+	ddb_init((int)((u_long)endsym - (u_long)startsym), startsym, endsym);
+
+	if (boothowto & RB_KDB)
+		Debugger();
+#endif
+}
+
+void
+mem_regions(mem, avail)
+	struct mem_region **mem, **avail;
+{
+
+	*mem = physmemr;
+	*avail = availmemr;
+}
+
+/*
+ * Machine dependent startup code.
+ */
+void
+cpu_startup()
+{
+	/*
+	 * Mapping PReP interrput vector register.
+	 */
+	prep_intr_reg = (vaddr_t) mapiodev(PREP_INTR_REG, PAGE_SIZE);
+	if (!prep_intr_reg)
+		panic("startup: no room for interrupt register");
+
+	/*
+	 * Do common startup.
+	 */
+	oea_startup("IBM NetworkStation 1000 (8362-XXX)");
+
+	/*
+	 * Now allow hardware interrupts.
+	 */
+	{
+		int msr;
+
+		splraise(-1);
+		__asm __volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
+			      : "=r"(msr) : "K"(PSL_EE));
+	}
+
+	/*
+	 * Now safe for bus space allocation to use malloc.
+	 */
+	bus_space_mallocok();
+}
+
+/*
+ * Soft tty interrupts.
+ */
+void
+softserial(void)
+{
+#if (NCOM > 0)
+	comsoft();
+#endif
+}
+
+/*
+ * Stray interrupts.
+ */
+void
+strayintr(int irq)
+{
+	log(LOG_ERR, "stray interrupt %d\n", irq);
+}
+
+/*
+ * Halt or reboot the machine after syncing/dumping according to howto.
+ */
+void
+cpu_reboot(howto, what)
+	int howto;
+	char *what;
+{
+	static int syncing;
+
+	if (cold) {
+		howto |= RB_HALT;
+		goto halt_sys;
+	}
+
+	boothowto = howto;
+	if ((howto & RB_NOSYNC) == 0 && syncing == 0) {
+		syncing = 1;
+		vfs_shutdown();		/* sync */
+		resettodr();		/* set wall clock */
+	}
+
+	/* Disable intr */
+	splhigh();
+
+	/* Do dump if requested */
+	if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
+		oea_dumpsys();
+
+halt_sys:
+	doshutdownhooks();
+
+	if (howto & RB_HALT) {
+                printf("\n");
+                printf("The operating system has halted.\n");
+                printf("Please press any key to reboot.\n\n");
+                cnpollc(1);	/* for proper keyboard command handling */
+                cngetc();
+                cnpollc(0);
+	}
+
+	printf("rebooting...\n\n");
+
+
+        {
+	    int msr;
+	    u_char reg;
+
+	    __asm__ volatile("mfmsr %0" : "=r"(msr));
+	    msr |= PSL_IP;
+	    __asm__ volatile("mtmsr %0" :: "r"(msr));
+
+	    reg = *(volatile u_char *)(PREP_BUS_SPACE_IO + 0x92);
+	    reg &= ~1UL;
+	    *(volatile u_char *)(PREP_BUS_SPACE_IO + 0x92) = reg;
+
+	    __asm__ volatile("sync; eieio\n");
+
+	    reg = *(volatile u_char *)(PREP_BUS_SPACE_IO + 0x92);
+	    reg |= 1;
+	    *(volatile u_char *)(PREP_BUS_SPACE_IO + 0x92) = reg;
+
+	    __asm__ volatile("sync; eieio\n");
+	}
+
+	for (;;)
+		continue;
+	/* NOTREACHED */
+}
+
+/*
+ * lcsplx() is called from locore; it is an open-coded version of
+ * splx() differing in that it returns the previous priority level.
+ */
+int
+lcsplx(ipl)
+	int ipl;
+{
+	int oldcpl;
+
+	__asm__ volatile("sync; eieio\n");	/* reorder protect */
+	oldcpl = cpl;
+	cpl = ipl;
+	if (ipending & ~ipl)
+		do_pending_int();
+	__asm__ volatile("sync; eieio\n");	/* reorder protect */
+
+	return (oldcpl);
+}
+
+struct powerpc_bus_space io_bus_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
+	0x80000000, 0x00000000, 0x3f800000,
+};
+struct powerpc_bus_space isa_io_bus_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
+	0x80000000, 0x00000000, 0x00010000,
+};
+struct powerpc_bus_space mem_bus_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
+	0xC0000000, 0x00000000, 0x3f000000,
+};
+struct powerpc_bus_space isa_mem_bus_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
+	0xC0000000, 0x00000000, 0x01000000,
+};
+
+static char ex_storage[2][EXTENT_FIXED_STORAGE_SIZE(8)]
+    __attribute__((aligned(8)));
+
+void
+ibmnws_bus_space_init(void)
+{
+	int error;
+
+	error = bus_space_init(&io_bus_space_tag, "ioport",
+	    ex_storage[0], sizeof(ex_storage[0]));
+	if (error)
+		panic("prep_bus_space_init: can't init io tag");
+
+	error = extent_alloc_region(io_bus_space_tag.pbs_extent,
+	    0x10000, 0x7F0000, EX_NOWAIT);
+	if (error)
+		panic("prep_bus_space_init: can't block out reserved I/O"
+		    " space 0x10000-0x7fffff: error=%d", error);
+	error = bus_space_init(&mem_bus_space_tag, "iomem",
+	    ex_storage[1], sizeof(ex_storage[1]));
+	if (error)
+		panic("prep_bus_space_init: can't init mem tag");
+
+	isa_io_bus_space_tag.pbs_extent = io_bus_space_tag.pbs_extent;
+	error = bus_space_init(&isa_io_bus_space_tag, "isa-ioport", NULL, 0);
+	if (error)
+		panic("bus_space_init: can't init isa io tag");
+
+	isa_mem_bus_space_tag.pbs_extent = mem_bus_space_tag.pbs_extent;
+	error = bus_space_init(&isa_mem_bus_space_tag, "isa-iomem", NULL, 0);
+	if (error)
+		panic("bus_space_init: can't init isa mem tag");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/ibmnws/mainbus.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,173 @@
+/*	$NetBSD: mainbus.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "opt_pci.h"
+
+/* #include "obio.h" */
+#include "pci.h"
+
+#include <sys/param.h>
+#include <sys/extent.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pciconf.h>
+
+#include <prep/dev/obiovar.h>
+
+int	mainbus_match(struct device *, struct cfdata *, void *);
+void	mainbus_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(mainbus, sizeof(struct device),
+    mainbus_match, mainbus_attach, NULL, NULL);
+
+int	mainbus_print(void *, const char *);
+
+union mainbus_attach_args {
+	const char *mba_busname;		/* first elem of all */
+	struct pcibus_attach_args mba_pba;
+};
+
+/* There can be only one. */
+int mainbus_found = 0;
+
+/*
+ * Probe for the mainbus; always succeeds.
+ */
+int
+mainbus_match(parent, match, aux)
+	struct device *parent;
+	struct cfdata *match;
+	void *aux;
+{
+
+	if (mainbus_found)
+		return 0;
+	return 1;
+}
+
+/*
+ * Attach the mainbus.
+ */
+void
+mainbus_attach(parent, self, aux)
+	struct device *parent;
+	struct device *self;
+	void *aux;
+{
+	union mainbus_attach_args mba;
+	struct confargs ca;
+#if NPCI > 0
+	static struct ibmnws_pci_chipset pc;
+#ifdef PCI_NETBSD_CONFIGURE
+	struct extent *ioext, *memext;
+#endif
+#endif
+
+	mainbus_found = 1;
+
+	printf("\n");
+
+	ca.ca_name = "cpu";
+	ca.ca_node = 0;
+	config_found(self, &ca, mainbus_print);
+
+#if NOBIO > 0
+	obio_reserve_resource_map();
+#endif
+
+	/*
+	 * XXX Note also that the presence of a PCI bus should
+	 * XXX _always_ be checked, and if present the bus should be
+	 * XXX 'found'.  However, because of the structure of the code,
+	 * XXX that's not currently possible.
+	 */
+#if NPCI > 0
+        ibmnws_pci_get_chipset_tag_indirect (&pc);
+
+#ifdef PCI_NETBSD_CONFIGURE
+	ioext  = extent_create("pciio",  0x00008000, 0x0000ffff, M_DEVBUF,
+	    NULL, 0, EX_NOWAIT);
+	memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
+	    NULL, 0, EX_NOWAIT);
+
+	pci_configure_bus(&pc, ioext, memext, NULL, 0, CACHELINESIZE);
+
+	extent_destroy(ioext);
+	extent_destroy(memext);
+#endif
+
+	mba.mba_pba.pba_busname = "pci";
+	mba.mba_pba.pba_iot = &io_bus_space_tag;
+	mba.mba_pba.pba_memt = &mem_bus_space_tag;
+	mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
+	mba.mba_pba.pba_pc = &pc;
+	mba.mba_pba.pba_bus = 0;
+	mba.mba_pba.pba_bridgetag = NULL;
+	mba.mba_pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
+	config_found(self, &mba.mba_pba, mainbus_print);
+#endif
+
+#if NOBIO > 0
+#if 0
+	obio_reserve_resource_unmap();
+
+	if (platform->obiodevs != obiodevs_nodev) {
+		bzero(&mba, sizeof(mba));
+		mba.mba_pba.pba_busname = "obio";
+		mba.mba_pba.pba_iot = &isa_io_space_tag;
+		mba.mba_pba.pba_memt = &isa_mem_space_tag;
+		config_found(self, &mba.mba_pba, mainbus_print);
+	}
+#endif
+#endif
+}
+
+int
+mainbus_print(aux, pnp)
+	void *aux;
+	const char *pnp;
+{
+	union mainbus_attach_args *mba = aux;
+
+	if (pnp)
+		aprint_normal("%s at %s", mba->mba_busname, pnp);
+	if (!strcmp(mba->mba_busname, "pci"))
+		aprint_normal(" bus %d", mba->mba_pba.pba_bus);
+
+	return (UNCONF);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/Makefile	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,24 @@
+#	$NetBSD: Makefile,v 1.1 2003/10/19 03:33:50 matt Exp $
+
+INCSDIR= /usr/include/ibmnws
+
+INCS=   ansi.h aout_machdep.h asm.h \
+	bat.h bswap.h bus.h \
+	cdefs.h cpu.h \
+	db_machdep.h disklabel.h \
+	elf_machdep.h endian.h endian_machdep.h \
+	float.h fpu.h frame.h \
+	ieee.h ieeefp.h \
+	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
+	intr.h \
+	kcore.h \
+	limits.h lock.h \
+	math.h mcontext.h \
+	param.h pcb.h pmap.h pmc.h powerpc.h proc.h profile.h \
+	psl.h pte.h ptrace.h \
+	reg.h reloc.h \
+	setjmp.h signal.h stdarg.h \
+	trap.h types.h \
+	varargs.h vmparam.h
+
+.include <bsd.kinc.mk>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/ansi.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: ansi.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/ansi.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/aout_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: aout_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/aout_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/asm.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: asm.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/asm.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/autoconf.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,48 @@
+/*	$NetBSD: autoconf.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (C) 1998	Internet Research Institute, Inc.
+ * 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
+ *	Internet Research Institute, Inc.
+ * 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.
+ */
+
+struct confargs {
+	char *ca_name;
+	u_int ca_node;
+	int ca_nreg;
+	u_int *ca_reg;
+	int ca_nintr;
+	int *ca_intr;
+
+	u_int ca_baseaddr;
+	/* bus_space_tag_t ca_tag; */
+};
+
+extern void *mapiodev __P((paddr_t, psize_t));
+extern paddr_t kvtop __P((caddr_t));
+extern void *intr_establish __P((int, int, int, int (*)(void *), void *));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/bat.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: bat.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/bat.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/bswap.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*     $NetBSD: bswap.h,v 1.1 2003/10/19 03:33:50 matt Exp $      */
+
+#include <powerpc/bswap.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/bus.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,129 @@
+/*	$NetBSD: bus.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+/*	$OpenBSD: bus.h,v 1.1 1997/10/13 10:53:42 pefo Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
+ * Copyright (c) 1996 Jason R. Thorpe.  All rights reserved.
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1997 Per Fogelstrom.  All rights reserved.
+ * Copyright (c) 1996 Niklas Hallqvist.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IBMNWS_BUS_H_
+#define _IBMNWS_BUS_H_
+
+/*
+ * Values for the Be bus space tag, not to be used directly by MI code.
+ */
+#define	PREP_BUS_SPACE_IO	0x80000000	/* i/o space */
+#define PREP_BUS_SPACE_MEM	0xC0000000	/* mem space */
+
+/*
+ * Address conversion as seen from a PCI master.
+ */
+#define MPC105_DIRECT_MAPPED_SPACE	0x80000000
+#define PHYS_TO_BUS_MEM(t, x)	((x) | MPC105_DIRECT_MAPPED_SPACE)
+#define BUS_MEM_TO_PHYS(t, x)	((x) & ~MPC105_DIRECT_MAPPED_SPACE)
+
+#ifdef _KERNEL
+extern struct powerpc_bus_space io_bus_space_tag;
+extern struct powerpc_bus_space isa_io_bus_space_tag;
+extern struct powerpc_bus_space mem_bus_space_tag;
+extern struct powerpc_bus_space isa_mem_bus_space_tag;
+#endif
+
+#include <powerpc/bus.h>
+
+#endif /* _IBMNWS_BUS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/cdefs.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: cdefs.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/cdefs.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/cpu.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,43 @@
+/*	$NetBSD: cpu.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*
+ * Copyright (C) 1995-1997 Wolfgang Solfrank.
+ * Copyright (C) 1995-1997 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_
+
+#if defined(_KERNEL)
+#define	CPU_MAXNUM	1
+extern char *bootpath;
+#endif
+
+#include <powerpc/cpu.h>
+
+#endif	/* _MACHINE_CPU_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/cpu_counter.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: cpu_counter.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/cpu_counter.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/cpufunc.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,1 @@
+/*	$NetBSD: cpufunc.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/darwin_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: darwin_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $ */
+
+#include <powerpc/darwin_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/db_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: db_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/db_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/disklabel.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,50 @@
+/*	$NetBSD: disklabel.h,v 1.1 2003/10/19 03:33:50 matt 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 _IBMNWS_DISKLABEL_H_
+#define _IBMNWS_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 */
+
+/* Pull in MBR partition definitions. */
+#include <sys/bootblock.h>
+#include <sys/dkbad.h>
+
+struct cpu_disklabel {
+	struct mbr_partition dosparts[MBR_PART_COUNT];
+	struct dkbad bad;
+};
+
+#endif /* _IBMNWS_DISKLABEL_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/elf_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: elf_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/elf_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/endian.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: endian.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <sys/endian.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/endian_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: endian_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/endian_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/float.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: float.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/float.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/fpu.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: fpu.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/fpu.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/frame.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: frame.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/frame.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/ieee.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: ieee.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/ieee.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/ieeefp.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: ieeefp.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/ieeefp.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/int_const.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: int_const.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/int_const.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/int_fmtio.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: int_fmtio.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/int_fmtio.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/int_limits.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: int_limits.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/int_limits.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/int_mwgwtypes.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/* $NetBSD: int_mwgwtypes.h,v 1.1 2003/10/19 03:33:50 matt Exp $ */
+
+#include <powerpc/int_mwgwtypes.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/int_types.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: int_types.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/int_types.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/intr.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,198 @@
+/*	$NetBSD: intr.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * 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.
+ */
+
+#ifndef _IBMNWS_INTR_H_
+#define _IBMNWS_INTR_H_
+
+/* Interrupt priority `levels'. */
+#define	IPL_NONE	9	/* nothing */
+#define	IPL_SOFTCLOCK	8	/* software clock interrupt */
+#define	IPL_SOFTNET	7	/* software network interrupt */
+#define	IPL_BIO		6	/* block I/O */
+#define	IPL_NET		5	/* network */
+#define	IPL_SOFTSERIAL	4	/* software serial interrupt */
+#define	IPL_TTY		3	/* terminal */
+#define	IPL_IMP		3	/* memory allocation */
+#define	IPL_AUDIO	2	/* audio */
+#define	IPL_CLOCK	1	/* clock */
+#define	IPL_HIGH	1	/* everything */
+#define	IPL_SERIAL	0	/* serial */
+#define	NIPL		10
+
+/* Interrupt sharing types. */
+#define	IST_NONE	0	/* none */
+#define	IST_PULSE	1	/* pulsed */
+#define	IST_EDGE	2	/* edge-triggered */
+#define	IST_LEVEL	3	/* level-triggered */
+
+#ifndef _LOCORE
+
+/*
+ * Interrupt handler chains.  intr_establish() inserts a handler into
+ * the list.  The handler is called with its (single) argument.
+ */
+struct intrhand {
+	int	(*ih_fun)(void *);
+	void	*ih_arg;
+	u_long	ih_count;
+	struct	intrhand *ih_next;
+	int	ih_level;
+	int	ih_irq;
+};
+
+void do_pending_int(void);
+
+void init_intr(void);
+void init_intr_ivr(void);
+
+void enable_intr(void);
+void disable_intr(void);
+
+void *intr_establish(int, int, int, int (*)(void *), void *);
+void intr_disestablish(void *);
+
+void softnet(int);
+void softserial(void);
+int isa_intr(void);
+void isa_intr_mask(int);
+void isa_intr_clr(int);
+void isa_setirqstat(int, int, int);
+
+static __inline int splraise(int);
+static __inline void spllower(int);
+static __inline void set_sint(int);
+
+extern volatile int cpl, ipending, astpending, tickspending;
+extern int imen;
+extern int imask[];
+extern long intrcnt[];
+extern unsigned intrcnt2[];
+extern struct intrhand *intrhand[];
+extern int intrtype[];
+extern vaddr_t prep_intr_reg;
+
+/*
+ *  Reorder protection in the following inline functions is
+ * achieved with the "eieio" instruction which the assembler
+ * seems to detect and then doesn't move instructions past....
+ */
+static __inline int
+splraise(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
+spllower(int newcpl)
+{
+
+	__asm__ volatile("sync; eieio\n");	/* reorder protect */
+	cpl = newcpl;
+	if(ipending & ~newcpl)
+		do_pending_int();
+	__asm__ volatile("sync; eieio\n");	/* reorder protect */
+}
+
+/* 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(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	ICU_LEN			32
+#define	IRQ_SLAVE		2
+#define	LEGAL_IRQ(x)		((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
+#define	I8259_INTR_NUM		16
+
+#define	PREP_INTR_REG	0xbffff000
+#define	INTR_VECTOR_REG	0xff0
+
+#define	SINT_CLOCK	0x20000000
+#define	SINT_NET	0x40000000
+#define	SINT_SERIAL	0x80000000
+#define	SPL_CLOCK	0x00000001
+#define	SINT_MASK	(SINT_CLOCK|SINT_NET|SINT_SERIAL)
+
+#define	CNT_SINT_NET	29
+#define	CNT_SINT_CLOCK	30
+#define	CNT_SINT_SERIAL	31
+#define	CNT_CLOCK	0
+
+#define splbio()	splraise(imask[IPL_BIO])
+#define splnet()	splraise(imask[IPL_NET])
+#define spltty()	splraise(imask[IPL_TTY])
+#define splclock()	splraise(imask[IPL_CLOCK])
+#define splvm()		splraise(imask[IPL_IMP])
+#define splaudio()	splraise(imask[IPL_AUDIO])
+#define	splserial()	splraise(imask[IPL_SERIAL])
+#define splstatclock()	splclock()
+#define	spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])
+#define	splsoftclock()	splraise(imask[IPL_SOFTCLOCK])
+#define	splsoftnet()	splraise(imask[IPL_SOFTNET])
+#define	splsoftserial()	splraise(imask[IPL_SOFTSERIAL])
+
+#define spllpt()	spltty()
+
+#define	setsoftclock()	set_sint(SINT_CLOCK);
+#define	setsoftnet()	set_sint(SINT_NET);
+#define	setsoftserial()	set_sint(SINT_SERIAL);
+
+#define	splhigh()	splraise(imask[IPL_HIGH])
+#define	splsched()	splhigh()
+#define	spllock()	splhigh()
+#define	splx(x)		spllower(x)
+#define	spl0()		spllower(0)
+
+#define	CLKF_BASEPRI(pri)	((pri) != 0)
+
+#endif /* !_LOCORE */
+
+#endif /* !_IBMNWS_INTR_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/ipkdb.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: ipkdb.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/ipkdb.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/isa_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,121 @@
+/*	$NetBSD: isa_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)isa.h	5.7 (Berkeley) 5/9/91
+ */
+
+/*
+ * Various pieces of the prep port want to include this file without
+ * or in spite of using isavar.h, and should be fixed.
+ */
+
+#ifndef _IBMNWS_ISA_MACHDEP_H_
+#define _IBMNWS_ISA_MACHDEP_H_
+
+#include <machine/bus.h>
+#include <dev/isa/isadmavar.h>
+#include <powerpc/isa_machdep.h>
+
+/*
+ * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
+ * BY PORTABLE CODE.
+ */
+
+#define	isa_outb(x,y)	outb(PREP_BUS_SPACE_IO + (x), y)
+#define isa_inb(x)	inb(PREP_BUS_SPACE_IO + (x))
+
+extern struct powerpc_bus_space isa_io_bus_space_tag;
+extern struct powerpc_bus_space isa_mem_bus_space_tag;
+extern struct powerpc_bus_dma_tag isa_bus_dma_tag;
+
+/*
+ * XXX Various seemingly PC-specific constants, some of which may be
+ * unnecessary anyway.
+ */
+
+/*
+ * stuff that used to be in pccons.c
+ */
+#define	MONO_BASE	0x3B4
+#define	MONO_BUF	0xB0000
+#define	CGA_BASE	0x3D4
+#define	CGA_BUF		0xB8000
+
+/*
+ * Miscellanous functions.
+ */
+void isabeep(int, int);		/* beep with the system speaker */
+void init_icu(int);		/* change ELCR */
+
+#endif /* _IBMNWS_ISA_MACHDEP_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/isapnp_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,46 @@
+/*	$NetBSD: isapnp_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center and 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.
+ */
+
+/*
+ * Functions provided to machine-independent ISA PnP code.
+ */
+int	isapnp_map(struct isapnp_softc *);
+void	isapnp_unmap(struct isapnp_softc *);
+int	isapnp_map_readport(struct isapnp_softc *);
+void	isapnp_unmap_readport(struct isapnp_softc *);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/kcore.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: kcore.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/kcore.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/kgdb.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,80 @@
+/*	$NetBSD: kgdb.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996 Wolfgang Solfrank.
+ * Copyright (C) 1995, 1996 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* register array */
+#define	FIX	0
+#define	LR	32
+#define	CR	33
+#define	CTR	34
+#define	XER	35
+#define	PC	36
+#define	MSR	37
+#define	NREG	38
+
+extern int kgdbregs[NREG];
+
+extern char kgdbstep;
+
+/* Doesn't handle overlapping regions */
+__inline extern void
+kgdbcopy(s,d,n)
+	void *s, *d;
+	int n;
+{
+	char *sp = s, *dp = d;
+	
+	while (--n >= 0)
+		*dp++ = *sp++;
+}
+
+__inline extern void
+kgdbzero(d,n)
+	void *d;
+	int n;
+{
+	char *dp = d;
+	
+	while (--n >= 0)
+		*dp++ = 0;
+}
+
+__inline extern int
+kgdbcmp(s,d,n)
+	void *s, *d;
+{
+	char *sp = s, *dp = d;
+	
+	while (--n >= 0)
+		if (*sp++ != *dp++)
+			return *--dp - *--sp;
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/limits.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: limits.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/limits.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/lock.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,4 @@
+/*	$NetBSD: lock.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/* Just use the common PowerPC definition */
+#include <powerpc/lock.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/macho_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: macho_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/macho_machdep.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/math.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: math.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/math.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/mcontext.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: mcontext.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/mcontext.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/openpicreg.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,5 @@
+/*	$NetBSD: openpicreg.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+void openpic_init(unsigned char *);
+
+#include <powerpc/openpicreg.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/param.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,49 @@
+/*	$NetBSD: param.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (C) 1995, 1996 Wolfgang Solfrank.
+ * Copyright (C) 1995, 1996 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef	_KERNEL
+#ifndef	_LOCORE
+#include <machine/cpu.h>
+#endif	/* _LOCORE */
+#endif
+
+/*
+ * Machine dependent constants for PowerPC (32-bit only currently)
+ */
+#define	MACHINE		"ibmnws"
+
+#define	__NO_FIXED_MSGBUF
+
+#define	KERNBASE	0x100000
+
+#include <powerpc/param.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pcb.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: pcb.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/pcb.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pci_machdep.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,131 @@
+/* $NetBSD: pci_machdep.h,v 1.1 2003/10/19 03:33:50 matt Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Machine-specific definitions for PCI autoconfiguration.
+ */
+
+#define __HAVE_PCI_CONF_HOOK
+
+/*
+ * Types provided to machine-independent PCI code
+ */
+typedef struct ibmnws_pci_chipset *pci_chipset_tag_t;
+typedef int pcitag_t;
+typedef int pci_intr_handle_t;
+
+/*
+ * Forward declarations.
+ */
+struct pci_attach_args;
+
+/*
+ * ibmnws-specific PCI structure and type definitions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+struct ibmnws_pci_chipset {
+	void		*pc_conf_v;
+	void		(*pc_attach_hook)(struct device *,
+			    struct device *, struct pcibus_attach_args *);
+	int		(*pc_bus_maxdevs)(void *, int);
+	pcitag_t	(*pc_make_tag)(void *, int, int, int);
+	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
+	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
+
+	void		*pc_intr_v;
+	int		(*pc_intr_map)(struct pci_attach_args *, 
+			    pci_intr_handle_t *);
+	const char	*(*pc_intr_string)(void *, pci_intr_handle_t);
+	const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
+	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
+			    int, int (*)(void *), void *);
+	void		(*pc_intr_disestablish)(void *, void *);
+	void		(*pc_conf_interrupt)(void *, int, int, int, int, int *);
+	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
+			    int *, int *);
+	int		(*pc_conf_hook)(void *, int, int, int, pcireg_t);
+};
+
+/*
+ * Functions provided to machine-independent PCI code.
+ */
+#define	pci_attach_hook(p, s, pba)					\
+    (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
+#define	pci_bus_maxdevs(c, b)						\
+    (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
+#define	pci_make_tag(c, b, d, f)					\
+    (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
+#define	pci_conf_read(c, t, r)						\
+    (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
+#define	pci_conf_write(c, t, r, v)					\
+    (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
+#define	pci_intr_map(pa, ihp)						\
+    (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
+#define	pci_intr_string(c, ih)						\
+    (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
+#define	pci_intr_evcnt(c, ih)						\
+    (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
+#define	pci_intr_establish(c, ih, l, h, a)				\
+    (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
+#define	pci_intr_disestablish(c, iv)					\
+    (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
+#define pci_conf_interrupt(c, b, d, p, s, ip)                           \
+    (*(c)->pc_conf_interrupt)((c)->pc_conf_v, (b), (d), (p), (s), (ip))
+#define	pci_decompose_tag(c, t, bp, dp, fp)				\
+    (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
+#define	pci_conf_hook(c, b, d, f, i)					\
+    (*(c)->pc_conf_hook)((c)->pc_conf_v, (b), (d), (f), (i))
+
+#define	pci_enumerate_bus(sc, m, p)					\
+	pci_enumerate_bus_generic((sc), (m), (p))
+
+#ifdef _KERNEL
+/*
+ * ibmnws-specific PCI functions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+int ibmnws_pci_bus_maxdevs(void *, int);
+int ibmnws_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
+const char *ibmnws_pci_intr_string(void *, pci_intr_handle_t);
+const struct evcnt *ibmnws_pci_intr_evcnt(void *, pci_intr_handle_t);
+void *ibmnws_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
+    void *);
+void ibmnws_pci_intr_disestablish(void *, void *);
+void ibmnws_pci_conf_interrupt(void *, int, int, int, int, int *);
+int ibmnws_pci_conf_hook(void *, int, int, int, pcireg_t);
+
+void ibmnws_pci_get_chipset_tag_direct(pci_chipset_tag_t);
+void ibmnws_pci_get_chipset_tag_indirect(pci_chipset_tag_t);
+
+/*
+ * ibmnws-specific PCI data.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+extern struct powerpc_bus_dma_tag pci_bus_dma_tag;
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pio.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: pio.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/pio.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pmap.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: pmap.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/pmap.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pmc.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: pmc.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/pmc.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pnp.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,643 @@
+/* 11/02/95                                                                   */
+/*----------------------------------------------------------------------------*/
+/*      Plug and Play header definitions                                      */
+/*----------------------------------------------------------------------------*/
+
+/* Structure map for PnP on PowerPC Reference Platform                        */
+/* See Plug and Play ISA Specification, Version 1.0, May 28, 1993.  It        */
+/* (or later versions) is available on Compuserve in the PLUGPLAY area.       */
+/* This code has extensions to that specification, namely new short and       */
+/* long tag types for platform dependent information                          */
+
+/* Warning: LE notation used throughout this file                             */
+
+/* For enum's: if given in hex then they are bit significant, i.e.            */
+/* only one bit is on for each enum                                           */
+
+#ifndef _PNP_
+#define _PNP_
+
+#ifndef __ASSEMBLY__
+#define MAX_MEM_REGISTERS 9
+#define MAX_IO_PORTS 20
+#define MAX_IRQS 7
+/*#define MAX_DMA_CHANNELS 7*/
+
+/* Interrupt controllers */
+
+#define PNPinterrupt0 "PNP0000"      /* AT Interrupt Controller               */
+#define PNPinterrupt1 "PNP0001"      /* EISA Interrupt Controller             */
+#define PNPinterrupt2 "PNP0002"      /* MCA Interrupt Controller              */
+#define PNPinterrupt3 "PNP0003"      /* APIC                                  */
+#define PNPExtInt     "IBM000D"      /* PowerPC Extended Interrupt Controller */
+
+/* Timers */
+
+#define PNPtimer0     "PNP0100"      /* AT Timer                              */
+#define PNPtimer1     "PNP0101"      /* EISA Timer                            */
+#define PNPtimer2     "PNP0102"      /* MCA Timer                             */
+
+/* DMA controllers */
+
+#define PNPdma0       "PNP0200"      /* AT DMA Controller                     */
+#define PNPdma1       "PNP0201"      /* EISA DMA Controller                   */
+#define PNPdma2       "PNP0202"      /* MCA DMA Controller                    */
+
+/* start of August 15, 1994 additions */
+/* CMOS */
+#define PNPCMOS       "IBM0009"      /* CMOS                                  */
+
+/* L2 Cache */
+#define PNPL2         "IBM0007"      /* L2 Cache                              */
+
+/* NVRAM */
+#define PNPNVRAM      "IBM0008"      /* NVRAM                                 */
+
+/* Power Management */
+#define PNPPM         "IBM0005"      /* Power Management                      */
+/* end of August 15, 1994 additions */
+
+/* Keyboards */
+
+#define PNPkeyboard0  "PNP0300"      /* IBM PC/XT KB Cntlr (83 key, no mouse) */
+#define PNPkeyboard1  "PNP0301"      /* Olivetti ICO (102 key)                */
+#define PNPkeyboard2  "PNP0302"      /* IBM PC/AT KB Cntlr (84 key)           */
+#define PNPkeyboard3  "PNP0303"      /* IBM Enhanced (101/2 key, PS/2 mouse)  */
+#define PNPkeyboard4  "PNP0304"      /* Nokia 1050 KB Cntlr                   */
+#define PNPkeyboard5  "PNP0305"      /* Nokia 9140 KB Cntlr                   */
+#define PNPkeyboard6  "PNP0306"      /* Standard Japanese KB Cntlr            */
+#define PNPkeyboard7  "PNP0307"      /* Microsoft Windows (R) KB Cntlr        */
+
+/* Parallel port controllers */
+
+#define PNPparallel0 "PNP0400"       /* Standard LPT Parallel Port            */
+#define PNPparallel1 "PNP0401"       /* ECP Parallel Port                     */
+#define PNPepp       "IBM001C"       /* EPP Parallel Port                     */
+
+/* Serial port controllers */
+
+#define PNPserial0   "PNP0500"       /* Standard PC Serial port               */
+#define PNPSerial1   "PNP0501"       /* 16550A Compatible Serial port         */
+
+/* Disk controllers */
+
+#define PNPdisk0     "PNP0600"       /* Generic ESDI/IDE/ATA Compat HD Cntlr  */
+#define PNPdisk1     "PNP0601"       /* Plus Hardcard II                      */
+#define PNPdisk2     "PNP0602"       /* Plus Hardcard IIXL/EZ                 */
+
+/* Diskette controllers */
+
+#define PNPdiskette0 "PNP0700"       /* PC Standard Floppy Disk Controller    */
+
+/* Display controllers */
+
+#define PNPdisplay0  "PNP0900"       /* VGA Compatible                        */
+#define PNPdisplay1  "PNP0901"       /* Video Seven VGA                       */
+#define PNPdisplay2  "PNP0902"       /* 8514/A Compatible                     */
+#define PNPdisplay3  "PNP0903"       /* Trident VGA                           */
+#define PNPdisplay4  "PNP0904"       /* Cirrus Logic Laptop VGA               */
+#define PNPdisplay5  "PNP0905"       /* Cirrus Logic VGA                      */
+#define PNPdisplay6  "PNP0906"       /* Tseng ET4000 or ET4000/W32            */
+#define PNPdisplay7  "PNP0907"       /* Western Digital VGA                   */
+#define PNPdisplay8  "PNP0908"       /* Western Digital Laptop VGA            */
+#define PNPdisplay9  "PNP0909"       /* S3                                    */
+#define PNPdisplayA  "PNP090A"       /* ATI Ultra Pro/Plus (Mach 32)          */
+#define PNPdisplayB  "PNP090B"       /* ATI Ultra (Mach 8)                    */
+#define PNPdisplayC  "PNP090C"       /* XGA Compatible                        */
+#define PNPdisplayD  "PNP090D"       /* ATI VGA Wonder                        */
+#define PNPdisplayE  "PNP090E"       /* Weitek P9000 Graphics Adapter         */
+#define PNPdisplayF  "PNP090F"       /* Oak Technology VGA                    */
+
+/* Peripheral busses */
+
+#define PNPbuses0    "PNP0A00"       /* ISA Bus                               */
+#define PNPbuses1    "PNP0A01"       /* EISA Bus                              */
+#define PNPbuses2    "PNP0A02"       /* MCA Bus                               */
+#define PNPbuses3    "PNP0A03"       /* PCI Bus                               */
+#define PNPbuses4    "PNP0A04"       /* VESA/VL Bus                           */
+
+/* RTC, BIOS, planar devices */
+
+#define PNPspeaker0  "PNP0800"       /* AT Style Speaker Sound                */
+#define PNPrtc0      "PNP0B00"       /* AT RTC                                */
+#define PNPpnpbios0  "PNP0C00"       /* PNP BIOS (only created by root enum)  */
+#define PNPpnpbios1  "PNP0C01"       /* System Board Memory Device            */
+#define PNPpnpbios2  "PNP0C02"       /* Math Coprocessor                      */
+#define PNPpnpbios3  "PNP0C03"       /* PNP BIOS Event Notification Interrupt */
+
+/* PCMCIA controller */
+
+#define PNPpcmcia0   "PNP0E00"       /* Intel 82365 Compatible PCMCIA Cntlr   */
+
+/* Mice */
+
+#define PNPmouse0    "PNP0F00"       /* Microsoft Bus Mouse                   */
+#define PNPmouse1    "PNP0F01"       /* Microsoft Serial Mouse                */
+#define PNPmouse2    "PNP0F02"       /* Microsoft Inport Mouse                */
+#define PNPmouse3    "PNP0F03"       /* Microsoft PS/2 Mouse                  */
+#define PNPmouse4    "PNP0F04"       /* Mousesystems Mouse                    */
+#define PNPmouse5    "PNP0F05"       /* Mousesystems 3 Button Mouse - COM2    */
+#define PNPmouse6    "PNP0F06"       /* Genius Mouse - COM1                   */
+#define PNPmouse7    "PNP0F07"       /* Genius Mouse - COM2                   */
+#define PNPmouse8    "PNP0F08"       /* Logitech Serial Mouse                 */
+#define PNPmouse9    "PNP0F09"       /* Microsoft Ballpoint Serial Mouse      */
+#define PNPmouseA    "PNP0F0A"       /* Microsoft PNP Mouse                   */
+#define PNPmouseB    "PNP0F0B"       /* Microsoft PNP Ballpoint Mouse         */
+
+/* Modems */
+
+#define PNPmodem0    "PNP9000"       /* Specific IDs TBD                      */
+
+/* Network controllers */
+
+#define PNPnetworkC9 "PNP80C9"       /* IBM Token Ring                        */
+#define PNPnetworkCA "PNP80CA"       /* IBM Token Ring II                     */
+#define PNPnetworkCB "PNP80CB"       /* IBM Token Ring II/Short               */
+#define PNPnetworkCC "PNP80CC"       /* IBM Token Ring 4/16Mbs                */
+#define PNPnetwork27 "PNP8327"       /* IBM Token Ring (All types)            */
+#define PNPnetworket "IBM0010"       /* IBM Ethernet used by Power PC         */
+#define PNPneteisaet "IBM2001"       /* IBM Ethernet EISA adapter             */
+#define PNPAMD79C970 "IBM0016"       /* AMD 79C970 (PCI Ethernet)             */
+
+/* SCSI controllers */
+
+#define PNPscsi0     "PNPA000"       /* Adaptec 154x Compatible SCSI Cntlr    */
+#define PNPscsi1     "PNPA001"       /* Adaptec 174x Compatible SCSI Cntlr    */
+#define PNPscsi2     "PNPA002"       /* Future Domain 16-700 Compat SCSI Cntlr*/
+#define PNPscsi3     "PNPA003"       /* Panasonic CDROM Adapter (SBPro/SB16)  */
+#define PNPscsiF     "IBM000F"       /* NCR 810 SCSI Controller               */
+#define PNPscsi825   "IBM001B"       /* NCR 825 SCSI Controller               */
+#define PNPscsi875   "IBM0018"       /* NCR 875 SCSI Controller               */
+
+/* Sound/Video, Multimedia */
+
+#define PNPmm0       "PNPB000"       /* Sound Blaster Compatible Sound Device */
+#define PNPmm1       "PNPB001"       /* MS Windows Sound System Compat Device */
+#define PNPmmF       "IBM000E"       /* Crystal CS4231 Audio Device           */
+#define PNPv7310     "IBM0015"       /* ASCII V7310 Video Capture Device      */
+#define PNPmm4232    "IBM0017"       /* Crystal CS4232 Audio Device           */
+#define PNPpmsyn     "IBM001D"       /* YMF 289B chip (Yamaha)                */
+#define PNPgp4232    "IBM0012"       /* Crystal CS4232 Game Port              */
+#define PNPmidi4232  "IBM0013"       /* Crystal CS4232 MIDI                   */
+
+/* Operator Panel */
+#define PNPopctl     "IBM000B"       /* Operator's panel                      */
+
+/* Service Processor */
+#define PNPsp        "IBM0011"       /* IBM Service Processor                 */
+#define PNPLTsp      "IBM001E"       /* Lightning/Terlingua Support Processor */
+#define PNPLTmsp     "IBM001F"       /* Lightning/Terlingua Mini-SP           */
+
+/* Memory Controller */
+#define PNPmemctl    "IBM000A"       /* Memory controller                     */
+
+/* Graphics Assist */
+#define PNPg_assist  "IBM0014"       /* Graphics Assist                       */
+
+/* Miscellaneous Device Controllers */
+#define PNPtablet    "IBM0019"       /* IBM Tablet Controller                 */
+
+/* PNP Packet Handles */
+
+#define S1_Packet                0x0A   /* Version resource                   */
+#define S2_Packet                0x15   /* Logical DEVID (without flags)      */
+#define S2_Packet_flags          0x16   /* Logical DEVID (with flags)         */
+#define S3_Packet                0x1C   /* Compatible device ID               */
+#define S4_Packet                0x22   /* IRQ resource (without flags)       */
+#define S4_Packet_flags          0x23   /* IRQ resource (with flags)          */
+#define S5_Packet                0x2A   /* DMA resource                       */
+#define S6_Packet                0x30   /* Depend funct start (w/o priority)  */
+#define S6_Packet_priority       0x31   /* Depend funct start (w/ priority)   */
+#define S7_Packet                0x38   /* Depend funct end                   */
+#define S8_Packet                0x47   /* I/O port resource (w/o fixed loc)  */
+#define S9_Packet_fixed          0x4B   /* I/O port resource (w/ fixed loc)   */
+#define S14_Packet               0x71   /* Vendor defined                     */
+#define S15_Packet               0x78   /* End of resource (w/o checksum)     */
+#define S15_Packet_checksum      0x79   /* End of resource (w/ checksum)      */
+#define L1_Packet                0x81   /* Memory range                       */
+#define L1_Shadow                0x20   /* Memory is shadowable               */
+#define L1_32bit_mem             0x18   /* 32-bit memory only                 */
+#define L1_8_16bit_mem           0x10   /* 8- and 16-bit supported            */
+#define L1_Decode_Hi             0x04   /* decode supports high address       */
+#define L1_Cache                 0x02   /* read cacheable, write-through      */
+#define L1_Writable              0x01   /* Memory is writable                */
+#define L2_Packet                0x82   /* ANSI ID string                     */
+#define L3_Packet                0x83   /* Unicode ID string                  */
+#define L4_Packet                0x84   /* Vendor defined                     */
+#define L5_Packet                0x85   /* Large I/O                          */
+#define L6_Packet                0x86   /* 32-bit Fixed Loc Mem Range Desc    */
+#define END_TAG                  0x78   /* End of resource                    */
+#define DF_START_TAG             0x30   /* Dependent function start           */
+#define DF_START_TAG_priority    0x31   /* Dependent function start           */
+#define DF_END_TAG               0x38   /* Dependent function end             */
+#define SUBOPTIMAL_CONFIGURATION 0x2    /* Priority byte sub optimal config   */
+
+/* Device Base Type Codes */
+
+typedef enum _PnP_BASE_TYPE {
+  Reserved = 0,
+  MassStorageDevice = 1,
+  NetworkInterfaceController = 2,
+  DisplayController = 3,
+  MultimediaController = 4,
+  MemoryController = 5,
+  BridgeController = 6,
+  CommunicationsDevice = 7,
+  SystemPeripheral = 8,
+  InputDevice = 9,
+  ServiceProcessor = 0x0A,              /* 11/2/95                            */
+  } PnP_BASE_TYPE;
+
+/* Device Sub Type Codes */
+
+typedef enum _PnP_SUB_TYPE {
+  SCSIController = 0,
+  IDEController = 1,
+  FloppyController = 2,
+  IPIController = 3,
+  OtherMassStorageController = 0x80,
+
+  EthernetController = 0,
+  TokenRingController = 1,
+  FDDIController = 2,
+  OtherNetworkController = 0x80,
+
+  VGAController= 0,
+  SVGAController= 1,
+  XGAController= 2,
+  OtherDisplayController = 0x80,
+
+  VideoController = 0,
+  AudioController = 1,
+  OtherMultimediaController = 0x80,
+
+  RAM = 0,
+  FLASH = 1,
+  OtherMemoryDevice = 0x80,
+
+  HostProcessorBridge = 0,
+  ISABridge = 1,
+  EISABridge = 2,
+  MicroChannelBridge = 3,
+  PCIBridge = 4,
+  PCMCIABridge = 5,
+  VMEBridge = 6,
+  OtherBridgeDevice = 0x80,
+
+  RS232Device = 0,
+  ATCompatibleParallelPort = 1,
+  OtherCommunicationsDevice = 0x80,
+
+  ProgrammableInterruptController = 0,
+  DMAController = 1,
+  SystemTimer = 2,
+  RealTimeClock = 3,
+  L2Cache = 4,
+  NVRAM = 5,
+  PowerManagement = 6,
+  CMOS = 7,
+  OperatorPanel = 8,
+  ServiceProcessorClass1 = 9,
+  ServiceProcessorClass2 = 0xA,
+  ServiceProcessorClass3 = 0xB,
+  GraphicAssist = 0xC,
+  SystemPlanar = 0xF,                   /* 10/5/95                            */
+  OtherSystemPeripheral = 0x80,
+
+  KeyboardController = 0,
+  Digitizer = 1,
+  MouseController = 2,
+  TabletController = 3,                 /* 10/27/95                           */
+  OtherInputController = 0x80,
+
+  GeneralMemoryController = 0,
+  } PnP_SUB_TYPE;
+
+/* Device Interface Type Codes */
+
+typedef enum _PnP_INTERFACE {
+  General = 0,
+  GeneralSCSI = 0,
+  GeneralIDE = 0,
+  ATACompatible = 1,
+
+  GeneralFloppy = 0,
+  Compatible765 = 1,
+  NS398_Floppy = 2,                     /* NS Super I/O wired to use index
+                                           register at port 398 and data
+                                           register at port 399               */
+  NS26E_Floppy = 3,                     /* Ports 26E and 26F                  */
+  NS15C_Floppy = 4,                     /* Ports 15C and 15D                  */
+  NS2E_Floppy = 5,                      /* Ports 2E and 2F                    */
+  CHRP_Floppy = 6,                      /* CHRP Floppy in PR*P system         */
+
+  GeneralIPI = 0,
+
+  GeneralEther = 0,
+  GeneralToken = 0,
+  GeneralFDDI = 0,
+
+  GeneralVGA = 0,
+  GeneralSVGA = 0,
+  GeneralXGA = 0,
+
+  GeneralVideo = 0,
+  GeneralAudio = 0,
+  CS4232Audio = 1,                      /* CS 4232 Plug 'n Play Configured    */
+
+  GeneralRAM = 0,
+  GeneralFLASH = 0,
+  PCIMemoryController = 0,              /* PCI Config Method                  */
+  RS6KMemoryController = 1,             /* RS6K Config Method                 */
+
+  GeneralHostBridge = 0,
+  GeneralISABridge = 0,
+  GeneralEISABridge = 0,
+  GeneralMCABridge = 0,
+  GeneralPCIBridge = 0,
+  PCIBridgeDirect = 0,
+  PCIBridgeIndirect = 1,
+  PCIBridgeRS6K = 2,
+  GeneralPCMCIABridge = 0,
+  GeneralVMEBridge = 0,
+
+  GeneralRS232 = 0,
+  COMx = 1,
+  Compatible16450 = 2,
+  Compatible16550 = 3,
+  NS398SerPort = 4,                     /* NS Super I/O wired to use index
+                                           register at port 398 and data
+                                           register at port 399               */
+  NS26ESerPort = 5,                     /* Ports 26E and 26F                  */
+  NS15CSerPort = 6,                     /* Ports 15C and 15D                  */
+  NS2ESerPort = 7,                      /* Ports 2E and 2F                    */
+
+  GeneralParPort = 0,
+  LPTx = 1,
+  NS398ParPort = 2,                     /* NS Super I/O wired to use index
+                                           register at port 398 and data
+                                           register at port 399               */
+  NS26EParPort = 3,                     /* Ports 26E and 26F                  */
+  NS15CParPort = 4,                     /* Ports 15C and 15D                  */
+  NS2EParPort = 5,                      /* Ports 2E and 2F                    */
+
+  GeneralPIC = 0,
+  ISA_PIC = 1,
+  EISA_PIC = 2,
+  MPIC = 3,
+  RS6K_PIC = 4,
+
+  GeneralDMA = 0,
+  ISA_DMA = 1,
+  EISA_DMA = 2,
+
+  GeneralTimer = 0,
+  ISA_Timer = 1,
+  EISA_Timer = 2,
+  GeneralRTC = 0,
+  ISA_RTC = 1,
+
+  StoreThruOnly = 1,
+  StoreInEnabled = 2,
+  RS6KL2Cache = 3,
+
+  IndirectNVRAM = 0,                    /* Indirectly addressed               */
+  DirectNVRAM = 1,                      /* Memory Mapped                      */
+  IndirectNVRAM24 = 2,                  /* Indirectly addressed - 24 bit      */
+
+  GeneralPowerManagement = 0,
+  EPOWPowerManagement = 1,
+  PowerControl = 2,                    // d1378
+
+  GeneralCMOS = 0,
+
+  GeneralOPPanel = 0,
+  HarddiskLight = 1,
+  CDROMLight = 2,
+  PowerLight = 3,
+  KeyLock = 4,
+  ANDisplay = 5,                        /* AlphaNumeric Display               */
+  SystemStatusLED = 6,                  /* 3 digit 7 segment LED              */
+  CHRP_SystemStatusLED = 7,             /* CHRP LEDs in PR*P system           */
+
+  GeneralServiceProcessor = 0,
+
+  TransferData = 1,
+  IGMC32 = 2,
+  IGMC64 = 3,
+
+  GeneralSystemPlanar = 0,              /* 10/5/95                            */
+
+  } PnP_INTERFACE;
+
+/* PnP resources */
+
+/* Compressed ASCII is 5 bits per char; 00001=A ... 11010=Z */
+
+typedef struct _SERIAL_ID {
+  unsigned char VendorID0;              /*    Bit(7)=0                        */
+                                        /*    Bits(6:2)=1st character in      */
+                                        /*       compressed ASCII             */
+                                        /*    Bits(1:0)=2nd character in      */
+                                        /*       compressed ASCII bits(4:3)   */
+  unsigned char VendorID1;              /*    Bits(7:5)=2nd character in      */
+                                        /*       compressed ASCII bits(2:0)   */
+                                        /*    Bits(4:0)=3rd character in      */
+                                        /*       compressed ASCII             */
+  unsigned char VendorID2;              /* Product number - vendor assigned   */
+  unsigned char VendorID3;              /* Product number - vendor assigned   */
+
+/* Serial number is to provide uniqueness if more than one board of same      */
+/* type is in system.  Must be "FFFFFFFF" if feature not supported.           */
+
+  unsigned char Serial0;                /* Unique serial number bits (7:0)    */
+  unsigned char Serial1;                /* Unique serial number bits (15:8)   */
+  unsigned char Serial2;                /* Unique serial number bits (23:16)  */
+  unsigned char Serial3;                /* Unique serial number bits (31:24)  */
+  unsigned char Checksum;
+  } SERIAL_ID;
+
+typedef enum _PnPItemName {
+  Unused = 0,
+  PnPVersion = 1,
+  LogicalDevice = 2,
+  CompatibleDevice = 3,
+  IRQFormat = 4,
+  DMAFormat = 5,
+  StartDepFunc = 6,
+  EndDepFunc = 7,
+  IOPort = 8,
+  FixedIOPort = 9,
+  Res1 = 10,
+  Res2 = 11,
+  Res3 = 12,
+  SmallVendorItem = 14,
+  EndTag = 15,
+  MemoryRange = 1,
+  ANSIIdentifier = 2,
+  UnicodeIdentifier = 3,
+  LargeVendorItem = 4,
+  MemoryRange32 = 5,
+  MemoryRangeFixed32 = 6,
+  } PnPItemName;
+
+/* Define a bunch of access functions for the bits in the tag field */
+
+/* Tag type - 0 = small; 1 = large */
+#define tag_type(t) (((t) & 0x80)>>7)
+#define set_tag_type(t,v) (t = (t & 0x7f) | ((v)<<7))
+
+/* Small item name is 4 bits - one of PnPItemName enum above */
+#define tag_small_item_name(t) (((t) & 0x78)>>3)
+#define set_tag_small_item_name(t,v) (t = (t & 0x07) | ((v)<<3))
+
+/* Small item count is 3 bits - count of further bytes in packet */
+#define tag_small_count(t) ((t) & 0x07)
+#define set_tag_count(t,v) (t = (t & 0x78) | (v))
+
+/* Large item name is 7 bits - one of PnPItemName enum above */
+#define tag_large_item_name(t) ((t) & 0x7f)
+#define set_tag_large_item_name(t,v) (t = (t | 0x80) | (v))
+
+/* a PnP resource is a bunch of contiguous TAG packets ending with an end tag */
+
+typedef union _PnP_TAG_PACKET {
+  struct _S1_Pack{                      /* VERSION PACKET                     */
+    unsigned char Tag;                  /* small tag = 0x0a                   */
+    unsigned char Version[2];           /* PnP version, Vendor version        */
+    } S1_Pack;
+
+  struct _S2_Pack{                      /* LOGICAL DEVICE ID PACKET           */
+    unsigned char Tag;                  /* small tag = 0x15 or 0x16           */
+    unsigned char DevId[4];             /* Logical device id                  */
+    unsigned char Flags[2];             /* bit(0) boot device;                */
+                                        /* bit(7:1) cmd in range x31-x37      */
+                                        /* bit(7:0) cmd in range x28-x3f (opt)*/
+    } S2_Pack;
+
+  struct _S3_Pack{                      /* COMPATIBLE DEVICE ID PACKET        */
+    unsigned char Tag;                  /* small tag = 0x1c                   */
+    unsigned char CompatId[4];          /* Compatible device id               */
+    } S3_Pack;
+
+  struct _S4_Pack{                      /* IRQ PACKET                         */
+    unsigned char Tag;                  /* small tag = 0x22 or 0x23           */
+    unsigned char IRQMask[2];           /* bit(0) is IRQ0, ...;               */
+                                        /* bit(0) is IRQ8 ...                 */
+    unsigned char IRQInfo;              /* optional; assume bit(0)=1; else    */
+                                        /*  bit(0) - high true edge sensitive */
+                                        /*  bit(1) - low true edge sensitive  */
+                                        /*  bit(2) - high true level sensitive*/
+                                        /*  bit(3) - low true level sensitive */
+                                        /*  bit(7:4) - must be 0              */
+    } S4_Pack;
+
+  struct _S5_Pack{                      /* DMA PACKET                         */
+    unsigned char Tag;                  /* small tag = 0x2a                   */
+    unsigned char DMAMask;              /* bit(0) is channel 0 ...            */
+    unsigned char DMAInfo;
+    } S5_Pack;
+
+  struct _S6_Pack{                      /* START DEPENDENT FUNCTION PACKET    */
+    unsigned char Tag;                  /* small tag = 0x30 or 0x31           */
+    unsigned char Priority;             /* Optional; if missing then x01; else*/
+                                        /*  x00 = best possible               */
+                                        /*  x01 = acceptible                  */
+                                        /*  x02 = sub-optimal but functional  */
+    } S6_Pack;
+
+  struct _S7_Pack{                      /* END DEPENDENT FUNCTION PACKET      */
+    unsigned char Tag;                  /* small tag = 0x38                   */
+    } S7_Pack;
+
+  struct _S8_Pack{                      /* VARIABLE I/O PORT PACKET           */
+    unsigned char Tag;                  /* small tag x47                      */
+    unsigned char IOInfo;               /* x0  = decode only bits(9:0);       */
+#define  ISAAddr16bit         0x01      /* x01 = decode bits(15:0)            */
+    unsigned char RangeMin[2];          /* Min base address                   */
+    unsigned char RangeMax[2];          /* Max base address                   */
+    unsigned char IOAlign;              /* base alignmt, incr in 1B blocks    */
+    unsigned char IONum;                /* number of contiguous I/O ports     */
+    } S8_Pack;
+
+  struct _S9_Pack{                      /* FIXED I/O PORT PACKET              */
+    unsigned char Tag;                  /* small tag = 0x4b                   */
+    unsigned char Range[2];             /* base address 10 bits               */
+    unsigned char IONum;                /* number of contiguous I/O ports     */
+    } S9_Pack;
+
+  struct _S14_Pack{                     /* VENDOR DEFINED PACKET              */
+    unsigned char Tag;                  /* small tag = 0x7m m = 1-7           */
+    union _S14_Data{
+      unsigned char Data[7];            /* Vendor defined                     */
+      struct _S14_PPCPack{              /* Pr*p s14 pack                      */
+         unsigned char Type;            /* 00=non-IBM                         */
+         unsigned char PPCData[6];      /* Vendor defined                     */
+        } S14_PPCPack;
+      } S14_Data;
+    } S14_Pack;
+
+  struct _S15_Pack{                     /* END PACKET                         */
+    unsigned char Tag;                  /* small tag = 0x78 or 0x79           */
+    unsigned char Check;                /* optional - checksum                */
+    } S15_Pack;
+
+  struct _L1_Pack{                      /* MEMORY RANGE PACKET                */
+    unsigned char Tag;                  /* large tag = 0x81                   */
+    unsigned char Count0;               /* x09                                */
+    unsigned char Count1;               /* x00                                */
+    unsigned char Data[9];              /* a variable array of bytes,         */
+                                        /* count in tag                       */
+    } L1_Pack;
+
+  struct _L2_Pack{                      /* ANSI ID STRING PACKET              */
+    unsigned char Tag;                  /* large tag = 0x82                   */
+    unsigned char Count0;               /* Length of string                   */
+    unsigned char Count1;
+    unsigned char Identifier[1];        /* a variable array of bytes,         */
+                                        /* count in tag                       */
+    } L2_Pack;
+
+  struct _L3_Pack{                      /* UNICODE ID STRING PACKET           */
+    unsigned char Tag;                  /* large tag = 0x83                   */
+    unsigned char Count0;               /* Length + 2 of string               */
+    unsigned char Count1;
+    unsigned char Country0;             /* TBD                                */
+    unsigned char Country1;             /* TBD                                */
+    unsigned char Identifier[1];        /* a variable array of bytes,         */
+                                        /* count in tag                       */
+    } L3_Pack;
+
+  struct _L4_Pack{                      /* VENDOR DEFINED PACKET              */
+    unsigned char Tag;                  /* large tag = 0x84                   */
+    unsigned char Count0;
+    unsigned char Count1;
+    union _L4_Data{
+      unsigned char Data[1];            /* a variable array of bytes,         */
+                                        /* count in tag                       */
+      struct _L4_PPCPack{               /* Pr*p L4 packet                     */
+         unsigned char Type;            /* 00=non-IBM                         */
+         unsigned char PPCData[1];      /* a variable array of bytes,         */
+                                        /* count in tag                       */
+        } L4_PPCPack;
+      } L4_Data;
+    } L4_Pack;
+
+  struct _L5_Pack{
+    unsigned char Tag;                  /* large tag = 0x85                   */
+    unsigned char Count0;               /* Count = 17                         */
+    unsigned char Count1;
+    unsigned char Data[17];
+    } L5_Pack;
+
+  struct _L6_Pack{
+    unsigned char Tag;                  /* large tag = 0x86                   */
+    unsigned char Count0;               /* Count = 9                          */
+    unsigned char Count1;
+    unsigned char Data[9];
+    } L6_Pack;
+
+  } PnP_TAG_PACKET;
+
+#endif /* __ASSEMBLY__ */
+#endif  /* ndef _PNP_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/powerpc.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,53 @@
+/*	$NetBSD: powerpc.h,v 1.1 2003/10/19 03:33:50 matt 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 {
+	paddr_t start;
+	psize_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
+ */
+void ppc_exit __P((void)) __attribute__((__noreturn__));
+void ppc_boot __P((char *bootspec)) __attribute__((__noreturn__));
+
+extern	int booted_partition;
+
+#endif	/* _MACHINE_POWERPC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/proc.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: proc.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/proc.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/profile.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: profile.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/profile.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/psl.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: psl.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/psl.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/pte.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: pte.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/pte.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/ptrace.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: ptrace.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/ptrace.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/reg.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: reg.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/reg.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/reloc.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: reloc.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/reloc.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/setjmp.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: setjmp.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/setjmp.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/signal.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: signal.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/signal.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/stdarg.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: stdarg.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/stdarg.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/trap.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: trap.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/trap.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/types.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,5 @@
+/*	$NetBSD: types.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#define	__HAVE_NWSCONS
+
+#include <powerpc/types.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/varargs.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,3 @@
+/*	$NetBSD: varargs.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#include <powerpc/varargs.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/include/vmparam.h	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,4 @@
+/*	$NetBSD: vmparam.h,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+#define	USER_SR		11
+#include <powerpc/oea/vmparam.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/pci/ibmnws_pciconf_indirect.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,188 @@
+/*	$NetBSD: ibmnws_pciconf_indirect.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ * Copyright (c) 1994 Charles M. Hannum.  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 Charles M. Hannum.
+ * 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-specific functions for PCI autoconfiguration.
+ *
+ * On PCs, there are two methods of generating PCI configuration cycles.
+ * We try to detect the appropriate mechanism for this machine and set
+ * up a few function pointers to access the correct method directly.
+ */
+
+#include "opt_openpic.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+
+#include <uvm/uvm_extern.h>
+
+#define _POWERPC_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+#include <machine/intr.h>
+#include <machine/pio.h>
+
+#if defined(OPENPIC)
+#include <powerpc/openpic.h>
+#endif /* OPENPIC */
+
+#include <dev/isa/isavar.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+
+#define	PCI_MODE1_ENABLE	0x80000000UL
+#define	PCI_MODE1_ADDRESS_REG	(PREP_BUS_SPACE_IO + 0xcf8)
+#define	PCI_MODE1_DATA_REG	(PREP_BUS_SPACE_IO + 0xcfc)
+
+#define	PCI_CBIO		0x10
+
+void ibmnws_pci_indirect_attach_hook(struct device *, struct device *,
+    struct pcibus_attach_args *);
+pcitag_t ibmnws_pci_indirect_make_tag(void *, int, int, int);
+pcireg_t ibmnws_pci_indirect_conf_read(void *, pcitag_t, int);
+void ibmnws_pci_indirect_conf_write(void *, pcitag_t, int, pcireg_t);
+void ibmnws_pci_indirect_decompose_tag(void *, pcitag_t, int *, int *, int *);
+
+void
+ibmnws_pci_get_chipset_tag_indirect(pci_chipset_tag_t pc)
+{
+
+	pc->pc_conf_v = NULL;
+
+	pc->pc_attach_hook = ibmnws_pci_indirect_attach_hook;
+	pc->pc_bus_maxdevs = ibmnws_pci_bus_maxdevs;
+	pc->pc_make_tag = ibmnws_pci_indirect_make_tag;
+	pc->pc_conf_read = ibmnws_pci_indirect_conf_read;
+	pc->pc_conf_write = ibmnws_pci_indirect_conf_write;
+
+	pc->pc_intr_v = NULL;
+
+	pc->pc_intr_map = ibmnws_pci_intr_map;
+	pc->pc_intr_string = ibmnws_pci_intr_string;
+	pc->pc_intr_evcnt = ibmnws_pci_intr_evcnt;
+	pc->pc_intr_establish = ibmnws_pci_intr_establish;
+	pc->pc_intr_disestablish = ibmnws_pci_intr_disestablish;
+
+	pc->pc_conf_interrupt = ibmnws_pci_conf_interrupt;
+	pc->pc_decompose_tag = ibmnws_pci_indirect_decompose_tag;
+	pc->pc_conf_hook = ibmnws_pci_conf_hook;
+}
+
+void
+ibmnws_pci_indirect_attach_hook(struct device *parent, struct device *self,
+    struct pcibus_attach_args *pba)
+{
+
+	if (pba->pba_bus != 0)
+		return;
+
+	printf(": indirect configuration space access");
+
+#if defined(OPENPIC)
+	if (openpic_base) {
+		pci_chipset_tag_t pc;
+		pcitag_t tag;
+		pcireg_t id, address;
+
+		pc = pba->pba_pc;
+		tag = pci_make_tag(pc, 0, 13, 0);
+		id = pci_conf_read(pc, tag, PCI_ID_REG);
+
+		if (PCI_VENDOR(id) == PCI_VENDOR_IBM
+		    && PCI_PRODUCT(id) == PCI_PRODUCT_IBM_MPIC) {
+			address = pci_conf_read(pc, tag, PCI_CBIO);
+			if ((address & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_MEM) {
+				address &= PCI_MAPREG_MEM_ADDR_MASK;
+				openpic_base = (unsigned char *)(PREP_BUS_SPACE_MEM | address);
+			}
+		}
+	}
+#endif /* OPENPIC */
+}
+
+pcitag_t
+ibmnws_pci_indirect_make_tag(void *v, int bus, int device, int function)
+{
+	pcitag_t tag;
+
+	if (bus >= 256 || device >= 32 || function >= 8)
+		panic("pci_make_tag: bad request");
+
+	tag = PCI_MODE1_ENABLE |
+		    (bus << 16) | (device << 11) | (function << 8);
+	return tag;
+}
+
+void
+ibmnws_pci_indirect_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp,
+    int *fp)
+{
+
+	if (bp != NULL)
+		*bp = (tag >> 16) & 0xff;
+	if (dp != NULL)
+		*dp = (tag >> 11) & 0x1f;
+	if (fp != NULL)
+		*fp = (tag >> 8) & 0x7;
+	return;
+}
+
+pcireg_t
+ibmnws_pci_indirect_conf_read(void *v, pcitag_t tag, int reg)
+{
+	pcireg_t data;
+	int s;
+
+	s = splhigh();
+	out32rb(PCI_MODE1_ADDRESS_REG, tag | reg);
+	data = in32rb(PCI_MODE1_DATA_REG);
+	out32rb(PCI_MODE1_ADDRESS_REG, 0);
+	splx(s);
+
+	return data;
+}
+
+void
+ibmnws_pci_indirect_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
+{
+	int s;
+
+	s = splhigh();
+	out32rb(PCI_MODE1_ADDRESS_REG, tag | reg);
+	out32rb(PCI_MODE1_DATA_REG, data);
+	out32rb(PCI_MODE1_ADDRESS_REG, 0);
+	splx(s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/pci/pchb.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,163 @@
+/*	$NetBSD: pchb.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+#include <machine/pio.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+int	pchbmatch __P((struct device *, struct cfdata *, void *));
+void	pchbattach __P((struct device *, struct device *, void *));
+
+CFATTACH_DECL(pchb, sizeof(struct device),
+    pchbmatch, pchbattach, NULL, NULL);
+
+int
+pchbmatch(parent, cf, aux)
+	struct device *parent;
+	struct cfdata *cf;
+	void *aux;
+{
+	struct pci_attach_args *pa = aux;
+
+	/*
+	 * Match all known PCI host chipsets.
+	 */
+	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
+	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) {
+		return (1);
+	}
+
+	return (0);
+}
+
+void
+pchbattach(parent, self, aux)
+	struct device *parent, *self;
+	void *aux;
+{
+	struct pci_attach_args *pa = aux;
+	pcireg_t reg1, reg2;
+	char devinfo[256];
+	const char * s1;
+	const char * s2;
+
+	printf("\n");
+
+	/*
+	 * All we do is print out a description.  Eventually, we
+	 * might want to add code that does something that's
+	 * possibly chipset-specific.
+	 */
+
+	pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
+	printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
+	    PCI_REVISION(pa->pa_class));
+
+#define IBM_82660_CACHE_STATUS		0xB1
+#define IBM_82660_CACHE_STATUS_L1_EN	0x01
+#define IBM_82660_CACHE_STATUS_L2_EN	0x02
+
+#define IBM_82660_OPTIONS_1		0xBA
+#define IBM_82660_OPTIONS_1_MCP		0x01
+#define IBM_82660_OPTIONS_1_TEA		0x02
+#define IBM_82660_OPTIONS_1_ISA		0x04
+
+#define IBM_82660_OPTIONS_3		0xD4
+#define IBM_82660_OPTIONS_3_ECC		0x01
+#define IBM_82660_OPTIONS_3_DRAM	0x04
+#define IBM_82660_OPTIONS_3_SRAM	0x08
+#define IBM_82660_OPTIONS_3_SNOOP	0x80
+
+#define IBM_82660_SYSTEM_CTRL		0x81C
+#define IBM_82660_SYSTEM_CTRL_L2_EN	0x40
+#define IBM_82660_SYSTEM_CTRL_L2_MI	0x80
+
+	switch (PCI_VENDOR(pa->pa_id)) {
+	case PCI_VENDOR_IBM:
+		switch (PCI_PRODUCT(pa->pa_id)) {
+		case PCI_PRODUCT_IBM_82660:
+			reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag,
+			    IBM_82660_CACHE_STATUS);
+			reg2 = in32rb (PREP_BUS_SPACE_IO + IBM_82660_SYSTEM_CTRL);
+			if (reg2 & IBM_82660_SYSTEM_CTRL_L2_EN) {
+				if (reg1 & IBM_82660_CACHE_STATUS_L2_EN)
+					s1 = "internal enabled";
+				else
+					s1 = "enabled";
+				if (reg2 & IBM_82660_SYSTEM_CTRL_L2_MI)
+					s2 = "(normal operation)";
+				else
+					s2 = "(miss updates inhibited)";
+			} else {
+				s1 = "disabled";
+				s2 = "";
+			}
+			printf("%s: L1: %s L2: %s %s\n", self->dv_xname,
+			       (reg1 & IBM_82660_CACHE_STATUS_L1_EN) ? "enabled" : "disabled",
+			       s1, s2);
+			reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag,
+			    IBM_82660_OPTIONS_1);
+
+			printf ("%s: MCP# assertion %s TEA# assertion %s\n", self->dv_xname,
+				(reg1 & IBM_82660_OPTIONS_1_MCP) ? "enabled" : "disabled",
+				(reg1 & IBM_82660_OPTIONS_1_TEA) ? "enabled" : "disabled");
+			printf ("%s: PCI/ISA I/O mapping %s\n", self->dv_xname,
+				(reg1 & IBM_82660_OPTIONS_1_ISA) ? "contiguous" : "non-contiguous");
+
+			reg1 = pci_conf_read(pa->pa_pc, pa->pa_tag,
+			    IBM_82660_OPTIONS_3);
+
+			printf ("%s: DRAM %s (%s) SRAM %s\n", self->dv_xname,
+			        (reg1 & IBM_82660_OPTIONS_3_DRAM) ? "EDO" : "standard",
+			        (reg1 & IBM_82660_OPTIONS_3_ECC) ? "ECC" : "parity",
+			        (reg1 & IBM_82660_OPTIONS_3_SRAM) ? "sync" : "async");
+
+			printf ("%s: Snoop mode %s\n", self->dv_xname,
+			        (reg1 & IBM_82660_OPTIONS_3_SNOOP) ? "603" : "601/604");
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/pci/pci_machdep.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,205 @@
+/*	NetBSD: pci_machdep.c,v 1.12 2001/06/19 11:56:27 nonaka Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ * Copyright (c) 1994 Charles M. Hannum.  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 Charles M. Hannum.
+ * 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-specific functions for PCI autoconfiguration.
+ *
+ * On PCs, there are two methods of generating PCI configuration cycles.
+ * We try to detect the appropriate mechanism for this machine and set
+ * up a few function pointers to access the correct method directly.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/extent.h>
+#include <sys/device.h>
+
+#include <uvm/uvm_extern.h>
+
+#define _POWERPC_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pciconf.h>
+
+/*
+ * PCI doesn't have any special needs; just use the generic versions
+ * of these functions.
+ */
+struct powerpc_bus_dma_tag pci_bus_dma_tag = {
+	0,			/* _bounce_thresh */
+	_bus_dmamap_create,
+	_bus_dmamap_destroy,
+	_bus_dmamap_load,
+	_bus_dmamap_load_mbuf,
+	_bus_dmamap_load_uio,
+	_bus_dmamap_load_raw,
+	_bus_dmamap_unload,
+	NULL,			/* _dmamap_sync */
+	_bus_dmamem_alloc,
+	_bus_dmamem_free,
+	_bus_dmamem_map,
+	_bus_dmamem_unmap,
+	_bus_dmamem_mmap,
+};
+
+int
+ibmnws_pci_bus_maxdevs(void *v, int busno)
+{
+
+	/*
+	 * Bus number is irrelevant.  Configuration Mechanism 1 is in
+	 * use, can have devices 0-32 (i.e. the `normal' range).
+	 */
+	return (32);
+}
+
+
+int
+ibmnws_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
+{
+	int pin = pa->pa_intrpin;
+	int line = pa->pa_intrline;
+
+	if (pin == 0) {
+		/* No IRQ used. */
+		goto bad;
+	}
+
+	if (pin > 4) {
+		printf("pci_intr_map: bad interrupt pin %d\n", pin);
+		goto bad;
+	}
+
+	/*
+	* Section 6.2.4, `Miscellaneous Functions', says that 255 means
+	* `unknown' or `no connection' on a PC.  We assume that a device with
+	* `no connection' either doesn't have an interrupt (in which case the
+	* pin number should be 0, and would have been noticed above), or
+	* wasn't configured by the BIOS (in which case we punt, since there's
+	* no real way we can know how the interrupt lines are mapped in the
+	* hardware).
+	*
+	* XXX
+	* Since IRQ 0 is only used by the clock, and we can't actually be sure
+	* that the BIOS did its job, we also recognize that as meaning that
+	* the BIOS has not configured the device.
+	*/
+	if (line == 0 || line == 255) {
+		printf("pci_intr_map: no mapping for pin %c\n", '@' + pin);
+		goto bad;
+	} else {
+		if (line >= ICU_LEN) {
+			printf("pci_intr_map: bad interrupt line %d\n", line);
+			goto bad;
+		}
+		if (line == IRQ_SLAVE) {
+			printf("pci_intr_map: changed line 2 to line 9\n");
+			line = 9;
+		}
+	}
+
+	*ihp = line;
+	return 0;
+
+bad:
+	*ihp = -1;
+	return 1;
+}
+
+const char *
+ibmnws_pci_intr_string(void *v, pci_intr_handle_t ih)
+{
+	static char irqstr[8];		/* 4 + 2 + NULL + sanity */
+
+	if (ih == 0 || ih >= ICU_LEN || ih == IRQ_SLAVE)
+		panic("pci_intr_string: bogus handle 0x%x", ih);
+
+	sprintf(irqstr, "irq %d", ih);
+	return (irqstr);
+	
+}
+
+const struct evcnt *
+ibmnws_pci_intr_evcnt(void *v, pci_intr_handle_t ih)
+{
+
+	/* XXX for now, no evcnt parent reported */
+	return NULL;
+}
+
+void *
+ibmnws_pci_intr_establish(void *v, pci_intr_handle_t ih, int level,
+    int (*func)(void *), void *arg)
+{
+
+	if (ih == 0 || ih >= ICU_LEN || ih == IRQ_SLAVE)
+		panic("pci_intr_establish: bogus handle 0x%x", ih);
+
+	return isa_intr_establish(NULL, ih, IST_LEVEL, level, func, arg);
+}
+
+void
+ibmnws_pci_intr_disestablish(void *v, void *cookie)
+{
+
+	isa_intr_disestablish(NULL, cookie);
+}
+
+void
+ibmnws_pci_conf_interrupt(void *v, int bus, int dev, int pin,
+    int swiz, int *iline)
+{
+}
+
+int
+ibmnws_pci_conf_hook(void *v, int bus, int dev, int func, pcireg_t id)
+{
+
+	/*
+	 * The P9100 board found in some IBM machines cannot be
+	 * over-configured.
+	 */
+	if (PCI_VENDOR(id) == PCI_VENDOR_WEITEK &&
+	    PCI_PRODUCT(id) == PCI_PRODUCT_WEITEK_P9100)
+		return 0;
+
+	return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ibmnws/pci/pcib.c	Sun Oct 19 03:33:49 2003 +0000
@@ -0,0 +1,185 @@
+/*	$NetBSD: pcib.c,v 1.1 2003/10/19 03:33:50 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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 REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.1 2003/10/19 03:33:50 matt Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+#include "isa.h"
+#include "isadma.h"
+
+int	pcibmatch(struct device *, struct cfdata *, void *);
+void	pcibattach(struct device *, struct device *, void *);
+
+struct pcib_softc {
+	struct device sc_dev;
+	struct powerpc_isa_chipset sc_chipset;
+};
+
+CFATTACH_DECL(pcib, sizeof(struct pcib_softc),
+    pcibmatch, pcibattach, NULL, NULL);
+
+void	pcib_callback(struct device *);
+int	pcib_print(void *, const char *);
+
+int
+pcibmatch(parent, cf, aux)
+	struct device *parent;
+	struct cfdata *cf;
+	void *aux;
+{
+	struct pci_attach_args *pa = aux;
+
+	/*
+	 * Match PCI-ISA bridge.
+	 */
+	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
+	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA) {
+		return (1);
+	}
+
+	/*
+	 * some special cases:
+	 */
+	switch (PCI_VENDOR(pa->pa_id)) {
+	case PCI_VENDOR_INTEL:
+		switch (PCI_PRODUCT(pa->pa_id)) {
+		case PCI_PRODUCT_INTEL_SIO:
+			/*
+			 * The Intel SIO identifies itself as a
+			 * miscellaneous prehistoric.
+			 */
+			return (1);
+		}
+		break;
+	}
+
+	return (0);
+}
+
+void
+pcibattach(parent, self, aux)
+	struct device *parent, *self;
+	void *aux;
+{
+	struct pci_attach_args *pa = aux;
+	char devinfo[256];
+	u_int32_t v;
+	int lvlmask = 0;
+
+	/*
+	 * Just print out a description and defer configuration
+	 * until all PCI devices have been attached.
+	 */
+	pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
+	printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));
+
+	v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x40);
+	if ((v & 0x20) == 0) {
+		printf("%s: PIRQ[0-3] not used\n", self->dv_xname);
+	} else {
+		v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x60);
+		if ((v & 0x80808080) == 0x80808080) {
+			printf("%s: PIRQ[0-3] disabled\n", self->dv_xname);
+		} else {
+			int i;
+			printf("%s:", self->dv_xname);
+			for (i = 0; i < 4; i++, v >>= 8) {
+				if ((v & 80) == 0 && (v & 0x0f) != 0) {
+					printf(" PIRQ[%d]=%d", i, v & 0x0f);
+					lvlmask |= (1 << (v & 0x0f));
+				}
+			}
+			printf("\n");
+		}
+	}
+#if NISA > 0
+	/* Initialize interrupt controller */
+	init_icu(lvlmask);
+#endif
+
+	config_defer(self, pcib_callback);
+}
+
+void
+pcib_callback(self)
+	struct device *self;
+{
+	struct pcib_softc *sc = (struct pcib_softc *)self;
+#if NISA > 0
+	struct isabus_attach_args iba;
+
+	/*
+	 * Attach the ISA bus behind this bridge.
+	 */
+	memset(&iba, 0, sizeof(iba));
+	iba.iba_busname = "isa";
+	iba.iba_ic = &sc->sc_chipset;
+	iba.iba_iot = &isa_io_bus_space_tag;
+	iba.iba_memt = &isa_mem_bus_space_tag;
+#if NISADMA > 0
+	iba.iba_dmat = &isa_bus_dma_tag;
+#endif
+	config_found(&sc->sc_dev, &iba, pcib_print);
+#endif
+}
+
+int
+pcib_print(aux, pnp)
+	void *aux;
+	const char *pnp;
+{
+
+	/* Only ISAs can attach to pcib's; easy. */
+	if (pnp)
+		aprint_normal("isa at %s", pnp);
+	return (UNCONF);
+}