Add some files for the Artesyn PMPPC board. This is a PowerPC based

Mezzanine PCI board.
NOTE: this is not yet all the files needed for the port.
This commit is contained in:
augustss 2002-05-30 08:51:06 +00:00
parent 0fc2511716
commit 1331023854
72 changed files with 3315 additions and 1 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: README,v 1.22 2002/03/24 15:56:59 bjh21 Exp $
$NetBSD: README,v 1.23 2002/05/30 08:51:06 augustss Exp $
acorn26: Acorn ARM2- and ARM3-based machines (arm)
acorn32: Acorn computers Ltd. ARM 6/7/SA based machines (arm)
@ -38,6 +38,7 @@ ofppc: Open Firmware based PowerPC machines (powerpc)
pc532: "PC-532" kit computer, based on NS 32532 CPU (ns32k)
playstation2: SONY PlayStation 2 (mips)
pmax: Digital Equipment Corp. MIPS based machines (mips)
pmppc: Artesyn PMPPC card (powerpc)
prep: PowerPC Reference Platform machines (powerpc)
sandpoint: Motorola Sandpoint reference platform (powerpc)
sbmips: Broadcom's SiByte processor evaluation boards (mips)

5
sys/arch/pmppc/Makefile Normal file
View File

@ -0,0 +1,5 @@
# $NetBSD: Makefile,v 1.1 2002/05/30 08:51:07 augustss Exp $
SUBDIR= include
.include <bsd.subdir.mk>

View File

@ -0,0 +1,3 @@
$NetBSD: .keep_me,v 1.1 2002/05/30 08:51:08 augustss Exp $
This normally empty directory needs to be kept in the distribution.

169
sys/arch/pmppc/conf/INSTALL Normal file
View File

@ -0,0 +1,169 @@
# $NetBSD: INSTALL,v 1.1 2002/05/30 08:51:09 augustss Exp $
#
# INSTALL
#
include "arch/pmppc/conf/std.pmppc"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
ident "INSTALL"
#options BOOTHOWTO=RB_SINGLE
options TLP_DEBUG
maxusers 32
# Options for necessary to use MD
options MEMORY_DISK_HOOKS
options MEMORY_DISK_IS_ROOT # force root on memory disk
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
options MEMORY_DISK_ROOT_SIZE=5120 # size of memory disk, in blocks
#options UCONSOLE # users can use TIOCCONS (for xconsole)
options INSECURE # disable kernel security levels
#options NTP # NTP phase/frequency locked loop
options KTRACE # system call tracing via ktrace(1)
options SYSVMSG # System V message queues
options SYSVSEM # System V semaphores
options SYSVSHM # System V shared memory
#options SHMMAXPGS=1024 # 1024 pages is the default
options LKM # loadable kernel modules
#options USERCONF # userconf(4) support
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
# Diagnostic/debugging support options
options DIAGNOSTIC # cheap kernel consistency checks
options DEBUG # expensive debugging checks/support
options DDB # in-kernel debugger
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
options TRAP_PANICWAIT
options SYMTAB_SPACE=300000 # size for embedded symbol table
makeoptions DEBUG="-g" # compile full symbol table
# Compatibility options
#options COMPAT_09 # NetBSD 0.9,
#options COMPAT_10 # NetBSD 1.0,
#options COMPAT_11 # NetBSD 1.1,
#options COMPAT_12 # NetBSD 1.2,
#options COMPAT_13 # NetBSD 1.3,
#options COMPAT_14 # NetBSD 1.4,
#options COMPAT_43 # and 4.3BSD
#options COMPAT_386BSD_MBRPART # recognize old partition ID
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
# File systems
file-system FFS # UFS
#file-system EXT2FS # second extended file system (linux)
#file-system LFS # log-structured file system
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 FDESC # /dev/fd
#file-system KERNFS # /kern
#file-system NULLFS # loopback file system
#file-system OVERLAY # overlay file system
#file-system PORTAL # portal filesystem (still experimental)
#file-system PROCFS # /proc
#file-system UMAPFS # NULLFS + uid and gid remapping
#file-system UNION # union file system
# File system options
#options QUOTA # UFS quotas
#options FFS_EI # FFS Endian Independant support
#options SOFTDEP # FFS soft updates support.
#options NFSSERVER # Network File System server
#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
# immutable) behave as system flags.
options NFS_BOOT_DHCP # Support DHCP NFS root
# Networking options
#options GATEWAY # packet forwarding
options INET # IP + ICMP + TCP + UDP
#options INET6 # IPV6
#options IPSEC # IP security
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
#options IPSEC_DEBUG # debug for IP security
#options MROUTING # IP multicast routing
#options NS # XNS
#options NSIP # XNS tunneling over IP
#options ISO,TPIP # OSI
#options EON # OSI tunneling over IP
#options CCITT,LLC,HDLC # X.25
#options NETATALK # AppleTalk networking protocols
#options PPP_BSDCOMP # BSD-Compress compression support for PPP
#options PPP_DEFLATE # Deflate compression support for PPP
#options PPP_FILTER # Active filter support for PPP (requires bpf)
#options PFIL_HOOKS # pfil(9) packet filter hooks
#options IPFILTER_LOG # ipmon(8) log support
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
#options NMBCLUSTERS=1024
# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!
options PCIVERBOSE # verbose PCI device autoconfig messages
options MIIVERBOSE # verbose PHY autoconfig messages
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
#options SCSIVERBOSE # human readable SCSI error messages
#options PCI_NETBSD_CONFIGURE # Do not rely on BIOS/whatever to configure PCI devices
#options PCI_CONFIGURE_VERBOSE # Show PCI config information
# Kernel root file system and dump configuration.
config netbsd root on ? type ?
#
# Device configuration
#
mainbus0 at root
cpu0 at mainbus0
# CPC700 controller
cpc0 at mainbus0
# TOD DS17485
rtc0 at mainbus0 addr 0x7ff00000
# Cirrus Logic Crystal CS89x0 Ethernet
cs0 at mainbus0 addr 0x7fe00000
# UARTs
com0 at cpc0 addr 0xff600300
com1 at cpc0 addr 0xff600400
# CPC700 integrated PCI bridge
pci* at cpc0
pchb* at pci?
pci* at pchb?
pci* at ppb? bus ?
ppb* at pci? dev ? function ? # PCI-PCI bridges
#tlp* at pci? dev ? function ? # DECchip 21x4x and clones
#lxtphy* at mii? phy ? # Level One LXT-970 PHYs
#pseudo-device vnd 4 # disk-like interface to files
pseudo-device md 1 # memory disk device
pseudo-device loop # network loopback
pseudo-device bpfilter 8 # packet filter
#pseudo-device ipfilter # IP filter (firewall) and NAT
pseudo-device ppp 2 # Point-to-Point Protocol
#pseudo-device sl 2 # Serial Line IP
#pseudo-device tun 4 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
#pseudo-device vlan # IEEE 802.1q encapsulation
pseudo-device pty # pseudo-terminals
pseudo-device rnd # /dev/random and in-kernel generator

View File

@ -0,0 +1,42 @@
CONF?=INSTALL
MAKE=/usr/obj/tools.pmppc/bin/nbmake-pmppc
OBJCOPY = /usr/obj/tools.pmppc/bin/powerpc--netbsd-objcopy
MDSETIMAGE = /usr/obj/tools.pmppc/bin/powerpc--netbsd-mdsetimage
NETBSD = ../compile/$(CONF)/netbsd
RAMDISK = /usr/SRC/src/distrib/pmppc/floppies/ramdisk/ramdisk.fs
BIN = /tftpboot/netbsd.bin
def: comp mdset tobin
all: conf comp mdset tobin
alldep: conf depend comp
tobin:
cp $(NETBSD).bin $(BIN)
# $(OBJCOPY) -O binary $(NETBSD) $(BIN)
mdset:
$(MDSETIMAGE) -v $(NETBSD) $(RAMDISK)
comp:
cd ../compile/$(CONF); $(MAKE) NOOBJ=y all
depend:
cd ../compile/$(CONF); $(MAKE) NOOBJ=y depend
conf:
config $(CONF)
art:
$(MAKE) CONF=PMPPC conf depend comp tobin copy
artc:
$(MAKE) CONF=PMPPC comp tobin copy
copy:
cp $(NETBSD) $(DESTDIR)
sb:
$(MAKE) CONF=SB conf depend comp copy
sbc:
$(MAKE) CONF=SB conf comp

181
sys/arch/pmppc/conf/PMPPC Normal file
View File

