Initial import of port "dreamcast" (cloned from port "evbsh3").
This commit is contained in:
parent
17bf4cff64
commit
83334549fb
|
@ -0,0 +1,318 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $NetBSD: MAKEDEV,v 1.1 2000/12/11 18:19:16 marcus Exp $
|
||||
#
|
||||
# Copyright (c) 1990 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Written and contributed by W. Jolitz 12/90
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
|
||||
#
|
||||
# Device "make" file. Valid arguments:
|
||||
# all makes all known devices, including local devices.
|
||||
# Tries to make the 'standard' number of each type.
|
||||
# floppy devices to be put on install floppies
|
||||
# std standard devices
|
||||
# local configuration specific devices
|
||||
#
|
||||
# Tapes:
|
||||
# wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
|
||||
# st* SCSI tapes
|
||||
#
|
||||
# Disks:
|
||||
# wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
|
||||
# fd* "floppy" disk drives (3 1/2", 5 1/4")
|
||||
# sd* SCSI disks
|
||||
# cd* SCSI CD-ROM
|
||||
# mcd* Mitsumi CD-ROM
|
||||
# vnd* "file" pseudo-disks
|
||||
# md* memory pseudo-disks
|
||||
# ccd* contatenated disk devices
|
||||
#
|
||||
# Console ports:
|
||||
# ttyv0 pccons or pcvt screen 0
|
||||
# ttyv* pcvt
|
||||
#
|
||||
# Terminal ports:
|
||||
# com* standard PC COM ports (XXX)
|
||||
# tty* alias for PC COM ports, this is what the system really wants
|
||||
#
|
||||
# Pseudo terminals:
|
||||
# pty* set of 16 master and slave pseudo terminals
|
||||
#
|
||||
# Call units:
|
||||
#
|
||||
# Special purpose devices:
|
||||
# fd file descriptors
|
||||
# bpf* packet filter
|
||||
# ipl ip filter
|
||||
# cbq Alternate Queueing (ALTQ)
|
||||
# random Random number generator
|
||||
# speaker pc speaker (XXX - installed)
|
||||
# lkm loadable kernel modules interface
|
||||
# audio audio device
|
||||
# apm power management device
|
||||
# tun* network tunnel driver
|
||||
# joy* joystick device
|
||||
# ss* SCSI scanner
|
||||
# uk* SCSI unknown
|
||||
# ch* SCSI changer
|
||||
#
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
umask 77
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
|
||||
all)
|
||||
sh $0 std fd fd0
|
||||
sh $0 tty0 tty1 pty0 pty1
|
||||
sh $0 vnd0 vnd1
|
||||
sh $0 ttyv0 bpf0 bpf1 bpf2 bpf3 tun0 tun1 ipl
|
||||
sh $0 ccd0 ccd1 ccd2 ccd3 md0 random
|
||||
sh $0 lkm audio local
|
||||
sh $0 ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8
|
||||
;;
|
||||
|
||||
ramdisk)
|
||||
sh $0 std md0
|
||||
sh $0 tty0 tty1 pty0 pty1
|
||||
sh $0 ttyv0 bpf0 bpf1 bpf2 bpf3 tun0 tun1 ipl
|
||||
;;
|
||||
|
||||
std)
|
||||
rm -f console drum mem kmem null zero io tty klog stdin stdout stderr
|
||||
mknod console c 0 0
|
||||
mknod drum c 4 0 ; chmod 640 drum ; chgrp kmem drum
|
||||
mknod kmem c 2 1 ; chmod 640 kmem ; chgrp kmem kmem
|
||||
mknod mem c 2 0 ; chmod 640 mem ; chgrp kmem mem
|
||||
mknod null c 2 2 ; chmod 666 null
|
||||
mknod zero c 2 12 ; chmod 666 zero
|
||||
mknod io c 2 14 ; chmod 640 io ; chgrp kmem io
|
||||
mknod tty c 1 0 ; chmod 666 tty
|
||||
mknod klog c 7 0 ; chmod 600 klog
|
||||
mknod stdin c 22 0 ; chmod 666 stdin
|
||||
mknod stdout c 22 1 ; chmod 666 stdout
|
||||
mknod stderr c 22 2 ; chmod 666 stderr
|
||||
;;
|
||||
|
||||
ttyv*)
|
||||
chr=12; unit=${i#ttyv}
|
||||
rm -f ttyv$unit
|
||||
mknod ttyv$unit c $chr $unit
|
||||
chown root.wheel ttyv$unit
|
||||
# case $unit in
|
||||
# 0)
|
||||
# rm -f vga
|
||||
# ln -s ttyv0 vga
|
||||
# ;;
|
||||
# esac
|
||||
;;
|
||||
|
||||
fd)
|
||||
rm -f fd/*
|
||||
mkdir fd > /dev/null 2>&1
|
||||
n=0
|
||||
while [ $n -lt 64 ]; do
|
||||
mknod fd/$n c 22 $n
|
||||
n=$(($n + 1))
|
||||
done
|
||||
chown -R root.wheel fd
|
||||
chmod 755 fd
|
||||
chmod 666 fd/*
|
||||
;;
|
||||
|
||||
md*)
|
||||
case $i in
|
||||
md*) name=md; unit=${i#md}; chr=24; blk=17;;
|
||||
esac
|
||||
rm -f $name$unit? r$name$unit?
|
||||
mknod ${name}${unit}a b $blk $(($unit * 8 + 0))
|
||||
mknod ${name}${unit}b b $blk $(($unit * 8 + 1))
|
||||
mknod ${name}${unit}c b $blk $(($unit * 8 + 2))
|
||||
mknod r${name}${unit}a c $chr $(($unit * 8 + 0))
|
||||
mknod r${name}${unit}b c $chr $(($unit * 8 + 1))
|
||||
mknod r${name}${unit}c c $chr $(($unit * 8 + 2))
|
||||
chgrp operator $name$unit? r$name$unit?
|
||||
chmod 640 $name$unit? r$name$unit?
|
||||
;;
|
||||
|
||||
ccd*|fd*|sd*|vnd*|wd*)
|
||||
case $i in
|
||||
ccd*) name=ccd; unit=${i#ccd}; blk=16; chr=18;;
|
||||
fd*) name=fd; unit=${i#fd}; blk=2; chr=9;;
|
||||
sd*) name=sd; unit=${i#sd}; blk=4; chr=13;;
|
||||
vnd*) name=vnd; unit=${i#vnd}; blk=14; chr=41;;
|
||||
wd*) name=wd; unit=${i#wd}; blk=0; chr=3;;
|
||||
esac
|
||||
rm -f $name$unit? r$name$unit?
|
||||
mknod ${name}${unit}a b $blk $(($unit * 8 + 0))
|
||||
mknod ${name}${unit}b b $blk $(($unit * 8 + 1))
|
||||
mknod ${name}${unit}c b $blk $(($unit * 8 + 2))
|
||||
mknod ${name}${unit}d b $blk $(($unit * 8 + 3))
|
||||
mknod ${name}${unit}e b $blk $(($unit * 8 + 4))
|
||||
mknod ${name}${unit}f b $blk $(($unit * 8 + 5))
|
||||
mknod ${name}${unit}g b $blk $(($unit * 8 + 6))
|
||||
mknod ${name}${unit}h b $blk $(($unit * 8 + 7))
|
||||
mknod r${name}${unit}a c $chr $(($unit * 8 + 0))
|
||||
mknod r${name}${unit}b c $chr $(($unit * 8 + 1))
|
||||
mknod r${name}${unit}c c $chr $(($unit * 8 + 2))
|
||||
mknod r${name}${unit}d c $chr $(($unit * 8 + 3))
|
||||
mknod r${name}${unit}e c $chr $(($unit * 8 + 4))
|
||||
mknod r${name}${unit}f c $chr $(($unit * 8 + 5))
|
||||
mknod r${name}${unit}g c $chr $(($unit * 8 + 6))
|
||||
mknod r${name}${unit}h c $chr $(($unit * 8 + 7))
|
||||
chgrp operator $name$unit? r$name$unit?
|
||||
chmod 640 $name$unit? r$name$unit?
|
||||
;;
|
||||
|
||||
com*|tty*) # (XXX -- com should die)
|
||||
unit=${i#???}
|
||||
rm -f com$unit tty0$unit
|
||||
mknod tty0$unit c 8 $unit
|
||||
chown uucp.wheel tty0$unit
|
||||
;;
|
||||
|
||||
pty*)
|
||||
class=${i#pty}
|
||||
case $class in
|
||||
0) name=p;;
|
||||
1) name=q;;
|
||||
2) name=r;;
|
||||
3) name=s;;
|
||||
4) name=t;;
|
||||
5) name=u;;
|
||||
6) name=v
|
||||
echo "$0: $i: pty unit conflicts with console ttyv* devices."
|
||||
continue;;
|
||||
7) name=w;;
|
||||
8) name=x;;
|
||||
9) name=y;;
|
||||
10) name=z;;
|
||||
11) name=P;;
|
||||
12) name=Q;;
|
||||
13) name=R;;
|
||||
14) name=S;;
|
||||
15) name=T;;
|
||||
*) echo "$0: $i: pty unit must be between 0 and 15"
|
||||
continue ;;
|
||||
esac
|
||||
rm -f tty$name[0-9a-f] pty$name[0-9a-f]
|
||||
for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
do
|
||||
case $j in
|
||||
[0-9]) jn=$j ;;
|
||||
a) jn=10 ;;
|
||||
b) jn=11 ;;
|
||||
c) jn=12 ;;
|
||||
d) jn=13 ;;
|
||||
e) jn=14 ;;
|
||||
f) jn=15 ;;
|
||||
esac
|
||||
unit=$(($class * 16 + $jn))
|
||||
mknod tty$name$j c 5 $unit
|
||||
mknod pty$name$j c 6 $unit
|
||||
done
|
||||
chgrp wheel tty$name? pty$name?
|
||||
chmod 666 tty$name? pty$name?
|
||||
;;
|
||||
|
||||
cd*|mcd*)
|
||||
case $i in
|
||||
cd*) name=cd; unit=${i#cd}; chr=15; blk=6;;
|
||||
mcd*) name=mcd; unit=${i#mcd}; chr=39; blk=7;;
|
||||
esac
|
||||
rm -f $name$unit? r$name$unit?
|
||||
mknod ${name}${unit}a b $blk $(($unit * 8 + 0))
|
||||
mknod ${name}${unit}d b $blk $(($unit * 8 + 3))
|
||||
mknod r${name}${unit}a c $chr $(($unit * 8 + 0))
|
||||
mknod r${name}${unit}d c $chr $(($unit * 8 + 3))
|
||||
chgrp operator $name$unit? r$name$unit?
|
||||
chmod 640 $name$unit? r$name$unit?
|
||||
;;
|
||||
|
||||
bpf*|tun*|mms*|lms*|pms*|joy*)
|
||||
case $i in
|
||||
bpf*) name=bpf; unit=${i#bpf}; chr=23;;
|
||||
tun*) name=tun; unit=${i#tun}; chr=40;;
|
||||
mms*) name=mms; unit=${i#mms}; chr=35;;
|
||||
lms*) name=lms; unit=${i#lms}; chr=36;;
|
||||
pms*) name=pms; unit=${i#pms}; chr=37;;
|
||||
joy*) name=joy; unit=${i#joy}; chr=26;;
|
||||
esac
|
||||
rm -f $name$unit
|
||||
mknod $name$unit c $chr $unit
|
||||
chown root.wheel $name$unit
|
||||
;;
|
||||
|
||||
ipl)
|
||||
rm -f ipl ipnat ipstate ipauth
|
||||
mknod ipl c 44 0
|
||||
mknod ipnat c 44 1
|
||||
mknod ipstate c 44 2
|
||||
mknod ipauth c 44 3
|
||||
chown root.wheel ipl ipnat ipstate ipauth
|
||||
chmod 600 ipl ipnat ipstate ipauth
|
||||
;;
|
||||
|
||||
lkm)
|
||||
rm -f lkm
|
||||
mknod lkm c 28 0
|
||||
chown root.kmem lkm
|
||||
chmod 640 lkm
|
||||
;;
|
||||
|
||||
audio*)
|
||||
unit=${i#audio}
|
||||
audio=audio$unit
|
||||
sound=sound$unit
|
||||
mixer=mixer$unit
|
||||
major=42
|
||||
audioctl=audioctl$unit
|
||||
if [ "$unit" = "" ]; then unit=0; fi
|
||||
rm -f $audio $sound $mixer $audioctl
|
||||
mknod $sound c $major $(($unit + 0))
|
||||
mknod $audio c $major $(($unit + 128))
|
||||
mknod $mixer c $major $(($unit + 16))
|
||||
mknod $audioctl c $major $(($unit + 192))
|
||||
chown root.wheel $audio $sound $mixer $audioctl
|
||||
chmod 666 $audio $sound $mixer $audioctl
|
||||
;;
|
||||
|
||||
random)
|
||||
rm -f random urandom
|
||||
mknod random c 46 0
|
||||
mknod urandom c 46 1
|
||||
chown root.wheel random urandom
|
||||
chmod 444 random
|
||||
chmod 644 urandom
|
||||
;;
|
||||
|
||||
local)
|
||||
umask 0
|
||||
#sh $0.local all
|
||||
umask 77
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $i: unknown device
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
|
@ -0,0 +1,44 @@
|
|||
# $NetBSD: disktab,v 1.1 2000/12/11 18:19:16 marcus Exp $
|
||||
#
|
||||
# Disk geometry and partition layout tables.
|
||||
# Key:
|
||||
# dt controller type
|
||||
# ty type of disk (fixed, removeable, simulated)
|
||||
# d[0-4] drive-type-dependent parameters
|
||||
# ns #sectors/track
|
||||
# nt #tracks/cylinder
|
||||
# nc #cylinders/disk
|
||||
# sc #sectors/cylinder, ns*nt default
|
||||
# su #sectors/unit, sc*nc default
|
||||
# se sector size, DEV_BSIZE default
|
||||
# rm rpm, 3600 default
|
||||
# sf supports bad144-style bad sector forwarding
|
||||
# sk sector skew per track, default 0
|
||||
# cs sector skew per cylinder, default 0
|
||||
# hs headswitch time, default 0
|
||||
# ts one-cylinder seek time, default 0
|
||||
# il sector interleave (n:1), 1 default
|
||||
# bs boot block size, default BBSIZE
|
||||
# sb superblock size, default SBSIZE
|
||||
# o[a-h] partition offsets in sectors
|
||||
# p[a-h] partition sizes in sectors
|
||||
# b[a-h] partition block sizes in bytes
|
||||
# f[a-h] partition fragment sizes in bytes
|
||||
# t[a-h] partition types (filesystem, swap, etc)
|
||||
#
|
||||
# All partition sizes reserve space for bad sector tables.
|
||||
# (5 cylinders needed for maintenance + replacement sectors)
|
||||
#
|
||||
|
||||
floppy|floppy3|3in|3.5in High Density Floppy:\
|
||||
:ty=floppy:se#512:nt#2:rm#300:ns#18:nc#80:\
|
||||
:pa#2880:oa#0:ba#4096:fa#512:ta=4.2BSD:\
|
||||
:pb#2880:ob#0:\
|
||||
:pc#2880:oc#0:
|
||||
|
||||
floppy5|5in|5.25in High Density Floppy:\
|
||||
:ty=floppy:se#512:nt#2:rm#300:ns#15:nc#80:\
|
||||
:pa#2400:oa#0:ba#4096:fa#512:ta=4.2BSD:\
|
||||
:pb#2400:ob#0:bb#4096:fb#512:\
|
||||
:pc#2400:oc#0:bc#4096:fc#512:
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/kern /kern kernfs rw 0 0
|
||||
/proc /proc procfs rw 0 0
|
|
@ -0,0 +1,48 @@
|
|||
# $NetBSD: ttys,v 1.1 2000/12/11 18:19:16 marcus Exp $
|
||||
# from: @(#)ttys 5.1 (Berkeley) 4/17/89
|
||||
#
|
||||
# name getty type status comments
|
||||
#
|
||||
# If the console is marked insecure, single-user requires
|
||||
# the root password.
|
||||
#
|
||||
# /dev/console is always valid, regardless of the board type.
|
||||
#
|
||||
console "/usr/libexec/getty std.115200" unknown on secure
|
||||
|
||||
#tty00 "/usr/libexec/getty std.9600" unknown off secure
|
||||
#tty01 "/usr/libexec/getty std.9600" unknown off secure
|
||||
|
||||
# Pseudo Terminals
|
||||
ttyp0 none network
|
||||
ttyp1 none network
|
||||
ttyp2 none network
|
||||
ttyp3 none network
|
||||
ttyp4 none network
|
||||
ttyp5 none network
|
||||
ttyp6 none network
|
||||
ttyp7 none network
|
||||
ttyp8 none network
|
||||
ttyp9 none network
|
||||
ttypa none network
|
||||
ttypb none network
|
||||
ttypc none network
|
||||
ttypd none network
|
||||
ttype none network
|
||||
ttypf none network
|
||||
ttyq0 none network
|
||||
ttyq1 none network
|
||||
ttyq2 none network
|
||||
ttyq3 none network
|
||||
ttyq4 none network
|
||||
ttyq5 none network
|
||||
ttyq6 none network
|
||||
ttyq7 none network
|
||||
ttyq8 none network
|
||||
ttyq9 none network
|
||||
ttyqa none network
|
||||
ttyqb none network
|
||||
ttyqc none network
|
||||
ttyqd none network
|
||||
ttyqe none network
|
||||
ttyqf none network
|
|
@ -0,0 +1,30 @@
|
|||
# $NetBSD: Makefile,v 1.1 2000/12/11 18:19:12 marcus Exp $
|
||||
|
||||
# Makefile for dreamcast tags file and boot blocks
|
||||
|
||||
#.include "../sh3/Makefile.inc"
|
||||
|
||||
TDREAMCAST= ../dreamcast/tags
|
||||
SDREAMCAST= ../dreamcast/dreamcast/*.[ch] ../dreamcast/include/*.h
|
||||
ADREAMCAST= ../dreamcast/dreamcast/*.[sS]
|
||||
|
||||
# Directories in which to place tags links
|
||||
DDREAMCAST= dreamcast include
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags:
|
||||
-ctags -wdtf ${TDREAMCAST} ${SDREAMCAST} ${COMM}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${ADREAMCAST} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TDREAMCAST}
|
||||
sort -o ${TDREAMCAST} ${TDREAMCAST}
|
||||
|
||||
links:
|
||||
-for i in ${DDREAMCAST}; do \
|
||||
(cd $$i && rm -f tags; ln -s ../tags tags); done
|
||||
|
||||
|
||||
SUBDIR= include # stand
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,140 @@
|
|||
# $NetBSD: GENERIC,v 1.1 2000/12/11 18:19:12 marcus Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
|
||||
include "arch/dreamcast/conf/std.dreamcast"
|
||||
|
||||
# Enable the hooks used for initializing the root memory-disk.
|
||||
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 MINIROOTSIZE=2880 # size of memory disk, in blocks
|
||||
|
||||
options DONT_INIT_BSC
|
||||
|
||||
maxusers 16 # estimated number of users
|
||||
|
||||
# CPU support
|
||||
options SH7750
|
||||
options SH4
|
||||
# options SH4_PCMCIA
|
||||
options EVBSH4
|
||||
options MMEYE
|
||||
options PCLOCK=50000000 # 50MHz
|
||||
options IOM_ROM_BEGIN=0x00000000
|
||||
options IOM_ROM_SIZE=0x00100000 # 1MB
|
||||
options IOM_RAM_BEGIN=0x8c000000
|
||||
options IOM_RAM_SIZE=0x01000000 # 16MB
|
||||
options INITTODR_ALWAYS_USE_RTC
|
||||
options BRAINS
|
||||
options USE_RTCCLK
|
||||
options SYNC_CLOCK_TO_RTC
|
||||
|
||||
makeoptions LDSCRIPTBASE="shl.x" # for little endian
|
||||
|
||||
options LED_ADDR=0xa8000000
|
||||
|
||||
# Standard system options
|
||||
#options UCONSOLE # users can use TIOCCONS (for xconsole)
|
||||
#options INSECURE # disable kernel security levels
|
||||
|
||||
#options RTC_OFFSET=-540
|
||||
options HZ=64 # clock interrupt generates every 1/HZ sec
|
||||
#options NTP # NTP phase/frequency locked loop
|
||||
|
||||
#options KTRACE # system call tracing via ktrace(1)
|
||||
|
||||
#options SYSVMSG # System V-like message queues
|
||||
#options SYSVSEM # System V-like semaphores
|
||||
#options SYSVSHM # System V-like memory sharing
|
||||
#options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
#options DIAGNOSTIC # cheap kernel consistency checks
|
||||
#options DEBUG # expensive debugging checks/support
|
||||
#options DDB # in-kernel debugger
|
||||
#makeoptions DEBUG="-g" # compile full symbol table
|
||||
#options SYSCALL_DEBUG
|
||||
#options UVMHIST
|
||||
#options UVMHIST_PRINT
|
||||
|
||||
# Compatibility options
|
||||
options COMPAT_13 # NetBSD 1.3
|
||||
options COMPAT_14 # NetBSD 1.4,
|
||||
options COMPAT_43 # and 4.3BSD
|
||||
|
||||
# Executable format options
|
||||
options EXEC_COFF # COFF executables
|
||||
options EXEC_ELF32 # 32-bit ELF executables
|
||||
|
||||
# File systems
|
||||
file-system FFS # UFS
|
||||
file-system MFS # memory file system
|
||||
#file-system NFS # Network File System client
|
||||
file-system PROCFS # /proc
|
||||
file-system KERNFS # /kern
|
||||
#file-system NULLFS # loopback file system
|
||||
#file-system UMAPFS # NULLFS + uid and gid remapping
|
||||
|
||||
# File system options
|
||||
#options QUOTA # UFS quotas
|
||||
#options NFSSERVER # Network File System server
|
||||
|
||||
# Networking options
|
||||
options INET # IP + ICMP + TCP + UDP
|
||||
#options NFS_BOOT_DHCP # Support DHCP NFS root
|
||||
|
||||
#options PCIVERBOSE # verbose PCI device autoconfig messages
|
||||
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
|
||||
#options PCMCIAVERBOSE # verbose PCMCIA configuration messages
|
||||
|
||||
# Kernel root file system and dump configuration.
|
||||
#config netbsd root on ? type nfs
|
||||
#config netbsd root on wd0a type ffs
|
||||
config netbsd root on ? type ffs
|
||||
|
||||
#
|
||||
# Device configuration
|
||||
#
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
shb* at mainbus?
|
||||
|
||||
# Serial Devices
|
||||
|
||||
options SCIFCN_SPEED=57600
|
||||
scif0 at shb? port 0xffe80000 irq 12
|
||||
|
||||
# SH PCMCIA controllers
|
||||
#shpcic0 at shb? port 0xb000000a iomem 0xb8000000 iosiz 0x1000000
|
||||
#shpcic1 at shb? port 0xb000000c iomem 0xb9000000 iosiz 0x1000000
|
||||
|
||||
# PCMCIA bus support
|
||||
#pcmcia* at shpcic? controller ? socket ?
|
||||
|
||||
#com* at pcmcia? function ? # Modems and serial cards
|
||||
#wdc* at pcmcia? function ?
|
||||
#wd* at wdc? drive ? # the drives themselves
|
||||
|
||||
#ep* at pcmcia? function ? # 3Com 3c589 and 3c562 Ethernet
|
||||
#mbe* at pcmcia? function ? # MB8696x based Ethernet
|
||||
#ne* at pcmcia? function ? # NE2000-compatible Ethernet
|
||||
#sm* at pcmcia? function ? # Megahertz Ethernet
|
||||
|
||||
#pseudo-device vnd 4 # disk-like interface to files
|
||||
#pseudo-device bpfilter 8 # Berkeley packet filter
|
||||
#pseudo-device ipfilter # IP filter (firewall) and NAT
|
||||
pseudo-device loop # network loopback
|
||||
pseudo-device pty # pseudo-terminals
|
||||
#pseudo-device ppp 2 # Point-to-Point Protocol
|
||||
#pseudo-device tun 2 # network tunneling over tty
|
||||
|
||||
# Enable the hooks used for initializing the root memory-disk.
|
||||
#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 MINIROOTSIZE=3074 # size of memory disk, in blocks
|
||||
|
||||
pseudo-device md 1 # memory disk device (ramdisk)
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: GENERIC.local,v 1.1 2000/12/11 18:19:12 marcus Exp $
|
||||
#
|
||||
# GENERIC.local -- local additions to the GENERIC configuration
|
||||
#
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
# $NetBSD: Makefile.dreamcast,v 1.1 2000/12/11 18:19:12 marcus Exp $
|
||||
|
||||
# Makefile for NetBSD
|
||||
#
|
||||
# This makefile is constructed from a machine description:
|
||||
# config machineid
|
||||
# Most changes should be made in the machine description
|
||||
# /sys/arch/sh3/conf/``machineid''
|
||||
# after which you should do
|
||||
# config machineid
|
||||
# Machine generic makefile changes should be made in
|
||||
# /sys/arch/sh3/conf/Makefile.sh3
|
||||
# after which config should be rerun for all machines of that type.
|
||||
#
|
||||
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
|
||||
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
|
||||
#
|
||||
# -DTRACE compile in kernel tracing hooks
|
||||
# -DQUOTA compile in file system quotas
|
||||
|
||||
# DEBUG is set to -g if debugging.
|
||||
# PROF is set to -pg if profiling.
|
||||
|
||||
AR?= ar
|
||||
AS?= as
|
||||
CC?= cc
|
||||
CPP?= cpp
|
||||
LD?= ld
|
||||
LORDER?=lorder
|
||||
MKDEP?= mkdep
|
||||
NM?= nm
|
||||
RANLIB?=ranlib
|
||||
SIZE?= size
|
||||
STRIP?= strip
|
||||
TSORT?= tsort -q
|
||||
OBJCOPY?= objcopy
|
||||
|
||||
COPTS?= -O2
|
||||
|
||||
# source tree is located via $S relative to the compilation directory
|
||||
.ifndef S
|
||||
S!= cd ../../../..; pwd
|
||||
.endif
|
||||
SH3= $S/arch/sh3
|
||||
DREAMCAST= $S/arch/dreamcast
|
||||
|
||||
HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo
|
||||
INCLUDES= -I. -I$S/arch -I$S -nostdinc
|
||||
CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
|
||||
-Dsh3
|
||||
CWARNFLAGS= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes
|
||||
CWARNFLAGS+= -Wpointer-arith -Wno-parentheses
|
||||
# XXX Delete -Wuninitialized for now, since the compiler doesn't
|
||||
# XXX always get it right. --thorpej
|
||||
CWARNFLAGS+= -Wno-uninitialized
|
||||
.if (${HAVE_EGCS} != "")
|
||||
CWARNFLAGS+= -Wno-main
|
||||
.endif
|
||||
CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS}
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
|
||||
LINKFLAGS= -e start -Map netbsd.map -T ../../conf/${LDSCRIPTBASE}
|
||||
LINKFLAGS2= -e start -Map netbsd2.map -T ../../conf/${LDSCRIPTBASE}.RAM
|
||||
LINKFLAGS3= -e start -Map netbsd3.map -T ../../conf/${LDSCRIPTBASE}.ICE
|
||||
STRIPFLAGS= --strip-debug
|
||||
MACHINE=dreamcast
|
||||
MACHINE_ARCH=sh3
|
||||
|
||||
### find out what to use for libkern
|
||||
.include "$S/lib/libkern/Makefile.inc"
|
||||
.ifndef PROF
|
||||
LIBKERN= ${KERNLIB}
|
||||
.else
|
||||
LIBKERN= ${KERNLIB_PROF}
|
||||
.endif
|
||||
|
||||
### find out what to use for libcompat
|
||||
.include "$S/compat/common/Makefile.inc"
|
||||
.ifndef PROF
|
||||
LIBCOMPAT= ${COMPATLIB}
|
||||
.else
|
||||
LIBCOMPAT= ${COMPATLIB_PROF}
|
||||
.endif
|
||||
|
||||
# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
|
||||
# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
|
||||
|
||||
NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
|
||||
NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
|
||||
|
||||
%OBJS
|
||||
|
||||
%CFILES
|
||||
|
||||
%SFILES
|
||||
|
||||
# load lines for config "xxx" will be emitted as:
|
||||
# xxx: ${SYSTEM_DEP} swapxxx.o
|
||||
# ${SYSTEM_LD_HEAD}
|
||||
# ${SYSTEM_LD} swapxxx.o
|
||||
# ${SYSTEM_LD_TAIL}
|
||||
MMEYEROOT=/usr/home/mmEye/root
|
||||
SYSTEM_OBJ= locore.o \
|
||||
param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
|
||||
SYSTEM_LD_HEAD= rm -f $@
|
||||
SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@.out '$${SYSTEM_OBJ}' vers.o; \
|
||||
${LD} ${LINKFLAGS} -o $@.out ${SYSTEM_OBJ} vers.o
|
||||
SYSTEM_LD_TAIL= @echo ${LD} ${LINKFLAGS2} -o $@2.out '$${SYSTEM_OBJ}' vers.o; \
|
||||
${LD} ${LINKFLAGS2} -o $@2.out ${SYSTEM_OBJ} vers.o swapnetbsd.o ; \
|
||||
${LD} ${LINKFLAGS3} -o $@3.out ${SYSTEM_OBJ} vers.o swapnetbsd.o ; \
|
||||
cp $@.out $@; ${STRIP} $@ ; \
|
||||
${SIZE} $@; chmod 755 $@ ; \
|
||||
echo ${OBJCOPY} -O srec $@.out $@.s; ${OBJCOPY} -O srec $@.out $@.s
|
||||
|
||||
|
||||
|
||||
DEBUG?=
|
||||
.if ${DEBUG} == "-g"
|
||||
LINKFLAGS+= -X
|
||||
SYSTEM_LD_TAIL+=; \
|
||||
echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
|
||||
echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
|
||||
${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
|
||||
.else
|
||||
LINKFLAGS+=
|
||||
.endif
|
||||
|
||||
%LOAD
|
||||
|
||||
assym.h: $S/kern/genassym.sh ${DREAMCAST}/dreamcast/genassym.cf
|
||||
sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
|
||||
< ${DREAMCAST}/dreamcast/genassym.cf > assym.h.tmp && \
|
||||
mv -f assym.h.tmp assym.h
|
||||
|
||||
param.c: $S/conf/param.c
|
||||
rm -f param.c
|
||||
cp $S/conf/param.c .
|
||||
|
||||
param.o: param.c Makefile
|
||||
${NORMAL_C}
|
||||
|
||||
ioconf.o: ioconf.c
|
||||
${NORMAL_C}
|
||||
|
||||
newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
sh $S/conf/newvers.sh
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
|
||||
|
||||
|
||||
__CLEANKERNEL: .USE
|
||||
@echo "${.TARGET}ing the kernel objects"
|
||||
rm -f eddep *netbsd netbsd netbsd.gdb tags *.[io] [a-z]*.s \
|
||||
[Ee]rrs linterrs makelinks assym.h.tmp assym.h
|
||||
|
||||
__CLEANDEPEND: .USE
|
||||
rm -f .depend
|
||||
|
||||
clean: __CLEANKERNEL
|
||||
|
||||
cleandir: __CLEANKERNEL __CLEANDEPEND
|
||||
|
||||
lint:
|
||||
@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
|
||||
${SH3}/sh3/Locore.c ${CFILES} \
|
||||
ioconf.c param.c | \
|
||||
grep -v 'static function .* unused'
|
||||
|
||||
tags:
|
||||
@echo "see $S/kern/Makefile for tags"
|
||||
|
||||
links:
|
||||
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
|
||||
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
|
||||
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
|
||||
sort -u | comm -23 - dontlink | \
|
||||
sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
|
||||
sh makelinks && rm -f dontlink
|
||||
|
||||
SRCS= ${DREAMCAST}/dreamcast/locore.s \
|
||||
param.c ioconf.c ${CFILES} ${SFILES}
|
||||
depend: .depend
|
||||
.depend: ${SRCS} assym.h param.c
|
||||
${MKDEP} ${AFLAGS} ${CPPFLAGS} ${DREAMCAST}/dreamcast/locore.s
|
||||
${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
|
||||
sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
|
||||
${CPPFLAGS} < ${DREAMCAST}/dreamcast/genassym.cf
|
||||
@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
|
||||
@rm -f assym.dep
|
||||
|
||||
dependall: depend all
|
||||
|
||||
|
||||
# depend on root or device configuration
|
||||
autoconf.o conf.o: Makefile
|
||||
|
||||
# depend on network or filesystem configuration
|
||||
uipc_proto.o vfs_conf.o: Makefile
|
||||
|
||||
# depend on maxusers
|
||||
machdep.o: Makefile
|
||||
|
||||
# depend on CPU configuration
|
||||
locore.o machdep.o: Makefile
|
||||
|
||||
|
||||
locore.o: ${DREAMCAST}/dreamcast/locore.s assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
# The install target can be redefined by putting a
|
||||
# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
|
||||
MACHINE_NAME!= uname -n
|
||||
install: install-kernel-${MACHINE_NAME}
|
||||
.if !target(install-kernel-${MACHINE_NAME}})
|
||||
install-kernel-${MACHINE_NAME}:
|
||||
rm -f /onetbsd
|
||||
ln /netbsd /onetbsd
|
||||
cp netbsd /nnetbsd
|
||||
mv /nnetbsd /netbsd
|
||||
.endif
|
||||
|
||||
%RULES
|
|
@ -0,0 +1,16 @@
|
|||
# $NetBSD: files.dreamcast,v 1.1 2000/12/11 18:19:12 marcus Exp $
|
||||
#
|
||||
# new style config file for sh3 architecture
|
||||
#
|
||||
|
||||
include "arch/dreamcast/conf/files.shbus"
|
||||
|
||||
file arch/dreamcast/dreamcast/conf.c
|
||||
file arch/dreamcast/dreamcast/machdep.c
|
||||
|
||||
defopt opt_memsize.h IOM_ROM_BEGIN IOM_ROM_SIZE IOM_RAM_BEGIN IOM_RAM_SIZE
|
||||
defopt opt_led_addr.h LED_ADDR
|
||||
defopt opt_initbsc.h BSC_BCR1_VAL BSC_BCR2_VAL BSC_WCR1_VAL BSC_WCR2_VAL
|
||||
BSC_WCR3_VAL BSC_MCR_VAL BSC_SDMR2_VAL BSC_SDMR3_VAL
|
||||
BSC_RTCSR_VAL BSC_RTCNT_VAL BSC_RTCOR_VAL BSC_RFCR_VAL
|
||||
BSC_PCR_VAL FRQCR_VAL PFC_SCPCR_VAL
|
|
@ -0,0 +1,69 @@
|
|||
# $NetBSD: files.shbus,v 1.1 2000/12/11 18:19:13 marcus Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent SHBus code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
# defined first.
|
||||
|
||||
# ports should specify appropriate major numbers for the following
|
||||
# devices:
|
||||
# mcd, scd, wd, wt
|
||||
|
||||
device shb {[port = -1], [size = 0],
|
||||
[iomem = -1], [iosiz = 0],
|
||||
[irq = -1], [drq = -1], [drq2 = -1]}
|
||||
attach shb at mainbus
|
||||
|
||||
file arch/dreamcast/dreamcast/shb.c shb needs-flag
|
||||
|
||||
# Misc devices
|
||||
|
||||
device wdog
|
||||
attach wdog at shb
|
||||
file arch/sh3/dev/wdog.c wdog needs-flag
|
||||
|
||||
#
|
||||
# Serial drivers
|
||||
#
|
||||
|
||||
defopt opt_sci.h SCICONSOLE SCICN_SPEED
|
||||
device sci
|
||||
attach sci at shb
|
||||
file arch/sh3/dev/sci.c sci needs-flag
|
||||
|
||||
defopt opt_scif.h SCIFCONSOLE SCIFCN_SPEED
|
||||
device scif
|
||||
attach scif at shb
|
||||
file arch/sh3/dev/scif.c scif needs-flag
|
||||
|
||||
# XXXX pcic here because it needs to be late. The catch: pcic needs
|
||||
# to be late, so devices which attach to it are attached late. But it
|
||||
# needs to be before its isa and pci attachments. This answer is
|
||||
# non-optimal, but I don't have a better answer right now.
|
||||
|
||||
# PCIC pcmcia contoller
|
||||
# XXX this needs to be done very late, so it's done here. This feels
|
||||
# like a kludge, but it might be for the best.
|
||||
|
||||
defopt PCIC_SHB_ALLOC_IOBASE
|
||||
defopt PCIC_SHB_ALLOC_IOSIZE
|
||||
defopt PCIC_SHB_INTR_ALLOC_MASK
|
||||
|
||||
device shpcic: pcmciabus
|
||||
file arch/sh3/dev/shpcic.c shpcic
|
||||
|
||||
# PCIC pcmcia contoller
|
||||
attach shpcic at shb with pcic_shb
|
||||
file arch/sh3/dev/pcic_shb.c pcic_shb
|
||||
file arch/sh3/dev/pcic_shbsubr.c pcic_shb
|
||||
|
||||
# PCIC pcmcia contoller
|
||||
#attach pcic at pci with pcic_pci
|
||||
#file dev/pci/i82365_pci.c pcic_pci
|
||||
|
||||
|
||||
# this wants to be probed as late as possible.
|
||||
#
|
||||
# Machine-independent PCMCIA drivers
|
||||
#
|
||||
device fdc {drive = -1}
|
||||
include "dev/pcmcia/files.pcmcia"
|
|
@ -0,0 +1,56 @@
|
|||
OUTPUT_FORMAT("coff-shl")
|
||||
OUTPUT_ARCH(sh)
|
||||
MEMORY
|
||||
{
|
||||
ram : o = 0x8C010000, l = 16M
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
ROM = 0x80010000;
|
||||
|
||||
.text :
|
||||
AT (ROM)
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.strings)
|
||||
_etext = . ;
|
||||
} > ram
|
||||
.tors :
|
||||
AT ( ROM + SIZEOF(.text))
|
||||
{
|
||||
___ctors = . ;
|
||||
*(.ctors)
|
||||
___ctors_end = . ;
|
||||
___dtors = . ;
|
||||
*(.dtors)
|
||||
___dtors_end = . ;
|
||||
} > ram
|
||||
.data :
|
||||
AT ( ROM + SIZEOF(.text) + SIZEOF(.tors))
|
||||
{
|
||||
*(.data)
|
||||
_edata = . ;
|
||||
} > ram
|
||||
.bss :
|
||||
AT ( ROM + SIZEOF(.text) + SIZEOF(.tors) + SIZEOF(.data))
|
||||
{
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_end = . ;
|
||||
} > ram
|
||||
.stack :
|
||||
{
|
||||
_stack = . ;
|
||||
*(.stack)
|
||||
} > ram
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
*(.stab)
|
||||
}
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
*(.stabstr)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
OUTPUT_FORMAT("coff-shl")
|
||||
OUTPUT_ARCH(sh)
|
||||
MEMORY
|
||||
{
|
||||
ram : o = 0x0c010000, l = 16M
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.strings)
|
||||
_etext = . ;
|
||||
} > ram
|
||||
.tors :
|
||||
{
|
||||
___ctors = . ;
|
||||
*(.ctors)
|
||||
___ctors_end = . ;
|
||||
___dtors = . ;
|
||||
*(.dtors)
|
||||
___dtors_end = . ;
|
||||
} > ram
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
_edata = . ;
|
||||
} > ram
|
||||
.bss :
|
||||
{
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_end = . ;
|
||||
} > ram
|
||||
.stack :
|
||||
{
|
||||
_stack = . ;
|
||||
*(.stack)
|
||||
} > ram
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
*(.stab)
|
||||
}
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
*(.stabstr)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
OUTPUT_FORMAT("coff-shl")
|
||||
OUTPUT_ARCH(sh)
|
||||
MEMORY
|
||||
{
|
||||
ram : o = 0x8C010000, l = 16M
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.strings)
|
||||
_etext = . ;
|
||||
} > ram
|
||||
.tors :
|
||||
{
|
||||
___ctors = . ;
|
||||
*(.ctors)
|
||||
___ctors_end = . ;
|
||||
___dtors = . ;
|
||||
*(.dtors)
|
||||
___dtors_end = . ;
|
||||
} > ram
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
_edata = . ;
|
||||
} > ram
|
||||
.bss :
|
||||
{
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_end = . ;
|
||||
} > ram
|
||||
.stack :
|
||||
{
|
||||
_stack = . ;
|
||||
*(.stack)
|
||||
} > ram
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
*(.stab)
|
||||
}
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
*(.stabstr)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
OUTPUT_FORMAT("coff-shl")
|
||||
OUTPUT_ARCH(sh)
|
||||
MEMORY
|
||||
{
|
||||
ram : o = 0x80010000, l = 16M
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.text 0xa0000000 :
|
||||
{
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.strings)
|
||||
_etext = . ;
|
||||
}
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
_edata = . ;
|
||||
}
|
||||
.bss 0x8c010000 :
|
||||
{
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_end = . ;
|
||||
}
|
||||
.stack :
|
||||
{
|
||||
_stack = . ;
|
||||
*(.stack)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: std.dreamcast,v 1.1 2000/12/11 18:19:13 marcus Exp $
|
||||
#
|
||||
# standard, required NetBSD/dreamcast 'options'
|
||||
|
||||
machine dreamcast sh3
|
||||
|
||||
options EXEC_SCRIPT # exec #! scripts
|
|
@ -0,0 +1,326 @@
|
|||
/* $NetBSD: conf.c,v 1.1 2000/12/11 18:19:13 marcus Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 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 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.
|
||||
*/
|
||||
|
||||
#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 <machine/conf.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 "raid.h"
|
||||
bdev_decl(raid);
|
||||
#include "md.h"
|
||||
bdev_decl(md);
|
||||
|
||||
struct bdevsw bdevsw[] =
|
||||
{
|
||||
bdev_disk_init(NWD,wd), /* 0: ST506/ESDI/IDE disk */
|
||||
bdev_swap_init(1,sw), /* 1: swap pseudo-device */
|
||||
bdev_notdef(), /* 2 (was floppy diskette) */
|
||||
bdev_notdef(), /* 3 (was 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 (was 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 (was 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]);
|
||||
|
||||
cdev_decl(cn);
|
||||
cdev_decl(ctty);
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
cdev_decl(mm);
|
||||
#include "wdog.h"
|
||||
cdev_decl(wdog);
|
||||
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);
|
||||
#include "sci.h"
|
||||
cdev_decl(sci);
|
||||
#include "scif.h"
|
||||
cdev_decl(scif);
|
||||
cdev_decl(fd);
|
||||
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 "cy.h"
|
||||
cdev_decl(cy);
|
||||
#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 "vcoda.h"
|
||||
cdev_decl(vc_nb_);
|
||||
|
||||
#include "esh.h"
|
||||
cdev_decl(esh_fp);
|
||||
#include "scsibus.h"
|
||||
cdev_decl(scsibus);
|
||||
|
||||
#include "ipfilter.h"
|
||||
#include "rnd.h"
|
||||
|
||||
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_disk_init(NWD,wd), /* 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 (was floppy disk) */
|
||||
cdev_tty_init(NSCIF,scif), /* 10: serial with FIFO */
|
||||
cdev_tty_init(NSCI,sci), /* 11: serial */
|
||||
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: */
|
||||
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 (was APM) */
|
||||
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 (was joystick) */
|
||||
cdev_notdef(), /* 27 (was 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 (was Microsoft mouse) */
|
||||
cdev_notdef(), /* 36 (was Logitech mouse) */
|
||||
cdev_notdef(), /* 37 (was PS/2 mouse) */
|
||||
cdev_notdef(), /* 38 (was Cyclom serial port) */
|
||||
cdev_notdef(), /* 39 (was 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 */
|
||||
cdev_notdef(), /* 43 */
|
||||
cdev_ipf_init(NIPFILTER,ipl), /* 44: ip-filter device */
|
||||
cdev_notdef(), /* 45 (was planetconnect satlink) */
|
||||
cdev_rnd_init(NRND,rnd), /* 46: random source pseudo-device */
|
||||
cdev_vc_nb_init(NVCODA,vc_nb_), /* 47: coda file system psdev */
|
||||
cdev_scsibus_init(NSCSIBUS,scsibus), /* 48: SCSI bus */
|
||||
cdev_disk_init(NRAID,raid), /* 49: RAIDframe disk driver */
|
||||
cdev_esh_init(NESH, esh_fp), /* 50: HIPPI (esh) raw device */
|
||||
cdev_wdog_init(NWDOG,wdog), /* 51: watchdog timer */
|
||||
};
|
||||
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 */ NODEV,
|
||||
/* 10 */ NODEV,
|
||||
/* 11 */ NODEV,
|
||||
/* 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 */ NODEV,
|
||||
/* 40 */ NODEV,
|
||||
/* 41 */ 14,
|
||||
/* 42 */ NODEV,
|
||||
/* 43 */ NODEV,
|
||||
/* 44 */ NODEV,
|
||||
/* 45 */ NODEV,
|
||||
/* 46 */ NODEV,
|
||||
/* 47 */ NODEV,
|
||||
/* 48 */ NODEV,
|
||||
/* 49 */ NODEV,
|
||||
/* 50 */ 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)));
|
||||
}
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#define scicnpollc nullcnpollc
|
||||
#define scifcnpollc nullcnpollc
|
||||
cons_decl(sci);
|
||||
cons_decl(scif);
|
||||
cons_decl(com);
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NSCI > 0
|
||||
cons_init(sci),
|
||||
#endif
|
||||
#if NSCIF > 0
|
||||
cons_init(scif),
|
||||
#endif
|
||||
#if NCOM > 0
|
||||
cons_init(com),
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
|
@ -0,0 +1,110 @@
|
|||
# $NetBSD: genassym.cf,v 1.1 2000/12/11 18:19:13 marcus Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1995, 1997 Charles M. Hannum. All rights reserved.
|
||||
# Copyright (c) 1982, 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.
|
||||
#
|
||||
# @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
||||
#
|
||||
|
||||
include "opt_memsize.h"
|
||||
include "opt_led_addr.h"
|
||||
|
||||
include <sys/param.h>
|
||||
include <sys/proc.h>
|
||||
include <sys/resourcevar.h>
|
||||
include <sys/device.h>
|
||||
include <sys/user.h>
|
||||
include <sys/mbuf.h>
|
||||
|
||||
include <uvm/uvm_extern.h>
|
||||
|
||||
include <sh3/mmureg.h>
|
||||
include <machine/trap.h>
|
||||
include <machine/pmap.h>
|
||||
include <machine/vmparam.h>
|
||||
|
||||
define SRUN SRUN
|
||||
define SONPROC SONPROC
|
||||
|
||||
define PDSLOT_PTE PDSLOT_PTE
|
||||
define PDSLOT_APTE PDSLOT_APTE
|
||||
define PDSLOT_KERN PDSLOT_KERN
|
||||
define NKPTP_MIN NKPTP_MIN
|
||||
define NKPTP_MAX NKPTP_MAX
|
||||
|
||||
define VM_MAXUSER_ADDRESS (int)VM_MAXUSER_ADDRESS
|
||||
|
||||
define P_ADDR offsetof(struct proc, p_addr)
|
||||
define P_BACK offsetof(struct proc, p_back)
|
||||
define P_FORW offsetof(struct proc, p_forw)
|
||||
define P_PRIORITY offsetof(struct proc, p_priority)
|
||||
define P_STAT offsetof(struct proc, p_stat)
|
||||
define P_WCHAN offsetof(struct proc, p_wchan)
|
||||
define P_VMSPACE offsetof(struct proc, p_vmspace)
|
||||
define P_FLAG offsetof(struct proc, p_flag)
|
||||
|
||||
define P_SYSTEM P_SYSTEM
|
||||
|
||||
define M_DATA offsetof(struct mbuf, m_data)
|
||||
define M_LEN offsetof(struct mbuf, m_len)
|
||||
define M_NEXT offsetof(struct mbuf, m_next)
|
||||
|
||||
define V_TRAP offsetof(struct uvmexp, traps)
|
||||
define V_INTR offsetof(struct uvmexp, intrs)
|
||||
|
||||
define PCB_PAGEDIRREG offsetof(struct pcb, pageDirReg)
|
||||
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
|
||||
define PCB_R15 offsetof(struct pcb, r15)
|
||||
define PCB_R14 offsetof(struct pcb, r14)
|
||||
define PCB_KR15 offsetof(struct pcb, kr15)
|
||||
|
||||
define TF_SPC offsetof(struct trapframe, tf_spc)
|
||||
define TF_TRAPNO offsetof(struct trapframe, tf_trapno)
|
||||
|
||||
define SIGF_HANDLER offsetof(struct sigframe, sf_handler)
|
||||
define SIGF_SC offsetof(struct sigframe, sf_sc)
|
||||
define SC_EFLAGS offsetof(struct sigcontext, sc_ssr)
|
||||
|
||||
define IOM_RAM_BEGIN IOM_RAM_BEGIN
|
||||
define IOM_RAM_SIZE IOM_RAM_SIZE
|
||||
define IOM_ROM_BEGIN IOM_ROM_BEGIN
|
||||
|
||||
# XXX SH4 only
|
||||
ifdef MMUCR_VALIDBITS
|
||||
define MMUCR_VALIDBITS MMUCR_VALIDBITS
|
||||
endif
|
||||
|
||||
define LED_ADDR LED_ADDR
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,849 @@
|
|||
/* $NetBSD: shb.c,v 1.1 2000/12/11 18:19:13 marcus Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994 Charles 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 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
#include <sh3/cpufunc.h>
|
||||
#include <sh3/intcreg.h>
|
||||
#include <sh3/trapreg.h>
|
||||
#include <machine/shbvar.h>
|
||||
|
||||
#if 0
|
||||
#include <dev/isa/isareg.h>
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <dev/isa/isadmareg.h>
|
||||
#endif
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
||||
int shbmatch __P((struct device *, struct cfdata *, void *));
|
||||
void shbattach __P((struct device *, struct device *, void *));
|
||||
int shbprint __P((void *, const char *));
|
||||
void intr_calculatemasks __P((void));
|
||||
int fakeintr __P((void *));
|
||||
void *shb_intr_establish __P((int irq, int type,
|
||||
int level, int (*ih_fun)(void *), void *ih_arg));
|
||||
int intrhandler __P((int, int, int, int, struct trapframe));
|
||||
int check_ipending __P((int, int, int, int, struct trapframe));
|
||||
void mask_irq __P((int));
|
||||
void unmask_irq __P((int));
|
||||
void Xsoftserial __P((void));
|
||||
void Xsoftnet __P((void));
|
||||
void Xsoftclock __P((void));
|
||||
void init_soft_intr_handler __P((void));
|
||||
|
||||
struct cfattach shb_ca = {
|
||||
sizeof(struct shb_softc), shbmatch, shbattach
|
||||
};
|
||||
|
||||
int shbsearch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
int
|
||||
shbmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct shbus_attach_args *iba = aux;
|
||||
|
||||
if (strcmp(iba->iba_busname, cf->cf_driver->cd_name))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
shbattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct shb_softc *sc = (struct shb_softc *)self;
|
||||
struct shbus_attach_args *iba = aux;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_iot = iba->iba_iot;
|
||||
sc->sc_memt = iba->iba_memt;
|
||||
|
||||
TAILQ_INIT(&sc->sc_subdevs);
|
||||
config_search(shbsearch, self, NULL);
|
||||
|
||||
init_soft_intr_handler();
|
||||
}
|
||||
|
||||
int
|
||||
shbprint(aux, isa)
|
||||
void *aux;
|
||||
const char *isa;
|
||||
{
|
||||
struct shb_attach_args *ia = aux;
|
||||
|
||||
if (ia->ia_iosize)
|
||||
printf(" port 0x%x", ia->ia_iobase);
|
||||
if (ia->ia_iosize > 1)
|
||||
printf("-0x%x", ia->ia_iobase + ia->ia_iosize - 1);
|
||||
if (ia->ia_msize)
|
||||
printf(" iomem 0x%x", ia->ia_maddr);
|
||||
if (ia->ia_msize > 1)
|
||||
printf("-0x%x", ia->ia_maddr + ia->ia_msize - 1);
|
||||
if (ia->ia_irq != IRQUNK)
|
||||
printf(" irq %d", ia->ia_irq);
|
||||
if (ia->ia_drq != DRQUNK)
|
||||
printf(" drq %d", ia->ia_drq);
|
||||
if (ia->ia_drq2 != DRQUNK)
|
||||
printf(" drq2 %d", ia->ia_drq2);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
int
|
||||
shbsearch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct shb_softc *sc = (struct shb_softc *)parent;
|
||||
struct shb_attach_args ia;
|
||||
int tryagain;
|
||||
|
||||
do {
|
||||
ia.ia_iot = sc->sc_iot;
|
||||
ia.ia_memt = sc->sc_memt;
|
||||
/* ia.ia_dmat = sc->sc_dmat; */
|
||||
/* ia.ia_ic = sc->sc_ic; */
|
||||
ia.ia_iobase = cf->cf_iobase;
|
||||
ia.ia_iosize = 0x666; /* cf->cf_iosize; */
|
||||
ia.ia_maddr = cf->cf_maddr;
|
||||
ia.ia_msize = cf->cf_msize;
|
||||
ia.ia_irq = cf->cf_irq == 2 ? 9 : cf->cf_irq;
|
||||
ia.ia_drq = cf->cf_drq;
|
||||
ia.ia_drq2 = cf->cf_drq2;
|
||||
/* ia.ia_delaybah = sc->sc_delaybah; */
|
||||
|
||||
tryagain = 0;
|
||||
if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0) {
|
||||
config_attach(parent, cf, &ia, shbprint);
|
||||
tryagain = (cf->cf_fstate == FSTATE_STAR);
|
||||
}
|
||||
} while (tryagain);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *
|
||||
shb_intr_typename(type)
|
||||
int type;
|
||||
{
|
||||
|
||||
switch (type) {
|
||||
case IST_NONE :
|
||||
return ("none");
|
||||
case IST_PULSE:
|
||||
return ("pulsed");
|
||||
case IST_EDGE:
|
||||
return ("edge-triggered");
|
||||
case IST_LEVEL:
|
||||
return ("level-triggered");
|
||||
default:
|
||||
panic("shb_intr_typename: invalid type %d", type);
|
||||
}
|
||||
}
|
||||
int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
|
||||
struct intrhand *intrhand[ICU_LEN];
|
||||
|
||||
/*
|
||||
* Recalculate the interrupt masks from scratch.
|
||||
* We could code special registry and deregistry versions of this function that
|
||||
* would be faster, but the code would be nastier, and we don't expect this to
|
||||
* happen very much anyway.
|
||||
*/
|
||||
void
|
||||
intr_calculatemasks()
|
||||
{
|
||||
int irq, level;
|
||||
struct intrhand *q;
|
||||
|
||||
/* First, figure out which levels each IRQ uses. */
|
||||
for (irq = 0; irq < ICU_LEN; irq++) {
|
||||
int levels = 0;
|
||||
for (q = intrhand[irq]; q; q = q->ih_next)
|
||||
levels |= 1 << q->ih_level;
|
||||
intrlevel[irq] = levels;
|
||||
}
|
||||
|
||||
/* Then figure out which IRQs use each level. */
|
||||
for (level = 0; level < NIPL; level++) {
|
||||
int irqs = 0;
|
||||
for (irq = 0; irq < ICU_LEN; irq++)
|
||||
if (intrlevel[irq] & (1 << level))
|
||||
irqs |= 1 << irq;
|
||||
imask[level] = irqs;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize soft interrupt masks to block themselves.
|
||||
*/
|
||||
imask[IPL_SOFTCLOCK] |= 1 << SIR_CLOCK;
|
||||
imask[IPL_SOFTNET] |= 1 << SIR_NET;
|
||||
imask[IPL_SOFTSERIAL] |= 1 << SIR_SERIAL;
|
||||
|
||||
/*
|
||||
* IPL_NONE is used for hardware interrupts that are never blocked,
|
||||
* and do not block anything else.
|
||||
*/
|
||||
imask[IPL_NONE] = 0;
|
||||
|
||||
/*
|
||||
* Enforce a hierarchy that gives slow devices a better chance at not
|
||||
* dropping data.
|
||||
*/
|
||||
imask[IPL_SOFTCLOCK] |= imask[IPL_NONE];
|
||||
imask[IPL_SOFTNET] |= imask[IPL_SOFTCLOCK];
|
||||
imask[IPL_BIO] |= imask[IPL_SOFTNET];
|
||||
imask[IPL_NET] |= imask[IPL_BIO];
|
||||
imask[IPL_SOFTSERIAL] |= imask[IPL_NET];
|
||||
imask[IPL_TTY] |= imask[IPL_SOFTSERIAL];
|
||||
|
||||
/*
|
||||
* There are tty, network and disk drivers that use free() at interrupt
|
||||
* time, so imp > (tty | net | bio).
|
||||
*/
|
||||
imask[IPL_IMP] |= imask[IPL_TTY];
|
||||
|
||||
imask[IPL_AUDIO] |= imask[IPL_IMP];
|
||||
|
||||
/*
|
||||
* Since run queues may be manipulated by both the statclock and tty,
|
||||
* network, and disk drivers, clock > imp.
|
||||
*/
|
||||
imask[IPL_CLOCK] |= imask[IPL_AUDIO];
|
||||
|
||||
/*
|
||||
* IPL_HIGH must block everything that can manipulate a run queue.
|
||||
*/
|
||||
imask[IPL_HIGH] |= imask[IPL_CLOCK];
|
||||
|
||||
/*
|
||||
* We need serial drivers to run at the absolute highest priority to
|
||||
* avoid overruns, so serial > high.
|
||||
*/
|
||||
imask[IPL_SERIAL] |= imask[IPL_HIGH];
|
||||
|
||||
/* And eventually calculate the complete masks. */
|
||||
for (irq = 0; irq < ICU_LEN; irq++) {
|
||||
int irqs = 1 << irq;
|
||||
for (q = intrhand[irq]; q; q = q->ih_next)
|
||||
irqs |= imask[q->ih_level];
|
||||
intrmask[irq] = irqs;
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
/* Lastly, determine which IRQs are actually in use. */
|
||||
{
|
||||
int irqs = 0;
|
||||
for (irq = 0; irq < ICU_LEN; irq++)
|
||||
if (intrhand[irq])
|
||||
irqs |= 1 << irq;
|
||||
if (irqs >= 0x100) /* any IRQs >= 8 in use */
|
||||
irqs |= 1 << IRQ_SLAVE;
|
||||
imen = ~irqs;
|
||||
SET_ICUS();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up an interrupt handler to start being called.
|
||||
* XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM.
|
||||
*/
|
||||
void *
|
||||
shb_intr_establish(irq, type, level, ih_fun, ih_arg)
|
||||
int irq;
|
||||
int type;
|
||||
int level;
|
||||
int (*ih_fun) __P((void *));
|
||||
void *ih_arg;
|
||||
{
|
||||
struct intrhand **p, *q, *ih;
|
||||
static struct intrhand fakehand = {fakeintr};
|
||||
|
||||
/* no point in sleeping unless someone can free memory. */
|
||||
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
|
||||
if (ih == NULL)
|
||||
panic("shb_intr_establish: can't malloc handler info");
|
||||
|
||||
#ifdef TODO
|
||||
if (type == IST_NONE)
|
||||
panic("intr_establish: bogus irq or type");
|
||||
|
||||
switch (intrtype[irq]) {
|
||||
case IST_NONE:
|
||||
intrtype[irq] = type;
|
||||
break;
|
||||
case IST_EDGE:
|
||||
case IST_LEVEL:
|
||||
if (type == intrtype[irq])
|
||||
break;
|
||||
case IST_PULSE:
|
||||
if (type != IST_NONE)
|
||||
panic("intr_establish: can't share %s with %s",
|
||||
shb_intr_typename(intrtype[irq]),
|
||||
shb_intr_typename(type));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Figure out where to put the handler.
|
||||
* This is O(N^2), but we want to preserve the order, and N is
|
||||
* generally small.
|
||||
*/
|
||||
for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next)
|
||||
;
|
||||
|
||||
/*
|
||||
* Actually install a fake handler momentarily, since we might be doing
|
||||
* this with interrupts enabled and don't want the real routine called
|
||||
* until masking is set up.
|
||||
*/
|
||||
fakehand.ih_level = level;
|
||||
*p = &fakehand;
|
||||
|
||||
intr_calculatemasks();
|
||||
|
||||
/*
|
||||
* Poke the real handler in now.
|
||||
*/
|
||||
ih->ih_fun = ih_fun;
|
||||
ih->ih_arg = ih_arg;
|
||||
ih->ih_count = 0;
|
||||
ih->ih_next = NULL;
|
||||
ih->ih_level = level;
|
||||
ih->ih_irq = irq;
|
||||
*p = ih;
|
||||
|
||||
/* unmask H/W interrupt mask register */
|
||||
if (irq < SHB_MAX_HARDINTR)
|
||||
unmask_irq(irq);
|
||||
|
||||
return (ih);
|
||||
}
|
||||
|
||||
int
|
||||
fakeintr(arg)
|
||||
void *arg;
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define IRQ_BIT(irq_num) (1 << (irq_num))
|
||||
|
||||
/*ARGSUSED*/
|
||||
int /* 1 = check ipending on return, 0 = fast intr return */
|
||||
intrhandler(p1, p2, p3, p4, frame)
|
||||
int p1, p2, p3, p4; /* dummy param */
|
||||
struct trapframe frame;
|
||||
{
|
||||
unsigned int irl;
|
||||
struct intrhand *ih;
|
||||
unsigned int irq_num;
|
||||
int ocpl;
|
||||
|
||||
#if 0
|
||||
printf("intr_handler:int_no %x spc %x ssr %x r15 %x curproc %x\n",
|
||||
frame.tf_trapno, frame.tf_spc, frame.tf_ssr, frame.tf_r15,
|
||||
(int)curproc);
|
||||
#endif
|
||||
|
||||
irl = (unsigned int)frame.tf_trapno;
|
||||
if (irl >= INTEVT_SOFT) {
|
||||
/* This is software interrupt */
|
||||
irq_num = (irl - INTEVT_SOFT);
|
||||
} else if (irl == INTEVT_TMU1) {
|
||||
irq_num = TMU1_IRQ;
|
||||
} else if (IS_INTEVT_SCI0(irl)) { /* XXX TOO DIRTY */
|
||||
irq_num = SCI_IRQ;
|
||||
#ifdef SH4
|
||||
} else if ((irl & 0x0f00) == INTEVT_SCIF) {
|
||||
irq_num = SCIF_IRQ;
|
||||
#endif
|
||||
} else
|
||||
irq_num = (irl - 0x200) >> 5;
|
||||
|
||||
mask_irq(irq_num);
|
||||
|
||||
if (cpl & IRQ_BIT(irq_num)) {
|
||||
ipending |= IRQ_BIT(irq_num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ocpl = cpl;
|
||||
cpl |= intrmask[irq_num];
|
||||
ih = intrhand[irq_num];
|
||||
if (ih == NULL) {
|
||||
|
||||
/* this is stray interrupt */
|
||||
cpl = ocpl;
|
||||
|
||||
#if 0 /* This is commented by T.Horiuchi */
|
||||
unmask_irq(irq_num);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
enable_ext_intr();
|
||||
while (ih) {
|
||||
if (ih->ih_arg)
|
||||
(*ih->ih_fun)(ih->ih_arg);
|
||||
else
|
||||
(*ih->ih_fun)(&frame);
|
||||
ih = ih->ih_next;
|
||||
}
|
||||
disable_ext_intr();
|
||||
|
||||
cpl = ocpl;
|
||||
|
||||
unmask_irq(irq_num);
|
||||
|
||||
#if 0
|
||||
printf("intr_handler:end\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int /* 1 = resume ihandler on return, 0 = go to fast intr return */
|
||||
check_ipending(p1, p2, p3, p4, frame)
|
||||
int p1, p2, p3, p4; /* dummy param */
|
||||
struct trapframe frame;
|
||||
{
|
||||
int ir;
|
||||
int i;
|
||||
int mask;
|
||||
#define MASK_LEN 32
|
||||
|
||||
restart:
|
||||
ir = (~cpl) & ipending;
|
||||
if (ir == 0)
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
mask = 1;
|
||||
for (i = 0; i < MASK_LEN; i++, mask <<= 1) {
|
||||
if (ir & mask)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
mask = 1 << IRQ_LOW;
|
||||
for (i = IRQ_LOW; i <= IRQ_HIGH; i++, mask <<= 1) {
|
||||
if (ir & mask)
|
||||
break;
|
||||
}
|
||||
if (IRQ_HIGH < i) {
|
||||
mask = 1 << SIR_LOW;
|
||||
for (i = SIR_LOW; i <= SIR_HIGH; i++, mask <<= 1) {
|
||||
if (ir & mask)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((mask & ipending) == 0)
|
||||
goto restart;
|
||||
|
||||
ipending &= ~mask;
|
||||
|
||||
if (i < SHB_MAX_HARDINTR) {
|
||||
/* set interrupt event register, this value is referenced in ihandler */
|
||||
SHREG_INTEVT = (i << 5) + 0x200;
|
||||
} else {
|
||||
/* This is software interrupt */
|
||||
SHREG_INTEVT = INTEVT_SOFT+i;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(SH4)
|
||||
|
||||
#ifdef SH7709A_BROKEN_IPR /* broken IPR patch */
|
||||
|
||||
#define IPRA 0
|
||||
#define IPRB 1
|
||||
#define IPRC 2
|
||||
#define IPRD 3
|
||||
#define IPRE 4
|
||||
|
||||
static unsigned short ipr[ 5 ];
|
||||
|
||||
#endif /* SH7709A_BROKEN_IPR */
|
||||
|
||||
void
|
||||
mask_irq(irq)
|
||||
int irq;
|
||||
{
|
||||
switch (irq) {
|
||||
case TMU1_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[IPRA] &= ~((15)<<8);
|
||||
SHREG_IPRA = ipr[IPRA];
|
||||
#else
|
||||
SHREG_IPRA &= ~((15)<<8);
|
||||
#endif
|
||||
break;
|
||||
case SCI_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[IPRB] &= ~((15)<<4);
|
||||
SHREG_IPRB = ipr[IPRB];
|
||||
#else
|
||||
SHREG_IPRB &= ~((15)<<4);
|
||||
#endif
|
||||
break;
|
||||
#if defined(SH7709) || defined(SH7709A) || defined(SH7729)
|
||||
case SCIF_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[IPRE] &= ~((15)<<4);
|
||||
SHREG_IPRE = ipr[IPRE];
|
||||
#else
|
||||
SHREG_IPRE &= ~((15)<<4);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if 0
|
||||
case IRQ0_IRQ:
|
||||
SHREG_IPRC &= ~(15);
|
||||
break;
|
||||
case IRQ1_IRQ:
|
||||
SHREG_IPRC &= ~((15)<<4);
|
||||
break;
|
||||
case IRQ2_IRQ:
|
||||
SHREG_IPRC &= ~((15)<<8);
|
||||
break;
|
||||
case DMAC_IRQ:
|
||||
SHREG_IPRE &= ~((15)<<12);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if (irq < SHB_MAX_HARDINTR)
|
||||
printf("masked unknown irq(%d)!\n", irq);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unmask_irq(irq)
|
||||
int irq;
|
||||
{
|
||||
|
||||
switch (irq) {
|
||||
case TMU1_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[ IPRA ] |= ((15 - irq)<<8);
|
||||
SHREG_IPRA = ipr[ IPRA ];
|
||||
#else
|
||||
SHREG_IPRA |= ((15 - irq)<<8);
|
||||
#endif
|
||||
break;
|
||||
case SCI_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[IPRB] |= ((15 - irq)<<4);
|
||||
SHREG_IPRB = ipr[IPRB];
|
||||
#else
|
||||
SHREG_IPRB |= ((15 - irq)<<4);
|
||||
#endif
|
||||
break;
|
||||
#if defined(SH7709) || defined(SH7709A) || defined(SH7729)
|
||||
case SCIF_IRQ:
|
||||
#ifdef SH7709A_BROKEN_IPR
|
||||
ipr[ IPRE ] |= ((15 - irq)<<4);
|
||||
SHREG_IPRE = ipr[ IPRE ];
|
||||
#else
|
||||
SHREG_IPRE |= ((15 - irq)<<4);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if 0
|
||||
case IRQ0_IRQ:
|
||||
SHREG_IPRC |= (15 - irq);
|
||||
break;
|
||||
case IRQ1_IRQ:
|
||||
SHREG_IPRC |= ((15 - irq)<<4);
|
||||
break;
|
||||
case IRQ2_IRQ:
|
||||
SHREG_IPRC |= ((15 - irq)<<8);
|
||||
break;
|
||||
case DMAC_IRQ:
|
||||
SHREG_IPRE |= ((15 - irq)<<12);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if (irq < SHB_MAX_HARDINTR)
|
||||
printf("unmasked unknown irq(%d)!\n", irq);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void
|
||||
mask_irq(irq)
|
||||
int irq;
|
||||
{
|
||||
switch (irq) {
|
||||
case TMU1_IRQ:
|
||||
SHREG_IPRA &= ~((15)<<8);
|
||||
break;
|
||||
case SCI_IRQ:
|
||||
SHREG_IPRB &= ~((15)<<4);
|
||||
break;
|
||||
case SCIF_IRQ:
|
||||
SHREG_IPRC &= ~((15)<<4);
|
||||
break;
|
||||
#if 0
|
||||
case IRQ0_IRQ:
|
||||
SHREG_IPRC &= ~(15);
|
||||
break;
|
||||
case IRQ1_IRQ:
|
||||
SHREG_IPRC &= ~((15)<<4);
|
||||
break;
|
||||
case IRQ2_IRQ:
|
||||
SHREG_IPRC &= ~((15)<<8);
|
||||
break;
|
||||
case DMAC_IRQ:
|
||||
SHREG_IPRE &= ~((15)<<12);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if (irq < SHB_MAX_HARDINTR)
|
||||
printf("masked unknown irq(%d)!\n", irq);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unmask_irq(irq)
|
||||
int irq;
|
||||
{
|
||||
|
||||
switch (irq) {
|
||||
case TMU1_IRQ:
|
||||
SHREG_IPRA |= ((15 - irq)<<8);
|
||||
break;
|
||||
case SCI_IRQ:
|
||||
SHREG_IPRB |= ((15 - irq)<<4);
|
||||
break;
|
||||
case SCIF_IRQ:
|
||||
SHREG_IPRC |= ((15 - irq)<<4);
|
||||
break;
|
||||
#if 0
|
||||
case IRQ0_IRQ:
|
||||
SHREG_IPRC |= (15 - irq);
|
||||
break;
|
||||
case IRQ1_IRQ:
|
||||
SHREG_IPRC |= ((15 - irq)<<4);
|
||||
break;
|
||||
case IRQ2_IRQ:
|
||||
SHREG_IPRC |= ((15 - irq)<<8);
|
||||
break;
|
||||
case DMAC_IRQ:
|
||||
SHREG_IPRE |= ((15 - irq)<<12);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if (irq < SHB_MAX_HARDINTR)
|
||||
printf("unmasked unknown irq(%d)!\n", irq);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
init_soft_intr_handler(void)
|
||||
{
|
||||
#include "sci.h"
|
||||
#include "scif.h"
|
||||
#if ((NSCI > 0) || (NSCIF > 0))
|
||||
shb_intr_establish(SIR_SERIAL, IST_LEVEL, IPL_SOFTSERIAL,
|
||||
(int (*) (void *))Xsoftserial, NULL);
|
||||
#endif
|
||||
|
||||
shb_intr_establish(SIR_NET, IST_LEVEL, IPL_SOFTNET,
|
||||
(int (*) (void *))Xsoftnet, NULL);
|
||||
|
||||
shb_intr_establish(SIR_CLOCK, IST_LEVEL, IPL_SOFTCLOCK,
|
||||
(int (*) (void *))Xsoftclock, NULL);
|
||||
}
|
||||
|
||||
#if ((NSCI > 0) || (NSCIF > 0))
|
||||
void scisoft __P((void *));
|
||||
void scifsoft __P((void *));
|
||||
|
||||
void
|
||||
Xsoftserial(void)
|
||||
{
|
||||
#if (NSCI > 0)
|
||||
scisoft(NULL);
|
||||
#endif
|
||||
#if (NSCIF > 0)
|
||||
scifsoft(NULL);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Xsoftnet(void)
|
||||
{
|
||||
int s, ni;
|
||||
|
||||
s = splhigh();
|
||||
ni = netisr;
|
||||
netisr = 0;
|
||||
splx(s);
|
||||
|
||||
#define DONETISR(bit, fn) do { \
|
||||
if (ni & (1 << bit)) \
|
||||
fn(); \
|
||||
} while (0)
|
||||
|
||||
#include <net/netisr_dispatch.h>
|
||||
|
||||
#undef DONETISR
|
||||
}
|
||||
|
||||
void
|
||||
Xsoftclock(void)
|
||||
{
|
||||
|
||||
softclock();
|
||||
}
|
||||
|
||||
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < SHB_MAX_HARDINTR && (x) != 2)
|
||||
|
||||
int
|
||||
sh_intr_alloc(mask, type, irq)
|
||||
int mask;
|
||||
int type;
|
||||
int *irq;
|
||||
{
|
||||
int i, tmp, bestirq, count;
|
||||
struct intrhand **p, *q;
|
||||
|
||||
if (type == IST_NONE)
|
||||
panic("intr_alloc: bogus type");
|
||||
|
||||
bestirq = -1;
|
||||
count = -1;
|
||||
|
||||
/* some interrupts should never be dynamically allocated */
|
||||
mask &= 0xdef8;
|
||||
|
||||
/*
|
||||
* XXX some interrupts will be used later (6 for fdc, 12 for pms).
|
||||
* the right answer is to do "breadth-first" searching of devices.
|
||||
*/
|
||||
mask &= 0xefbf;
|
||||
|
||||
for (i = 0; i < SHB_MAX_HARDINTR; i++) {
|
||||
if (LEGAL_IRQ(i) == 0 || (mask & (1 << i)) == 0)
|
||||
continue;
|
||||
|
||||
switch(intrtype[i]) {
|
||||
case IST_NONE:
|
||||
/*
|
||||
* if nothing's using the irq, just return it
|
||||
*/
|
||||
*irq = i;
|
||||
return (0);
|
||||
|
||||
case IST_EDGE:
|
||||
case IST_LEVEL:
|
||||
if (type != intrtype[i])
|
||||
continue;
|
||||
/*
|
||||
* if the irq is shareable, count the number of other
|
||||
* handlers, and if it's smaller than the last irq like
|
||||
* this, remember it
|
||||
*
|
||||
* XXX We should probably also consider the
|
||||
* interrupt level and stick IPL_TTY with other
|
||||
* IPL_TTY, etc.
|
||||
*/
|
||||
for (p = &intrhand[i], tmp = 0; (q = *p) != NULL;
|
||||
p = &q->ih_next, tmp++)
|
||||
;
|
||||
if ((bestirq == -1) || (count > tmp)) {
|
||||
bestirq = i;
|
||||
count = tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case IST_PULSE:
|
||||
/* this just isn't shareable */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (bestirq == -1)
|
||||
return (1);
|
||||
|
||||
*irq = bestirq;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Deregister an interrupt handler.
|
||||
*/
|
||||
void
|
||||
shb_intr_disestablish(ic, arg)
|
||||
void *ic;
|
||||
void *arg;
|
||||
{
|
||||
struct intrhand *ih = arg;
|
||||
int irq = ih->ih_irq;
|
||||
struct intrhand **p, *q;
|
||||
|
||||
mask_irq(irq);
|
||||
|
||||
/*
|
||||
* Remove the handler from the chain.
|
||||
* This is O(n^2), too.
|
||||
*/
|
||||
for (p = &intrhand[irq]; (q = *p) != NULL && q != ih; p = &q->ih_next)
|
||||
;
|
||||
if (q)
|
||||
*p = q->ih_next;
|
||||
else
|
||||
panic("shb_intr_disestablish: handler not registered");
|
||||
free(ih, M_DEVBUF);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.1 2000/12/11 18:19:13 marcus Exp $
|
||||
|
||||
KDIR= /sys/arch/dreamcast/include
|
||||
INCSDIR= /usr/include/dreamcast
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h bootinfo.h bswap.h bus.h cdefs.h \
|
||||
coff_machdep.h conf.h cpu.h cpufunc.h cputypes.h db_machdep.h \
|
||||
disklabel.h elf_machdep.h endian.h endian_machdep.h float.h frame.h \
|
||||
ieee.h ieeefp.h int_types.h intr.h limits.h lock.h math.h mmeye.h \
|
||||
param.h pcb.h pio.h pmap.h proc.h profile.h psl.h pte.h ptrace.h \
|
||||
reg.h segments.h setjmp.h shbvar.h signal.h stdarg.h \
|
||||
trap.h types.h varargs.h vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: ansi.h,v 1.1 2000/12/11 18:19:13 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_ANSI_H_
|
||||
#define _DREAMCAST_ANSI_H_
|
||||
|
||||
#include <sh3/ansi.h>
|
||||
|
||||
#endif /* _DREAMCAST_ANSI_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: aout_machdep.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_AOUT_MACHDEP_H_
|
||||
#define _DREAMCAST_AOUT_MACHDEP_H_
|
||||
|
||||
#include <sh3/aout_machdep.h>
|
||||
|
||||
#endif /* _DREAMCAST_AOUT_MACHDEP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: asm.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_ASM_H_
|
||||
#define _DREAMCAST_ASM_H_
|
||||
|
||||
#include <sh3/asm.h>
|
||||
|
||||
#endif /* _DREAMCAST_ASM_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: bootinfo.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_BOOTINFO_H_
|
||||
#define _DREAMCAST_BOOTINFO_H_
|
||||
|
||||
#include <sh3/bootinfo.h>
|
||||
|
||||
#endif /* _DREAMCAST_BOOTINFO_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_BSWAP_H_
|
||||
#define _DREAMCAST_BSWAP_H_
|
||||
|
||||
#include <sh3/bswap.h>
|
||||
|
||||
#endif /* _DREAMCAST_BSWAP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: bus.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_BUS_H_
|
||||
#define _DREAMCAST_BUS_H_
|
||||
|
||||
#include <sh3/bus.h>
|
||||
|
||||
#endif /* _DREAMCAST_BUS_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: cdefs.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_CDEFS_H_
|
||||
#define _DREAMCAST_CDEFS_H_
|
||||
|
||||
#include <sh3/cdefs.h>
|
||||
|
||||
#endif /* _DREAMCAST_CDEFS_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: coff_machdep.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_COFF_MACHDEP_H_
|
||||
#define _DREAMCAST_COFF_MACHDEP_H_
|
||||
|
||||
#include <sh3/coff_machdep.h>
|
||||
|
||||
#endif /* _DREAMCAST_COFF_MACHDEP_H_ */
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: conf.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christos Zoulas.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/conf.h>
|
||||
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
cdev_decl(mm);
|
||||
|
||||
bdev_decl(fd);
|
||||
cdev_decl(fd);
|
||||
|
||||
/* open, close, ioctl */
|
||||
#define cdev_wdog_init(c,n) { \
|
||||
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
|
||||
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
|
||||
(dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev }
|
||||
|
||||
cdev_decl(wdog);
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: cpu.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_CPU_H_
|
||||
#define _DREAMCAST_CPU_H_
|
||||
|
||||
#include <sh3/cpu.h>
|
||||
|
||||
#endif /* _DREAMCAST_CPU_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: cpufunc.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_CPUFUNC_H_
|
||||
#define _DREAMCAST_CPUFUNC_H_
|
||||
|
||||
#include <sh3/cpufunc.h>
|
||||
|
||||
#endif /* _DREAMCAST_CPUFUNC_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: cputypes.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_CPUTYPES_H_
|
||||
#define _DREAMCAST_CPUTYPES_H_
|
||||
|
||||
#include <sh3/cputypes.h>
|
||||
|
||||
#endif /* _DREAMCAST_CPUTYPES_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_DB_MACHDEP_H_
|
||||
#define _DREAMCAST_DB_MACHDEP_H_
|
||||
|
||||
#include <sh3/db_machdep.h>
|
||||
|
||||
#endif /* _DREAMCAST_DB_MACHDEP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: disklabel.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_DISKLABEL_H_
|
||||
#define _DREAMCAST_DISKLABEL_H_
|
||||
|
||||
#include <sh3/disklabel.h>
|
||||
|
||||
#endif /* _DREAMCAST_DISKLABEL_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: elf_machdep.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_ELF_MACHDEP_H_
|
||||
#define _DREAMCAST_ELF_MACHDEP_H_
|
||||
|
||||
#include <sh3/elf_machdep.h>
|
||||
|
||||
#endif /* _DREAMCAST_ELF_MACHDEP_H_ */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: endian_machdep.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
|
||||
#if 0
|
||||
#define _BYTE_ORDER _BIG_ENDIAN
|
||||
#else
|
||||
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||
#endif
|
||||
#include <sh3/endian_machdep.h>
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: float.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_FLOAT_H_
|
||||
#define _DREAMCAST_FLOAT_H_
|
||||
|
||||
#include <sh3/float.h>
|
||||
|
||||
#endif /* _DREAMCAST_FLOAT_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: frame.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_FRAME_H_
|
||||
#define _DREAMCAST_FRAME_H_
|
||||
|
||||
#include <sh3/frame.h>
|
||||
|
||||
#endif /* _DREAMCAST_FRAME_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: ieee.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_IEEE_H_
|
||||
#define _DREAMCAST_IEEE_H_
|
||||
|
||||
#include <sh3/ieee.h>
|
||||
|
||||
#endif /* _DREAMCAST_IEEE_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_IEEEFP_H_
|
||||
#define _DREAMCAST_IEEEFP_H_
|
||||
|
||||
#include <sh3/ieeefp.h>
|
||||
|
||||
#endif /* _DREAMCAST_IEEEFP_H_ */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: int_types.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
|
||||
#include <sh3/int_types.h>
|
|
@ -0,0 +1,39 @@
|
|||
/* $NetBSD: intr.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_INTR_H_
|
||||
#define _DREAMCAST_INTR_H_
|
||||
|
||||
/* Interrupt priority `levels'. */
|
||||
#define IPL_NONE 9 /* nothing */
|
||||
#define IPL_SOFTCLOCK 8 /* timeouts */
|
||||
#define IPL_SOFTNET 7 /* protocol stacks */
|
||||
#define IPL_BIO 6 /* block I/O */
|
||||
#define IPL_NET 5 /* network */
|
||||
#define IPL_SOFTSERIAL 4 /* serial */
|
||||
#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
|
||||
|
||||
#include <sh3/intr.h>
|
||||
|
||||
/* Soft interrupt masks. */
|
||||
#define SIR_CLOCK 31
|
||||
#define SIR_NET 30
|
||||
#define SIR_SERIAL 29
|
||||
|
||||
#define SIR_LOW 29
|
||||
#define SIR_HIGH 31
|
||||
|
||||
/* IRQ */
|
||||
#define TMU1_IRQ 2
|
||||
#define SCI_IRQ 6
|
||||
#define SCIF_IRQ 7
|
||||
#define WDOG_IRQ 1
|
||||
|
||||
#define IRQ_LOW 1
|
||||
#define IRQ_HIGH 15
|
||||
|
||||
#endif /* _DREAMCAST_INTR_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: limits.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_LIMITS_H_
|
||||
#define _DREAMCAST_LIMITS_H_
|
||||
|
||||
#include <sh3/limits.h>
|
||||
|
||||
#endif /* _DREAMCAST_LIMITS_H_ */
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: lock.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
|
||||
/* Just use the common sh3 definition */
|
||||
#include <sh3/lock.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: math.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
|
||||
#include <sh3/math.h>
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Brains mmEye specific register definition
|
||||
*/
|
||||
|
||||
#ifndef _MMEYE_H_
|
||||
#define _MMEYE_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include "opt_led_addr.h"
|
||||
|
||||
#define MMEYE_LED (*(volatile unsigned char *)LED_ADDR)
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#define MMEYE_LED (*(volatile unsigned char *)0xa8000000)
|
||||
#else
|
||||
#define MMEYE_LED (*(volatile unsigned char *)0xb8000000)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _MMEYE_H_ */
|
|
@ -0,0 +1,186 @@
|
|||
/* $NetBSD: param.h,v 1.1 2000/12/11 18:19:15 marcus 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.
|
||||
*
|
||||
* @(#)param.h 5.8 (Berkeley) 6/28/91
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine dependent constants for Intel 386.
|
||||
*/
|
||||
|
||||
#ifndef _DREAMCAST_PARAM_H_
|
||||
#define _DREAMCAST_PARAM_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifdef _LOCORE
|
||||
#include <machine/psl.h>
|
||||
#else
|
||||
#include <machine/cpu.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _MACHINE dreamcast
|
||||
#define MACHINE "dreamcast"
|
||||
|
||||
|
||||
#if 1
|
||||
#define _MACHINE_ARCH sh3
|
||||
#define MACHINE_ARCH "sh3"
|
||||
#define MID_MACHINE MID_SH3
|
||||
#else /* XXX (msaioth) */
|
||||
#include <sh3/param.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value
|
||||
* for all data types (int, long, ...). The result is u_int and
|
||||
* must be cast to any desired pointer type.
|
||||
*
|
||||
* ALIGNED_POINTER is a boolean macro that checks whether an address
|
||||
* is valid to fetch data elements of type t from on this architecture.
|
||||
* This does not reflect the optimal alignment, just the possibility
|
||||
* (within reasonable limits).
|
||||
*
|
||||
*/
|
||||
#define ALIGNBYTES (sizeof(int) - 1)
|
||||
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
||||
#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
|
||||
/* #define ALIGNED_POINTER(p, t) 1 */
|
||||
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
#define NBPG (1 << PGSHIFT) /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef _LOCORE
|
||||
extern vaddr_t ram_start;
|
||||
#define KERNBASE ram_start /* start of kernel virtual space */
|
||||
#define KERNTEXTOFF ram_start /* start of kernel text */
|
||||
#else
|
||||
#define KERNBASE IOM_RAM_BEGIN /* start of kernel virtual space */
|
||||
#define KERNTEXTOFF IOM_RAM_BEGIN /* start of kernel text */
|
||||
#endif
|
||||
#endif
|
||||
#define KERNSIZE 0x01800000 /* size of kernel virtual space */
|
||||
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
|
||||
|
||||
#define NPGDIR (1*NBPG)
|
||||
#define SYSMAP (5*NBPG) /* page table area offset from _end */
|
||||
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define DEV_BSIZE (1 << DEV_BSHIFT)
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define SSIZE 1 /* initial stack size/NBPG */
|
||||
#define SINCR 1 /* increment of stack/NBPG */
|
||||
#if 0
|
||||
#define UPAGES 2 /* pages of u-area */
|
||||
#else
|
||||
#define UPAGES 4 /* pages of u-area */
|
||||
#endif
|
||||
#define USPACE (UPAGES * NBPG) /* total size of u-area */
|
||||
|
||||
#ifndef MSGBUFSIZE
|
||||
#define MSGBUFSIZE NBPG /* default message buffer size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZE 256 /* size of an mbuf */
|
||||
|
||||
#ifndef MCLSHIFT
|
||||
# define MCLSHIFT 11 /* convert bytes to m_buf clusters */
|
||||
#endif /* MCLSHIFT */
|
||||
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
|
||||
#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
|
||||
|
||||
#ifndef NMBCLUSTERS
|
||||
#ifdef GATEWAY
|
||||
#define NMBCLUSTERS 512 /* map size, max cluster allocation */
|
||||
#else
|
||||
#define NMBCLUSTERS 256 /* map size, max cluster allocation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
|
||||
* logical pages.
|
||||
*/
|
||||
#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT)
|
||||
#define NKMEMPAGES_MAX_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT)
|
||||
|
||||
/* pages ("clicks") to disk blocks */
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
|
||||
/* bytes to pages */
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/* bytes to disk blocks */
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and should use the bsize
|
||||
* field from the disk label.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Mach derived conversion macros
|
||||
*/
|
||||
#define sh3_round_pdr(x) ((((unsigned)(x)) + PDOFSET) & ~PDOFSET)
|
||||
#define sh3_trunc_pdr(x) ((unsigned)(x) & ~PDOFSET)
|
||||
#define sh3_btod(x) ((unsigned)(x) >> PDSHIFT)
|
||||
#define sh3_dtob(x) ((unsigned)(x) << PDSHIFT)
|
||||
#define sh3_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
|
||||
#define sh3_trunc_page(x) ((unsigned)(x) & ~PGOFSET)
|
||||
#define sh3_btop(x) ((unsigned)(x) >> PGSHIFT)
|
||||
#define sh3_ptob(x) ((unsigned)(x) << PGSHIFT)
|
||||
|
||||
#endif /* _DREAMCAST_PARAM_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: pcb.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PCB_H_
|
||||
#define _DREAMCAST_PCB_H_
|
||||
|
||||
#include <sh3/pcb.h>
|
||||
|
||||
#endif /* _DREAMCAST_PCB_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: pio.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PIO_H_
|
||||
#define _DREAMCAST_PIO_H_
|
||||
|
||||
#include <sh3/pio.h>
|
||||
|
||||
#endif /* _DREAMCAST_PIO_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: pmap.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PMAP_H_
|
||||
#define _DREAMCAST_PMAP_H_
|
||||
|
||||
#include <sh3/pmap.h>
|
||||
|
||||
#endif /* _DREAMCAST_PMAP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: proc.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PROC_H_
|
||||
#define _DREAMCAST_PROC_H_
|
||||
|
||||
#include <sh3/proc.h>
|
||||
|
||||
#endif /* _DREAMCAST_PROC_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: profile.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PROFILE_H_
|
||||
#define _DREAMCAST_PROFILE_H_
|
||||
|
||||
#include <sh3/profile.h>
|
||||
|
||||
#endif /* _DREAMCAST_PROFILE_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: psl.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PSL_H_
|
||||
#define _DREAMCAST_PSL_H_
|
||||
|
||||
#include <sh3/psl.h>
|
||||
|
||||
#endif /* _DREAMCAST_PSL_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: pte.h,v 1.1 2000/12/11 18:19:15 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PTE_H_
|
||||
#define _DREAMCAST_PTE_H_
|
||||
|
||||
#include <sh3/pte.h>
|
||||
|
||||
#endif /* _DREAMCAST_PTE_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: ptrace.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_PTRACE_H_
|
||||
#define _DREAMCAST_PTRACE_H_
|
||||
|
||||
#include <sh3/ptrace.h>
|
||||
|
||||
#endif /* _DREAMCAST_PTRACE_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: reg.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_REG_H_
|
||||
#define _DREAMCAST_REG_H_
|
||||
|
||||
#include <sh3/reg.h>
|
||||
|
||||
#endif /* _DREAMCAST_REG_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: segments.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_SEGMENTS_H_
|
||||
#define _DREAMCAST_SEGMENTS_H_
|
||||
|
||||
#include <sh3/segments.h>
|
||||
|
||||
#endif /* _DREAMCAST_SEGMENTS_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: setjmp.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_SETJMP_H_
|
||||
#define _DREAMCAST_SETJMP_H_
|
||||
|
||||
#include <sh3/setjmp.h>
|
||||
|
||||
#endif /* _DREAMCAST_SETJMP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: shbvar.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_SHBVAR_H_
|
||||
#define _DREAMCAST_SHBVAR_H_
|
||||
|
||||
#include <sh3/shbvar.h>
|
||||
|
||||
#endif /* _DREAMCAST_SHBVAR_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: signal.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_SIGNAL_H_
|
||||
#define _DREAMCAST_SIGNAL_H_
|
||||
|
||||
#include <sh3/signal.h>
|
||||
|
||||
#endif /* _DREAMCAST_SIGNAL_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: stdarg.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_STDARG_H_
|
||||
#define _DREAMCAST_STDARG_H_
|
||||
|
||||
#include <sh3/stdarg.h>
|
||||
|
||||
#endif /* _DREAMCAST_STDARG_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: trap.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_TRAP_H_
|
||||
#define _DREAMCAST_TRAP_H_
|
||||
|
||||
#include <sh3/trap.h>
|
||||
|
||||
#endif /* _DREAMCAST_TRAP_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: types.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_TYPES_H_
|
||||
#define _DREAMCAST_TYPES_H_
|
||||
|
||||
#include <sh3/types.h>
|
||||
|
||||
#endif /* _DREAMCAST_TYPES_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: varargs.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_VARARGS_H_
|
||||
#define _DREAMCAST_VARARGS_H_
|
||||
|
||||
#include <sh3/varargs.h>
|
||||
|
||||
#endif /* _DREAMCAST_VARARGS_H_ */
|
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: vmparam.h,v 1.1 2000/12/11 18:19:16 marcus Exp $ */
|
||||
#ifndef _DREAMCAST_VMPARAM_H_
|
||||
#define _DREAMCAST_VMPARAM_H_
|
||||
|
||||
#include <sh3/vmparam.h>
|
||||
|
||||
#endif /* _DREAMCAST_VMPARAM_H_ */
|
Loading…
Reference in New Issue