@ -0,0 +1,181 @@
# $NetBSD: PMPPC,v 1.1 2002/05/30 08:51:10 augustss Exp $
#
# PMPPC
#
include "arch/pmppc/conf/std.pmppc"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
ident "PMPPC"
#options BOOTHOWTO=RB_SINGLE
options BOOTHOWTO=0
options MSGBUFSIZE=0x10000
options TLP_DEBUG
maxusers 32
# Options for necessary to use MD
#options MEMORY_DISK_HOOKS
#options MEMORY_DISK_IS_ROOT # force root on memory disk
#options MEMORY_DISK_SERVER=0 # no userspace memory disk support
#options MEMORY_DISK_ROOT_SIZE=8192 # size of memory disk, in blocks
#options UCONSOLE # users can use TIOCCONS (for xconsole)
options INSECURE # disable kernel security levels
#options NTP # NTP phase/frequency locked loop
options KTRACE # system call tracing via ktrace(1)
options SYSVMSG # System V message queues
options SYSVSEM # System V semaphores
options SYSVSHM # System V shared memory
#options SHMMAXPGS=1024 # 1024 pages is the default
options LKM # loadable kernel modules
#options USERCONF # userconf(4) support
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
# Diagnostic/debugging support options
options DIAGNOSTIC # cheap kernel consistency checks
#options DEBUG # expensive debugging checks/support
options DDB # in-kernel debugger
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
#options TRAP_PANICWAIT
options SYMTAB_SPACE=300000 # size for embedded symbol table
#makeoptions DEBUG="-g" # compile full symbol table
# Compatibility options
#options COMPAT_09 # NetBSD 0.9,
#options COMPAT_10 # NetBSD 1.0,
#options COMPAT_11 # NetBSD 1.1,
#options COMPAT_12 # NetBSD 1.2,
#options COMPAT_13 # NetBSD 1.3,
#options COMPAT_14 # NetBSD 1.4,
#options COMPAT_43 # and 4.3BSD
#options COMPAT_386BSD_MBRPART # recognize old partition ID
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
# File systems
file-system FFS # UFS
#file-system EXT2FS # second extended file system (linux)
#file-system LFS # log-structured file system
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 FDESC # /dev/fd
file-system KERNFS # /kern
#file-system NULLFS # loopback file system
#file-system OVERLAY # overlay file system
#file-system PORTAL # portal filesystem (still experimental)
#file-system PROCFS # /proc
#file-system UMAPFS # NULLFS + uid and gid remapping
#file-system UNION # union file system
# File system options
#options QUOTA # UFS quotas
#options FFS_EI # FFS Endian Independant support
#options SOFTDEP # FFS soft updates support.
#options NFSSERVER # Network File System server
#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
# immutable) behave as system flags.
options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
options NFS_BOOT_RWSIZE=1024
# Networking options
#options GATEWAY # packet forwarding
options INET # IP + ICMP + TCP + UDP
#options INET6 # IPV6
#options IPSEC # IP security
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
#options IPSEC_DEBUG # debug for IP security
#options MROUTING # IP multicast routing
#options NS # XNS
#options NSIP # XNS tunneling over IP
#options ISO,TPIP # OSI
#options EON # OSI tunneling over IP
#options CCITT,LLC,HDLC # X.25
#options NETATALK # AppleTalk networking protocols
#options PPP_BSDCOMP # BSD-Compress compression support for PPP
#options PPP_DEFLATE # Deflate compression support for PPP
#options PPP_FILTER # Active filter support for PPP (requires bpf)
#options PFIL_HOOKS # pfil(9) packet filter hooks
#options IPFILTER_LOG # ipmon(8) log support
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
#options NMBCLUSTERS=1024
# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!
options PCIVERBOSE # verbose PCI device autoconfig messages
options MIIVERBOSE # verbose PHY autoconfig messages
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
#options SCSIVERBOSE # human readable SCSI error messages
#options PCI_NETBSD_CONFIGURE # Do not rely on BIOS/whatever to configure PCI devices
#options PCI_CONFIGURE_VERBOSE # Show PCI config information
# Kernel root file system and dump configuration.
#config netbsd root on ? type ?
config netbsd root on cs0 type nfs
#
# Device configuration
#
mainbus0 at root
cpu0 at mainbus0
# CPC700 controller
cpc0 at mainbus0
# TOD DS17485
rtc0 at mainbus0 addr 0x7ff00000
# Cirrus Logic Crystal CS89x0 Ethernet
cs0 at mainbus0 addr 0x7fe00000
flash0 at mainbus0 addr 0x70000000
# UARTs
com0 at cpc0 addr 0xff600300
com1 at cpc0 addr 0xff600400
# timer driver not implemented
cpctim0 at cpc0 addr 0xff650000
cpciic0 at cpc0 addr 0xff620000
cpciic1 at cpc0 addr 0xff630000
# CPC700 integrated PCI bridge
pci* at cpc0
pchb* at pci?
pci* at pchb?
pci* at ppb? bus ?
ppb* at pci? dev ? function ? # PCI-PCI bridges
#tlp* at pci? dev ? function ? # DECchip 21x4x and clones
#lxtphy* at mii? phy ? # Level One LXT-970 PHYs
#pseudo-device vnd 4 # disk-like interface to files
#pseudo-device md 1 # memory disk device
pseudo-device loop # network loopback
pseudo-device bpfilter 8 # packet filter
#pseudo-device ipfilter # IP filter (firewall) and NAT
#pseudo-device ppp 2 # Point-to-Point Protocol
#pseudo-device sl 2 # Serial Line IP
#pseudo-device tun 4 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
#pseudo-device vlan # IEEE 802.1q encapsulation
pseudo-device pty # pseudo-terminals
pseudo-device rnd # /dev/random and in-kernel generator

View File

@ -0,0 +1,90 @@
# $NetBSD: files.pmppc,v 1.1 2002/05/30 08:51:10 augustss Exp $
#
#
maxpartitions 16
maxusers 2 8 64
file arch/pmppc/pmppc/autoconf.c
file arch/pmppc/pmppc/bus_space.c
file arch/pmppc/pmppc/clock.c
file arch/pmppc/pmppc/conf.c
file arch/pmppc/pmppc/disksubr.c disk
file arch/pmppc/pmppc/extintr.c
file arch/pmppc/pmppc/machdep.c
file arch/pmppc/pmppc/procfs_machdep.c procfs
file arch/powerpc/powerpc/bus_dma.c
# General files
file dev/cons.c
#
# Machine-independent SCSI drivers
#
include "dev/scsipi/files.scsipi"
major {sd = 4}
major {cd = 6}
#
# Machine-independent ATA drivers
#
include "dev/ata/files.ata"
major {wd = 0}
#
# Memory Disk for install floppy
#
file dev/md_root.c memory_disk_hooks
major {md = 17}
#
# Compatibility modules
#
# OSS audio driver compatibility
include "compat/ossaudio/files.ossaudio"
# Linux binary compatibility (COMPAT_LINUX)
include "compat/linux/files.linux"
include "compat/linux/arch/powerpc/files.linux_powerpc"
file arch/powerpc/powerpc/linux_sigcode.S compat_linux
file arch/powerpc/powerpc/linux_trap.c compat_linux
#
# System bus types
#
define mainbus { [addr=-1], [irq=-1] }
device mainbus: mainbus, pcibus
attach mainbus at root
device cpu
attach cpu at mainbus
file arch/pmppc/pmppc/mainbus.c mainbus | cpu needs-flag
attach cs at mainbus with cs_mainbus
file arch/pmppc/dev/if_cs_mainbus.c cs_mainbus
device rtc
attach rtc at mainbus
file arch/pmppc/dev/ds17485.c rtc
device flash
attach flash at mainbus
file arch/pmppc/dev/flash.c flash
attach cpc at mainbus with cpc_mainbus
file arch/pmppc/dev/cpc_mainbus.c cpc_mainbus
include "dev/i2o/files.i2o"
include "dev/pci/files.pci"
file arch/pmppc/pci/pci_machdep.c pci
device pchb: pcibus
attach pchb at pci
file arch/pmppc/pci/pchb.c pchb
include "dev/wscons/files.wscons"
include "dev/wsfont/files.wsfont"
device isa { }
include "dev/sand/files.sand"

View File

@ -0,0 +1,16 @@
# $NetBSD: std.pmppc,v 1.1 2002/05/30 08:51:10 augustss Exp $
#
# standard, required NetBSD/pmppc 'options'
machine pmppc powerpc
options PPC_MPC6XX # Artesyn PMPPC uses Motorola PPC750 CPUs
makeoptions PPCDIR="mpc6xx" # Tell Makefile.powerpc what dir to use
# Executable support:
options EXEC_ELF32 # exec ELF binaries
options EXEC_SCRIPT # exec #! scripts
makeoptions TEXTADDR=0x40000
makeoptions NEED_BINARY=1

View File

@ -0,0 +1,25 @@
# $NetBSD: Makefile,v 1.1 2002/05/30 08:51:11 augustss Exp $
KDIR= /sys/arch/pmppc/include
INCSDIR= /usr/include/pmppc
INCS= ansi.h aout_machdep.h asm.h \
bswap.h bus.h \
cdefs.h conf.h cpu.h cpufunc.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 ipkdb.h \
kcore.h kgdb.h \
limits.h lock.h \
math.h \
param.h pcb.h pio.h pmap.h powerpc.h proc.h profile.h psl.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>

View File

@ -0,0 +1,3 @@
/* $NetBSD: ansi.h,v 1.1 2002/05/30 08:51:12 augustss Exp $ */
#include <powerpc/ansi.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: aout_machdep.h,v 1.1 2002/05/30 08:51:12 augustss Exp $ */
#include <powerpc/aout_machdep.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: asm.h,v 1.1 2002/05/30 08:51:13 augustss Exp $ */
#include <powerpc/asm.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: bswap.h,v 1.1 2002/05/30 08:51:13 augustss Exp $ */
#include <powerpc/bswap.h>

View File

@ -0,0 +1,20 @@
/* $NetBSD: bus.h,v 1.1 2002/05/30 08:51:14 augustss Exp $ */
#ifndef _PMPPC_BUS_H_
#define _PMPPC_BUS_H_
#include <powerpc/bus.h>
/*
* Address conversion as seen from a PCI master.
*/
#define PHYS_TO_PCI_MEM(x) (x)
#define PCI_MEM_TO_PHYS(x) (x)
extern const struct powerpc_bus_space pmppc_mem_tag;
extern const struct powerpc_bus_space pmppc_pci_io_tag;
void pmppc_bus_space_init(void);
void pmppc_bus_space_mallocok(void);
#endif /* _PMPPC_BUS_H_ */

View File

@ -0,0 +1,3 @@
/* $NetBSD: cdefs.h,v 1.1 2002/05/30 08:51:14 augustss Exp $ */
#include <powerpc/cdefs.h>

View File

@ -0,0 +1,50 @@
/* $NetBSD: conf.h,v 1.1 2002/05/30 08:51:15 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/conf.h>
bdev_decl(fd);
cdev_decl(fd);
cdev_decl(pc);
cdev_decl(mms);
cdev_decl(lms);
cdev_decl(joy);

View File

@ -0,0 +1,43 @@
/* $NetBSD: cpu.h,v 1.1 2002/05/30 08:51:15 augustss 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_
#ifdef _KERNEL
#define CPU_MAXNUM 1
extern char *bootpath;
#endif
#include <powerpc/cpu.h>
#endif /* _MACHINE_CPU_H_ */

View File

@ -0,0 +1,2 @@
/* $NetBSD: cpufunc.h,v 1.1 2002/05/30 08:51:16 augustss Exp $ */

View File

@ -0,0 +1,3 @@
/* $NetBSD: db_machdep.h,v 1.1 2002/05/30 08:51:16 augustss Exp $ */
#include <powerpc/db_machdep.h>

View File

@ -0,0 +1,55 @@
/* $NetBSD: disklabel.h,v 1.1 2002/05/30 08:51:16 augustss Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MACHINE_DISKLABEL_H_
#define _MACHINE_DISKLABEL_H_
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
#define MAXPARTITIONS 16 /* number of partitions */
#define RAW_PART 2 /* raw partition: wdNc */
/* Pull in MBR partition definitions. */
#include <sys/disklabel_mbr.h>
#include <sys/dkbad.h>
struct cpu_disklabel {
struct mbr_partition dosparts[NMBRPART];
struct dkbad bad;
};
#ifdef _KERNEL
struct disklabel;
int bounds_check_with_label(struct buf *, struct disklabel *, int);
#endif
#endif /* _MACHINE_DISKLABEL_H_ */

View File

@ -0,0 +1,3 @@
/* $NetBSD: elf_machdep.h,v 1.1 2002/05/30 08:51:17 augustss Exp $ */
#include <powerpc/elf_machdep.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: endian.h,v 1.1 2002/05/30 08:51:17 augustss Exp $ */
#include <sys/endian.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: endian_machdep.h,v 1.1 2002/05/30 08:51:18 augustss Exp $ */
#include <powerpc/endian_machdep.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: float.h,v 1.1 2002/05/30 08:51:18 augustss Exp $ */
#include <powerpc/float.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: fpu.h,v 1.1 2002/05/30 08:51:19 augustss Exp $ */
#include <powerpc/fpu.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: frame.h,v 1.1 2002/05/30 08:51:19 augustss Exp $ */
#include <powerpc/frame.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: ieee.h,v 1.1 2002/05/30 08:51:19 augustss Exp $ */
#include <powerpc/ieee.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: ieeefp.h,v 1.1 2002/05/30 08:51:20 augustss Exp $ */
#include <powerpc/ieeefp.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_const.h,v 1.1 2002/05/30 08:51:20 augustss Exp $ */
#include <powerpc/int_const.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_fmtio.h,v 1.1 2002/05/30 08:51:21 augustss Exp $ */
#include <powerpc/int_fmtio.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_limits.h,v 1.1 2002/05/30 08:51:21 augustss Exp $ */
#include <powerpc/int_limits.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_mwgwtypes.h,v 1.1 2002/05/30 08:51:21 augustss Exp $ */
#include <powerpc/int_mwgwtypes.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_types.h,v 1.1 2002/05/30 08:51:22 augustss Exp $ */
#include <powerpc/int_types.h>

View File

@ -0,0 +1,197 @@
/* $NetBSD: intr.h,v 1.1 2002/05/30 08:51:22 augustss 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 _PMPPC_INTR_H_
#define _PMPPC_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 setsoftclock(void);
void clearsoftclock(void);
int splsoftclock(void);
void setsoftnet(void);
void clearsoftnet(void);
int splsoftnet(void);
void do_pending_int(void);
void *intr_establish(int, int, int, int (*)(void *), void *);
void intr_disestablish(void *);
static __inline int splraise(int);
static __inline int spllower(int);
static __inline void splx(int);
static __inline void set_sint(int);
void softnet(int); /* Defined in machdep.c, used in extintr.c */
extern volatile int cpl, ipending, astpending, tickspending;
extern int imask[];
extern long intrcnt[];
/*
* Reorder protection in the following inline functions is
* protected with the "eieio" instruction.
*/
static __inline int
splraise(newcpl)
int newcpl;
{
int oldcpl;
__asm__ volatile("sync; eieio\n"); /* don't reorder.... */
oldcpl = cpl;
cpl = oldcpl | newcpl;
__asm__ volatile("sync; eieio\n"); /* reorder protect */
return(oldcpl);
}
static __inline void
splx(newcpl)
int newcpl;
{
__asm__ volatile("sync; eieio\n"); /* reorder protect */
cpl = newcpl;
if(ipending & ~newcpl)
do_pending_int();
__asm__ volatile("sync; eieio\n"); /* reorder protect */
}
static __inline int
spllower(newcpl)
int newcpl;
{
int oldcpl;
__asm__ volatile("sync; eieio\n"); /* reorder protect */
oldcpl = cpl;
cpl = newcpl;
if(ipending & ~newcpl)
do_pending_int();
__asm__ volatile("sync; eieio\n"); /* reorder protect */
return(oldcpl);
}
/* Following code should be implemented with lwarx/stwcx to avoid
* the disable/enable. i need to read the manual once more.... */
static __inline void
set_sint(pending)
int pending;
{
int msrsave;
__asm__ ("mfmsr %0" : "=r"(msrsave));
__asm__ volatile ("mtmsr %0" :: "r"(msrsave & ~PSL_EE));
ipending |= pending;
__asm__ volatile ("mtmsr %0" :: "r"(msrsave));
}
/*
* IBM CPC700 interrupts
*/
#define ICU_LEN 32
#define ICU_MASK 0x1f000fc0
#define LEGAL_IRQ(x) ((x) >= 0 && (x) <= 31 && (ICU_MASK & (0x80000000 >> (x))))
#define SINT_NET 0x20000000
#define SINT_CLOCK 0x40000000
#define SINT_SERIAL 0x80000000
#define SPL_CLOCK 0x00000001
#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_SERIAL)
#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 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 spl0() spllower(0)
#define splsched() splhigh()
#define spllock() splhigh()
#endif /* !_LOCORE */
#endif /* !_PMPPC_INTR_H_ */

View File

@ -0,0 +1,42 @@
/* $NetBSD: intrpriv.h,v 1.1 2002/05/30 08:51:23 augustss 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.
*/
#define CNT_SINT_NET 29
#define CNT_SINT_CLOCK 30
#define CNT_SINT_SERIAL 31
#define CNT_CLOCK 0

View File

@ -0,0 +1,3 @@
/* $NetBSD: ipkdb.h,v 1.1 2002/05/30 08:51:23 augustss Exp $ */
#include <powerpc/ipkdb.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: kcore.h,v 1.1 2002/05/30 08:51:23 augustss Exp $ */
#include <powerpc/kcore.h>

View File

@ -0,0 +1,80 @@
/* $NetBSD: kgdb.h,v 1.1 2002/05/30 08:51:24 augustss 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;
}

View File

@ -0,0 +1,3 @@
/* $NetBSD: limits.h,v 1.1 2002/05/30 08:51:24 augustss Exp $ */
#include <powerpc/limits.h>

View File

@ -0,0 +1,54 @@
/* $NetBSD: loadfile_machdep.h,v 1.1 2002/05/30 08:51:24 augustss Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#define BOOT_ELF32
#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)
#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
#define LOADADDR(a) (((u_long)(a)) + offset)
#define ALIGNENTRY(a) ((u_long)(a))
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
#define WARN(a) (void)(printf a, \
printf((errno ? ": %s\n" : "\n"), \
strerror(errno)))
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define FREE(a, b) free(a, b)

View File

@ -0,0 +1,4 @@
/* $NetBSD: lock.h,v 1.1 2002/05/30 08:51:25 augustss Exp $ */
/* Just use the common PowerPC definition */
#include <powerpc/lock.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: math.h,v 1.1 2002/05/30 08:51:25 augustss Exp $ */
#include <powerpc/math.h>

View File

@ -0,0 +1,50 @@
/* $NetBSD: param.h,v 1.1 2002/05/30 08:51:25 augustss 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 "pmppc"
#define __NO_FIXED_MSGBUF
#define KERNBASE 0x40000
#include <powerpc/param.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: pcb.h,v 1.1 2002/05/30 08:51:26 augustss Exp $ */
#include <powerpc/pcb.h>

View File

@ -0,0 +1,78 @@
/* $NetBSD: pci_machdep.h,v 1.1 2002/05/30 08:51:26 augustss 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 definitions for PCI autoconfiguration.
*/
/*
* be-specific PCI structure and type definitions.
* NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
*
* Configuration tag; created from a {bus,device,function} triplet by
* pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
* We could instead always pass the {bus,device,function} triplet to
* the read and write routines, but this would cause extra overhead.
*/
struct pci_attach_args; /* Forward declaration */
/*
* Types provided to machine-independent PCI code
*/
typedef void *pci_chipset_tag_t;
typedef int pcitag_t;
typedef int pci_intr_handle_t;
extern struct powerpc_bus_dma_tag pci_bus_dma_tag;
/*
* Functions provided to machine-independent PCI code.
*/
void pci_attach_hook(struct device *, struct device *,
struct pcibus_attach_args *);
int pci_bus_maxdevs(pci_chipset_tag_t, int);
pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
void pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
int *, int *, int *);
pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);
int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
int, int (*)(void *), void *);
void pci_intr_disestablish(pci_chipset_tag_t, void *);
#define pci_enumerate_bus(sc, m, p) \
pci_enumerate_bus_generic((sc), (m), (p))

View File

@ -0,0 +1,3 @@
/* $NetBSD: pio.h,v 1.1 2002/05/30 08:51:27 augustss Exp $ */
#include <powerpc/pio.h>

View File

@ -0,0 +1,7 @@
/* $NetBSD: pmap.h,v 1.1 2002/05/30 08:51:27 augustss Exp $ */
#ifndef OLDPMAP
#include <powerpc/mpc6xx/pmap.h>
#else
#include <powerpc/pmap.h>
#endif

View File

@ -0,0 +1,53 @@
/* $NetBSD: powerpc.h,v 1.1 2002/05/30 08:51:28 augustss 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(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(void) __attribute__((__noreturn__));
void ppc_boot(char *bootspec) __attribute__((__noreturn__));
extern int booted_partition;
#endif /* _MACHINE_POWERPC_H_ */

View File

@ -0,0 +1,3 @@
/* $NetBSD: proc.h,v 1.1 2002/05/30 08:51:29 augustss Exp $ */
#include <powerpc/proc.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: profile.h,v 1.1 2002/05/30 08:51:29 augustss Exp $ */
#include <powerpc/profile.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: psl.h,v 1.1 2002/05/30 08:51:30 augustss Exp $ */
#include <powerpc/psl.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: pte.h,v 1.1 2002/05/30 08:51:30 augustss Exp $ */
#include <powerpc/pte.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: ptrace.h,v 1.1 2002/05/30 08:51:30 augustss Exp $ */
#include <powerpc/ptrace.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: reg.h,v 1.1 2002/05/30 08:51:31 augustss Exp $ */
#include <powerpc/reg.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: reloc.h,v 1.1 2002/05/30 08:51:31 augustss Exp $ */
#include <powerpc/reloc.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: rnd.h,v 1.1 2002/05/30 08:51:31 augustss Exp $ */
#include <powerpc/rnd.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: setjmp.h,v 1.1 2002/05/30 08:51:31 augustss Exp $ */
#include <powerpc/setjmp.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: signal.h,v 1.1 2002/05/30 08:51:32 augustss Exp $ */
#include <powerpc/signal.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: stdarg.h,v 1.1 2002/05/30 08:51:32 augustss Exp $ */
#include <powerpc/stdarg.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: trap.h,v 1.1 2002/05/30 08:51:33 augustss Exp $ */
#include <powerpc/trap.h>

View File

@ -0,0 +1,5 @@
/* $NetBSD: types.h,v 1.1 2002/05/30 08:51:34 augustss Exp $ */
#include <powerpc/types.h>
#define __HAVE_NWSCONS

View File

@ -0,0 +1,3 @@
/* $NetBSD: varargs.h,v 1.1 2002/05/30 08:51:34 augustss Exp $ */
#include <powerpc/varargs.h>

View File

@ -0,0 +1,103 @@
/* $NetBSD: vmparam.h,v 1.1 2002/05/30 08:51:35 augustss Exp $ */
#ifndef OLDPMAP
#include <powerpc/mpc6xx/vmparam.h>
#else
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MACHINE_VMPARAM_H_
#define _MACHINE_VMPARAM_H_
#define USRTEXT NBPG
#define USRSTACK VM_MAXUSER_ADDRESS
#ifndef MAXTSIZ
#define MAXTSIZ (64*1024*1024) /* max text size */
#endif
#ifndef DFLDSIZ
#define DFLDSIZ (128*1024*1024) /* default data size */
#endif
#ifndef MAXDSIZ
#define MAXDSIZ (1*1024*1024*1024) /* max data size */
#endif
#ifndef DFLSSIZ
#define DFLSSIZ (2*1024*1024) /* default stack size */
#endif
#ifndef MAXSSIZ
#define MAXSSIZ (32*1024*1024) /* max stack size */
#endif
/*
* Size of shared memory map
*/
#ifndef SHMMAXPGS
#define SHMMAXPGS 1024
#endif
/*
* Size of User Raw I/O map
*/
#define USRIOSIZE 1024
/*
* Would like to have MAX addresses = 0, but this doesn't (currently) work
*/
#define VM_MIN_ADDRESS ((vaddr_t)0)
#define VM_MAXUSER_ADDRESS ((vaddr_t)0xfffff000)
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)(KERNEL_SR << ADDR_SR_SHFT))
#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + SEGMENT_LENGTH - 1)
#define VM_PHYS_SIZE (USRIOSIZE * NBPG)
#define __HAVE_PMAP_PHYSSEG
#ifndef _LOCORE
struct pmap_physseg {
struct pv_entry *pvent;
char *attrs;
};
#endif
#define VM_PHYSSEG_MAX 32
#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
#define VM_NFREELIST 1
#define VM_FREELIST_DEFAULT 0
#endif /* _MACHINE_VMPARAM_H_ */
#endif

105
sys/arch/pmppc/pci/pchb.c Normal file
View File

@ -0,0 +1,105 @@
/* $NetBSD: pchb.c,v 1.1 2002/05/30 08:51:36 augustss 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 "pci.h"
#include "opt_pci.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#include <machine/bus.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#include <dev/pci/pciconf.h>
static int pchbmatch(struct device *, struct cfdata *, void *);
static void pchbattach(struct device *, struct device *, void *);
struct cfattach pchb_ca = {
sizeof(struct device), pchbmatch, pchbattach
};
static int
pchbmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct pci_attach_args *pa = aux;
u_int32_t class, id;
class = pa->pa_class;
id = pa->pa_id;
/*
* Match all known PCI host chipsets.
*/
if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) {
switch (PCI_VENDOR(id)) {
case PCI_VENDOR_HEURICON:
switch (PCI_PRODUCT(id)) {
case PCI_PRODUCT_HEURICON_PMPPC:
return (1);
}
break;
}
}
return (0);
}
static void
pchbattach(struct device *parent, struct device *self, void *aux)
{
struct pci_attach_args *pa = aux;
char devinfo[256];
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));
}

View File

@ -0,0 +1,236 @@
/* $NetBSD: pci_machdep.c,v 1.1 2002/05/30 08:51:36 augustss 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.
*
* The configuration method can be hard-coded in the config file by
* using `options PCI_CONF_MODE=N', where `N' is the configuration mode
* as defined section 3.6.4.1, `Generating Configuration Cycles'.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <uvm/uvm.h>
#define _POWERPC_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/pio.h>
#include <machine/intr.h>
#include <dev/ic/cpc700reg.h>
#include <machine/pmppc.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pciconf.h>
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,
};
void
pci_attach_hook(struct device *parent, struct device *self,
struct pcibus_attach_args *pba)
{
}
int
pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
{
/*
* Bus number is irrelevant. Configuration Mechanism 1 is in
* use, can have devices 0-32 (i.e. the `normal' range).
*/
return (32);
}
pcitag_t
pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
{
pcitag_t tag;
if (bus >= 256 || device >= 32 || function >= 8)
panic("pci_make_tag: bad request");
tag = CPC_PCI_CONFIG_ENABLE |
(bus << 16) | (device << 11) | (function << 8);
return (tag);
}
void
pci_decompose_tag(pci_chipset_tag_t pc, 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;
}
#define SP_PCI(tag, reg) ((tag) | (reg))
pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
pcireg_t data;
/*printf("pci_conf_read %x %x\n", tag, reg);*/
out32rb(CPC_PCICFGADR, SP_PCI(tag, reg));
data = in32rb(CPC_PCICFGDATA);
/*out32rb(CPC_PCICFGADR, 0);*/
return data;
}
void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
/*printf("pci_conf_write %x %x %x\n", tag, reg, data);*/
out32rb(CPC_PCICFGADR, SP_PCI(tag, reg));
out32rb(CPC_PCICFGDATA, data);
/*out32rb(CPC_PCICFGADR, 0);*/
}
int
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;
}
if (line == 255) {
printf("pci_intr_map: no mapping for pin %c\n", '@' + pin);
goto bad;
}
printf("pci_intr_map pin=%d line=%d\n", pin, line);
switch (line & 3) { /* XXX what should this be? */
case 0: *ihp = PMPPC_I_BPMC_INTA; break;
case 1: *ihp = PMPPC_I_BPMC_INTB; break;
case 2: *ihp = PMPPC_I_BPMC_INTC; break;
case 3: *ihp = PMPPC_I_BPMC_INTD; break;
}
return 0;
bad:
*ihp = -1;
return 1;
}
const char *
pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
{
static char irqstr[8]; /* 4 + 2 + NULL + sanity */
if (ih < 0 || ih >= ICU_LEN)
panic("pci_intr_string: bogus handle 0x%x\n", ih);
sprintf(irqstr, "irq %d", ih);
return (irqstr);
}
const struct evcnt *
pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
{
/* XXX for now, no evcnt parent reported */
return NULL;
}
void *
pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
int (*func)(void *), void *arg)
{
/*
* ih is the value assigned in pci_intr_map(), above.
*/
return intr_establish(ih, IST_LEVEL, level, func, arg);
}
void
pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
{
intr_disestablish(cookie);
}
void
pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin, int swiz,
int *iline)
{
int i;
printf("pci_conf_interrupt dev=%d pin=%d swiz=%d\n", dev, pin, swiz);
if (bus == 0) {
i = dev;
} else {
i = ((swiz + dev + 3) & 3);
}
*iline = i;
}

View File

@ -0,0 +1,142 @@
/* $NetBSD: autoconf.c,v 1.1 2002/05/30 08:51:37 augustss 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 <powerpc/mpc6xx/pte.h>
struct device *booted_device;
int booted_partition;
void findroot(void);
void disable_intr(void);
void enable_intr(void);
/*
* Determine i/o configuration for a machine.
*/
void
cpu_configure()
{
/* startrtclock(); */
disable_intr();
if (config_rootfound("mainbus", NULL) == NULL)
panic("configure: mainbus not configured");
printf("biomask %x netmask %x ttymask %x serialmask %x\n",
imask[IPL_BIO] & ICU_MASK,
imask[IPL_NET] & ICU_MASK, imask[IPL_TTY] & ICU_MASK,
imask[IPL_SERIAL] & ICU_MASK);
enable_intr();
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 */
/* XXX remove? */
/*
* 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 i, majdev, unit, part;
struct device *dv;
char buf[32];
#if 0
printf("howto %x bootdev %x ", boothowto, bootdev);
#endif
if ((bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
if (majdev == dev_name2blk[i].d_maj)
break;
if (dev_name2blk[i].d_name == NULL)
return;
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
sprintf(buf, "%s%d", dev_name2blk[i].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;
}
}
}

View File

@ -0,0 +1,191 @@
/* $NetBSD: clock.c,v 1.1 2002/05/30 08:51:38 augustss 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 <uvm/uvm_extern.h>
#include <machine/pio.h>
#include <machine/intrpriv.h>
u_long ticks_per_sec;
static u_long ns_per_tick;
static long ticks_per_intr;
static volatile u_long lasttb;
void decr_intr(struct clockframe *); /* Called from trap_subr.S */
static inline u_quad_t mftb(void);
void
decr_intr(struct clockframe *frame)
{
u_long tb;
long tick;
int nticks;
int pri, msr;
#if 1
{
#define XXSHFT 7
extern void setleds(int);
int csr, cer;
csr = in32(0xff500880);
cer = in32(0xff500888);
/*x = in32(0xff500898);*/
setleds(((cer >> XXSHFT) & 3) | (((csr >> XXSHFT) & 3) << 2));
}
#endif
/*
* 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 ("mfdec %0" : "=r"(tick));
for (nticks = 0; tick < 0; nticks++)
tick += ticks_per_intr;
asm volatile ("mtdec %0" :: "r"(tick));
uvmexp.intrs++;
intrcnt[CNT_CLOCK]++;
pri = splclock();
if (pri & SPL_CLOCK) {
tickspending += nticks;
} else {
nticks += tickspending;
tickspending = 0;
/*
* lasttb is used during microtime. Set it to the virtual
* start of this tick interval.
*/
asm ("mftb %0" : "=r"(tb));
lasttb = tb + tick - ticks_per_intr;
/*
* 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);
}
void
cpu_initclocks(void)
{
ticks_per_intr = ticks_per_sec / hz;
ns_per_tick = 1000000000 / ticks_per_sec;
asm volatile ("mftb %0" : "=r"(lasttb));
asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
}
static __inline u_quad_t
mftb(void)
{
u_long scratch;
u_quad_t tb;
asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b"
: "=r"(tb), "=r"(scratch));
return tb;
}
/*
* Fill in *tvp with current time with microsecond resolution.
*/
void
microtime(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(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));
}
/*
* Nothing to do.
*/
void
setstatclockrate(int arg)
{
/* Do nothing */
}

356
sys/arch/pmppc/pmppc/conf.c Normal file
View File

@ -0,0 +1,356 @@
/* $NetBSD: conf.c,v 1.1 2002/05/30 08:51:38 augustss 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.
*/
#include "opt_compat_svr4.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/vnode.h>
#include "wd.h"
bdev_decl(wd);
bdev_decl(sw);
#include "sd.h"
bdev_decl(sd);
#include "st.h"
bdev_decl(st);
#include "cd.h"
bdev_decl(cd);
#include "vnd.h"
bdev_decl(vnd);
#include "ccd.h"
bdev_decl(ccd);
#include "md.h"
bdev_decl(md);
#include "raid.h"
bdev_decl(raid);
struct bdevsw bdevsw[] =
{
bdev_notdef(), /* 0: ST506/ESDI/IDE disk */
bdev_swap_init(1,sw), /* 1: swap pseudo-device */
bdev_notdef(), /* 2: floppy diskette */
bdev_notdef(), /* 3: QIC-02/QIC-36 tape */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
bdev_notdef(), /* 7: Mitsumi CD-ROM */
bdev_lkm_dummy(), /* 8 */
bdev_lkm_dummy(), /* 9 */
bdev_lkm_dummy(), /* 10 */
bdev_lkm_dummy(), /* 11 */
bdev_lkm_dummy(), /* 12 */
bdev_lkm_dummy(), /* 13 */
bdev_disk_init(NVND,vnd), /* 14: vnode disk driver */
bdev_notdef(), /* 15: Sony CD-ROM */
bdev_disk_init(NCCD,ccd), /* 16: concatenated disk driver */
bdev_disk_init(NMD,md), /* 17: memory disk driver */
bdev_disk_init(NRAID,raid), /* 18: RAIDframe disk driver */
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#include "isdn.h"
#include "isdnctl.h"
#include "isdntrc.h"
#include "isdnbchan.h"
#include "isdntel.h"
cdev_decl(isdn);
cdev_decl(isdnctl);
cdev_decl(isdntrc);
cdev_decl(isdnbchan);
cdev_decl(isdntel);
cdev_decl(cn);
cdev_decl(ctty);
#define mmread mmrw
#define mmwrite mmrw
cdev_decl(mm);
cdev_decl(wd);
cdev_decl(sw);
#include "pty.h"
#define ptstty ptytty
#define ptsioctl ptyioctl
cdev_decl(pts);
#define ptctty ptytty
#define ptcioctl ptyioctl
cdev_decl(ptc);
cdev_decl(log);
#include "com.h"
cdev_decl(com);
cdev_decl(scd);
/*#include "pc.h"
cdev_decl(pc); */
cdev_decl(sd);
cdev_decl(st);
#include "ss.h"
cdev_decl(ss);
#include "uk.h"
cdev_decl(uk);
cdev_decl(cd);
#include "ch.h"
cdev_decl(ch);
dev_decl(filedesc,open);
#include "bpfilter.h"
cdev_decl(bpf);
cdev_decl(md);
/* #include "mms.h"
cdev_decl(mms);
#include "lms.h"
cdev_decl(lms); */
#include "cy.h"
cdev_decl(cy);
cdev_decl(mcd);
#include "tun.h"
cdev_decl(tun);
cdev_decl(vnd);
#include "audio.h"
cdev_decl(audio);
cdev_decl(svr4_net);
cdev_decl(ccd);
cdev_decl(raid);
#include "ipfilter.h"
#include "rnd.h"
#include "wsdisplay.h"
cdev_decl(wsdisplay);
#include "wskbd.h"
cdev_decl(wskbd);
#include "wsmouse.h"
cdev_decl(wsmouse);
#include "wsmux.h"
cdev_decl(wsmux);
#include "scsibus.h"
cdev_decl(scsibus);
#include "clockctl.h"
cdev_decl(clockctl);
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
cdev_ctty_init(1,ctty), /* 1: controlling terminal */
cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
cdev_notdef(), /* 3: ST506/ESDI/IDE disk */
cdev_swap_init(1,sw), /* 4: /dev/drum (swap pseudo-device) */
cdev_tty_init(NPTY,pts), /* 5: pseudo-tty slave */
cdev_ptc_init(NPTY,ptc), /* 6: pseudo-tty master */
cdev_log_init(1,log), /* 7: /dev/klog */
cdev_tty_init(NCOM,com), /* 8: serial port */
cdev_notdef(), /* 9: floppy disk */
cdev_notdef(), /* 10: QIC-02/QIC-36 tape */
cdev_notdef(), /* 11: Sony CD-ROM */
cdev_notdef(), /* 12 */
cdev_disk_init(NSD,sd), /* 13: SCSI disk */
cdev_tape_init(NST,st), /* 14: SCSI tape */
cdev_disk_init(NCD,cd), /* 15: SCSI CD-ROM */
cdev_notdef(), /* 16: parallel printer */
cdev_ch_init(NCH,ch), /* 17: SCSI autochanger */
cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */
cdev_scanner_init(NSS,ss), /* 19: SCSI scanner */
cdev_uk_init(NUK,uk), /* 20: SCSI unknown */
cdev_notdef(), /* 21: */
cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */
cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */
cdev_disk_init(NMD,md), /* 24: memory disk driver */
cdev_notdef(), /* 25 */
cdev_notdef(), /* 26 */
cdev_notdef(), /* 27: PC speaker */
cdev_lkm_init(NLKM,lkm), /* 28: loadable module driver */
cdev_lkm_dummy(), /* 29 */
cdev_lkm_dummy(), /* 30 */
cdev_lkm_dummy(), /* 31 */
cdev_lkm_dummy(), /* 32 */
cdev_lkm_dummy(), /* 33 */
cdev_lkm_dummy(), /* 34 */
cdev_notdef(), /* 35: Microsoft mouse */
cdev_notdef(), /* 36: Logitech mouse */
cdev_notdef(), /* 37: PS/2 mouse */
cdev_tty_init(NCY,cy), /* 38: Cyclom serial port */
cdev_notdef(), /* 39: Mitsumi CD-ROM */
cdev_bpftun_init(NTUN,tun), /* 40: network tunnel */
cdev_disk_init(NVND,vnd), /* 41: vnode disk driver */
cdev_audio_init(NAUDIO,audio), /* 42: generic audio I/O */
#ifdef COMPAT_SVR4
cdev_svr4_net_init(1,svr4_net), /* 43: svr4 net pseudo-device */
#else
cdev_notdef(), /* 43 */
#endif
cdev_ipf_init(NIPFILTER,ipl), /* 44: ip-filter device */
cdev_notdef(), /* 45: planetconnect satlink */
cdev_rnd_init(NRND,rnd), /* 46: random source pseudo-device */
cdev_wsdisplay_init(NWSDISPLAY,
wsdisplay), /* 47: frame buffers, etc. */
cdev_mouse_init(NWSKBD, wskbd), /* 48: ws keyboards */
cdev_mouse_init(NWSMOUSE,
wsmouse), /* 49: ws mice */
cdev_scsibus_init(NSCSIBUS,scsibus), /* 50: SCSI bus */
cdev_disk_init(NRAID,raid), /* 51: RAIDframe disk driver */
cdev_mouse_init(NWSMUX, wsmux), /* 52: ws multiplexor */
cdev_isdn_init(NISDN, isdn), /* 53: isdn main device */
cdev_isdnctl_init(NISDNCTL, isdnctl), /* 54: isdn control device */
cdev_isdnbchan_init(NISDNBCHAN, isdnbchan), /* 55: isdn raw b-channel access */
cdev_isdntrc_init(NISDNTRC, isdntrc), /* 56: isdn trace device */
cdev_isdntel_init(NISDNTEL, isdntel), /* 57: isdn phone device */
cdev_clockctl_init(NCLOCKCTL, clockctl),/* 58: clockctl pseudo device */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
int mem_no = 2; /* major device number of memory special file */
/*
* Swapdev is a fake device implemented
* in sw.c used only internally to get to swstrategy.
* It cannot be provided to the users, because the
* swstrategy routine munches the b_dev and b_blkno entries
* before calling the appropriate driver. This would horribly
* confuse, e.g. the hashing routines. Instead, /dev/drum is
* provided as a character (raw) device.
*/
dev_t swapdev = makedev(1, 0);
/*
* Returns true if dev is /dev/mem or /dev/kmem.
*/
int
iskmemdev(dev)
dev_t dev;
{
return (major(dev) == mem_no && (minor(dev) < 2 || minor(dev) == 14));
}
/*
* Returns true if dev is /dev/zero.
*/
int
iszerodev(dev)
dev_t dev;
{
return (major(dev) == mem_no && minor(dev) == 12);
}
static int chrtoblktbl[] = {
/* XXXX This needs to be dynamic for LKMs. */
/*VCHR*/ /*VBLK*/
/* 0 */ NODEV,
/* 1 */ NODEV,
/* 2 */ NODEV,
/* 3 */ 0,
/* 4 */ NODEV,
/* 5 */ NODEV,
/* 6 */ NODEV,
/* 7 */ NODEV,
/* 8 */ NODEV,
/* 9 */ 2,
/* 10 */ 3,
/* 11 */ 15,
/* 12 */ NODEV,
/* 13 */ 4,
/* 14 */ 5,
/* 15 */ 6,
/* 16 */ NODEV,
/* 17 */ NODEV,
/* 18 */ 16,
/* 19 */ NODEV,
/* 20 */ NODEV,
/* 21 */ NODEV,
/* 22 */ NODEV,
/* 23 */ NODEV,
/* 24 */ 17,
/* 25 */ NODEV,
/* 26 */ NODEV,
/* 27 */ NODEV,
/* 28 */ NODEV,
/* 29 */ NODEV,
/* 30 */ NODEV,
/* 31 */ NODEV,
/* 32 */ NODEV,
/* 33 */ NODEV,
/* 34 */ NODEV,
/* 35 */ NODEV,
/* 36 */ NODEV,
/* 37 */ NODEV,
/* 38 */ NODEV,
/* 39 */ 7,
/* 40 */ NODEV,
/* 41 */ 14,
/* 42 */ NODEV,
/* 43 */ NODEV,
/* 44 */ NODEV,
/* 45 */ NODEV,
/* 46 */ NODEV,
/* 47 */ NODEV,
/* 48 */ NODEV,
/* 49 */ NODEV,
/* 50 */ NODEV,
/* 51 */ 18,
/* 52 */ NODEV,
/* 53 */ NODEV,
/* 54 */ NODEV,
/* 55 */ NODEV,
/* 56 */ NODEV,
/* 57 */ NODEV,
/* 58 */ NODEV,
};
/*
* Convert a character device number to a block device number.
*/
dev_t
chrtoblk(dev)
dev_t dev;
{
int blkmaj;
if (major(dev) >= nchrdev)
return (NODEV);
blkmaj = chrtoblktbl[major(dev)];
if (blkmaj == NODEV)
return (NODEV);
return (makedev(blkmaj, minor(dev)));
}

View File

@ -0,0 +1,507 @@
/* $NetBSD: disksubr.c,v 1.1 2002/05/30 08:51:38 augustss Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/syslog.h>
#include "opt_mbr.h"
int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32,
MBR_PTYPE_FAT32L, MBR_PTYPE_FAT16L,
-1 };
#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1)
static struct mbr_partition *
mbr_findslice(struct mbr_partition* dp, struct buf *bp);
/*
* Scan MBR for NetBSD partittion. Return NO_MBR_SIGNATURE if no MBR found
* Otherwise, copy valid MBR partition-table into dp, and if a NetBSD
* partition is found, return a pointer to it; else return NULL.
*/
static
struct mbr_partition *
mbr_findslice(struct mbr_partition *dp, struct buf *bp)
{
struct mbr_partition *ourdp = NULL;
u_int16_t *mbrmagicp;
int i;
/* Note: Magic number is little-endian. */
mbrmagicp = (u_int16_t *)(bp->b_data + MBR_MAGICOFF);
if (*mbrmagicp != MBR_MAGIC)
return (NO_MBR_SIGNATURE);
/* XXX how do we check veracity/bounds of this? */
memcpy(dp, bp->b_data + MBR_PARTOFF, NMBRPART * sizeof(*dp));
/* look for NetBSD partition */
for (i = 0; i < NMBRPART; i++) {
if (dp[i].mbrp_typ == MBR_PTYPE_NETBSD) {
ourdp = &dp[i];
break;
}
}
#ifdef COMPAT_386BSD_MBRPART
/* didn't find it -- look for 386BSD partition */
if (!ourdp) {
for (i = 0; i < NMBRPART; i++) {
if (dp[i].mbrp_typ == MBR_PTYPE_386BSD) {
printf("WARNING: old BSD partition ID!\n");
ourdp = &dp[i];
/*
* If more than one matches, take last,
* as NetBSD install tool does.
*/
#if 0
break;
#endif
}
}
}
#endif /* COMPAT_386BSD_MBRPART */
return (ourdp);
}
/*
* Attempt to read a disk label from a device
* using the indicated strategy routine.
* The label must be partly set up before this:
* secpercyl, secsize and anything required for a block i/o read
* operation in the driver's strategy/start routines
* must be filled in before calling us.
*
* If dos partition table requested, attempt to load it and
* find disklabel inside a DOS partition. Also, if bad block
* table needed, attempt to extract it as well. Return buffer
* for use in signalling errors if requested.
*
* Returns null on success and an error string on failure.
*/
char *
readdisklabel(dev_t dev,
void (*strat)(struct buf *),
struct disklabel *lp,
struct cpu_disklabel *osdep)
{
struct mbr_partition *dp;
struct partition *pp;
struct dkbad *bdp;
struct buf *bp;
struct disklabel *dlp;
char *msg = NULL;
int dospartoff, cyl, i, *ip;
/* minimal requirements for archtypal disk label */
if (lp->d_secsize == 0)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
#if 0
if (lp->d_ncylinders == 16383) {
printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors;
printf("%d/%d/%d\n",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
}
#endif
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < RAW_PART; i++) {
lp->d_partitions[i].p_size = 0;
lp->d_partitions[i].p_offset = 0;
}
if (lp->d_partitions[i].p_size == 0)
lp->d_partitions[i].p_size = 0x1fffffff;
lp->d_partitions[i].p_offset = 0;
/* get a buffer and initialize it */
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
/* do dos partitions in the process of getting disklabel? */
dospartoff = 0;
cyl = LABELSECTOR / lp->d_secpercyl;
if (!osdep)
goto nombrpart;
dp = osdep->dosparts;
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
/* if successful, wander through dos partition table */
if (biowait(bp)) {
msg = "dos partition I/O error";
goto done;
} else {
struct mbr_partition *ourdp = NULL;
ourdp = mbr_findslice(dp, bp);
if (ourdp == NO_MBR_SIGNATURE)
goto nombrpart;
for (i = 0; i < NMBRPART; i++, dp++) {
/* Install in partition e, f, g, or h. */
pp = &lp->d_partitions[RAW_PART + 1 + i];
pp->p_offset = dp->mbrp_start;
pp->p_size = dp->mbrp_size;
for (ip = fat_types; *ip != -1; ip++) {
if (dp->mbrp_typ == *ip)
pp->p_fstype = FS_MSDOS;
}
if (dp->mbrp_typ == MBR_PTYPE_LNXEXT2)
pp->p_fstype = FS_EX2FS;
if (dp->mbrp_typ == MBR_PTYPE_NTFS)
pp->p_fstype = FS_NTFS;
/* is this ours? */
if (dp == ourdp) {
/* need sector address for SCSI/IDE,
cylinder for ESDI/ST506/RLL */
dospartoff = dp->mbrp_start;
cyl = MBR_PCYL(dp->mbrp_scyl, dp->mbrp_ssect);
/* update disklabel with details */
lp->d_partitions[2].p_size =
dp->mbrp_size;
lp->d_partitions[2].p_offset =
dp->mbrp_start;
#if 0
if (lp->d_ntracks != dp->mbrp_ehd + 1 ||
lp->d_nsectors != DPSECT(dp->mbrp_esect)) {
printf("disklabel: BIOS sees chs %d/%d/%d as ",
lp->d_ncylinders, lp->d_ntracks,
lp->d_nsectors);
lp->d_ntracks = dp->mbrp_ehd + 1;
lp->d_nsectors = DPSECT(dp->mbrp_esect);
lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
lp->d_ncylinders = lp->d_secperunit / lp->d_secpercyl;
if (! lp->d_ncylinders)
lp->d_ncylinders = 1;
printf("%d/%d/%d\n",
lp->d_ncylinders, lp->d_ntracks,
lp->d_nsectors);
}
#endif
}
}
lp->d_npartitions = RAW_PART + 1 + i;
}
nombrpart:
/* next, dig out disk label */
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
if (biowait(bp)) {
msg = "disk label I/O error";
goto done;
}
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
if (msg == NULL)
msg = "no disk label";
} else if (dlp->d_npartitions > MAXPARTITIONS ||
dkcksum(dlp) != 0)
msg = "disk label corrupted";
else {
*lp = *dlp;
msg = NULL;
break;
}
}
if (msg)
goto done;
/* obtain bad sector table if requested and present */
if (osdep && (lp->d_flags & D_BADSECT)) {
struct dkbad *db;
bdp = &osdep->bad;
i = 0;
do {
/* read a bad sector table */
bp->b_flags = B_BUSY | B_READ;
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
if (lp->d_secsize > DEV_BSIZE)
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
else
bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
bp->b_bcount = lp->d_secsize;
bp->b_cylinder = lp->d_ncylinders - 1;
(*strat)(bp);
/* if successful, validate, otherwise try another */
if (biowait(bp)) {
msg = "bad sector table I/O error";
} else {
db = (struct dkbad *)(bp->b_data);
#define DKBAD_MAGIC 0x4321
if (db->bt_mbz == 0
&& db->bt_flag == DKBAD_MAGIC) {
msg = NULL;
*bdp = *db;
break;
} else
msg = "bad sector table corrupted";
}
} while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
i < lp->d_nsectors);
}
done:
bp->b_flags |= B_INVAL;
brelse(bp);
return (msg);
}
/*
* Check new disk label for sensibility
* before setting it.
*/
int
setdisklabel(struct disklabel *olp,
struct disklabel *nlp,
u_long openmask,
struct cpu_disklabel *osdep)
{
int i;
struct partition *opp, *npp;
/* sanity clause */
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
|| (nlp->d_secsize % DEV_BSIZE) != 0)
return(EINVAL);
/* special case to allow disklabel to be invalidated */
if (nlp->d_magic == 0xffffffff) {
*olp = *nlp;
return (0);
}
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
dkcksum(nlp) != 0)
return (EINVAL);
/* XXX missing check if other dos partitions will be overwritten */
while (openmask != 0) {
i = ffs(openmask) - 1;
openmask &= ~(1 << i);
if (nlp->d_npartitions <= i)
return (EBUSY);
opp = &olp->d_partitions[i];
npp = &nlp->d_partitions[i];
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
return (EBUSY);
/*
* Copy internally-set partition information
* if new label doesn't include it. XXX
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
npp->p_fsize = opp->p_fsize;
npp->p_frag = opp->p_frag;
npp->p_cpg = opp->p_cpg;
}
}
nlp->d_checksum = 0;
nlp->d_checksum = dkcksum(nlp);
*olp = *nlp;
return (0);
}
/*
* Write disk label back to device after modification.
*/
int
writedisklabel(dev_t dev,
void (*strat)(struct buf *),
struct disklabel *lp,
struct cpu_disklabel *osdep)
{
struct mbr_partition *dp;
struct buf *bp;
struct disklabel *dlp;
int error, dospartoff, cyl;
/* get a buffer and initialize it */
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
/* do dos partitions in the process of getting disklabel? */
dospartoff = 0;
cyl = LABELSECTOR / lp->d_secpercyl;
if (!osdep)
goto nombrpart;
dp = osdep->dosparts;
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
if ((error = biowait(bp)) == 0) {
struct mbr_partition *ourdp = NULL;
ourdp = mbr_findslice(dp, bp);
if (ourdp == NO_MBR_SIGNATURE)
goto nombrpart;
if (ourdp) {
/* need sector address for SCSI/IDE,
cylinder for ESDI/ST506/RLL */
dospartoff = ourdp->mbrp_start;
cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect);
}
}
nombrpart:
#ifdef maybe
/* disklabel in appropriate location? */
if (lp->d_partitions[2].p_offset != 0
&& lp->d_partitions[2].p_offset != dospartoff) {
error = EXDEV;
goto done;
}
#endif
/* next, dig out disk label */
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
if ((error = biowait(bp)) != 0)
goto done;
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
*dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
goto done;
}
}
error = ESRCH;
done:
bp->b_flags |= B_INVAL;
brelse(bp);
return (error);
}
/*
* Determine the size of the transfer, and make sure it is
* within the boundaries of the partition. Adjust transfer
* if needed, and signal errors or early completion.
*/
int
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
{
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
int sz;
sz = howmany(bp->b_bcount, lp->d_secsize);
if (bp->b_blkno + sz > p->p_size) {
sz = p->p_size - bp->b_blkno;
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
bp->b_error = EINVAL;
goto bad;
}
/* Otherwise, truncate request. */
bp->b_bcount = sz << DEV_BSHIFT;
}
/* Overwriting disk label? */
if (bp->b_blkno + p->p_offset <= labelsector &&
#if LABELSECTOR != 0
bp->b_blkno + p->p_offset + sz > labelsector &&
#endif
(bp->b_flags & B_READ) == 0 && !wlabel) {
bp->b_error = EROFS;
goto bad;
}
/* calculate cylinder for disksort to order transfers with */
bp->b_cylinder = (bp->b_blkno + p->p_offset) /
(lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
return (1);
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
}

View File

@ -0,0 +1,95 @@
/* $NetBSD: kgdb_glue.c,v 1.1 2002/05/30 08:51:39 augustss 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/cdefs.h>
#include <sys/param.h>
#include <kgdb/kgdb.h>
#include <machine/frame.h>
#include <machine/kgdb.h>
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/trap.h>
int kgdbregs[NREG];
#ifdef KGDBUSERHACK
int kgdbsr; /* TEMPRORARY (Really needs some better mechanism) XXX */
int savesr;
#endif
void
kgdbinit()
{
}
int
kgdb_poll()
{
/* for now: */
return 0;
}
int
kgdb_trap_glue(frame)
struct trapframe *frame;
{
if (!(frame->srr1 & PSL_PR)
&& (frame->exc == EXC_TRC
|| (frame->exc == EXC_PGM
&& (frame->srr1 & 0x20000))
|| frame->exc == EXC_BPT)) {
#ifdef KGDBUSERHACK
asm ("mfsr %0,%1" : "=r"(savesr) : "K"(USER_SR)); /* see above XXX */
#endif
kgdbcopy(frame, kgdbregs, sizeof kgdbregs);
kgdbregs[MSR] &= ~PSL_BE;
switch (kgdbcmds()) {
case 2:
case 0:
kgdbregs[MSR] &= ~PSL_SE;
break;
case 1:
kgdbregs[MSR] |= PSL_SE;
break;
}
kgdbcopy(kgdbregs, frame, sizeof kgdbregs);
#ifdef KGDBUSERHACK
asm ("mtsr %0,%1; isync" :: "K"(USER_SR), "r"(savesr));
#endif
return 1;
}
return 0;
}

View File

@ -0,0 +1,173 @@
/* $NetBSD: locore.S,v 1.1 2002/05/30 08:51:39 augustss Exp $ */
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds 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_ddb.h"
#include "fs_kernfs.h"
#include "opt_ipkdb.h"
#include "opt_multiprocessor.h"
#include "opt_openpic.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/mpc6xx/hid.h>
/*
* Some instructions gas doesn't understand (yet?)
*/
#define bdneq bdnzf 2,
#define INTSTK 8192
#define SPILLSTK 4096
/*
* Globals
*/
GLOBAL(startsym)
.long 0 /* start symbol table */
GLOBAL(endsym)
.long 0 /* end symbol table */
GLOBAL(proc0paddr)
.long 0 /* proc0 p_addr */
/*
* File-scope for locore.S
*/
.data
idle_u:
.long 0 /* fake uarea during idle after exit */
/*
* 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:
li 0,0
mtmsr 0 /* Disable FPU/MMU/exceptions */
isync
/* Enable data and instruction caches */
/*
mfspr 8,1008
ori 8, 8, (HID0_ICE | HID0_DCE)@l
mtspr 1008,8
*/
/* compute end of kernel memory */
lis 8,_C_LABEL(end)@ha
addi 8,8,_C_LABEL(end)@l
#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)
/* mr 8,4 * end of symbol table */
#endif
li 9,PGOFSET
add 8,8,9
andc 8,8,9
addi 8,8,NBPG
lis 9,idle_u@ha
stw 8,idle_u@l(9)
addi 8,8,USPACE /* space for idle_u */
lis 9,_C_LABEL(proc0paddr)@ha
stw 8,_C_LABEL(proc0paddr)@l(9)
addi 1,8,USPACE-FRAMELEN /* stackpointer for proc0 */
mr 4,1 /* end of mem reserved for kernel */
xor 0,0,0
stwu 0,-16(1) /* end of stack chain */
lis 3,__start@ha
addi 3,3,__start@l
xor 5,5,5
xor 6,6,6
bl _C_LABEL(initppc)
sync
isync
mfspr 8,SPR_HID0
ori 8, 8, (HID0_ICE | HID0_DCE)@l
isync
mtspr SPR_HID0,8
sync
isync
bl _C_LABEL(main)
loop: b loop /* XXX not reached */
.globl _C_LABEL(enable_intr)
_C_LABEL(enable_intr):
mfmsr 3
ori 3,3,PSL_EE@l
mtmsr 3
blr
.globl _C_LABEL(disable_intr)
_C_LABEL(disable_intr):
mfmsr 3
andi. 3,3,~PSL_EE@l
mtmsr 3
blr
/*
* Include common switch / setfault code
*/
#include <powerpc/powerpc/locore_subr.S>
/*
* Include common trap / execption code
*/
#include <powerpc/powerpc/trap_subr.S>

View File

@ -0,0 +1,20 @@
/* $NetBSD: procfs_machdep.c,v 1.1 2002/05/30 08:51:40 augustss Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/vnode.h>
#include <miscfs/procfs/procfs.h>
/*
* Linux-style /proc/cpuinfo.
* Only used when procfs is mounted with -o linux.
*/
int
procfs_getcpuinfstr(char *buf, int *len)
{
*len = 0;
return 0;
}