Add support for the Extensible MIPS ("eMIPS") platform. The
NetBSD/emips port runs on Xilinx and Beecube FPGA systems and the Giano system simulator. eMIPS is a platform developed at Microsoft Research for researching reconfigurable computing. eMIPS allows dynamic loading and scheduling of application-specific circuits for the purpose of accelerating computations based on the current workload. NetBSD eMIPS support for NetBSD 4.x was written at Microsoft Research by Alessandro Forin and Neil Pittman. Microsoft Corporation has donated full copyright to The NetBSD Foundation. Platform support for eMIPS is the first part of Microsoft's contribution. The second part includes the hardware accelerator framework and will be proposed on tech-kern soon.
This commit is contained in:
parent
ecfd85d839
commit
5f7e80a834
6
build.sh
6
build.sh
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env sh
|
||||
# $NetBSD: build.sh,v 1.243 2011/01/23 06:50:53 matt Exp $
|
||||
# $NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
|
||||
#
|
||||
# Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -379,7 +379,7 @@ getarch()
|
|||
MACHINE_ARCH=mips64eb
|
||||
;;
|
||||
|
||||
ews4800mips|mipsco|newsmips|sgimips)
|
||||
ews4800mips|mipsco|newsmips|sgimips|emips)
|
||||
MACHINE_ARCH=mipseb
|
||||
;;
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ createmakewrapper()
|
|||
eval cat <<EOF ${makewrapout}
|
||||
#! ${HOST_SH}
|
||||
# Set proper variables to allow easy "make" building of a NetBSD subtree.
|
||||
# Generated from: \$NetBSD: build.sh,v 1.243 2011/01/23 06:50:53 matt Exp $
|
||||
# Generated from: \$NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
|
||||
# with these arguments: ${_args}
|
||||
#
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:43 pooka Exp $
|
||||
|
||||
SUBDIR= ramdisk .WAIT instkernel .WAIT cdroms
|
||||
TARGETS+= release
|
||||
|
||||
iso_image:
|
||||
${MAKEDIRTARGET} cdroms iso_image
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:43 pooka Exp $
|
||||
|
||||
SUBDIR= installcd
|
||||
TARGETS+= release iso_image
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,11 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
CDBASE= emipscd # gives ${CDBASE}.iso
|
||||
CDRELEASE= true # include $RELEASEDIR/$MACHINE
|
||||
CDKERNELS= netbsd-INSTALL.gz netbsd
|
||||
CDINSTKERNEL= ../../instkernel
|
||||
|
||||
#make the CD bootable
|
||||
image_md_post:
|
||||
${TOOL_INSTALLBOOT} -m${MACHINE} ${CDBASE}.iso bootxx.${MACHINE}
|
||||
|
||||
.include "${.CURDIR}/../../../common/Makefile.bootcd"
|
|
@ -0,0 +1,31 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
|
||||
|
||||
.include <bsd.kernobj.mk>
|
||||
|
||||
IMAGE= diskimage
|
||||
IMAGESIZE= 2100k
|
||||
LISTS= ${.CURDIR}/list
|
||||
MTREECONF= ${DISTRIBDIR}/common/mtree.dot
|
||||
IMAGEENDIAN= be
|
||||
PRIMARYBOOT= ${DESTDIR}/usr/mdec/bootxx_ffs
|
||||
IMAGEDEPENDS= netbsd-INSTALL.gz ${DESTDIR}/usr/mdec/boot.emips ${PRIMARYBOOT}
|
||||
IMAGEPOSTBUILD= ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${IMAGE} ${PRIMARYBOOT}
|
||||
|
||||
RAMDISKDIR!= cd ${.CURDIR}/../ramdisk && ${PRINTOBJDIR}
|
||||
RAMDISK= ${RAMDISKDIR}/ramdisk.fs
|
||||
|
||||
MDSETTARGETS= RAMDISK ${RAMDISK} netbsd-INSTALL
|
||||
MDSET_RELEASEDIR= binary/kernel
|
||||
|
||||
MDSET_SUFFIXES.netbsd-INSTALL= ecoff create-ecoff
|
||||
create-ecoff= ${ELF2ECOFF} ${.TARGET:R} ${.TARGET}
|
||||
|
||||
IMAGE_RELEASEDIR= installation/diskimage
|
||||
|
||||
.include "${DISTRIBDIR}/common/Makefile.image"
|
||||
.include "${DISTRIBDIR}/common/Makefile.mdset"
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,4 @@
|
|||
# $NetBSD: list,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
COPY ${DESTDIR}/usr/mdec/boot.emips boot.emips
|
||||
COPY ${OBJDIR}/netbsd-INSTALL.gz netbsd
|
|
@ -0,0 +1,18 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
DBG= -Os
|
||||
|
||||
IMAGESIZE= 32m
|
||||
MAKEFS_FLAGS= -f 15
|
||||
IMAGEENDIAN= be
|
||||
MAKEDEVTARGETS= all
|
||||
LISTS+= ${DISTRIBDIR}/common/list.sysinst
|
||||
MTREECONF+= ${.CURDIR}/mtree.usr.install
|
||||
IMAGEDEPENDS+= ${ARCHDIR}/dot.profile \
|
||||
${DESTDIR}/.profile ${DESTDIR}/boot.emips \
|
||||
${DESTDIR}/etc/disktab \
|
||||
${KERNOBJDIR}/GENERIC/netbsd \
|
||||
${KERNOBJDIR}/GENERIC/netbsd.ecoff \
|
||||
${KERNOBJDIR}/INSTALL/nfsnetbsd.ecoff
|
||||
|
||||
IMAGEPOSTBUILD= ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${IMAGE} ${DESTDIR}/usr/mdec/bootxx_ffs
|
|
@ -0,0 +1,20 @@
|
|||
# $NetBSD: dot.profile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
|
||||
export PATH
|
||||
|
||||
# get the terminal type
|
||||
_loop=""
|
||||
while [ "X${_loop}" = X"" ]; do
|
||||
echo "" >& 2
|
||||
echo "Setting terminal type. Options:" >& 2
|
||||
echo " ansi-nt for Windows console window" >& 2
|
||||
echo " vt100 for dumb serial terminal" >& 2
|
||||
echo " xterm for xterm." >& 2
|
||||
echo "" >& 2
|
||||
eval `tset -s -m ":?$TERM"`
|
||||
if [ "X${TERM}" != X"unknown" ]; then
|
||||
_loop="done"
|
||||
fi
|
||||
done
|
||||
|
||||
sysinst
|
|
@ -0,0 +1,49 @@
|
|||
# $NetBSD: list,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
# extras in bin
|
||||
PROG bin/csh
|
||||
PROG bin/date
|
||||
PROG bin/rcp
|
||||
PROG bin/rcmd
|
||||
|
||||
# extras in sbin
|
||||
PROG sbin/disklabel
|
||||
PROG sbin/fsck_ext2fs
|
||||
PROG sbin/mount_ext2fs
|
||||
PROG sbin/mount_kernfs
|
||||
|
||||
# extras in usr/bin
|
||||
PROG usr/bin/netstat
|
||||
PROG usr/bin/rsh
|
||||
PROG usr/bin/tset usr/bin/reset
|
||||
PROG usr/bin/vi
|
||||
|
||||
# extras in usr/sbin
|
||||
PROG usr/sbin/installboot
|
||||
|
||||
# crunchgen source directory specials: progs built in nonstandard places
|
||||
SPECIAL vi srcdir usr.bin/nvi/build
|
||||
|
||||
# Minimize use of MFS
|
||||
SYMLINK /tmp var/tmp
|
||||
|
||||
# we need the contents of /usr/mdec
|
||||
COPYDIR ${DESTDIR}/usr/mdec usr/mdec
|
||||
# and /boot.emips
|
||||
COPY ${DESTDIR}/boot.emips boot.emips
|
||||
|
||||
# copy the kernel(s)
|
||||
COPY ${KERNOBJDIR}/GENERIC/netbsd netbsd
|
||||
COPY ${KERNOBJDIR}/GENERIC/netbsd.ecoff netbsd.ecoff
|
||||
COPY ${KERNOBJDIR}/INSTALL/nfsnetbsd.ecoff nfsnetbsd.ecoff
|
||||
|
||||
# various files that we need in /etc for the install
|
||||
#SYMLINK /tmp/fstab.shadow etc/fstab
|
||||
#SYMLINK /tmp/resolv.conf.shadow etc/resolv.conf
|
||||
#SYMLINK /tmp/hosts etc/hosts
|
||||
|
||||
# and the installation tools
|
||||
COPY ${ARCHDIR}/dot.profile .profile
|
||||
|
||||
# and a spare .profile
|
||||
COPY ${DESTDIR}/.profile tmp/.hdprofile
|
|
@ -0,0 +1,39 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
|
||||
|
||||
IMAGE= ramdisk.fs
|
||||
IMAGETAR= diskimage.tgz
|
||||
IMAGESIZE= 3500k
|
||||
MAKEFS_FLAGS= -f 15
|
||||
|
||||
WARNS= 1
|
||||
DBG= -Os -mmemcpy
|
||||
|
||||
CRUNCHBIN= ramdiskbin
|
||||
CRUNCHGEN_FLAGS= -d "${DBG}"
|
||||
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
|
||||
MTREECONF= ${DISTRIBDIR}/common/mtree.common
|
||||
IMAGEENDIAN= be
|
||||
MAKEDEVTARGETS= minimal pty0 ace0 ace1
|
||||
IMAGEDEPENDS= ${CRUNCHBIN} \
|
||||
dot.hdprofile dot.profile \
|
||||
${DESTDIR}/usr/mdec/boot.emips ${DESTDIR}/usr/mdec/bootxx_ffs \
|
||||
${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \
|
||||
${NETBSDSRCDIR}/etc/netconfig \
|
||||
${DISTRIBDIR}/common/protocols \
|
||||
${DISTRIBDIR}/common/services
|
||||
|
||||
IMAGETAR_RELEASEDIR= installation/netboot
|
||||
|
||||
# Use stubs to eliminate some large stuff from libc
|
||||
HACKSRC= ${DISTRIBDIR}/utils/libhack
|
||||
.include "${HACKSRC}/Makefile.inc"
|
||||
${CRUNCHBIN}: libhack.o
|
||||
|
||||
.include "${DISTRIBDIR}/common/Makefile.crunch"
|
||||
.include "${DISTRIBDIR}/common/Makefile.makedev"
|
||||
.include "${DISTRIBDIR}/common/Makefile.image"
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,42 @@
|
|||
# $NetBSD: disktab.preinstall,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
#
|
||||
# Disk geometry and partition layout tables.
|
||||
# Key:
|
||||
# dt controller type
|
||||
# ty type of disk (fixed, removable, simulated)
|
||||
# d[0-4] drive-type-dependent parameters
|
||||
# ns #sectors/track
|
||||
# nt #tracks/cylinder
|
||||
# nc #cylinders/disk
|
||||
# sc #sectors/cylinder, nc*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)
|
||||
#
|
||||
ace400|400MB CFcard Cartridge:\
|
||||
:dt=ESDI:ty=removable:se#512:nt#255:ns#63:nc#50: \
|
||||
:pa#614400:oa#0:ta=4.2BSD:ba#8192:fa#1024:\
|
||||
:pb#18850:ob#614400:tb=swap:2: \
|
||||
:pc#633250:oc#0:
|
||||
ace800|800MB CFcard Cartridge:\
|
||||
:dt=ESDI:ty=removable:se#512:nt#255:ns#63:nc#100: \
|
||||
:pa#614400:oa#0:ta=4.2BSD:ba#8192:fa#1024:\
|
||||
:pb#18850:ob#614400:tb=swap:2 \
|
||||
:pc#633250:oc#0: \
|
||||
:pd#633250:oa#633250:ta=4.2BSD:ba#8192:fa#1024:\
|
|
@ -0,0 +1,62 @@
|
|||
# $NetBSD: dot.hdprofile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
#
|
||||
# Copyright (c) 1994 Christopher G. Demetriou
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed for the
|
||||
# NetBSD Project. See http://www.NetBSD.org/ for
|
||||
# information about NetBSD.
|
||||
# 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.
|
||||
#
|
||||
# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
|
||||
|
||||
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
|
||||
export PATH
|
||||
TERM=vt100
|
||||
export TERM
|
||||
HOME=/
|
||||
export HOME
|
||||
|
||||
umask 022
|
||||
|
||||
if [ "X${DONEPROFILE}" = "X" ]; then
|
||||
DONEPROFILE=YES
|
||||
export DONEPROFILE
|
||||
|
||||
echo "Checking filesystems..."
|
||||
fsck -y
|
||||
|
||||
echo "Mounting root..."
|
||||
mount -u /
|
||||
|
||||
# set up some sane defaults
|
||||
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
|
||||
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
|
||||
echo ''
|
||||
|
||||
TERMCAP=/.termcap ; export TERMCAP
|
||||
|
||||
[ -x /sysinst ] && /sysinst
|
||||
fi
|
|
@ -0,0 +1,67 @@
|
|||
# $NetBSD: dot.profile,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
#
|
||||
# Copyright (c) 1997 Perry E. Metzger
|
||||
# Copyright (c) 1994 Christopher G. Demetriou
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed for the
|
||||
# NetBSD Project. See http://www.NetBSD.org/ for
|
||||
# information about NetBSD.
|
||||
# 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.
|
||||
#
|
||||
# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
|
||||
|
||||
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
|
||||
export PATH
|
||||
TERM=vt100
|
||||
export TERM
|
||||
HOME=/
|
||||
export HOME
|
||||
|
||||
umask 022
|
||||
|
||||
ROOTDEV=/dev/md0a
|
||||
|
||||
if [ "X${DONEPROFILE}" = "X" ]; then
|
||||
DONEPROFILE=YES
|
||||
export DONEPROFILE
|
||||
|
||||
# get the terminal type
|
||||
eval `tset -s -m ":?$TERM"`
|
||||
|
||||
# set up some sane defaults
|
||||
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
|
||||
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
|
||||
echo ''
|
||||
|
||||
# mount the ramdisk read write
|
||||
mount -u $ROOTDEV /
|
||||
|
||||
# mount the kern_fs so that we can examine the dmesg state
|
||||
mount -t kernfs /kern /kern
|
||||
|
||||
# run the installation program
|
||||
sysinst
|
||||
fi
|
|
@ -0,0 +1,80 @@
|
|||
# $NetBSD: list,v 1.1 2011/01/26 01:18:44 pooka Exp $
|
||||
|
||||
SRCDIRS bin sbin usr.bin usr.sbin gnu/usr.bin sys/arch/emips/stand
|
||||
|
||||
PROG bin/cat
|
||||
PROG bin/chmod
|
||||
PROG bin/cp
|
||||
PROG bin/dd
|
||||
PROG bin/df
|
||||
PROG bin/ed
|
||||
PROG bin/ln
|
||||
PROG bin/ls
|
||||
PROG bin/mkdir
|
||||
PROG bin/mt
|
||||
PROG bin/mv
|
||||
PROG bin/pax usr/bin/tar usr/bin/cpio
|
||||
PROG bin/pwd
|
||||
PROG bin/rm
|
||||
PROG bin/sh
|
||||
PROG bin/stty
|
||||
PROG bin/sync
|
||||
|
||||
PROG sbin/disklabel
|
||||
PROG sbin/fsck
|
||||
PROG sbin/fsck_ffs
|
||||
PROG sbin/ifconfig
|
||||
PROG sbin/init
|
||||
PROG sbin/mknod
|
||||
PROG sbin/mount
|
||||
PROG sbin/mount_cd9660
|
||||
PROG sbin/mount_ffs
|
||||
PROG sbin/mount_kernfs
|
||||
PROG sbin/mount_msdos
|
||||
PROG sbin/mount_nfs
|
||||
PROG sbin/newfs sbin/mount_mfs
|
||||
PROG sbin/ping
|
||||
PROG sbin/reboot sbin/halt
|
||||
PROG sbin/restore sbin/rrestore
|
||||
PROG sbin/route
|
||||
PROG sbin/shutdown
|
||||
PROG sbin/slattach
|
||||
PROG sbin/umount
|
||||
|
||||
PROG usr/bin/ftp
|
||||
PROG usr/bin/gzip usr/bin/gzcat usr/bin/gunzip
|
||||
PROG usr/bin/sed
|
||||
PROG usr/bin/tip
|
||||
PROG usr/bin/tset
|
||||
|
||||
PROG usr/sbin/installboot
|
||||
|
||||
PROG usr/sbin/chown usr/bin/chgrp
|
||||
PROG usr/sbin/chroot
|
||||
|
||||
# init invokes the shell as -sh
|
||||
ARGVLN sh -sh
|
||||
|
||||
SPECIAL ping srcdir distrib/utils/x_ping
|
||||
|
||||
LIBS -ledit -lbz2 -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop
|
||||
|
||||
# we need the boot blocks /usr/mdec
|
||||
COPY ${DESTDIR}/usr/mdec/bootxx_ffs usr/mdec/bootxx_ffs
|
||||
COPY ${DESTDIR}/usr/mdec/boot.emips usr/mdec/boot.emips
|
||||
|
||||
# various files that we need in /etc for the install
|
||||
COPY ${NETBSDSRCDIR}/etc/group etc/group
|
||||
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
|
||||
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
|
||||
COPY ${DISTRIBDIR}/common/protocols etc/protocols
|
||||
COPY ${DISTRIBDIR}/common/services etc/services
|
||||
|
||||
# and the shell startup files
|
||||
COPY ${CURDIR}/dot.profile .profile
|
||||
COPY ${CURDIR}/dot.hdprofile tmp/.hdprofile
|
||||
|
||||
|
||||
# someday put in the release notes too
|
||||
#
|
||||
# COPY ${DISTRIBDIR}/notes/emips/INSTALL.txt INSTALL.txt
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.41 2010/11/13 05:20:21 kiyohara Exp $
|
||||
# $NetBSD: Makefile,v 1.42 2011/01/26 01:18:44 pooka Exp $
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
@ -19,6 +19,7 @@ SUBDIR+= arc
|
|||
SUBDIR+= atari
|
||||
SUBDIR+= bebox
|
||||
SUBDIR+= cats
|
||||
SUBDIR+= emips
|
||||
SUBDIR+= evbarm
|
||||
SUBDIR+= evbppc
|
||||
SUBDIR+= hp300
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
|
||||
MERGED_SRCS+= ${COMMON}/sysinst ${COMMON}/upgrade ${COMMON}/xfer
|
||||
|
||||
.include <bsd.man.mk>
|
|
@ -0,0 +1,26 @@
|
|||
.\" $NetBSD: hardware,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.
|
||||
.Ss2 Supported machines
|
||||
.(bullet -offset indent
|
||||
.Tn Xilinx
|
||||
Ml401 and Ml402 with Virtex-4 FPGAs. XUP board with Virtex-5 FPGAs.
|
||||
.It
|
||||
.Tn BeSquare
|
||||
BEE3 system with four Xilinx Virtex-5 FPGAs.
|
||||
.bullet)
|
||||
.
|
||||
.Pp
|
||||
The minimal configuration requires 8 MB of RAM and ~60 MB of disk space.
|
||||
To install the entire system requires in excess of 800 MB of disk space,
|
||||
for any serious work at least 64 MB of RAM is recommended.
|
||||
The processor can address the full 4 GB of physical space, but configurations with
|
||||
more than 256 MB of RAM are currently untested.
|
||||
.
|
||||
.Ss2 Supported devices
|
||||
.(bullet -offset indent
|
||||
eMIPS serial line as console
|
||||
.It
|
||||
Xilinx SystemACE Compact FLASH interface, using cards of any size.
|
||||
.It
|
||||
Ethernet using 1 Gbps cabling, both on XUP and BEE3 systems.
|
||||
.bullet)
|
|
@ -0,0 +1,378 @@
|
|||
.\" $NetBSD: install,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.
|
||||
.(Note
|
||||
There may be updates to this procedure available from the
|
||||
.Nx*M
|
||||
web page at
|
||||
http://www.NetBSD.org/ports/\*M/ .
|
||||
.Note)
|
||||
.Pp
|
||||
To install or upgrade
|
||||
.Nx ,
|
||||
you need to first boot an installation
|
||||
program and then interact with the screen-menu program
|
||||
.Ic sysinst .
|
||||
The installation program actually consists of the
|
||||
.Nx
|
||||
kernel plus
|
||||
an in-memory file system of utility programs.
|
||||
.Pp
|
||||
From most convenient to least convenient, the installation methods
|
||||
are:
|
||||
.(enum
|
||||
Installation from an existing
|
||||
.Nx
|
||||
system by booting the
|
||||
install kernel from an existing root file system
|
||||
.Pq Pa / .
|
||||
See the
|
||||
.Sx Installing from an existing system
|
||||
section later in these INSTALL notes.
|
||||
.It
|
||||
Copying a bootable diskimage onto the beginning of a disk and installing
|
||||
onto that disk.
|
||||
See the
|
||||
.Sx Install via diskimage
|
||||
section later in these INSTALL notes.
|
||||
.It
|
||||
Booting the install kernel over the network and installing onto a local
|
||||
disk.
|
||||
See the
|
||||
.Sx Install via netboot install kernel
|
||||
section later in these INSTALL notes.
|
||||
.It
|
||||
Using a helper machine with a CompactFLASH controller to copy the bootable
|
||||
diskimage onto the beginning of a disk, and moving the disk to the
|
||||
target machine.
|
||||
See the
|
||||
.Sx Install via diskimage
|
||||
section later in these INSTALL notes.
|
||||
.It
|
||||
For BEE3 machines that do not have local disk storage, you
|
||||
will need to set up an NFS server with a diskless root file system for
|
||||
trimmed-down network install kernel and run the installation system from
|
||||
the NFS root file system. NFS is also your only option for user storage.
|
||||
See the
|
||||
.Sx Install via diskless boot
|
||||
section later in these INSTALL notes.
|
||||
.enum)
|
||||
.Pp
|
||||
You should familiarize yourself with the hardware configuration on your machine or simulator.
|
||||
Be sure you know how to print the configuration of your machine,
|
||||
and how to boot from disk or network, as appropriate.
|
||||
.Pp
|
||||
To boot from disk, use:
|
||||
.Pp
|
||||
.(tag 12n -offset indent -compact
|
||||
.It "All systems:"
|
||||
.Ic "/netbsd"
|
||||
.tag)
|
||||
.Pp
|
||||
To boot via TFTP, use
|
||||
.(tag 12n -offset indent -compact
|
||||
.It "boot:"
|
||||
.Ic "tftp"
|
||||
.tag)
|
||||
.Pp
|
||||
You will also need to know the total size (in sectors) and the
|
||||
approximate geometry of the disks you are installing onto, so that you
|
||||
can label your disks for the
|
||||
.Bx
|
||||
fast file system (FFS).
|
||||
The kernel should correctly detect the disk geometry. The
|
||||
.Ic sysinst
|
||||
tool will suggest these as the default.
|
||||
.Pp
|
||||
If you're installing
|
||||
.Nx*M
|
||||
for the first time it's a very
|
||||
good idea to pre-plan partition sizes for the disks on which you're
|
||||
installing
|
||||
.Nx .
|
||||
Changing the size of partitions after you've installed is difficult.
|
||||
If you do not have a spare bootable disk, it may be simpler to re-install
|
||||
.Nx
|
||||
again from scratch.
|
||||
.Pp
|
||||
Assuming a classic partition scheme with separate
|
||||
.Pa /
|
||||
(root)
|
||||
and
|
||||
.Pa /usr
|
||||
file systems, a comfortable size for the
|
||||
.Nx
|
||||
.Pa /
|
||||
partition is about 64 MB.
|
||||
A good initial size for the swap partition is twice the
|
||||
amount of physical memory in your machine.
|
||||
The default swap size is 64 MB, which
|
||||
is adequate for doing a full system build.
|
||||
A full binary installation, with X11R6 takes about 700 MB in
|
||||
.Pa /usr ;
|
||||
a 1 GB
|
||||
.Pa /usr
|
||||
should be ample.
|
||||
.
|
||||
.Ss2 Install via a NetBSD CD-ROM
|
||||
.
|
||||
You can obtain the disk image or diskless boot tar file from the
|
||||
.Nx \*V
|
||||
.Tn CD-ROM .
|
||||
.Pp
|
||||
To mount the CD-ROM from a
|
||||
.Nx*M
|
||||
host, type
|
||||
.Pp
|
||||
.Dl # Ic "mount -r -t cd9660 /dev/cd" Ns Ar X Ns Ic "c /mnt"
|
||||
.Pp
|
||||
where
|
||||
.Ar X
|
||||
is the ID of the CD-ROM.
|
||||
.Pp
|
||||
The diskimage file can be found on the CD-ROM at the following location
|
||||
(relative to the mount point of the CD)
|
||||
.Pp
|
||||
.Dl Pa \*M/installation/diskimage/diskimage.gz
|
||||
.Pp
|
||||
and the diskless boot tar file can be found at
|
||||
.Pp
|
||||
.Dl Pa \*M/installation/netboot/diskimage.tgz
|
||||
.Pp
|
||||
Once you have located these files, continue on to either
|
||||
.Sx Install via netboot install kernel ,
|
||||
.Sx Install via diskless boot ,
|
||||
.Sx Install via diskimage
|
||||
or
|
||||
.Sx Installing from an existing system
|
||||
section later in the INSTALL notes.
|
||||
.
|
||||
.Ss2 Installing from an existing system
|
||||
.
|
||||
.Pp
|
||||
Using the bootloader you can boot the kernel located in:
|
||||
.Pp
|
||||
.Dl Pa \*M/binary/kernel/netbsd-INSTALL.gz
|
||||
.Pp
|
||||
Then boot using:
|
||||
.Pp
|
||||
.(tag 12n -offset indent -compact
|
||||
.It "All systems:"
|
||||
.Ic "/netbsd-INSTALL"
|
||||
.tag)
|
||||
.Pp
|
||||
then continue to the
|
||||
.Sx Once you've booted the diskimage
|
||||
section
|
||||
.
|
||||
.Ss2 Install via diskimage
|
||||
.
|
||||
The diskimage file is in
|
||||
.Pp
|
||||
.Dl Pa \*M/installation/diskimage/diskimage.gz .
|
||||
.Pp
|
||||
It is shipped compressed and is around 1620 kbytes, uncompressing to
|
||||
exactly 2100 kbytes.
|
||||
.Pp
|
||||
To install the diskimage onto disk
|
||||
.Li ace Ns Ar X
|
||||
on a
|
||||
.Nx*M
|
||||
system, do:
|
||||
.Pp
|
||||
.Dl # Ic "disklabel -W /dev/race" Ns Ar X Ns Ic "c"
|
||||
.Dl # Ic "gunzip -c diskimage.gz\ |\ dd of=/dev/race" Ns Ar X Ns Ic "c bs=10240"
|
||||
.Pp
|
||||
On
|
||||
.Nx Ns /i386,
|
||||
the
|
||||
.Dq raw disk partition
|
||||
is the
|
||||
.Sq Li d
|
||||
partition, so do:
|
||||
.Pp
|
||||
.Dl # Ic "disklabel -W /dev/rsd" Ns Ar X Ns Ic "d"
|
||||
.Dl # Ic "gunzip -c diskimage.gz\ |\ dd of=/dev/rsd" Ns Ar X Ns Ic "d bs=10240"
|
||||
.Pp
|
||||
On
|
||||
.Nx ,
|
||||
be sure to use
|
||||
.Ic disklabel -W
|
||||
to enable writing to the label
|
||||
area of the disk.
|
||||
If you forget this and/or use the
|
||||
.Sq block
|
||||
device, the
|
||||
.Ic dd
|
||||
command may silently fail.
|
||||
.Pp
|
||||
Then boot using:
|
||||
.Pp
|
||||
.(tag 12n -offset indent -compact
|
||||
.It "All systems:"
|
||||
.Ic "/netbsd"
|
||||
.tag)
|
||||
.Pp
|
||||
then continue to the
|
||||
.Sx Once you've booted the diskimage
|
||||
section.
|
||||
.
|
||||
.Ss2 Install via netboot install kernel
|
||||
.
|
||||
Booting
|
||||
.Nx*M
|
||||
\*V install kernel over a network requires a BOOTP
|
||||
or DHCP server and a TFTP server.
|
||||
(These are usually all run on the same machine.)
|
||||
There are two basic stages to the boot:
|
||||
.Pp
|
||||
.
|
||||
.(bullet
|
||||
The \*M boot loader sends a BOOTP request to get its own address, the
|
||||
address of the TFTP server and the file to download.
|
||||
.It
|
||||
It downloads the file name obtained from BOOTP, which is the install
|
||||
kernel, via TFTP and then executes it.
|
||||
.bullet)
|
||||
.
|
||||
.Pp
|
||||
You will need to set up servers for BOOTP and TFTP.
|
||||
.Pp
|
||||
For the BOOTP server you need to specify the:
|
||||
.Pp
|
||||
.
|
||||
.(bullet -compact
|
||||
hardware type (Ethernet)
|
||||
.It
|
||||
hardware address (Ethernet MAC address)
|
||||
.It
|
||||
IP address of the client
|
||||
.It
|
||||
subnet mask of the client
|
||||
.It
|
||||
address of the TFTP server
|
||||
.It
|
||||
name of the kernel loaded via TFTP
|
||||
.bullet)
|
||||
.
|
||||
.Pp
|
||||
Here's an example for a
|
||||
.Ul
|
||||
system running
|
||||
.Ic bootpd :
|
||||
.(disp
|
||||
myhost.mydom.com:\e
|
||||
:ht=ethernet:ha=08002b123456:\e
|
||||
:ip=192.168.1.2:sm=255.255.255.0:\e
|
||||
:sa=192.168.1.1:bf=netbsd-INSTALL:\e
|
||||
:rp=/usr/export/\*M:
|
||||
.disp)
|
||||
.Pp
|
||||
And here's an example for a
|
||||
.Ul
|
||||
system running the ISC
|
||||
.Ic dhcpd :
|
||||
.(disp
|
||||
host \*M {
|
||||
hardware ethernet 08:0:2b:12:34:56;
|
||||
fixed-address 192.168.1.2;
|
||||
option host-name "myhost.mydom.com";
|
||||
filename "netbsd-INSTALL";
|
||||
option domain-name-servers 192.168.1.1;
|
||||
option broadcast-address 255.255.255.0;
|
||||
option domain-name "my.domain";
|
||||
option root-path "/usr/export/\*M";
|
||||
}
|
||||
.disp)
|
||||
.Pp
|
||||
For the TFTP server, You will need to copy the
|
||||
.Ic netbsd-INSTALL
|
||||
kernel to the directory used by the TFTP server.
|
||||
.Pp
|
||||
Then boot using TFTP as described earlier.
|
||||
.Pp
|
||||
and continue to the
|
||||
.Sx Once you've booted the diskimage
|
||||
section.
|
||||
.
|
||||
.Ss2 Install via diskless boot
|
||||
.
|
||||
The file
|
||||
.Pa \*M/installation/netboot/diskimage.tar.gz
|
||||
contains a suitable set of files for installing on an NFS server to set
|
||||
up a diskless root filesytem.
|
||||
(It is a tar copy of the contents of an
|
||||
installation ramdisk file system contained in the install kernel.)
|
||||
You will need to find an NFS server, unpack the tarfile, and setup
|
||||
BOOTP/dhcp service for your \*M.
|
||||
Instructions for setting up an NFS server and diskless booting are on the
|
||||
.Nx*M
|
||||
netboot
|
||||
webpage at
|
||||
.Lk http://www.NetBSD.org/ports/\*M/netboot.html
|
||||
.Pp
|
||||
Since the system install utility,
|
||||
.Ic sysinst ,
|
||||
requires a read/write root,
|
||||
installing via diskless boot is only feasible if your NFS server exports
|
||||
the diskless root read-write.
|
||||
If this is not possible, you should
|
||||
install via other of the other installation procedures.
|
||||
.Pp
|
||||
Once you have booted the kernel, continue to the
|
||||
.Sx Once you've booted the diskimage
|
||||
section.
|
||||
.
|
||||
.Ss2 Once you've booted the diskimage
|
||||
.
|
||||
Once you've booted the installation kernel you will need to
|
||||
select your terminal type.
|
||||
Use
|
||||
.Ic vt100
|
||||
for a serial console with a vt100-compatible terminal emulator, such as PuTTY, or
|
||||
.Ic xterm
|
||||
or
|
||||
.Ic xterms
|
||||
for a
|
||||
.Xr tip 1
|
||||
or
|
||||
.Xr cu 1
|
||||
connection running in an
|
||||
.Xr xterm 1 .
|
||||
.Pp
|
||||
The system will then start the
|
||||
.Ic sysinst
|
||||
program.
|
||||
.so ../common/sysinst
|
|
@ -0,0 +1,141 @@
|
|||
.\" $NetBSD: legal,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.
|
||||
.It
|
||||
This product includes software developed by Ted Lemon.
|
||||
.It
|
||||
This product includes software contributed to Berkeley by
|
||||
Ralph Campbell.
|
||||
.It
|
||||
This product includes software contributed to Berkeley by
|
||||
Ralph Campbell and Rick Macklem.
|
||||
.It
|
||||
This product includes software contributed to Berkeley by
|
||||
Van Jacobson of Lawrence Berkeley Laboratory and Ralph
|
||||
Campbell.
|
||||
.It
|
||||
This product includes software developed by Chris G.
|
||||
Demetriou, and Jonathan Stone.
|
||||
.It
|
||||
This product includes software developed by Keith Bostic,
|
||||
Chris G. Demetriou, and Jonathan Stone.
|
||||
.It
|
||||
This product includes software developed by the University
|
||||
of California, Lawrence Berkeley Laboratory.
|
||||
.It
|
||||
This product includes software developed by Jonathan Stone for
|
||||
the NetBSD Project.
|
||||
.It
|
||||
This product includes software developed by Tohru Nishimura
|
||||
for the NetBSD Project.
|
||||
.It
|
||||
Some files have the following copyright:
|
||||
.(item -offset indent -compact
|
||||
Mach Operating System
|
||||
.br
|
||||
Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
.br
|
||||
All Rights Reserved.
|
||||
|
||||
Permission to use, copy, modify and distribute this software and its
|
||||
documentation is hereby granted, provided that both the copyright
|
||||
notice and this permission notice appear in all copies of the
|
||||
software, derivative works or modified versions, and any portions
|
||||
thereof, and that both notices appear in supporting documentation.
|
||||
|
||||
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
|
||||
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
|
||||
Carnegie Mellon requests users of this software to return to
|
||||
|
||||
Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
.br
|
||||
School of Computer Science
|
||||
.br
|
||||
Carnegie Mellon University
|
||||
.br
|
||||
Pittsburgh PA 15213-3890
|
||||
|
||||
any improvements or extensions that they make and grant Carnegie the
|
||||
rights to redistribute these changes.
|
||||
.item)
|
||||
.It
|
||||
Some files have the following copyright:
|
||||
.(item -offset indent -compact
|
||||
Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
.br
|
||||
All rights reserved.
|
||||
|
||||
Author: Chris G. Demetriou
|
||||
|
||||
Permission to use, copy, modify and distribute this software and
|
||||
its documentation is hereby granted, provided that both the copyright
|
||||
notice and this permission notice appear in all copies of the
|
||||
software, derivative works or modified versions, and any portions
|
||||
thereof, and that both notices appear in supporting documentation.
|
||||
|
||||
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
|
||||
Carnegie Mellon requests users of this software to return to
|
||||
|
||||
Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
.br
|
||||
School of Computer Science
|
||||
.br
|
||||
Carnegie Mellon University
|
||||
.br
|
||||
Pittsburgh PA 15213-3890
|
||||
|
||||
any improvements or extensions that they make and grant Carnegie the
|
||||
rights to redistribute these changes.
|
||||
.item)
|
||||
.It
|
||||
Some files have the following copyright:
|
||||
.(item -offset indent -compact
|
||||
Copyright (C) 1989 Digital Equipment Corporation.
|
||||
.br
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appears in all copies.
|
||||
Digital Equipment Corporation makes no representations about the
|
||||
suitability of this software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
|
||||
Some files have the following copyright:
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
Some files have the following copyright:
|
||||
|
||||
Copyright 1996 The Board of Trustees of The Leland Stanford
|
||||
Junior University. All Rights Reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies. Stanford University
|
||||
makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
.item)
|
|
@ -0,0 +1,6 @@
|
|||
.\" $NetBSD: prep,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.
|
||||
First and foremost, before beginning the installation process,
|
||||
.Em make sure you have a reliable backup
|
||||
of any data on your hard disk that you wish to keep.
|
||||
Mistakes in partitioning your hard disk may lead to data loss.
|
|
@ -0,0 +1,3 @@
|
|||
.\" $NetBSD: upgrade,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.
|
||||
.so ../common/upgrade
|
|
@ -0,0 +1,3 @@
|
|||
.\" $NetBSD: xfer,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
.
|
||||
.so ../common/xfer
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: md.emips,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
#
|
||||
./boot.emips base-sysutil-bin
|
||||
./usr/mdec/boot.emips base-sysutil-bin
|
||||
./usr/mdec/bootxx_cd9660 base-sysutil-bin
|
||||
./usr/mdec/bootxx_ffs base-sysutil-bin
|
||||
./usr/mdec/bootxx_lfs base-sysutil-bin
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.916 2011/01/20 18:47:20 pooka Exp $
|
||||
# $NetBSD: mi,v 1.917 2011/01/26 01:18:45 pooka Exp $
|
||||
#
|
||||
# Note: Don't delete entries from here - mark them as "obsolete" instead,
|
||||
# unless otherwise stated below.
|
||||
|
@ -3309,6 +3309,7 @@
|
|||
./usr/share/man/cat4/atari base-man-share
|
||||
./usr/share/man/cat4/cobalt base-man-share
|
||||
./usr/share/man/cat4/dreamcast base-man-share
|
||||
./usr/share/man/cat4/emips base-man-share
|
||||
./usr/share/man/cat4/evbarm base-man-share
|
||||
./usr/share/man/cat4/evbmips base-man-share
|
||||
./usr/share/man/cat4/evbppc base-man-share
|
||||
|
@ -3353,6 +3354,7 @@
|
|||
./usr/share/man/cat8/cesfic base-man-share
|
||||
./usr/share/man/cat8/cobalt base-man-share
|
||||
./usr/share/man/cat8/dreamcast base-man-share
|
||||
./usr/share/man/cat8/emips base-man-share
|
||||
./usr/share/man/cat8/evbarm base-man-share
|
||||
./usr/share/man/cat8/evbmips base-man-share
|
||||
./usr/share/man/cat8/evbppc base-man-share
|
||||
|
@ -3402,6 +3404,7 @@
|
|||
./usr/share/man/cat9/arm26 base-obsolete obsolete
|
||||
./usr/share/man/cat9/arm32 base-obsolete obsolete
|
||||
./usr/share/man/cat9/atari base-man-share
|
||||
./usr/share/man/cat9/emips base-man-share
|
||||
./usr/share/man/cat9/hp300 base-man-share
|
||||
./usr/share/man/cat9/i386 base-man-share
|
||||
./usr/share/man/cat9/mac68k base-man-share
|
||||
|
@ -3430,6 +3433,7 @@
|
|||
./usr/share/man/html4/atari base-man-share
|
||||
./usr/share/man/html4/cobalt base-man-share
|
||||
./usr/share/man/html4/dreamcast base-man-share
|
||||
./usr/share/man/html4/emips base-man-share
|
||||
./usr/share/man/html4/evbarm base-man-share
|
||||
./usr/share/man/html4/evbmips base-man-share
|
||||
./usr/share/man/html4/evbppc base-man-share
|
||||
|
@ -3473,6 +3477,7 @@
|
|||
./usr/share/man/html8/cesfic base-man-share
|
||||
./usr/share/man/html8/cobalt base-man-share
|
||||
./usr/share/man/html8/dreamcast base-man-share
|
||||
./usr/share/man/html8/emips base-man-share
|
||||
./usr/share/man/html8/evbarm base-man-share
|
||||
./usr/share/man/html8/evbmips base-man-share
|
||||
./usr/share/man/html8/evbppc base-man-share
|
||||
|
@ -3522,6 +3527,7 @@
|
|||
./usr/share/man/html9/arm26 base-obsolete obsolete
|
||||
./usr/share/man/html9/arm32 base-obsolete obsolete
|
||||
./usr/share/man/html9/atari base-man-share
|
||||
./usr/share/man/html9/emips base-man-share
|
||||
./usr/share/man/html9/hp300 base-man-share
|
||||
./usr/share/man/html9/i386 base-man-share
|
||||
./usr/share/man/html9/mac68k base-man-share
|
||||
|
@ -3552,6 +3558,7 @@
|
|||
./usr/share/man/man4/atari base-man-share
|
||||
./usr/share/man/man4/cobalt base-man-share
|
||||
./usr/share/man/man4/dreamcast base-man-share
|
||||
./usr/share/man/man4/emips base-man-share
|
||||
./usr/share/man/man4/evbarm base-man-share
|
||||
./usr/share/man/man4/evbmips base-man-share
|
||||
./usr/share/man/man4/evbppc base-man-share
|
||||
|
@ -3596,6 +3603,7 @@
|
|||
./usr/share/man/man8/cesfic base-man-share
|
||||
./usr/share/man/man8/cobalt base-man-share
|
||||
./usr/share/man/man8/dreamcast base-man-share
|
||||
./usr/share/man/man8/emips base-man-share
|
||||
./usr/share/man/man8/evbarm base-man-share
|
||||
./usr/share/man/man8/evbmips base-man-share
|
||||
./usr/share/man/man8/evbppc base-man-share
|
||||
|
@ -3645,6 +3653,7 @@
|
|||
./usr/share/man/man9/arm26 base-obsolete obsolete
|
||||
./usr/share/man/man9/arm32 base-obsolete obsolete
|
||||
./usr/share/man/man9/atari base-man-share
|
||||
./usr/share/man/man9/emips base-man-share
|
||||
./usr/share/man/man9/hp300 base-man-share
|
||||
./usr/share/man/man9/i386 base-man-share
|
||||
./usr/share/man/man9/mac68k base-man-share
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# $NetBSD: md.emips,v 1.1 2011/01/26 01:18:45 pooka Exp $
|
||||
#
|
||||
./usr/include/ieeefp.h comp-c-include
|
||||
./usr/include/emips comp-c-include
|
||||
./usr/include/emips/ansi.h comp-c-include
|
||||
./usr/include/emips/asm.h comp-c-include
|
||||
./usr/include/emips/autoconf.h comp-c-include
|
||||
./usr/include/emips/bswap.h comp-c-include
|
||||
./usr/include/emips/bus.h comp-c-include
|
||||
./usr/include/emips/cdefs.h comp-c-include
|
||||
./usr/include/emips/cpu.h comp-c-include
|
||||
./usr/include/emips/disklabel.h comp-c-include
|
||||
./usr/include/emips/ecoff_machdep.h comp-c-include
|
||||
./usr/include/emips/elf_machdep.h comp-c-include
|
||||
./usr/include/emips/emipsreg.h comp-c-include
|
||||
./usr/include/emips/endian.h comp-c-include
|
||||
./usr/include/emips/endian_machdep.h comp-c-include
|
||||
./usr/include/emips/float.h comp-c-include
|
||||
./usr/include/emips/ieee.h comp-c-include
|
||||
./usr/include/emips/ieeefp.h comp-c-include
|
||||
./usr/include/emips/int_const.h comp-c-include
|
||||
./usr/include/emips/int_fmtio.h comp-c-include
|
||||
./usr/include/emips/int_limits.h comp-c-include
|
||||
./usr/include/emips/int_mwgwtypes.h comp-c-include
|
||||
./usr/include/emips/int_types.h comp-c-include
|
||||
./usr/include/emips/intr.h comp-c-include
|
||||
./usr/include/emips/kcore.h comp-c-include
|
||||
./usr/include/emips/kdbparam.h comp-c-include
|
||||
./usr/include/emips/limits.h comp-c-include
|
||||
./usr/include/emips/lock.h comp-c-include
|
||||
./usr/include/emips/locore.h comp-c-include
|
||||
./usr/include/emips/math.h comp-c-include
|
||||
./usr/include/emips/mcontext.h comp-c-include
|
||||
./usr/include/emips/mips_opcode.h comp-c-include
|
||||
./usr/include/emips/mutex.h comp-c-include
|
||||
./usr/include/emips/param.h comp-c-include
|
||||
./usr/include/emips/pcb.h comp-c-include
|
||||
./usr/include/emips/pmap.h comp-c-include
|
||||
./usr/include/emips/pmc.h comp-c-include
|
||||
./usr/include/emips/proc.h comp-c-include
|
||||
./usr/include/emips/profile.h comp-c-include
|
||||
./usr/include/emips/psl.h comp-c-include
|
||||
./usr/include/emips/pte.h comp-c-include
|
||||
./usr/include/emips/ptrace.h comp-c-include
|
||||
./usr/include/emips/reg.h comp-c-include
|
||||
./usr/include/emips/regdef.h comp-c-include
|
||||
./usr/include/emips/regnum.h comp-c-include
|
||||
./usr/include/emips/reloc.h comp-c-include
|
||||
./usr/include/emips/rwlock.h comp-c-include
|
||||
./usr/include/emips/setjmp.h comp-c-include
|
||||
./usr/include/emips/signal.h comp-c-include
|
||||
./usr/include/emips/stdarg.h comp-c-include
|
||||
./usr/include/emips/trap.h comp-c-include
|
||||
./usr/include/emips/types.h comp-c-include
|
||||
./usr/include/emips/varargs.h comp-c-include
|
||||
./usr/include/emips/vmparam.h comp-c-include
|
||||
./usr/include/emips/wchar_limits.h comp-c-include
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1280 2011/01/24 01:14:59 jakllsch Exp $
|
||||
# $NetBSD: mi,v 1.1281 2011/01/26 01:18:46 pooka Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -925,6 +925,13 @@
|
|||
./usr/share/man/cat4/eisa.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/el.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/elmc.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/ace.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/autoconf.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/dz.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/ebus.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/eclock.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/enic.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emips/intro.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/emuxki.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/en.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/envsys.0 man-sys-catman .cat
|
||||
|
@ -2173,6 +2180,10 @@
|
|||
./usr/share/man/cat8/editmap.0 man-obsolete obsolete
|
||||
./usr/share/man/cat8/edquota.0 man-sysutil-catman .cat
|
||||
./usr/share/man/cat8/eeprom.0 man-sysutil-catman .cat
|
||||
./usr/share/man/cat8/emips/MAKEDEV.0 man-obsolete obsolete
|
||||
./usr/share/man/cat8/emips/boot.0 man-sys-catman .cat
|
||||
./usr/share/man/cat8/emips/installboot.0 man-obsolete obsolete
|
||||
./usr/share/man/cat8/emips/makedev.0 man-obsolete obsolete
|
||||
./usr/share/man/cat8/envstat.0 man-sysutil-catman .cat
|
||||
./usr/share/man/cat8/error.0 man-postfix-catman postfix,.cat
|
||||
./usr/share/man/cat8/eshconfig.0 man-sysutil-catman .cat
|
||||
|
@ -3681,6 +3692,13 @@
|
|||
./usr/share/man/html4/ess.html man-sys-htmlman html
|
||||
./usr/share/man/html4/et.html man-sys-htmlman html
|
||||
./usr/share/man/html4/etherip.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/ace.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/autoconf.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/dz.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/ebus.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/eclock.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/enic.html man-sys-htmlman html
|
||||
./usr/share/man/html4/emips/intro.html man-sys-htmlman html
|
||||
./usr/share/man/html4/etphy.html man-sys-htmlman html
|
||||
./usr/share/man/html4/evbarm/epgpio.html man-sys-htmlman html
|
||||
./usr/share/man/html4/evbarm/intro.html man-sys-htmlman html
|
||||
|
@ -4767,6 +4785,7 @@
|
|||
./usr/share/man/html8/dumplfs.html man-sysutil-htmlman html
|
||||
./usr/share/man/html8/edquota.html man-sysutil-htmlman html
|
||||
./usr/share/man/html8/eeprom.html man-sysutil-htmlman html
|
||||
./usr/share/man/html8/emips/boot.html man-sys-htmlman html
|
||||
./usr/share/man/html8/envstat.html man-sysutil-htmlman html
|
||||
./usr/share/man/html8/error.html man-postfix-htmlman postfix,html
|
||||
./usr/share/man/html8/eshconfig.html man-sysutil-htmlman html
|
||||
|
@ -6183,6 +6202,13 @@
|
|||
./usr/share/man/man4/eisa.4 man-sys-man .man
|
||||
./usr/share/man/man4/el.4 man-sys-man .man
|
||||
./usr/share/man/man4/elmc.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/ace.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/autoconf.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/dz.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/ebus.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/eclock.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/enic.4 man-sys-man .man
|
||||
./usr/share/man/man4/emips/intro.4 man-sys-man .man
|
||||
./usr/share/man/man4/emuxki.4 man-sys-man .man
|
||||
./usr/share/man/man4/en.4 man-sys-man .man
|
||||
./usr/share/man/man4/envsys.4 man-sys-man .man
|
||||
|
@ -7430,6 +7456,10 @@
|
|||
./usr/share/man/man8/editmap.8 man-obsolete obsolete
|
||||
./usr/share/man/man8/edquota.8 man-sysutil-man .man
|
||||
./usr/share/man/man8/eeprom.8 man-sysutil-man .man
|
||||
./usr/share/man/man8/emips/MAKEDEV.8 man-obsolete obsolete
|
||||
./usr/share/man/man8/emips/boot.8 man-sys-man .man
|
||||
./usr/share/man/man8/emips/installboot.8 man-obsolete obsolete
|
||||
./usr/share/man/man8/emips/makedev.8 man-obsolete obsolete
|
||||
./usr/share/man/man8/envstat.8 man-sysutil-man .man
|
||||
./usr/share/man/man8/error.8 man-postfix-man postfix,.man
|
||||
./usr/share/man/man8/eshconfig.8 man-sysutil-man .man
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.15 2010/05/03 14:14:35 tsutsui Exp $
|
||||
# $NetBSD: Makefile,v 1.16 2011/01/26 01:18:46 pooka Exp $
|
||||
#
|
||||
# sysinst is usually built when the crunched install binary is built,
|
||||
# but can be built here as a normal program for testing.
|
||||
|
@ -17,6 +17,7 @@ SUBDIR += arch/atari
|
|||
SUBDIR += arch/bebox
|
||||
SUBDIR += arch/cats
|
||||
SUBDIR += arch/cobalt
|
||||
SUBDIR += arch/emips
|
||||
SUBDIR += arch/evbarm
|
||||
SUBDIR += arch/evbmips
|
||||
SUBDIR += arch/evbppc
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:46 pooka Exp $
|
||||
#
|
||||
# Makefile for emips
|
||||
#
|
||||
|
||||
.include "../../Makefile.inc"
|
|
@ -0,0 +1,206 @@
|
|||
/* $NetBSD: md.c,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Based on code written by Philip A. Nelson for Piermont Information
|
||||
* Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*/
|
||||
|
||||
/* md.c -- emips machine specific routines */
|
||||
/* This file is in close sync with sparc, vax, and x68k md.c */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <curses.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <util.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "md.h"
|
||||
#include "msg_defs.h"
|
||||
#include "menu_defs.h"
|
||||
|
||||
void
|
||||
md_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
md_init_set_status(int minimal)
|
||||
{
|
||||
(void)minimal;
|
||||
}
|
||||
|
||||
int
|
||||
md_get_info(void)
|
||||
{
|
||||
struct disklabel disklabel;
|
||||
int fd;
|
||||
char dev_name[100];
|
||||
|
||||
snprintf(dev_name, 100, "/dev/r%sc", diskdev);
|
||||
|
||||
fd = open(dev_name, O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
if (logging)
|
||||
(void)fprintf(logfp, "Can't open %s\n", dev_name);
|
||||
endwin();
|
||||
fprintf(stderr, "Can't open %s\n", dev_name);
|
||||
exit(1);
|
||||
}
|
||||
if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
|
||||
if (logging)
|
||||
(void)fprintf(logfp, "Can't read disklabel on %s.\n",
|
||||
dev_name);
|
||||
endwin();
|
||||
fprintf(stderr, "Can't read disklabel on %s.\n", dev_name);
|
||||
close(fd);
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
dlcyl = disklabel.d_ncylinders;
|
||||
dlhead = disklabel.d_ntracks;
|
||||
dlsec = disklabel.d_nsectors;
|
||||
sectorsize = disklabel.d_secsize;
|
||||
dlcylsize = disklabel.d_secpercyl;
|
||||
|
||||
/*
|
||||
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec)
|
||||
* and secperunit, just in case the disk is already labelled.
|
||||
* (If our new label's RAW_PART size ends up smaller than the
|
||||
* in-core RAW_PART size value, updating the label will fail.)
|
||||
*/
|
||||
dlsize = dlcyl*dlhead*dlsec;
|
||||
if (disklabel.d_secperunit > dlsize)
|
||||
dlsize = disklabel.d_secperunit;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* md back-end code for menu-driven BSD disklabel editor.
|
||||
*/
|
||||
int
|
||||
md_make_bsd_partitions(void)
|
||||
{
|
||||
return(make_bsd_partitions());
|
||||
}
|
||||
|
||||
/*
|
||||
* any additional partition validation
|
||||
*/
|
||||
int
|
||||
md_check_partitions(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* hook called before writing new disklabel.
|
||||
*/
|
||||
int
|
||||
md_pre_disklabel(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* hook called after writing disklabel to new target disk.
|
||||
*/
|
||||
int
|
||||
md_post_disklabel(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* hook called after upgrade() or install() has finished setting
|
||||
* up the target disk but immediately before the user is given the
|
||||
* ``disks are now set up'' message.
|
||||
*/
|
||||
int
|
||||
md_post_newfs(void)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called after extraction of all sets is complete.
|
||||
*
|
||||
* On emips, we take this opportunity to update the boot loader.
|
||||
*/
|
||||
int
|
||||
md_post_extract(void)
|
||||
{
|
||||
char ldr_path[STRSIZE];
|
||||
|
||||
strlcpy(ldr_path, target_expand("/boot.emips"), sizeof ldr_path);
|
||||
|
||||
msg_display(MSG_dobootblks, "");
|
||||
process_menu(MENU_noyes, NULL);
|
||||
|
||||
if (yesno) {
|
||||
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
|
||||
"/bin/dd if=%s of=/dev/reflash0c bs=512", ldr_path))
|
||||
process_menu(MENU_ok, deconst("Warning: the system "
|
||||
"is probably not bootable"));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
md_cleanup_install(void)
|
||||
{
|
||||
#ifndef DEBUG
|
||||
enable_rc_conf();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
md_pre_update(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Upgrade support */
|
||||
int
|
||||
md_update(void)
|
||||
{
|
||||
md_post_newfs();
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/* $NetBSD: md.h,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* md.h -- Machine specific definitions for the emips */
|
||||
|
||||
/* Constants and defines */
|
||||
|
||||
/*
|
||||
* Symbolic names for disk partitions.
|
||||
*/
|
||||
#define PART_ROOT PART_A
|
||||
#define PART_SWAP PART_B
|
||||
#define PART_RAW PART_C
|
||||
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
|
||||
#define PART_FIRST_FREE PART_E
|
||||
|
||||
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
|
||||
#define DEFROOTSIZE 64 /* Default root size */
|
||||
#define DEFVARSIZE 32 /* Default /var size, if created */
|
||||
#define DEFUSRSIZE 120 /* Default /usr size, if /home */
|
||||
#define XNEEDMB 100 /* Extra megs for full X installation */
|
||||
|
||||
/*
|
||||
* Disk names accepted as valid targets for a from-scratch installation.
|
||||
*
|
||||
*/
|
||||
#define DISK_NAMES "ace", "sd", "wd", "ld", "raid"
|
||||
|
||||
/* have support for booting from UFS2 */
|
||||
#define HAVE_UFS2_BOOT
|
||||
|
||||
/* have file system specific primary boot loader */
|
||||
#define HAVE_BOOTXX_xFS
|
||||
#define BOOTXXDIR "/usr/mdec"
|
||||
#define BOOTXX_FFSV1 "bootxx_ffs"
|
||||
#define BOOTXX_FFSV2 "bootxx_ffsv2"
|
||||
|
||||
/*
|
||||
* Machine-specific command to write a new label to a disk.
|
||||
* If not defined, we assume the port does not support disklabels and
|
||||
* hand-edited disklabel will NOT be written by MI code.
|
||||
*/
|
||||
#define DISKLABEL_CMD "disklabel -w -r"
|
||||
|
||||
|
||||
/*
|
||||
* Default filesets to fetch and install during installation
|
||||
* or upgrade. The standard sets are:
|
||||
* base etc comp games man misc tests text xbase xcomp xetc xfont xserver
|
||||
*/
|
||||
#define SET_KERNEL_1_NAME "kern-GENERIC"
|
||||
#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11_NOSERVERS
|
||||
|
||||
/* default install CD device is ace1a */
|
||||
#define CD_NAME "ace1a"
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.en,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent menus, english */
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.es,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent menus, spanish */
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.fr,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent menus, french */
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/* $NetBSD: menus.md.pl,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: menus.md.en,v 1.17 2001/11/29 23:21:00 thorpej Exp */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Based on code written by Philip A. Nelson for Piermont Information
|
||||
* Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent menus, Polish */
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: msg.md.de,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent messages, German */
|
||||
|
||||
|
||||
message md_hello
|
||||
{Wenn Sie von einer Diskette gebootet haben, so können Sie diese jetzt
|
||||
entnehmen.
|
||||
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installiere die Bootblöcke auf %s ...
|
||||
}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: msg.md.en,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent messages, english */
|
||||
|
||||
|
||||
message md_hello
|
||||
{If you booted from a floppy, you may now remove the disk.
|
||||
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installing boot blocks on %s....
|
||||
}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: msg.md.es,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent messages, spanish */
|
||||
|
||||
|
||||
message md_hello
|
||||
{Si ha iniciado desde disquette, ahora deberia retirar el disco.
|
||||
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Instalando bloques de arranque en %s...
|
||||
}
|
||||
|
||||
message set_kernel_1
|
||||
{Núcleo (GENERIC)}
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: msg.md.fr,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent messages, french */
|
||||
|
||||
|
||||
message md_hello
|
||||
{Si vous avez démarré sur une disquette, vous pouvez maintenant la retirer.
|
||||
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installation des secteurs de démarrage sur %s ...
|
||||
}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: msg.md.pl,v 1.1 2011/01/26 01:18:46 pooka Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: msg.md.en,v 1.8 2000/12/03 01:54:49 minoura Exp */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Based on code written by Philip A. Nelson for Piermont Information
|
||||
* Systems Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Piermont Information Systems Inc.
|
||||
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* emips machine dependent messages, Polish */
|
||||
|
||||
|
||||
message md_hello
|
||||
{Jesli uruchomiles komputer z dyskietki, mozesz ja teraz wyciagnac.
|
||||
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Instalowanie bootblokow na %s....
|
||||
}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disks.c,v 1.111 2010/02/17 16:09:52 martin Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.112 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -767,7 +767,7 @@ make_fstab(void)
|
|||
scripting_fprintf(f, "kernfs\t\t/kern\tkernfs\trw\n");
|
||||
scripting_fprintf(f, "ptyfs\t\t/dev/pts\tptyfs\trw\n");
|
||||
scripting_fprintf(f, "procfs\t\t/proc\tprocfs\trw\n");
|
||||
scripting_fprintf(f, "/dev/cd0a\t\t/cdrom\tcd9660\tro,noauto\n");
|
||||
scripting_fprintf(f, "/dev/" CD_NAME "\t\t/cdrom\tcd9660\tro,noauto\n");
|
||||
make_target_dir("/kern");
|
||||
make_target_dir("/proc");
|
||||
make_target_dir("/dev/pts");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.54 2009/10/18 12:09:48 ahoka Exp $ */
|
||||
/* $NetBSD: main.c,v 1.55 2011/01/26 01:18:46 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -82,6 +82,10 @@ struct f_arg {
|
|||
int size;
|
||||
};
|
||||
|
||||
#ifndef CD_NAME
|
||||
#define CD_NAME "cd0a"
|
||||
#endif
|
||||
|
||||
static const struct f_arg fflagopts[] = {
|
||||
{"release", REL, rel, sizeof rel},
|
||||
{"machine", MACH, machine, sizeof machine},
|
||||
|
@ -95,7 +99,7 @@ static const struct f_arg fflagopts[] = {
|
|||
{"ftp proxy", "", ftp.proxy, sizeof ftp.proxy},
|
||||
{"nfs host", "", nfs_host, sizeof nfs_host},
|
||||
{"nfs dir", "/bsd/release", nfs_dir, sizeof nfs_dir},
|
||||
{"cd dev", "cd0a", cdrom_dev, sizeof cdrom_dev},
|
||||
{"cd dev", CD_NAME, cdrom_dev, sizeof cdrom_dev},
|
||||
{"fd dev", "/dev/fd0a", fd_dev, sizeof fd_dev},
|
||||
{"local dev", "", localfs_dev, sizeof localfs_dev},
|
||||
{"local fs", "ffs", localfs_fs, sizeof localfs_fs},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1495 $>
|
||||
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1496 $>
|
||||
#
|
||||
#
|
||||
# [Note: This file does not mention every change made to the NetBSD source tree.
|
||||
|
@ -834,3 +834,4 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
|
|||
atactl(8): Fix mislabelled S.M.A.R.T. lifetime temperature record
|
||||
reading. [nisimura 20110119]
|
||||
pcf8563rtc(4): Add a todr(9) driver for NXP PCF8563 [jakllsch 20110124]
|
||||
emips: Initial commit of the emips port [pooka 20110125]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh -
|
||||
# $NetBSD: MAKEDEV.tmpl,v 1.136 2010/09/19 20:52:23 jakllsch Exp $
|
||||
# $NetBSD: MAKEDEV.tmpl,v 1.137 2011/01/26 01:18:47 pooka Exp $
|
||||
#
|
||||
# Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -1017,6 +1017,16 @@ sd*)
|
|||
%MKDISK% $name $unit $blk $chr
|
||||
;;
|
||||
|
||||
ace*)
|
||||
name=ace; unit=${i#ace}; blk=%ace_blk%; chr=%ace_chr%
|
||||
%MKDISK% $name $unit $blk $chr
|
||||
;;
|
||||
|
||||
eflash*)
|
||||
name=eflash; unit=${i#eflash}; blk=%eflash_blk%; chr=%eflash_chr%
|
||||
%MKDISK% $name $unit $blk $chr
|
||||
;;
|
||||
|
||||
wd*)
|
||||
name=wd; unit=${i#wd}; blk=%wd_blk%; chr=%wd_chr%
|
||||
%MKDISK% $name $unit $blk $chr
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# $NetBSD: MAKEDEV.conf,v 1.1 2011/01/26 01:18:47 pooka Exp $
|
||||
|
||||
all_md)
|
||||
makedev minimal
|
||||
;;
|
||||
|
||||
minimal)
|
||||
makedev std
|
||||
makedev ace0 ace1
|
||||
makedev eflash0
|
||||
makedev md0 dz0
|
||||
;;
|
||||
|
||||
# Serial devices: dz*.
|
||||
#
|
||||
# Create dz* devices as /dev/ttyD[0-3],
|
||||
dz*)
|
||||
case $i in
|
||||
dz*) name=dz; unit=${i#dz}; chr=16;;
|
||||
esac
|
||||
case $unit in
|
||||
0)
|
||||
mkdev ttyD0 c $chr 0
|
||||
# mkdev ttyD1 c $chr 1
|
||||
# mkdev ttyD2 c $chr 2
|
||||
# mkdev ttyD3 c $chr 3
|
||||
;;
|
||||
*)
|
||||
warn "bad unit for $name in: $i"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2011/01/26 01:18:47 pooka Exp $
|
||||
#
|
||||
# etc.emips/Makefile.inc -- emips-specific etc Makefile targets
|
||||
#
|
||||
|
||||
KERNEL_SETS= GENERIC
|
||||
|
||||
BUILD_KERNELS= INSTALL RAMDISK
|
||||
|
||||
INSTALLATION_DIRS+= installation/diskimage \
|
||||
installation/netboot \
|
||||
installation/miniroot
|
|
@ -0,0 +1,25 @@
|
|||
# $NetBSD: ttys,v 1.1 2011/01/26 01:18:47 pooka Exp $
|
||||
#
|
||||
# from: @(#)ttys 5.1 (Berkeley) 4/17/89
|
||||
#
|
||||
# name getty type status comments
|
||||
#
|
||||
|
||||
# Assumes you use PuTTY on your serial line
|
||||
console "/usr/libexec/getty std.38400" vt100 on secure
|
||||
#
|
||||
# ttys for serial ports
|
||||
#
|
||||
##ttyD0 "/usr/libexec/getty std.38400" unknown off secure # console
|
||||
|
||||
#
|
||||
# ttys for historical compatibility (Qbus decsystems?)
|
||||
#
|
||||
tty00 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty01 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty02 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty03 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty04 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty05 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty06 "/usr/libexec/getty std.9600" unknown off secure
|
||||
tty07 "/usr/libexec/getty std.9600" unknown off secure
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: NetBSD.dist.base,v 1.72 2011/01/05 14:57:29 haad Exp $
|
||||
# $NetBSD: NetBSD.dist.base,v 1.73 2011/01/26 01:18:47 pooka Exp $
|
||||
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
|
||||
|
||||
# Do not customize this file as it may be overwritten on upgrades.
|
||||
|
@ -703,6 +703,7 @@
|
|||
./usr/share/man/cat4/atari
|
||||
./usr/share/man/cat4/cobalt
|
||||
./usr/share/man/cat4/dreamcast
|
||||
./usr/share/man/cat4/emips
|
||||
./usr/share/man/cat4/evbarm
|
||||
./usr/share/man/cat4/evbmips
|
||||
./usr/share/man/cat4/evbppc
|
||||
|
@ -741,6 +742,7 @@
|
|||
./usr/share/man/cat8/cesfic
|
||||
./usr/share/man/cat8/cobalt
|
||||
./usr/share/man/cat8/dreamcast
|
||||
./usr/share/man/cat8/emips
|
||||
./usr/share/man/cat8/evbarm
|
||||
./usr/share/man/cat8/evbmips
|
||||
./usr/share/man/cat8/evbppc
|
||||
|
@ -782,6 +784,7 @@
|
|||
./usr/share/man/cat9/alpha
|
||||
./usr/share/man/cat9/amiga
|
||||
./usr/share/man/cat9/atari
|
||||
./usr/share/man/cat9/emips
|
||||
./usr/share/man/cat9/hp300
|
||||
./usr/share/man/cat9/i386
|
||||
./usr/share/man/cat9/mac68k
|
||||
|
@ -807,6 +810,7 @@
|
|||
./usr/share/man/man4/atari
|
||||
./usr/share/man/man4/cobalt
|
||||
./usr/share/man/man4/dreamcast
|
||||
./usr/share/man/man4/emips
|
||||
./usr/share/man/man4/evbarm
|
||||
./usr/share/man/man4/evbmips
|
||||
./usr/share/man/man4/evbppc
|
||||
|
@ -845,6 +849,7 @@
|
|||
./usr/share/man/man8/cesfic
|
||||
./usr/share/man/man8/cobalt
|
||||
./usr/share/man/man8/dreamcast
|
||||
./usr/share/man/man8/emips
|
||||
./usr/share/man/man8/evbarm
|
||||
./usr/share/man/man8/evbmips
|
||||
./usr/share/man/man8/evbppc
|
||||
|
@ -886,6 +891,7 @@
|
|||
./usr/share/man/man9/alpha
|
||||
./usr/share/man/man9/amiga
|
||||
./usr/share/man/man9/atari
|
||||
./usr/share/man/man9/emips
|
||||
./usr/share/man/man9/hp300
|
||||
./usr/share/man/man9/i386
|
||||
./usr/share/man/man9/mac68k
|
||||
|
@ -911,6 +917,7 @@
|
|||
./usr/share/man/html4/atari
|
||||
./usr/share/man/html4/cobalt
|
||||
./usr/share/man/html4/dreamcast
|
||||
./usr/share/man/html4/emips
|
||||
./usr/share/man/html4/evbarm
|
||||
./usr/share/man/html4/evbmips
|
||||
./usr/share/man/html4/evbppc
|
||||
|
@ -949,6 +956,7 @@
|
|||
./usr/share/man/html8/cesfic
|
||||
./usr/share/man/html8/cobalt
|
||||
./usr/share/man/html8/dreamcast
|
||||
./usr/share/man/html8/emips
|
||||
./usr/share/man/html8/evbarm
|
||||
./usr/share/man/html8/evbmips
|
||||
./usr/share/man/html8/evbppc
|
||||
|
@ -990,6 +998,7 @@
|
|||
./usr/share/man/html9/alpha
|
||||
./usr/share/man/html9/amiga
|
||||
./usr/share/man/html9/atari
|
||||
./usr/share/man/html9/emips
|
||||
./usr/share/man/html9/hp300
|
||||
./usr/share/man/html9/i386
|
||||
./usr/share/man/html9/mac68k
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.9 2009/12/14 01:07:41 matt Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.10 2011/01/26 01:18:48 pooka Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
|
||||
|
||||
|
@ -8,4 +10,5 @@ CPPFLAGS.assym.h+=-D__LIBC12_SOURCE__
|
|||
.if ${MKSOFTFLOAT} != "no"
|
||||
.include <softfloat/Makefile.inc>
|
||||
CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
|
||||
CPPFLAGS+= -DSOFTFLOAT
|
||||
.endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
../man4/man4.atari/intro.4
|
||||
../man4/man4.cobalt/intro.4
|
||||
../man4/man4.dreamcast/intro.4
|
||||
../man4/man4.emips/intro.4
|
||||
../man4/man4.evbarm/intro.4
|
||||
../man4/man4.hp300/intro.4
|
||||
../man4/man4.hp700/intro.4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.545 2011/01/24 01:15:00 jakllsch Exp $
|
||||
# $NetBSD: Makefile,v 1.546 2011/01/26 01:18:48 pooka Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
|
||||
|
@ -217,7 +217,8 @@ MLINKS+=zstty.4 zs.4 zstty.4 zsc.4
|
|||
MLINKS+=edc.4 i386/ed.4
|
||||
|
||||
SUBDIR= man4.acorn26 man4.acorn32 man4.alpha man4.amiga man4.arc man4.atari \
|
||||
man4.cobalt man4.dreamcast man4.evbarm man4.evbmips man4.evbppc \
|
||||
man4.cobalt man4.dreamcast man4.emips man4.evbarm man4.evbmips \
|
||||
man4.evbppc \
|
||||
man4.hp300 man4.hp700 man4.hpcarm man4.hpcmips man4.hpcsh man4.i386 \
|
||||
man4.mac68k man4.macppc man4.mvme68k man4.pmax man4.prep \
|
||||
man4.sgimips man4.sparc man4.sparc64 man4.sun2 man4.sun3 man4.vax \
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
# from: @(#)Makefile 8.2 (Berkeley) 2/16/94
|
||||
|
||||
MAN= ace.4 autoconf.4 dz.4 ebus.4 eclock.4 enic.4 intro.4
|
||||
MANSUBDIR=/emips
|
||||
|
||||
.include <bsd.man.mk>
|
|
@ -0,0 +1,58 @@
|
|||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $NetBSD: ace.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt ACE 4 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ace
|
||||
.Nd
|
||||
ACE disk adaptor
|
||||
.Sh SYNOPSIS
|
||||
.Cd "ace* at ebus0 addr ?
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the
|
||||
.Tn Xilinx
|
||||
SystemACE Compact-FLASH card adaptor used in the Xilinx XUP, ML401, ML401.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
is a medium-performance implementation of the CF interface.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
chip currently does not support DMA and the CPU must copy data using programmed-I/O.
|
||||
.Sh SEE ALSO
|
||||
.Xr ebus 4 ,
|
||||
.Xr intro 4 ,
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Nx 6.0 .
|
|
@ -0,0 +1,60 @@
|
|||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $NetBSD: autoconf.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt AUTOCONF 4 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm autoconf
|
||||
.Nd diagnostics from the autoconfiguration code
|
||||
.Sh DESCRIPTION
|
||||
When
|
||||
.Nx
|
||||
bootstraps it probes the innards of the machine on which it is running
|
||||
and locates controllers, drives, and other devices, printing out what
|
||||
it finds on the console. This procedure is driven by a system
|
||||
configuration table which is processed by
|
||||
.Xr config 1
|
||||
and compiled into each kernel.
|
||||
Devices which exist in the machine but are not configured into the
|
||||
kernel are not detected.
|
||||
.Sh DIAGNOSTICS
|
||||
.Bl -diag
|
||||
.It CPU type (0x%x) not supported.
|
||||
You tried to boot
|
||||
.Nx
|
||||
on a type of
|
||||
.Tn CPU
|
||||
type which it doesn't
|
||||
(or at least this compiled version of
|
||||
.Nx
|
||||
doesn't) understand.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr config 1 ,
|
||||
.Xr intro 4 ,
|
||||
.Xr boot 8
|
|
@ -0,0 +1,91 @@
|
|||
.\" $NetBSD: dz.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt DZ 4 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm dz
|
||||
.Nd
|
||||
.Tn eMIPS
|
||||
console serial device interface
|
||||
.Sh SYNOPSIS
|
||||
.Cd "dz* at ebus0 addr ?"
|
||||
.Sh DESCRIPTION
|
||||
This serial line provides a simple communication line with no modem control.
|
||||
It is not adequate for
|
||||
.Ux
|
||||
dialup use.
|
||||
.Pp
|
||||
Normal I/O
|
||||
control parameters for individual lines are managed by
|
||||
.Xr ioctl 2
|
||||
calls.
|
||||
Line speeds may be initiated via
|
||||
the
|
||||
.Xr ttys 5
|
||||
file,
|
||||
.Xr stty 1
|
||||
or
|
||||
.Xr ifconfig 8
|
||||
to name a few,
|
||||
see
|
||||
.Xr tty 4 .
|
||||
.Pp
|
||||
The
|
||||
.Nm dz
|
||||
driver monitors the rate of input on each board,
|
||||
and switches between the use of character-at-a-time interrupts
|
||||
and input silos.
|
||||
While the silo is enabled during periods of high-speed input,
|
||||
the driver polls for input 30 times per second.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /dev/tty[0-9][0-9]xx -compact
|
||||
.It Pa /dev/ttyD0
|
||||
phys interface.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Bl -diag
|
||||
.It dz%d: silo overflow .
|
||||
The 1 character input silo overflowed
|
||||
before it could be serviced. This can happen if a hard error occurs
|
||||
when the
|
||||
.Tn CPU
|
||||
is running with elevated priority, as the system will
|
||||
then print a message on the console with interrupts disabled.
|
||||
It is not serious.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr stty 1 ,
|
||||
.Xr tty 4 ,
|
||||
.Xr ttys 5 ,
|
||||
.Xr getty 8
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
driver appeared in
|
||||
.Nx 6.0 .
|
|
@ -0,0 +1,67 @@
|
|||
.\" $NetBSD: ebus.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt EBUS 4 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ebus
|
||||
.Nd eMIPS Extensible I/O BUS driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd "ebus0 at mainbus0"
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a virtual device for the Extensible I/O BUS realized with eMIPS
|
||||
on FPGA boards such as the BEE3, Xilinx XUP, and Xilinx ML40x systems.
|
||||
.Pp
|
||||
Devices on the BUS can generally be relocated and can be found by
|
||||
scanning the Peripheral Mapping Table at the top of the BUS physical space.
|
||||
The driver is responsible for identifying devices that are currently available,
|
||||
and to map them into the kernel virtual space during the kernel startup procedure.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
driver manages the Extensible I/O BUS on eMIPS and provides
|
||||
.Pp
|
||||
.Bl -bullet -offset indent
|
||||
.It
|
||||
Address range management to avoid conflicts.
|
||||
.It
|
||||
Interrupt vector management.
|
||||
.It
|
||||
Other utility functions.
|
||||
.El
|
||||
.Pp
|
||||
.Nm
|
||||
is always required to run the
|
||||
.Nx
|
||||
kernel.
|
||||
.Sh SEE ALSO
|
||||
.Xr intro 4 ,
|
||||
.Xr ace 4 ,
|
||||
.Xr dz 4 ,
|
||||
.Xr eclock 4 ,
|
||||
.Xr enic 4
|
|
@ -0,0 +1,43 @@
|
|||
.\" $NetBSD: eclock.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt ECLOCK 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm eclock
|
||||
.Nd eMIPS system real-time clock
|
||||
.Sh SYNOPSIS
|
||||
.Ss emips
|
||||
.Cd "eclock* at ebus0 addr ?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the eMIPS real-time clock.
|
||||
.Sh SEE ALSO
|
||||
.Xr intro 4 ,
|
||||
.Xr ebus 4
|
|
@ -0,0 +1,78 @@
|
|||
.\" $NetBSD: enic.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.Dd July 27, 2010
|
||||
.Dt ENIC 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm enic
|
||||
.Nd eMIPS ExtensibleNIC Ethernet interface driver
|
||||
.Cd "enic* at ebus0 addr ?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
interface provides access to a
|
||||
.Tn Ethernet
|
||||
network via the eMIPS builtin
|
||||
.Tn eNIC
|
||||
(Extensible Network Interface Controller - Ethernet) interface.
|
||||
.Pp
|
||||
Each of the host's network addresses
|
||||
is specified at boot time with an
|
||||
.Dv SIOCSIFADDR
|
||||
.Xr ioctl 2 .
|
||||
The
|
||||
.Nm
|
||||
interface employs the Address Resolution Protocol (ARP) described in
|
||||
.Xr arp 4
|
||||
to dynamically map between Internet and
|
||||
.Tn Ethernet
|
||||
addresses on the local network.
|
||||
.Pp
|
||||
Multicast Ethernet frames are unconditionally received and must be filtered in software.
|
||||
.Sh HARDWARE
|
||||
.Ss emips
|
||||
The
|
||||
.Tn ENIC
|
||||
interface is present on the BEE3 and Xilinx XUP boards. The interface speed is wired at 1Gbps.
|
||||
.Sh DIAGNOSTICS
|
||||
.Bl -diag
|
||||
.It "le%d: enic_put: no mem?"
|
||||
The driver could not allocate a transmit buffer, packet was not sent.
|
||||
.It "le%d: internal error"
|
||||
This and other messages are indicative of bad hardware or software driver coding errors.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr arp 4 ,
|
||||
.Xr ifmedia 4 ,
|
||||
.Xr inet 4 ,
|
||||
.Xr intro 4 ,
|
||||
.Xr ifconfig 8
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Nx 6.0 .
|
|
@ -0,0 +1,126 @@
|
|||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $NetBSD: intro.4,v 1.1 2011/01/26 01:18:48 pooka Exp $
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt INTRO 4 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm intro
|
||||
.Nd introduction to emips special files and hardware support
|
||||
.Sh DESCRIPTION
|
||||
This section describes the special files, related driver functions,
|
||||
and networking support available in the system.
|
||||
In this part of the manual, the
|
||||
.Tn SYNOPSIS
|
||||
section of each configurable device gives a sample specification
|
||||
for use in constructing a system description for the
|
||||
.Xr config 1
|
||||
program.
|
||||
The
|
||||
.Tn DIAGNOSTICS
|
||||
section lists messages which may appear on the console
|
||||
and/or in the system error log
|
||||
.Pa /var/log/messages
|
||||
due to errors in device operation; see
|
||||
.Xr syslogd 8
|
||||
for more information.
|
||||
.Pp
|
||||
This section contains both devices which may be configured into
|
||||
the system and network related information.
|
||||
The networking support is introduced in
|
||||
.Xr netintro 4 .
|
||||
.Sh DEVICE SUPPORT
|
||||
This section describes the hardware supported on eMIPS
|
||||
(Microsoft Extensible MIPS processor)-based platforms.
|
||||
Software support for these devices comes in two forms.
|
||||
A hardware device may be supported with a character or block
|
||||
.Em device driver ,
|
||||
or it may be used within the networking subsystem and have a
|
||||
.Em network interface driver .
|
||||
Block and character devices are accessed through files in the file
|
||||
system of a special type; see
|
||||
.Xr mknod 8 .
|
||||
Network interfaces are indirectly accessed through the interprocess
|
||||
communication facilities provided by the system; see
|
||||
.Xr socket 2 .
|
||||
.Pp
|
||||
A hardware device is identified to the system at configuration time
|
||||
and the appropriate device or network interface driver is then compiled
|
||||
into the system.
|
||||
When the resultant system is booted, the autoconfiguration facilities
|
||||
in the system probe for the device and, if found, enable the software
|
||||
support for it.
|
||||
If a device does not respond at autoconfiguration
|
||||
time it is not accessible at any time afterwards.
|
||||
To enable a device which did not autoconfigure,
|
||||
the system must be rebooted.
|
||||
.Pp
|
||||
The autoconfiguration system is described in
|
||||
.Xr autoconf 4 .
|
||||
A list of the supported devices is given below.
|
||||
.Sh SEE ALSO
|
||||
.Xr config 1 ,
|
||||
.Xr autoconf 4
|
||||
.Sh SUPPORTED SYSTEMS
|
||||
The following systems are supported:
|
||||
.Pp
|
||||
.Bl -tag -width speaker -offset indent -compact
|
||||
.It BeSquare BErkeley Emulation System-3 FPGA development board
|
||||
known as the "BEE3". This is a quad-chip FPGA system where eMIPS can run on each FPGA separately,
|
||||
on multiple FPGAs in concert, and in multi-processor configurations.
|
||||
.It Xilinx University Program board
|
||||
known as "XUP". This is the Xilinx reference board for the Virtex-5 series chips.
|
||||
It can use the same XL110T FPGA chip present on the BEE3.
|
||||
.It Xilinx ML402
|
||||
Xilinx reference board for the Virtex-4 series chip, including the SX35.
|
||||
.It Xilinx ML401
|
||||
Same as the above, but with the smaller LX25 chip.
|
||||
.El
|
||||
.Sh LIST OF DEVICES
|
||||
The devices listed below are supported in this incarnation of the system.
|
||||
Devices are indicated by their functional interface.
|
||||
Not all supported devices are listed.
|
||||
.Pp
|
||||
.Bl -tag -width speaker -offset indent -compact
|
||||
.It ace
|
||||
Xilinx SystemACE interface for Compact-FLASH cards, bears similarities to the IDE interface.
|
||||
Present on XUP and ML40x boards. Not present on BEE3.
|
||||
.It dz
|
||||
serial driver for the eMIPS console serial device. Present on all systems.
|
||||
.It enic
|
||||
Ethernet driver for the eNIC device. Present on XUP and BEE3 systems. Not present on ML40x systems.
|
||||
.It eclock
|
||||
System clock, must be configured on all systems.
|
||||
.It ebus
|
||||
Extensible BUS, present on all systems.
|
||||
.El
|
||||
.Sh HISTORY
|
||||
This
|
||||
.Tn eMIPS
|
||||
.Nm intro
|
||||
appeared in
|
||||
.Nx 6.0 .
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.97 2010/05/14 16:19:58 jruoho Exp $
|
||||
# $NetBSD: Makefile,v 1.98 2011/01/26 01:18:48 pooka Exp $
|
||||
# from: @(#)Makefile 8.1 (Berkeley) 6/5/93
|
||||
|
||||
MAN= MAKEDEV.8 MAKEDEV.local.8 afterboot.8 boot.8 compat_30.8 \
|
||||
|
@ -24,7 +24,8 @@ MLINKS+=rc.8 rc.local.8
|
|||
MLINKS+=rc.8 rc.shutdown.8
|
||||
|
||||
SUBDIR= man8.acorn26 man8.acorn32 man8.alpha man8.amd64 man8.amiga man8.atari \
|
||||
man8.cobalt man8.dreamcast man8.hp300 man8.hp700 man8.hpcarm \
|
||||
man8.cobalt man8.dreamcast man8.emips man8.hp300 man8.hp700 \
|
||||
man8.hpcarm \
|
||||
man8.hpcmips man8.hpcsh man8.i386 man8.mac68k man8.macppc \
|
||||
man8.mvme68k man8.next68k man8.pmax man8.prep \
|
||||
man8.sgimips man8.sparc man8.sparc64 man8.sun2 man8.sun3 \
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:49 pooka Exp $
|
||||
#
|
||||
|
||||
MAN= boot.8
|
||||
MANSUBDIR=/emips
|
||||
|
||||
.include <bsd.man.mk>
|
|
@ -0,0 +1,96 @@
|
|||
.\" $NetBSD: boot.8,v 1.1 2011/01/26 01:18:49 pooka Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Microsoft Corp.
|
||||
.\" Copyright (c) 2010 NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd July 17, 2010
|
||||
.Dt BOOT 8 emips
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm boot
|
||||
.Nd system bootstrapping procedures
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nx
|
||||
kernel is started by placing it near the beginning of physical
|
||||
memory and transferring to the entry point.
|
||||
Since the system is not reenterable,
|
||||
it is necessary to read it in from disk or the network
|
||||
each time it is to be bootstrapped.
|
||||
.Ss Power fail and crash recovery
|
||||
FPGA devices lose their content upon loss of power and must be re-programmed.
|
||||
This is usually accomplished via a JTAG cable programmer, or using a FLASH device.
|
||||
Once the eMIPS processor has been programmed into the FPGA, the system will normally boot itself.
|
||||
An automatic consistency check of the file systems will be performed,
|
||||
and unless this fails, the system will resume multi-user operations.
|
||||
.Sh Xilinx XUP, ML401 and ML402
|
||||
On these systems the kernel is normally read in from disk. The path used for automatic booting is
|
||||
.Nm /netbsd ,
|
||||
but it can be overridden in the optional file
|
||||
.Nm /boot.config
|
||||
stored in the root of the disk filesystem. The user can also type a different filename and a combination of boot options.
|
||||
.Sh BeSquare BEE3
|
||||
On this system there is no local disk and booting over the network is the only option.
|
||||
Network boot can also be explicitly selected by hitting
|
||||
.Nm f
|
||||
at the boot loader prompt.
|
||||
.Sh KERNEL ARGUMENTS
|
||||
At the boot loader prompt, the user may boot
|
||||
.Nx
|
||||
with a number of otions that are passed to the kernel unmodified. Parsing of these options is
|
||||
defined in the file
|
||||
.Nm /sys/boot_flag.h
|
||||
Some additional flags are as follows.
|
||||
.Bl -tag -width xxx -offset indent
|
||||
.It Li e
|
||||
Empty -- this argument requests
|
||||
.Nx
|
||||
to ignore all symbolic information and empty its initial symbol table.
|
||||
.It Li n
|
||||
Name -- Prompt for the root file system device, the system crash dump
|
||||
device, and the path to
|
||||
.Xr init 8 .
|
||||
.It Li N
|
||||
NoName -- Do not prompt for the root file system device, the system crash dump
|
||||
device, and the path to
|
||||
.Xr init 8 .
|
||||
If the configured-in devices are present, use them.
|
||||
.It Li s
|
||||
Single -- Boot only to single-user mode.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ddb 4 ,
|
||||
.Xr halt 8 ,
|
||||
.Xr init 8 ,
|
||||
.Xr installboot 8 ,
|
||||
.Xr rc 8 ,
|
||||
.Xr reboot 8 ,
|
||||
.Xr savecore 8 ,
|
||||
.Xr shutdown 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command is
|
||||
.Ud .
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: bsd.own.mk,v 1.648 2011/01/25 10:28:56 he Exp $
|
||||
# $NetBSD: bsd.own.mk,v 1.649 2011/01/26 01:18:49 pooka Exp $
|
||||
|
||||
# This needs to be before bsd.init.mk
|
||||
.if defined(BSD_MK_COMPAT_FILE)
|
||||
|
@ -687,11 +687,17 @@ MKCOMPAT:= no
|
|||
|
||||
#
|
||||
# Default mips64 to softfloat now.
|
||||
# emips is always softfloat.
|
||||
#
|
||||
.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
|
||||
.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \
|
||||
${MACHINE} == "emips"
|
||||
MKSOFTFLOAT?= yes
|
||||
.endif
|
||||
|
||||
.if ${MACHINE} == "emips"
|
||||
SOFTFLOAT_BITS= 32
|
||||
.endif
|
||||
|
||||
#
|
||||
# MK* backward compatibility.
|
||||
#
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:49 pooka Exp $
|
||||
|
||||
# Makefile for emips tags file and boot blocks
|
||||
|
||||
# Find where mips source files are for inclusion in tags
|
||||
.include <../mips/Makefile.inc>
|
||||
|
||||
TEMIPS= ../emips/tags
|
||||
SEMIPS= ../emips/emips/*.[ch] ../emips/include/*.h \
|
||||
../emips/dev/*.[ch] ../emips/tc/*.[ch]
|
||||
AEMIPS= ../emips/emips/*.S
|
||||
|
||||
# Directories in which to place tags links
|
||||
DEMIPS= dev tc include
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags:
|
||||
-ctags -wdtf ${TEMIPS} ${SEMIPS} ${SMIPS} ${COMM}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AEMIPS} ${AMIPS} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TEMIPS}
|
||||
sort -o ${TEMIPS} ${TEMIPS}
|
||||
|
||||
links:
|
||||
-for i in ${DEMIPS}; do \
|
||||
cd $$i && rm -f tags; ln -s ../tags tags; done
|
||||
|
||||
|
||||
SUBDIR= compile include stand
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,3 @@
|
|||
# $NetBSD: Makefile,v 1.1 2011/01/26 01:18:49 pooka Exp $
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,230 @@
|
|||
# $NetBSD: GENERIC,v 1.1 2011/01/26 01:18:49 pooka Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
# This machine description file is used to generate the default NetBSD
|
||||
# kernel. The generic kernel does not include all options, subsystems
|
||||
# and device drivers, but should be useful for most applications.
|
||||
#
|
||||
# The machine description file can be customised for your specific
|
||||
# machine to reduce the kernel size and improve its performance.
|
||||
#
|
||||
# For further information on compiling NetBSD kernels, see the config(8)
|
||||
# man page.
|
||||
#
|
||||
# For further information on hardware support for this architecture, see
|
||||
# the intro(4) man page. For further information about kernel options
|
||||
# for this architecture, see the options(4) man page. For an explanation
|
||||
# of each device driver in this file see the section 4 man page for the
|
||||
# device.
|
||||
|
||||
include "arch/emips/conf/std.emips"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.1 $"
|
||||
|
||||
maxusers 64
|
||||
|
||||
options MIPS1 # R2000/R3000 CPUs
|
||||
options NOFPU # No FPU
|
||||
options SOFTFLOAT # emulate FPU insn
|
||||
|
||||
# Support eMIPS-based systems
|
||||
options XILINX_ML40X # Xilinx Ml401/2 dev boards
|
||||
options XS_BEE3 # MSR/BeCube BEE3 system
|
||||
|
||||
# Standard system options
|
||||
options DDB # in-kernel debugger
|
||||
options DDB_HISTORY_SIZE=100 # enable history editing in DDB
|
||||
options DDB_ONPANIC=1 # enter debugger on panic
|
||||
#options DIAGNOSTIC # extra kernel debugging checks
|
||||
#options DEBUG # extra kernel debugging support
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options KTRACE # system call tracing support
|
||||
#options SYSTRACE # system call vetting via systrace(1)
|
||||
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
#options SEMMNI=10 # number of semaphore identifiers
|
||||
#options SEMMNS=60 # number of semaphores in system
|
||||
#options SEMUME=10 # max number of undo entries per process
|
||||
#options SEMMNU=30 # number of undo structures in system
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
#options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
options P1003_1B_SEMAPHORE # p1003.1b semaphore support
|
||||
|
||||
options USERCONF # userconf(4) support
|
||||
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
# Enable experimental buffer queue strategy for better responsiveness under
|
||||
# high disk I/O load. Use it with caution - it's not proven to be stable yet.
|
||||
#options BUFQ_READPRIO
|
||||
#options BUFQ_PRIOCSCAN
|
||||
|
||||
# Old 4.4BSD/emips kgdb options
|
||||
#options KGDB # support for kernel gdb
|
||||
#options KGDB_DEVRATE=19200 # kernel gdb port rate (default 9600)
|
||||
#options KGDB_DEV="15*256+0" # device for kernel gdb
|
||||
|
||||
options NTP # network time protocol
|
||||
|
||||
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem with user and group quotas
|
||||
file-system MFS # memory-based filesystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # MS-DOS file system
|
||||
file-system FDESC # /dev/fd
|
||||
file-system KERNFS # /kern (kernel informational filesystem)
|
||||
file-system NULLFS # loopback file system
|
||||
file-system OVERLAY # overlay file system
|
||||
file-system PROCFS # /proc
|
||||
file-system UMAPFS # NULLFS + uid and gid remapping
|
||||
file-system UNION
|
||||
file-system PTYFS # /dev/pts/N support
|
||||
file-system TMPFS # Efficient memory file-system
|
||||
file-system UDF # experimental - OSTA UDF CD/DVD file-system
|
||||
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
options QUOTA # UFS quotas
|
||||
options FFS_EI # FFS Endian Independant support
|
||||
#options FFS_NO_SNAPSHOT # No FFS snapshot support
|
||||
#options UFS_DIRHASH # UFS Large Directory Hashing - Experimental
|
||||
|
||||
# Networking options
|
||||
options INET # Internet protocols
|
||||
options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_NAT_T # IPsec NAT traversal (NAT-T)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options GATEWAY # IP packet forwarding
|
||||
#options MROUTING # Multicast routing support
|
||||
#options PIM # Protocol Independent Multicast
|
||||
#options ISO # OSI networking
|
||||
#options TPIP # TPIP
|
||||
#options EON # OSI tunneling over IP
|
||||
#options NETATALK # AppleTalk networking protocols
|
||||
options PPP_BSDCOMP # BSD-Compress compression support for PPP
|
||||
options PPP_DEFLATE # Deflate compression support for PPP
|
||||
options PPP_FILTER # Active filter support for PPP (requires bpf)
|
||||
options PFIL_HOOKS # pfil(9) packet filter hooks
|
||||
options IPFILTER_LOG # ipmon(8) log support
|
||||
options IPFILTER_LOOKUP # ippool(8) support
|
||||
#options IPFILTER_DEFAULT_BLOCK # block all packets by default
|
||||
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
|
||||
|
||||
#options ALTQ # Manipulate network interfaces' output queues
|
||||
#options ALTQ_BLUE # Stochastic Fair Blue
|
||||
#options ALTQ_CBQ # Class-Based Queueing
|
||||
#options ALTQ_CDNR # Diffserv Traffic Conditioner
|
||||
#options ALTQ_FIFOQ # First-In First-Out Queue
|
||||
#options ALTQ_FLOWVALVE # RED/flow-valve (red-penalty-box)
|
||||
#options ALTQ_HFSC # Hierarchical Fair Service Curve
|
||||
#options ALTQ_LOCALQ # Local queueing discipline
|
||||
#options ALTQ_PRIQ # Priority Queueing
|
||||
#options ALTQ_RED # Random Early Detection
|
||||
#options ALTQ_RIO # RED with IN/OUT
|
||||
#options ALTQ_WFQ # Weighted Fair Queueing
|
||||
|
||||
# NetBSD backwards compatibility
|
||||
#options COMPAT_10 # NetBSD 1.0, (needed for X on 386?)
|
||||
#options COMPAT_11 # NetBSD 1.1, EXEC_ELF_NOTELESS
|
||||
options COMPAT_12 # NetBSD 1.2 reboot(), EXEC_ELF_NOTELESS
|
||||
options COMPAT_13 # NetBSD 1.3
|
||||
options COMPAT_14 # NetBSD 1.4
|
||||
options COMPAT_15 # NetBSD 1.5
|
||||
options COMPAT_16 # NetBSD 1.6
|
||||
options COMPAT_20 # NetBSD 2.0
|
||||
options COMPAT_30 # NetBSD 3.0 compatibility.
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
|
||||
options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
|
||||
|
||||
# Workstation console options
|
||||
#options FONT_BOLD8x16
|
||||
#options FONT_GALLANT12x22
|
||||
|
||||
#options WSEMUL_VT100
|
||||
#options WS_KERNEL_FG=WSCOL_GREEN
|
||||
#options WS_KERNEL_BG=WSCOL_BLACK
|
||||
|
||||
# Disable kernel security levels. Needed for X with a PX or PXG.
|
||||
#options INSECURE
|
||||
|
||||
# emips specific
|
||||
options HZ=16 # RTC rate required, uses timecounter
|
||||
|
||||
options NFS_BOOT_DHCP # superset of BOOTP
|
||||
options NFS_BOOT_RWSIZE=1024
|
||||
|
||||
config netbsd root on ? type ?
|
||||
config nfsnetbsd root on ? type nfs
|
||||
mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
## Peripheral Bus Support (for devices to attach to)
|
||||
## ----------------------------------------------------------------------------
|
||||
|
||||
# eMIPS systems
|
||||
ebus0 at mainbus0
|
||||
eclock* at ebus0 addr ? # clock
|
||||
dz* at ebus0 addr ? # usart
|
||||
enic* at ebus0 addr ? # ethernet
|
||||
ace* at ebus0 addr ? # disk
|
||||
eflash* at ebus0 addr ? # flash memory
|
||||
icap* at ebus0 addr ? # ICAP interface
|
||||
evga* at ebus0 addr ? # eVGA graphics
|
||||
pstwo* at ebus0 addr ? # PS2 mouse and kbd
|
||||
acns* at ebus0 addr ? # AC97 audio
|
||||
epio* at ebus0 addr ? # GPIO interface
|
||||
gpio* at epio?
|
||||
lcd* at ebus0 addr ? # lcd display
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Pseudo-devices #
|
||||
#########################################################################
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device sl # serial-line IP ports
|
||||
pseudo-device ppp # serial-line IP ports
|
||||
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
|
||||
pseudo-device pty # pseudo-terminals
|
||||
pseudo-device bpfilter # packet filter ports
|
||||
#pseudo-device carp # Common Address Redundancy Protocol
|
||||
pseudo-device ipfilter # IP filter, NAT
|
||||
#pseudo-device gre # generic L3 over IP tunnel
|
||||
pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith # IPv[46] tcp relay translation i/f
|
||||
pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
|
||||
pseudo-device vlan # IEEE 802.1q encapsulation
|
||||
pseudo-device bridge # simple inter-network bridging
|
||||
#options BRIDGE_IPF # bridge uses IP/IPv6 pfil hooks too
|
||||
pseudo-device agr # IEEE 802.3ad link aggregation
|
||||
|
||||
pseudo-device vnd # virtual disk ick
|
||||
#options VND_COMPRESSION # compressed vnd(4)
|
||||
pseudo-device ccd 4 # concatenated disks
|
||||
#pseudo-device cgd 4 # cryptographic disk devices
|
||||
#pseudo-device raid 8 # RAIDframe disk driver
|
||||
#options RAID_AUTOCONFIG # auto-configuration of RAID components
|
||||
# Options to enable various other RAIDframe RAID types.
|
||||
#options RF_INCLUDE_EVENODD=1
|
||||
#options RF_INCLUDE_RAID5_RS=1
|
||||
#options RF_INCLUDE_PARITYLOGGING=1
|
||||
#options RF_INCLUDE_CHAINDECLUSTER=1
|
||||
#options RF_INCLUDE_INTERDECLUSTER=1
|
||||
#options RF_INCLUDE_PARITY_DECLUSTERING=1
|
||||
#options RF_INCLUDE_PARITY_DECLUSTERING_DS=1
|
||||
pseudo-device fss # file system snapshot device
|
||||
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
pseudo-device ksyms # /dev/ksyms
|
||||
#pseudo-device pf # PF packet filter
|
||||
#pseudo-device pflog # PF log if
|
|
@ -0,0 +1,88 @@
|
|||
# $NetBSD: INSTALL,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
#
|
||||
# Distribution install kernel (any model)
|
||||
# netbsd: cut-down kernel for miniroots.
|
||||
# nfsnetbsd: root on NFS to boot diskless for installation,
|
||||
# disk drivers for labelling disks and installation on local disk.
|
||||
#
|
||||
#
|
||||
include "arch/emips/conf/std.emips"
|
||||
|
||||
makeoptions COPTS="-Os -mmemcpy" # Optimise for space. Implies -O2
|
||||
|
||||
maxusers 8
|
||||
|
||||
# CPU options
|
||||
options MIPS1 # R2000/R3000 support
|
||||
options NOFPU # No FPU
|
||||
options SOFTFLOAT # emulate FPU insn
|
||||
|
||||
# Support for specific models
|
||||
options XILINX_ML40X # Xilinx Ml401/2 dev boards
|
||||
options XS_BEE3 # MSR/BeCube BEE3 system
|
||||
|
||||
# Standard system options
|
||||
options USERCONF # userconf(4) support
|
||||
options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
|
||||
#options NTP # network time protocol
|
||||
|
||||
# File systems
|
||||
file-system FFS # BSD fast filesystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
|
||||
|
||||
# Filesystem options
|
||||
#options NFS_V2_ONLY # Exclude NFS3 and NQNFS code to save space
|
||||
options FFS_NO_SNAPSHOT # No FFS snapshot support
|
||||
|
||||
|
||||
# Networking options
|
||||
options INET # Internet protocols
|
||||
|
||||
# Workstation console options
|
||||
options FONT_BOLD8x16 # Font for fb devices
|
||||
options FONT_GALLANT12x22
|
||||
|
||||
options WSEMUL_VT100
|
||||
options WS_KERNEL_FG=WSCOL_GREEN
|
||||
options WS_KERNEL_BG=WSCOL_BLACK
|
||||
|
||||
# Disable kernel security levels. Needed for X with a PX or PXG.
|
||||
#options INSECURE
|
||||
|
||||
# emips specific
|
||||
options HZ=16 # RTC rate required, uses timecounter
|
||||
|
||||
options NFS_BOOT_DHCP # superset of BOOTP
|
||||
options NFS_BOOT_RWSIZE=1024
|
||||
|
||||
config netbsd root on ? type ?
|
||||
config nfsnetbsd root on ? type nfs
|
||||
|
||||
mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
## Peripheral Bus Support (for devices to attach to)
|
||||
## ----------------------------------------------------------------------------
|
||||
|
||||
# eMIPS systems
|
||||
ebus0 at mainbus0
|
||||
eclock* at ebus0 addr ? # clock
|
||||
dz* at ebus0 addr ? # usart
|
||||
enic* at ebus0 addr ? # ethernet
|
||||
ace* at ebus0 addr ? # disk
|
||||
eflash* at ebus0 addr ? # flash memory
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Pseudo-devices #
|
||||
#########################################################################
|
||||
|
||||
pseudo-device pty 2 # pseudo-terminals (Sysinst needs two)
|
||||
pseudo-device bpfilter # packet filter ports
|
||||
pseudo-device loop
|
||||
#pseudo-device ccd 4 # concatenated disks
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile.emips.inc,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA=; \
|
||||
echo ${ELF2ECOFF} $@ $@.ecoff; ${ELF2ECOFF} $@ $@.ecoff; \
|
||||
chmod 755 $@.ecoff
|
|
@ -0,0 +1,26 @@
|
|||
# $NetBSD: RAMDISK,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
#
|
||||
# Install kernel with ramdisk added.
|
||||
# The ramdisk is be too big to netboot directly via ECOFF on some machines,
|
||||
# so keep it otherise identical to INSTALL.
|
||||
#
|
||||
|
||||
# Pull in standard `install' config
|
||||
include "arch/emips/conf/INSTALL"
|
||||
|
||||
options DDB
|
||||
|
||||
# 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 MEMORY_DISK_ROOT_SIZE=7000 # size of memory disk, in blocks (3500kB)
|
||||
#options MEMORY_DISK_ROOT_SIZE=2880 # 1.44M, same as a floppy
|
||||
|
||||
# File systems: need MFS
|
||||
file-system MFS # memory file system
|
||||
|
||||
# Extra Pseudo-Devices
|
||||
|
||||
# disk/mass storage pseudo-devices
|
||||
pseudo-device md 1 # memory disk device (ramdisk)
|
|
@ -0,0 +1,112 @@
|
|||
# $NetBSD: files.emips,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
# eMIPS-specific configuration info
|
||||
|
||||
# maxpartitions must be first item in files.${ARCH}.
|
||||
maxpartitions 8
|
||||
|
||||
maxusers 2 8 64
|
||||
|
||||
#
|
||||
# Bus-independent devices
|
||||
#
|
||||
device mainbus { } # no locators
|
||||
attach mainbus at root
|
||||
|
||||
device cpu # not optional
|
||||
attach cpu at mainbus
|
||||
file arch/emips/emips/cpu.c cpu
|
||||
|
||||
# Model support option headers
|
||||
defflag XILINX_ML40X # Xilinx ML401/2 devboards
|
||||
defflag XS_BEE3 # MSR/BeCube BEE3
|
||||
|
||||
# Model dependent files
|
||||
file arch/emips/emips/xilinx_ml40x.c xilinx_ml40x # ML40X, emips
|
||||
file arch/emips/emips/xs_bee3.c xs_bee3 # BEE3, emips
|
||||
|
||||
# ML40x/Bee3
|
||||
device ebus { [addr = -1] }
|
||||
attach ebus at mainbus with ebus_emips
|
||||
file arch/emips/ebus/ebus.c ebus
|
||||
file arch/emips/ebus/ebus_emips.c ebus & (xilinx_ml40x|xs_bee3)
|
||||
|
||||
# Real-time clock (not optional)
|
||||
device eclock
|
||||
attach eclock at ebus with eclock_ebus
|
||||
file arch/emips/emips/clock.c
|
||||
file arch/emips/ebus/clock_ebus.c eclock_ebus
|
||||
|
||||
# Disk
|
||||
include "dev/scsipi/files.scsipi"
|
||||
device ace: disk
|
||||
attach ace at ebus with ace_ebus
|
||||
file arch/emips/ebus/ace_ebus.c ace_ebus
|
||||
|
||||
# Memory Disk
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
# Ethernet driver.
|
||||
device enic: arp, ether, ifnet
|
||||
attach enic at ebus with enic_emips
|
||||
file arch/emips/ebus/if_le_ebus.c enic_emips
|
||||
|
||||
# Flash memory
|
||||
device eflash: disk
|
||||
attach eflash at ebus with flash_ebus
|
||||
file arch/emips/ebus/flash_ebus.c flash_ebus
|
||||
|
||||
# ICAP interface
|
||||
device icap: disk
|
||||
attach icap at ebus with icap_ebus
|
||||
file arch/emips/ebus/icap_ebus.c icap_ebus
|
||||
|
||||
# eVGA graphics
|
||||
device evga: disk
|
||||
attach evga at ebus with evga_ebus
|
||||
file arch/emips/ebus/evga_ebus.c evga_ebus
|
||||
|
||||
# PS2 interface
|
||||
device pstwo: disk
|
||||
attach pstwo at ebus with pstwo_ebus
|
||||
file arch/emips/ebus/ps2_ebus.c pstwo_ebus
|
||||
|
||||
# AC97 audio
|
||||
device acns: disk
|
||||
attach acns at ebus with acns_ebus
|
||||
file arch/emips/ebus/ac97_ebus.c acns_ebus
|
||||
|
||||
# GPIO interface
|
||||
device epio: gpiobus
|
||||
attach epio at ebus
|
||||
file arch/emips/ebus/gpio_ebus.c epio
|
||||
|
||||
# LCD display
|
||||
device lcd: disk
|
||||
attach lcd at ebus with lcd_ebus
|
||||
file arch/emips/ebus/lcd_ebus.c lcd_ebus
|
||||
|
||||
file arch/emips/emips/autoconf.c
|
||||
file arch/emips/emips/bus_dma.c
|
||||
file arch/emips/emips/bus_space.c
|
||||
file kern/subr_disk_mbr.c disk
|
||||
file arch/emips/emips/machdep.c
|
||||
file arch/emips/emips/mainbus.c
|
||||
file arch/emips/emips/interrupt.c
|
||||
file arch/emips/emips/promcall.c
|
||||
file arch/emips/emips/sysconf.c
|
||||
file dev/cons.c
|
||||
|
||||
file common/bus_dma/bus_dmamem_common.c
|
||||
|
||||
file arch/mips/mips/softintr.c
|
||||
|
||||
#
|
||||
# Workstation console devices
|
||||
#
|
||||
|
||||
# USART
|
||||
device dz { line = -1 }: tty
|
||||
attach dz at ebus with dz_ebus
|
||||
file arch/emips/ebus/dz_ebus.c dz_ebus
|
||||
|
||||
include "arch/emips/conf/majors.emips"
|
|
@ -0,0 +1,50 @@
|
|||
# $NetBSD: majors.emips,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
#
|
||||
# Device majors for emips
|
||||
#
|
||||
|
||||
device-major cons char 0
|
||||
device-major swap char 1 block 4 vmswap
|
||||
device-major ctty char 2
|
||||
device-major mem char 3
|
||||
device-major pts char 4 pty
|
||||
device-major ptc char 5 pty
|
||||
device-major log char 6
|
||||
device-major filedesc char 7
|
||||
|
||||
device-major ace char 9 block 19 ace
|
||||
|
||||
device-major vnd char 11 block 2 vnd
|
||||
device-major bpf char 12 bpfilter
|
||||
|
||||
device-major dz char 16 dz
|
||||
|
||||
device-major st char 46 block 18 st
|
||||
device-major cd char 47 block 25 cd
|
||||
|
||||
device-major ss char 53 ss
|
||||
device-major ch char 54 ch
|
||||
device-major uk char 55 uk
|
||||
|
||||
device-major eflash char 66 block 22 eflash
|
||||
device-major icap char 67 icap
|
||||
device-major evga char 68 evga
|
||||
device-major pstwo char 69 pstwo
|
||||
device-major acns char 70 acns
|
||||
device-major lcd char 72 lcd
|
||||
|
||||
device-major ccd char 87 block 24 ccd
|
||||
device-major ipl char 91 ipfilter
|
||||
device-major rnd char 92 rnd
|
||||
device-major tun char 93 tun
|
||||
device-major raid char 96 block 32 raid
|
||||
device-major md char 97 block 17 md
|
||||
device-major clockctl char 100 clockctl
|
||||
device-major systrace char 103 systrace
|
||||
device-major cgd char 104 block 33 cgd
|
||||
device-major ksyms char 105 ksyms
|
||||
device-major nsmb char 106 nsmb
|
||||
|
||||
# Majors up to 143 are reserved for machine-dependant drivers.
|
||||
# New machine-independent driver majors are assigned in
|
||||
# sys/conf/majors.
|
|
@ -0,0 +1,20 @@
|
|||
# $NetBSD: std.emips,v 1.1 2011/01/26 01:18:50 pooka Exp $
|
||||
# standard, required emips info
|
||||
|
||||
machine emips mips
|
||||
include "conf/std" # MI standard options
|
||||
makeoptions MACHINE_ARCH="mipseb"
|
||||
|
||||
# accelerator support, ENOTYET
|
||||
#options ACCELERATOR
|
||||
#defparam opt_accelerator.h ACCELERATOR_MAX_OPS
|
||||
#defparam opt_accelerator.h ACCELERATOR_MAX_SLOTS
|
||||
|
||||
#options ACCELERATOR_MAX_OPS=8 # fixed by the ISA, more or less
|
||||
#options ACCELERATOR_MAX_SLOTS=4 # should we allow redef in specific config? at runtime?
|
||||
|
||||
# Standard exec-package options
|
||||
options EXEC_ELF32 # 32-bit ELF support (native format)
|
||||
options EXEC_SCRIPT # exec of #! scripts
|
||||
|
||||
makeoptions DEFTEXTADDR="0x80020000"
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: ac97_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ac97_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#define STUBNAME acns
|
||||
#define STUBSTRING "ac97"
|
||||
#define STUBBANNER "AC97 audio"
|
||||
#define STUBSTRUCT _Cpbdi
|
||||
#define STUBMATCH(_f_) ((_f_)->Tag == PMTTAG_AC97)
|
||||
|
||||
#define stub_ebus_match __CONCAT(acns,_ebus_match)
|
||||
#define stub_ebus_attach __CONCAT(acns,_ebus_attach)
|
||||
#define stub_ebus __CONCAT(acns,_ebus)
|
||||
#define stub_softc __CONCAT(acns,_softc)
|
||||
#define stubopen __CONCAT(acns,open)
|
||||
#define stubclose __CONCAT(acns,close)
|
||||
#define stub_cdevsw __CONCAT(acns,_cdevsw)
|
||||
|
||||
#include "stub_ebus.c"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,323 @@
|
|||
/* $NetBSD: clock_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/timetc.h>
|
||||
|
||||
#include <dev/clock_subr.h>
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
/*
|
||||
* Device softc
|
||||
*/
|
||||
struct eclock_softc {
|
||||
struct device sc_dev;
|
||||
struct _Tc *sc_dp;
|
||||
uint32_t reload;
|
||||
struct timecounter sc_tc;
|
||||
#ifdef __HAVE_GENERIC_TODR
|
||||
struct todr_chip_handle sc_todr;
|
||||
#endif
|
||||
};
|
||||
|
||||
static int eclock_ebus_match (struct device *, struct cfdata *, void *);
|
||||
static void eclock_ebus_attach (struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(eclock_ebus, sizeof (struct eclock_softc),
|
||||
eclock_ebus_match, eclock_ebus_attach, NULL, NULL);
|
||||
|
||||
void eclock_init(struct device *);
|
||||
static void __eclock_init(struct device *);
|
||||
static int eclock_gettime(struct todr_chip_handle *,
|
||||
struct timeval *);
|
||||
static int eclock_settime(struct todr_chip_handle *,
|
||||
struct timeval *);
|
||||
static int eclock_ebus_intr(void *cookie, void *f);
|
||||
static u_int eclock_counter(struct timecounter *tc);
|
||||
|
||||
struct device *clockdev = NULL; /* BUGBUG resolve the gap between cpu_initclocks() and eclock_init(x) */
|
||||
|
||||
void
|
||||
eclock_init(struct device *dev)
|
||||
{
|
||||
if (dev == NULL)
|
||||
dev = clockdev;
|
||||
if (dev == NULL)
|
||||
panic("eclock_init");
|
||||
__eclock_init(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
__eclock_init(struct device *dev)
|
||||
{
|
||||
struct eclock_softc *sc = (struct eclock_softc *)dev;
|
||||
struct _Tc *tc = sc->sc_dp;
|
||||
uint32_t reload = 10*1000000; /* 1sec in 100ns units (10MHz clock) */
|
||||
|
||||
/* Compute reload according to whatever value passed in, Warn if fractional */
|
||||
if (hz > 1) {
|
||||
uint32_t r = reload / hz;
|
||||
if ((r * hz) != reload)
|
||||
printf("%s: %d Hz clock will cause roundoffs with 10MHz xtal (%d)\n",
|
||||
sc->sc_dev.dv_xname, hz, reload - (r * hz));
|
||||
reload = r;
|
||||
}
|
||||
|
||||
sc->reload = reload;
|
||||
|
||||
/* Start the counter */
|
||||
tc->DownCounterHigh = 0;
|
||||
tc->DownCounter = sc->reload;
|
||||
tc->Control = TCCT_ENABLE | TCCT_INT_ENABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the time of day, based on the clock's value and/or the base value.
|
||||
* NB: At 10MHz, our 64bits FreeRunning is worth 58,426 years.
|
||||
*/
|
||||
|
||||
extern u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq);
|
||||
|
||||
|
||||
static int
|
||||
eclock_gettime(struct todr_chip_handle *todr, struct timeval *tv)
|
||||
{
|
||||
struct eclock_softc *sc = (struct eclock_softc *) todr->cookie;
|
||||
struct _Tc *tc = sc->sc_dp;
|
||||
uint64_t free;
|
||||
int s;
|
||||
|
||||
/* 32bit processor, guard against interrupts in the middle of reading this 64bit entity
|
||||
* BUGBUG Should read it "twice" to guard against rollover too.
|
||||
*/
|
||||
s = splhigh();
|
||||
free = tc->FreeRunning;
|
||||
splx(s);
|
||||
|
||||
/* Big fight with the compiler here, it gets very confused by 64bits.
|
||||
*/
|
||||
#if 0
|
||||
/* This is in C:
|
||||
*/
|
||||
{
|
||||
uint64_t freeS, freeU;
|
||||
freeS = free / (10*1000*1000);
|
||||
freeU = free % (10*1000*1000);
|
||||
tv->tv_sec = freeS;
|
||||
tv->tv_usec = freeU / 10;
|
||||
//printf("egt: s x%lx u x%lx (fs %lld fu %lld f %lld)\n",tv->tv_sec,tv->tv_usec,freeS,freeU,free);
|
||||
}
|
||||
#else
|
||||
/* And this is in assembly :-)
|
||||
*/
|
||||
{
|
||||
u_quad_t r;
|
||||
u_quad_t d = __qdivrem(free,(u_quad_t)10000000,&r);
|
||||
uint32_t su, uu;
|
||||
su = (uint32_t) d;
|
||||
uu = (uint32_t) r;
|
||||
uu = uu / 10; /* in usecs */
|
||||
tv->tv_sec = su;
|
||||
tv->tv_usec = uu;
|
||||
//printf("egt: s x%lx u x%lx (d %lld r %lld f %lld)\n",tv->tv_sec,tv->tv_usec,d,r,free);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the TODR based on the time value.
|
||||
*/
|
||||
static int
|
||||
eclock_settime(struct todr_chip_handle *todr, struct timeval *tv)
|
||||
{
|
||||
struct eclock_softc *sc = (struct eclock_softc *) todr->cookie;
|
||||
struct _Tc *tc = sc->sc_dp;
|
||||
uint64_t free;
|
||||
uint32_t su, uu;
|
||||
int s;
|
||||
|
||||
/* Careful with what we do here, else the compilerbugs hit hard */
|
||||
s = splhigh();
|
||||
|
||||
su = (uint32_t) tv->tv_sec; //0(tv)
|
||||
uu = (uint32_t) tv->tv_usec; //4(tv)
|
||||
|
||||
|
||||
free = 10*1000*1000 * (uint64_t)su;
|
||||
free += uu * 10;
|
||||
|
||||
tc->FreeRunning = free;
|
||||
splx(s);
|
||||
|
||||
#if 0
|
||||
Should compile to something like this:
|
||||
80260c84 <eclock_settime>:
|
||||
80260c84: 27bdffc0 addiu sp,sp,-64
|
||||
80260c88: afbf0038 sw ra,56(sp)
|
||||
80260c8c: afb40030 sw s4,48(sp)
|
||||
80260c90: afb3002c sw s3,44(sp)
|
||||
80260c94: afb20028 sw s2,40(sp)
|
||||
80260c98: afb10024 sw s1,36(sp)
|
||||
80260c9c: afb00020 sw s0,32(sp)
|
||||
80260ca0: afb50034 sw s5,52(sp)
|
||||
80260ca4: 8c820000 lw v0,0(a0)
|
||||
80260ca8: 00a09021 move s2,a1
|
||||
80260cac: 8c55003c lw s5,60(v0) //s5=tc
|
||||
80260cb0: 0c004122 jal 80010488 <_splraise>
|
||||
80260cb4: 3404ff00 li a0,0xff00
|
||||
80260cb8: 8e540000 lw s4,0(s2) //s4=tv->tv_sec=us
|
||||
80260cbc: 3c060098 lui a2,0x98
|
||||
80260cc0: 34c69680 ori a2,a2,0x9680 //a2=10000000
|
||||
80260cc4: 02860019 multu s4,a2 //free=us*10000000
|
||||
80260cc8: 8e530004 lw s3,4(s2) //s3=uu
|
||||
80260ccc: 00402021 move a0,v0 //s=splhigh()
|
||||
80260cd0: 001328c0 sll a1,s3,0x3
|
||||
80260cd4: 00131040 sll v0,s3,0x1
|
||||
80260cd8: 00451021 addu v0,v0,a1
|
||||
80260cdc: 00401821 move v1,v0 //v1 = uu*10
|
||||
80260ce0: 00001021 move v0,zero
|
||||
80260ce4: 00003812 mflo a3 //a3=low(free)
|
||||
80260ce8: 00e38821 addu s1,a3,v1 //s1=low(free)+(uu*10)
|
||||
80260cec: 0227282b sltu a1,s1,a3 //a1=overflow bit
|
||||
80260cf0: 00003010 mfhi a2 //a2=high(free)
|
||||
80260cf4: 00c28021 addu s0,a2,v0 //s0=a2=high(free) [useless, v0=0]
|
||||
80260cf8: 00b08021 addu s0,a1,s0 //s0+=overflow bit
|
||||
80260cfc: aeb1000c sw s1,12(s5)
|
||||
80260d00: aeb00008 sw s0,8(s5)
|
||||
80260d04: 0c00413f jal 800104fc <_splset>
|
||||
80260d08: 00000000 nop
|
||||
|
||||
#endif
|
||||
|
||||
//printf("est: s x%lx u x%lx (%d %d), free %lld\n",tv->tv_sec,tv->tv_usec,su,uu,free);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
eclock_ebus_intr(void *cookie, void *f)
|
||||
{
|
||||
struct eclock_softc *sc = cookie;
|
||||
struct _Tc *tc = sc->sc_dp;
|
||||
struct clockframe *cf = f;
|
||||
volatile uint32_t x;
|
||||
|
||||
x = tc->Control;
|
||||
tc->DownCounterHigh = 0;
|
||||
tc->DownCounter = sc->reload;
|
||||
|
||||
hardclock(cf);
|
||||
emips_clock_evcnt.ev_count++;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static u_int
|
||||
eclock_counter(struct timecounter *tc)
|
||||
{
|
||||
struct eclock_softc *sc = tc->tc_priv;
|
||||
struct _Tc *Tc = sc->sc_dp;
|
||||
return (u_int)Tc->FreeRunning; /* NB: chops to 32bits */
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
eclock_ebus_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia = aux;
|
||||
struct _Tc *mc = (struct _Tc *)ia->ia_vaddr;
|
||||
|
||||
if (strcmp("eclock", ia->ia_name) != 0)
|
||||
return (0);
|
||||
if ((mc == NULL) ||
|
||||
(mc->Tag != PMTTAG_TIMER))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
eclock_ebus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia =aux;
|
||||
struct eclock_softc *sc = (struct eclock_softc *)self;
|
||||
|
||||
sc->sc_dp = (struct _Tc*)ia->ia_vaddr;
|
||||
|
||||
/* NB: We are chopping our 64bit free-running down to 32bits */
|
||||
sc->sc_tc.tc_get_timecount = eclock_counter;
|
||||
sc->sc_tc.tc_poll_pps = 0;
|
||||
sc->sc_tc.tc_counter_mask = 0xffffffff;
|
||||
sc->sc_tc.tc_frequency = 10*1000*1000; /* 10 MHz */
|
||||
sc->sc_tc.tc_name = "eclock"; /* BUGBUG is it unique per instance?? */
|
||||
sc->sc_tc.tc_quality = 2000; /* uhu? */
|
||||
sc->sc_tc.tc_priv = sc;
|
||||
sc->sc_tc.tc_next = NULL;
|
||||
|
||||
#if DEBUG
|
||||
printf(" virt=%p ", (void*)sc->sc_dp);
|
||||
#endif
|
||||
printf(": eMIPS clock\n");
|
||||
|
||||
/* Turn interrupts off, just in case. */
|
||||
sc->sc_dp->Control &= ~(TCCT_INT_ENABLE|TCCT_INTERRUPT);
|
||||
|
||||
ebus_intr_establish(parent, (void *)ia->ia_cookie, IPL_CLOCK,
|
||||
eclock_ebus_intr, sc);
|
||||
|
||||
#ifdef EVCNT_COUNTERS
|
||||
evcnt_attach_dynamic(&clock_intr_evcnt, EVCNT_TYPE_INTR, NULL,
|
||||
sc->sc_dev->dv_xname, "intr");
|
||||
#endif
|
||||
|
||||
#ifdef __HAVE_GENERIC_TODR
|
||||
clockdev = self;
|
||||
memset(&sc->sc_todr,0,sizeof sc->sc_todr);
|
||||
sc->sc_todr.cookie = sc;
|
||||
sc->sc_todr.todr_gettime = eclock_gettime;
|
||||
sc->sc_todr.todr_settime = eclock_settime;
|
||||
todr_attach(&sc->sc_todr);
|
||||
#endif
|
||||
|
||||
tc_init(&sc->sc_tc);
|
||||
}
|
|
@ -0,0 +1,793 @@
|
|||
/* $NetBSD: dz_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dz_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/cons.h>
|
||||
//#include <emips/emips/machdep.h>
|
||||
|
||||
#include "ioconf.h" /* for dz_cd */
|
||||
|
||||
#define DZ_C2I(c) ((c)<<3) /* convert controller # to index */
|
||||
#define DZ_I2C(c) ((c)>>3) /* convert minor to controller # */
|
||||
#define DZ_PORT(u) ((u)&07) /* extract the port # */
|
||||
|
||||
struct dz_softc {
|
||||
struct device sc_dev; /* Autoconf blaha */
|
||||
struct evcnt sc_rintrcnt; /* recevive interrupt counts */
|
||||
struct evcnt sc_tintrcnt; /* transmit interrupt counts */
|
||||
struct _Usart *sc_dr; /* reg pointers */
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
int sc_consline; /* console line, or -1 */
|
||||
int sc_rxint; /* Receive interrupt count XXX */
|
||||
u_char sc_brk; /* Break asserted on some lines */
|
||||
u_char sc_dsr; /* DSR set bits if no mdm ctrl */
|
||||
struct dz_linestate {
|
||||
struct dz_softc *dz_sc; /* backpointer to softc */
|
||||
int dz_line; /* channel number */
|
||||
struct tty * dz_tty; /* what we work on */
|
||||
} sc_dz;
|
||||
};
|
||||
|
||||
void dzrint(struct dz_softc *, uint32_t);
|
||||
void dzxint(struct dz_softc *, uint32_t);
|
||||
|
||||
#ifndef TIOCM_BRK
|
||||
#define TIOCM_BRK 0100000 /* no equivalent */
|
||||
|
||||
static void dzstart(struct tty *);
|
||||
static int dzparam(struct tty *, struct termios *);
|
||||
static unsigned dzmctl(struct dz_softc *sc, int line,
|
||||
int bits, /* one of the TIOCM_xx */
|
||||
int how); /* one of the DMSET/BIS.. */
|
||||
|
||||
#include <dev/dec/dzkbdvar.h>
|
||||
#endif
|
||||
|
||||
dev_type_open(dzopen);
|
||||
dev_type_close(dzclose);
|
||||
dev_type_read(dzread);
|
||||
dev_type_write(dzwrite);
|
||||
dev_type_ioctl(dzioctl);
|
||||
dev_type_stop(dzstop);
|
||||
dev_type_tty(dztty);
|
||||
dev_type_poll(dzpoll);
|
||||
|
||||
const struct cdevsw dz_cdevsw = {
|
||||
dzopen, dzclose, dzread, dzwrite, dzioctl,
|
||||
dzstop, dztty, dzpoll, nommap, ttykqfilter, D_TTY
|
||||
};
|
||||
|
||||
int
|
||||
dzopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
{
|
||||
struct tty *tp;
|
||||
int unit, line;
|
||||
struct dz_softc *sc;
|
||||
int s, error = 0;
|
||||
|
||||
unit = DZ_I2C(minor(dev));
|
||||
line = DZ_PORT(minor(dev));
|
||||
if (unit >= dz_cd.cd_ndevs || dz_cd.cd_devs[unit] == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
sc = (void *)dz_cd.cd_devs[unit];
|
||||
|
||||
if (line > 0) /* FIXME fo rmore than one line */
|
||||
return ENXIO;
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
if (tp == NULL)
|
||||
return (ENODEV);
|
||||
tp->t_oproc = dzstart;
|
||||
tp->t_param = dzparam;
|
||||
tp->t_dev = dev;
|
||||
|
||||
if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
|
||||
return (EBUSY);
|
||||
|
||||
if ((tp->t_state & TS_ISOPEN) == 0) {
|
||||
ttychars(tp);
|
||||
if (tp->t_ispeed == 0) {
|
||||
tp->t_iflag = TTYDEF_IFLAG;
|
||||
tp->t_oflag = TTYDEF_OFLAG;
|
||||
tp->t_cflag = TTYDEF_CFLAG;
|
||||
tp->t_lflag = TTYDEF_LFLAG;
|
||||
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
|
||||
}
|
||||
(void) dzparam(tp, &tp->t_termios);
|
||||
ttsetwater(tp);
|
||||
}
|
||||
/* we have no modem control but..*/
|
||||
if (dzmctl(sc, line, TIOCM_DTR, DMBIS) & TIOCM_CD)
|
||||
tp->t_state |= TS_CARR_ON;
|
||||
s = spltty();
|
||||
while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
|
||||
!(tp->t_state & TS_CARR_ON)) {
|
||||
tp->t_wopen++;
|
||||
error = ttysleep(tp, &tp->t_rawcv, true, 0);
|
||||
tp->t_wopen--;
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
(void) splx(s);
|
||||
if (error)
|
||||
return (error);
|
||||
return ((*tp->t_linesw->l_open)(dev, tp));
|
||||
}
|
||||
int
|
||||
dzclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct tty *tp;
|
||||
int unit, line;
|
||||
|
||||
|
||||
unit = DZ_I2C(minor(dev));
|
||||
line = DZ_PORT(minor(dev));
|
||||
sc = (void *)dz_cd.cd_devs[unit];
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
|
||||
(*tp->t_linesw->l_close)(tp, flag);
|
||||
|
||||
/* Make sure a BREAK state is not left enabled. */
|
||||
(void) dzmctl(sc, line, TIOCM_BRK, DMBIC);
|
||||
|
||||
/* Do a hangup if so required. */
|
||||
if ((tp->t_cflag & HUPCL) || tp->t_wopen || !(tp->t_state & TS_ISOPEN))
|
||||
(void) dzmctl(sc, line, 0, DMSET);
|
||||
|
||||
return (ttyclose(tp));
|
||||
}
|
||||
int
|
||||
dzread(dev_t dev, struct uio *uio, int flag)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct dz_softc *sc;
|
||||
|
||||
sc = (void *)dz_cd.cd_devs[DZ_I2C(minor(dev))];
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
return ((*tp->t_linesw->l_read)(tp, uio, flag));
|
||||
}
|
||||
|
||||
int
|
||||
dzwrite(dev_t dev, struct uio *uio, int flag)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct dz_softc *sc;
|
||||
|
||||
sc = (void *)dz_cd.cd_devs[DZ_I2C(minor(dev))];
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
return ((*tp->t_linesw->l_write)(tp, uio, flag));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
dzioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct tty *tp;
|
||||
int unit, line;
|
||||
int error;
|
||||
|
||||
unit = DZ_I2C(minor(dev));
|
||||
line = 0;
|
||||
sc = (void *)dz_cd.cd_devs[unit];
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
|
||||
error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l);
|
||||
if (error >= 0)
|
||||
return (error);
|
||||
|
||||
error = ttioctl(tp, cmd, data, flag, l);
|
||||
if (error >= 0)
|
||||
return (error);
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case TIOCSBRK:
|
||||
(void) dzmctl(sc, line, TIOCM_BRK, DMBIS);
|
||||
break;
|
||||
|
||||
case TIOCCBRK:
|
||||
(void) dzmctl(sc, line, TIOCM_BRK, DMBIC);
|
||||
break;
|
||||
|
||||
case TIOCSDTR:
|
||||
(void) dzmctl(sc, line, TIOCM_DTR, DMBIS);
|
||||
break;
|
||||
|
||||
case TIOCCDTR:
|
||||
(void) dzmctl(sc, line, TIOCM_DTR, DMBIC);
|
||||
break;
|
||||
|
||||
case TIOCMSET:
|
||||
(void) dzmctl(sc, line, *(int *)data, DMSET);
|
||||
break;
|
||||
|
||||
case TIOCMBIS:
|
||||
(void) dzmctl(sc, line, *(int *)data, DMBIS);
|
||||
break;
|
||||
|
||||
case TIOCMBIC:
|
||||
(void) dzmctl(sc, line, *(int *)data, DMBIC);
|
||||
break;
|
||||
|
||||
case TIOCMGET:
|
||||
*(int *)data = (dzmctl(sc, line, 0, DMGET) & ~TIOCM_BRK);
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EPASSTHROUGH);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dzstop(struct tty *tp, int flag)
|
||||
{
|
||||
if (tp->t_state & TS_BUSY)
|
||||
if (!(tp->t_state & TS_TTSTOP))
|
||||
tp->t_state |= TS_FLUSH;
|
||||
}
|
||||
|
||||
struct tty *
|
||||
dztty(dev_t dev)
|
||||
{
|
||||
struct dz_softc *sc = (void *)dz_cd.cd_devs[DZ_I2C(minor(dev))];
|
||||
struct tty *tp = sc->sc_dz.dz_tty;
|
||||
|
||||
return (tp);
|
||||
}
|
||||
|
||||
int
|
||||
dzpoll( dev_t dev, int events, struct lwp *l)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct dz_softc *sc;
|
||||
|
||||
sc = (void *)dz_cd.cd_devs[DZ_I2C(minor(dev))];
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
return ((*tp->t_linesw->l_poll)(tp, events, l));
|
||||
}
|
||||
|
||||
void
|
||||
dzstart(struct tty *tp)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct clist *cl;
|
||||
int unit, s;
|
||||
|
||||
unit = DZ_I2C(minor(tp->t_dev));
|
||||
sc = (void *)dz_cd.cd_devs[unit];
|
||||
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
cl = &tp->t_outq;
|
||||
ttypull(tp);
|
||||
if (cl->c_cc == 0) {
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
|
||||
tp->t_state |= TS_BUSY;
|
||||
|
||||
/* was idle, get it started */
|
||||
dzxint(sc,USI_TXRDY);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static int rclk = 25000000; /* BUGBUGBUGBUG */
|
||||
|
||||
static int
|
||||
dzdivisor(int baudrate)
|
||||
{
|
||||
int act_baud, divisor, error;
|
||||
|
||||
if (baudrate <= 0)
|
||||
return (0);
|
||||
|
||||
divisor = (rclk/8)/(baudrate);
|
||||
divisor = (divisor/2) + (divisor&1);
|
||||
|
||||
if (divisor <= 0)
|
||||
return (-1);
|
||||
act_baud = rclk / (divisor * 16);
|
||||
|
||||
/* 10 times error in percent: */
|
||||
error = ((act_baud - baudrate) * 2000 / baudrate + 1) >> 1;
|
||||
|
||||
/* 3.0% maximum error tolerance: */
|
||||
if (error < -30 || error > 30)
|
||||
return (-1);
|
||||
|
||||
return (divisor);
|
||||
}
|
||||
|
||||
static int
|
||||
dzparam(struct tty *tp, struct termios *t)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
int cflag = t->c_cflag;
|
||||
int unit, line;
|
||||
int speed;
|
||||
unsigned lpr;
|
||||
int s;
|
||||
struct _Usart *dzr;
|
||||
|
||||
unit = DZ_I2C(minor(tp->t_dev));
|
||||
line = DZ_PORT(minor(tp->t_dev));
|
||||
sc = (void *)dz_cd.cd_devs[unit];
|
||||
|
||||
/* check requested parameters */
|
||||
if (t->c_ispeed != t->c_ospeed)
|
||||
return (EINVAL);
|
||||
speed = dzdivisor(t->c_ispeed);
|
||||
if (speed < 0)
|
||||
return (EINVAL);
|
||||
|
||||
tp->t_ispeed = t->c_ispeed;
|
||||
tp->t_ospeed = t->c_ospeed;
|
||||
tp->t_cflag = cflag;
|
||||
|
||||
{ static int didit=0;
|
||||
if (!didit && t->c_ispeed != 38400)
|
||||
printf("dzparam: c_ispeed %d ignored, keeping 38400\n",t->c_ispeed);
|
||||
didit = 1;
|
||||
}
|
||||
speed = dzdivisor(38400);
|
||||
|
||||
if (speed == 0) {
|
||||
(void) dzmctl(sc, line, 0, DMSET); /* hang up line */
|
||||
return (0);
|
||||
}
|
||||
|
||||
switch (cflag & CSIZE)
|
||||
{
|
||||
case CS5:
|
||||
lpr = USC_BPC_5;
|
||||
break;
|
||||
case CS6:
|
||||
lpr = USC_BPC_6;
|
||||
break;
|
||||
case CS7:
|
||||
lpr = USC_BPC_7;
|
||||
break;
|
||||
default:
|
||||
lpr = USC_BPC_8;
|
||||
break;
|
||||
}
|
||||
if (cflag & CSTOPB)
|
||||
lpr |= USC_2STOP;
|
||||
|
||||
if (cflag & PARENB) {
|
||||
if (cflag & PARODD)
|
||||
lpr |= USC_ODD;
|
||||
else
|
||||
lpr |= USC_EVEN;
|
||||
} else
|
||||
lpr |= USC_NONE;
|
||||
|
||||
s = spltty();
|
||||
|
||||
dzr = sc->sc_dr;
|
||||
|
||||
dzr->Baud = speed;
|
||||
dzr->Control = USC_CLKDIV_4 | USC_TXEN | USC_RXEN | lpr;
|
||||
#define USI_INTRS (USI_RXRDY|USI_RXBRK|USI_OVRE|USI_FRAME|USI_PARE)
|
||||
dzr->IntrEnable = USI_INTRS;
|
||||
|
||||
(void) splx(s);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
dzmctl(struct dz_softc *sc, int line, int bits, int how)
|
||||
{
|
||||
unsigned mbits;
|
||||
int s;
|
||||
struct _Usart *dzr;
|
||||
|
||||
mbits = 0;
|
||||
|
||||
s = spltty();
|
||||
|
||||
dzr = sc->sc_dr;
|
||||
|
||||
/* we have no modem control bits (CD,RI,DTR,DSR,..) */
|
||||
mbits |= TIOCM_CD;
|
||||
mbits |= TIOCM_DTR;
|
||||
|
||||
if (dzr->ChannelStatus & USI_RXBRK)
|
||||
mbits |= TIOCM_BRK;
|
||||
|
||||
switch (how)
|
||||
{
|
||||
case DMSET:
|
||||
mbits = bits;
|
||||
break;
|
||||
|
||||
case DMBIS:
|
||||
mbits |= bits;
|
||||
break;
|
||||
|
||||
case DMBIC:
|
||||
mbits &= ~bits;
|
||||
break;
|
||||
|
||||
case DMGET:
|
||||
(void) splx(s);
|
||||
return (mbits);
|
||||
}
|
||||
|
||||
/* BUGBUG work in progress */
|
||||
if (mbits & TIOCM_BRK) {
|
||||
sc->sc_brk |= (1 << line);
|
||||
dzr->Control |= USC_STTBRK;
|
||||
} else {
|
||||
sc->sc_brk &= ~(1 << line);
|
||||
dzr->Control |= USC_STPBRK;
|
||||
}
|
||||
|
||||
(void) splx(s);
|
||||
return (mbits);
|
||||
}
|
||||
|
||||
|
||||
#if defined(DDB)
|
||||
int dz_ddb = 0;
|
||||
#endif
|
||||
|
||||
/* Receiver Interrupt */
|
||||
|
||||
void
|
||||
dzrint(struct dz_softc *sc, uint32_t csr)
|
||||
{
|
||||
struct tty *tp;
|
||||
int cc, mcc;
|
||||
struct _Usart *dzr;
|
||||
|
||||
sc->sc_rxint++;
|
||||
dzr = sc->sc_dr;
|
||||
|
||||
cc = dzr->RxData;
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
|
||||
if (csr & USI_RXBRK)
|
||||
mcc = CNC_BREAK;
|
||||
else
|
||||
mcc = cc;
|
||||
|
||||
/* clear errors before we print or bail out */
|
||||
if (csr & (USI_OVRE|USI_FRAME|USI_PARE))
|
||||
dzr->Control = USC_RSTSTA;
|
||||
|
||||
if (!(tp->t_state & TS_ISOPEN)) {
|
||||
wakeup(&tp->t_rawq);
|
||||
return;
|
||||
}
|
||||
|
||||
if (csr & USI_OVRE) {
|
||||
log(LOG_WARNING, "%s: silo overflow, line %d\n",
|
||||
sc->sc_dev.dv_xname, 0);
|
||||
}
|
||||
|
||||
if (csr & USI_FRAME)
|
||||
cc |= TTY_FE;
|
||||
if (csr & USI_PARE)
|
||||
cc |= TTY_PE;
|
||||
|
||||
#if defined(DDB)
|
||||
/* ^P drops into DDB */
|
||||
if (dz_ddb && (cc == 0x10))
|
||||
Debugger();
|
||||
#endif
|
||||
(*tp->t_linesw->l_rint)(cc, tp);
|
||||
|
||||
}
|
||||
|
||||
/* Transmitter Interrupt */
|
||||
|
||||
void
|
||||
dzxint(struct dz_softc *sc, uint32_t csr)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct clist *cl;
|
||||
int ch;
|
||||
struct _Usart *dzr;
|
||||
|
||||
dzr = sc->sc_dr;
|
||||
|
||||
tp = sc->sc_dz.dz_tty;
|
||||
cl = &tp->t_outq;
|
||||
tp->t_state &= ~TS_BUSY;
|
||||
|
||||
/* Just send out a char if we have one */
|
||||
if (cl->c_cc) {
|
||||
tp->t_state |= TS_BUSY;
|
||||
ch = getc(cl);
|
||||
dzr->TxData = ch;
|
||||
dzr->IntrEnable = USI_TXRDY;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Nothing to send; turn off intr */
|
||||
dzr->IntrDisable = USI_TXRDY;
|
||||
|
||||
if (tp->t_state & TS_FLUSH)
|
||||
tp->t_state &= ~TS_FLUSH;
|
||||
else
|
||||
ndflush (&tp->t_outq, cl->c_cc);
|
||||
|
||||
(*tp->t_linesw->l_start)(tp);
|
||||
}
|
||||
|
||||
/* Machdep part of the driver
|
||||
*/
|
||||
int dz_ebus_match(struct device *, struct cfdata *, void *);
|
||||
void dz_ebus_attach(struct device *, struct device *, void *);
|
||||
int dz_ebus_intr(void *, void *);
|
||||
|
||||
void dz_ebus_cnsetup(paddr_t);
|
||||
void dz_ebus_cninit(struct consdev*);
|
||||
int dz_ebus_cngetc(dev_t);
|
||||
void dz_ebus_cnputc(dev_t, int);
|
||||
void dz_ebus_cnpollc(dev_t, int);
|
||||
|
||||
static int dz_ebus_getmajor(void);
|
||||
|
||||
CFATTACH_DECL(dz_ebus, sizeof(struct dz_softc),
|
||||
dz_ebus_match, dz_ebus_attach, NULL, NULL);
|
||||
|
||||
struct consdev dz_ebus_consdev = {
|
||||
NULL, dz_ebus_cninit, dz_ebus_cngetc, dz_ebus_cnputc,
|
||||
dz_ebus_cnpollc, NULL, NULL, NULL, NODEV, CN_NORMAL,
|
||||
};
|
||||
|
||||
/* Points to the console regs. Special mapping until VM is turned on.
|
||||
*/
|
||||
struct _Usart *dzcn;
|
||||
|
||||
int
|
||||
dz_ebus_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *iba;
|
||||
struct _Usart *us;
|
||||
|
||||
iba = aux;
|
||||
|
||||
if (strcmp(iba->ia_name, "dz") != 0)
|
||||
return (0);
|
||||
|
||||
us = (struct _Usart *)iba->ia_vaddr;
|
||||
if ((us == NULL) ||
|
||||
(us->Tag != PMTTAG_USART))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
dz_ebus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *iba;
|
||||
struct dz_softc *sc;
|
||||
|
||||
iba = aux;
|
||||
sc = (struct dz_softc *)self;
|
||||
|
||||
sc->sc_dr = (struct _Usart *)iba->ia_vaddr;
|
||||
#if DEBUG
|
||||
printf(" virt=%p ", (void *)sc->sc_dr);
|
||||
#endif
|
||||
|
||||
printf(": neilsart 1 line");
|
||||
ebus_intr_establish(parent, (void *)iba->ia_cookie, IPL_TTY,
|
||||
dz_ebus_intr, sc);
|
||||
|
||||
sc->sc_rxint = sc->sc_brk = 0;
|
||||
sc->sc_consline = 0;
|
||||
|
||||
/* Initialize our softc structure. Should be done in open? */
|
||||
|
||||
sc->sc_dz.dz_sc = sc;
|
||||
sc->sc_dz.dz_line = 0;
|
||||
sc->sc_dz.dz_tty = ttymalloc();
|
||||
|
||||
evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, NULL,
|
||||
sc->sc_dev.dv_xname, "rintr");
|
||||
evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, NULL,
|
||||
sc->sc_dev.dv_xname, "tintr");
|
||||
|
||||
/* Initialize hw regs */
|
||||
#if 0
|
||||
DZ_WRITE_WORD(dr_csr, DZ_CSR_MSE | DZ_CSR_RXIE | DZ_CSR_TXIE);
|
||||
DZ_WRITE_BYTE(dr_dtr, 0);
|
||||
DZ_WRITE_BYTE(dr_break, 0);
|
||||
#endif
|
||||
|
||||
/* Switch the console to virtual mode */
|
||||
dzcn = sc->sc_dr;
|
||||
/* And test it */
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
dz_ebus_getmajor(void)
|
||||
{
|
||||
extern const struct cdevsw dz_cdevsw;
|
||||
static int cache = -1;
|
||||
|
||||
if (cache != -1)
|
||||
return (cache);
|
||||
|
||||
return (cache = cdevsw_lookup_major(&dz_cdevsw));
|
||||
}
|
||||
|
||||
int
|
||||
dz_ebus_intr(void *cookie, void *f)
|
||||
{
|
||||
struct dz_softc *sc;
|
||||
struct _Usart *dzr;
|
||||
uint32_t csr;
|
||||
|
||||
sc = cookie;
|
||||
dzr = sc->sc_dr;
|
||||
|
||||
#define USI_INTERRUPTS (USI_INTRS|USI_TXRDY)
|
||||
|
||||
for (; ((csr = (dzr->ChannelStatus & dzr->IntrMask)) & USI_INTERRUPTS) != 0;) {
|
||||
if ((csr & USI_INTRS) != 0)
|
||||
dzrint(sc, csr);
|
||||
if ((csr & USI_TXRDY) != 0)
|
||||
dzxint(sc, csr);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
dz_ebus_cnsetup(paddr_t addr)
|
||||
{
|
||||
|
||||
dzcn = (struct _Usart *)addr;
|
||||
|
||||
#if 0
|
||||
/* Initialize enough to xmit/recv via polling.
|
||||
* Bootloader might or might not have done it.
|
||||
*/
|
||||
dzcn->Control = USC_RXEN|USC_TXEN|USC_BPC_8|USC_NONE|USC_1STOP|USC_CLKDIV_4;
|
||||
dzcn->Baud = 0x29; /* 38400 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Point the console at us
|
||||
*/
|
||||
cn_tab = &dz_ebus_consdev;
|
||||
cn_tab->cn_pri = CN_NORMAL;/*CN_REMOTE?*/
|
||||
cn_tab->cn_dev = makedev(dz_ebus_getmajor(), 0);
|
||||
}
|
||||
|
||||
void dz_ebus_cninit(struct consdev *cn)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dz_ebus_cngetc(dev_t dev)
|
||||
{
|
||||
int c, s;
|
||||
|
||||
c = 0;
|
||||
s = spltty();
|
||||
|
||||
while ((dzcn->ChannelStatus & USI_RXRDY) == 0)
|
||||
DELAY(10);
|
||||
c = dzcn->RxData;
|
||||
|
||||
splx(s);
|
||||
if (c == 13) /* map cr->ln */
|
||||
c = 10;
|
||||
return (c);
|
||||
}
|
||||
|
||||
int dzflipped = 0;
|
||||
void
|
||||
dz_ebus_cnputc(dev_t dev, int ch)
|
||||
{
|
||||
int timeout, s;
|
||||
|
||||
/* Don't hang the machine! */
|
||||
timeout = 1 << 15;
|
||||
|
||||
s = spltty();
|
||||
|
||||
#if 1
|
||||
/* Keep wired to hunt for a bug */
|
||||
if (dzcn && (dzcn != (struct _Usart *)0xfff90000)) {
|
||||
dzcn = (struct _Usart *)0xfff90000;
|
||||
dzflipped++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Wait until ready */
|
||||
while ((dzcn->ChannelStatus & USI_TXRDY) == 0)
|
||||
if (--timeout < 0)
|
||||
break;
|
||||
|
||||
/* Put the character */
|
||||
dzcn->TxData = ch;
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/* Called before/after going into poll mode
|
||||
*/
|
||||
void
|
||||
dz_ebus_cnpollc(dev_t dev, int on)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/* $NetBSD: ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/sysconf.h>
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
void
|
||||
ebusattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct ebus_dev_attach_args *ida = aux;
|
||||
struct ebus_attach_args *ia;
|
||||
void *addr;
|
||||
int i;
|
||||
int locs[EBUSCF_NLOCS];
|
||||
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Loop through the devices and attach them. If a probe-size
|
||||
* is specified, it's an optional item on the platform and
|
||||
* do a badaddr() test to make sure it's there.
|
||||
*/
|
||||
for (i = 0; i < ida->ida_ndevs; i++) {
|
||||
ia = &ida->ida_devs[i];
|
||||
|
||||
#if 0 // DEBUG
|
||||
printf("PROBING %s %d@%x i=%d\n", ia->ia_name, ia->ia_basz, ia->ia_paddr, ia->ia_cookie);
|
||||
#endif
|
||||
if (ia->ia_basz != 0) {
|
||||
addr = (void *) mips_map_physmem(ia->ia_paddr, ia->ia_basz);
|
||||
if (addr == NULL){
|
||||
printf("Failed to map %s: phys %x size %d\n",
|
||||
ia->ia_name, ia->ia_paddr, ia->ia_basz);
|
||||
continue;
|
||||
}
|
||||
ia->ia_vaddr = addr;
|
||||
#if 0 // DEBUG
|
||||
printf("MAPPED at %p\n", ia->ia_vaddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
locs[EBUSCF_ADDR] = ia->ia_paddr;
|
||||
|
||||
if (NULL == config_found_sm_loc(self, "ebus", locs, ia,
|
||||
ebusprint, config_stdsubmatch)) {
|
||||
/* do we need to say anything? */
|
||||
if (ia->ia_basz != 0) {
|
||||
mips_unmap_physmem((vaddr_t)ia->ia_vaddr, ia->ia_basz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ebusprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
{
|
||||
struct ebus_attach_args *ia = aux;
|
||||
|
||||
if (pnp)
|
||||
aprint_normal("%s at %s", ia->ia_name, pnp);
|
||||
|
||||
aprint_normal(" addr 0x%x", ia->ia_paddr);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
void
|
||||
ebus_intr_establish(dev, cookie, level, handler, arg)
|
||||
struct device *dev;
|
||||
void *cookie;
|
||||
int level;
|
||||
int (*handler) (void *, void *);
|
||||
void *arg;
|
||||
{
|
||||
(*platform.intr_establish)(dev, cookie, level, handler, arg);
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/* $NetBSD: ebus_emips.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ebus_emips.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include "opt_xilinx_ml40x.h"
|
||||
#include "opt_xs_bee3.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/sysconf.h>
|
||||
|
||||
#include <machine/emipsreg.h>
|
||||
#include <emips/emips/emipstype.h>
|
||||
|
||||
static int ebus_emips_match __P((struct device *, struct cfdata *, void *));
|
||||
static void ebus_emips_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
CFATTACH_DECL(ebus_emips, sizeof(struct ebus_softc),
|
||||
ebus_emips_match, ebus_emips_attach, NULL, NULL);
|
||||
|
||||
#if defined(XILINX_ML40x) || defined(XS_BEE3)
|
||||
struct ebus_attach_args ebus_emips_devs[] = {
|
||||
/* NAME INTERRUPT PHYS VIRT PHYS_SIZE */
|
||||
{ "eclock", AIC_TIMER, TIMER_DEFAULT_ADDRESS, NULL, sizeof(struct _Tc) },
|
||||
{ "dz", AIC_USART, USART_DEFAULT_ADDRESS, NULL, sizeof(struct _Usart)},
|
||||
{ "ace", AIC_SYSTEM_ACE, IDE_DEFAULT_ADDRESS, NULL, sizeof(struct _Sac) },
|
||||
{ "ace", AIC_SYSTEM_ACE2, IDE_DEFAULT_ADDRESS+256, NULL, sizeof(struct _Sac) },
|
||||
{ "enic", AIC_ETHERNET, ETHERNET_DEFAULT_ADDRESS, NULL, sizeof(struct _Enic) },
|
||||
{ "icap", AIC_ICAP, ICAP_DEFAULT_ADDRESS, NULL, sizeof(struct _Icap) },
|
||||
{ "gpio", AIC_GPIO, GPIO_DEFAULT_ADDRESS, NULL, sizeof(struct _Pio) },
|
||||
{ "flash", 0, FLASH_0_DEFAULT_ADDRESS, NULL, sizeof(struct _Flash) },
|
||||
{ "lcd", 0, LCD_DEFAULT_ADDRESS, NULL, sizeof(struct _Lcd) },
|
||||
{ "evga", AIC_VGA, VGA_DEFAULT_ADDRESS, NULL, sizeof(struct _Evga) },
|
||||
{ "ps2", AIC_PS2, PS2_DEFAULT_ADDRESS, NULL, sizeof(struct _Cpbdi) },
|
||||
{ "ac97", AIC_AC97, AC97_DEFAULT_ADDRESS, NULL, sizeof(struct _Cpbdi) },
|
||||
};
|
||||
static const int ebus_emips_ndevs =
|
||||
sizeof(ebus_emips_devs)/sizeof(ebus_emips_devs[0]);
|
||||
#endif /* XILINX_ML40x */
|
||||
|
||||
static int ebus_attached;
|
||||
|
||||
static int
|
||||
ebus_emips_match(struct device *parent, struct cfdata *cfdata, void *aux)
|
||||
{
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
|
||||
if (ebus_attached)
|
||||
return (0);
|
||||
if (systype != XS_ML40x && systype != XS_BE3 && systype != XS_ML50x)
|
||||
return (0);
|
||||
if (strcmp(ma->ma_name, "baseboard") != 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
ebus_emips_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ebus_dev_attach_args ida;
|
||||
|
||||
ebus_attached = 1;
|
||||
|
||||
ida.ida_busname = "ebus";
|
||||
switch (systype) {
|
||||
#if defined(XILINX_ML40x) || defined(XS_BEE3)
|
||||
case XS_ML40x:
|
||||
case XS_ML50x:
|
||||
case XS_BE3:
|
||||
ida.ida_devs = ebus_emips_devs;
|
||||
ida.ida_ndevs = ebus_emips_ndevs;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
panic("ebus_emips_attach: no ebus configured for systype = %d", systype);
|
||||
}
|
||||
|
||||
ebusattach(parent, self, &ida);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/* $NetBSD: ebusvar.h,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
#ifndef _EMIPS_EBUS_EBUSVAR_H_
|
||||
#define _EMIPS_EBUS_EBUSVAR_H_
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
struct ebus_attach_args;
|
||||
|
||||
struct ebus_softc {
|
||||
struct device sc_dev;
|
||||
};
|
||||
|
||||
/*
|
||||
* Arguments used to attach an ebus "device" to its parent
|
||||
*/
|
||||
struct ebus_dev_attach_args {
|
||||
const char *ida_busname; /* XXX should be common */
|
||||
bus_space_tag_t ida_memt;
|
||||
|
||||
int ida_ndevs;
|
||||
struct ebus_attach_args *ida_devs;
|
||||
};
|
||||
|
||||
/*
|
||||
* Arguments used to attach devices to an ebus
|
||||
*/
|
||||
struct ebus_attach_args {
|
||||
const char *ia_name; /* device name */
|
||||
int ia_cookie; /* device cookie */
|
||||
u_int32_t ia_paddr; /* device address (PHYSICAL) */
|
||||
void *ia_vaddr; /* device address (VIRTUAL) */
|
||||
int ia_basz; /* device size (for min regset at probe, else 0) */
|
||||
};
|
||||
|
||||
void ebusattach (struct device *, struct device *, void *);
|
||||
int ebusprint (void *, const char *);
|
||||
void ebus_intr_establish (struct device *, void * cookie, int level,
|
||||
int (*handler)(void *, void *), void *arg);
|
||||
|
||||
#endif /* !_EMIPS_EBUS_EBUSVAR_H_ */
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: evga_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: evga_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#define STUBNAME evga
|
||||
#define STUBSTRING "evga"
|
||||
#define STUBBANNER "EVGA"
|
||||
#define STUBSTRUCT _Evga
|
||||
#define STUBMATCH(_f_) ((_f_)->Tag == PMTTAG_VGA)
|
||||
|
||||
#define stub_ebus_match __CONCAT(evga,_ebus_match)
|
||||
#define stub_ebus_attach __CONCAT(evga,_ebus_attach)
|
||||
#define stub_ebus __CONCAT(evga,_ebus)
|
||||
#define stub_softc __CONCAT(evga,_softc)
|
||||
#define stubopen __CONCAT(evga,open)
|
||||
#define stubclose __CONCAT(evga,close)
|
||||
#define stub_cdevsw __CONCAT(evga,_cdevsw)
|
||||
|
||||
#include "stub_ebus.c"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,174 @@
|
|||
/* $NetBSD: gpio_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: gpio_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/gpio.h>
|
||||
#include <dev/gpio/gpiovar.h>
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
/*
|
||||
* Device softc
|
||||
*/
|
||||
#define GPIO_NPINS 32
|
||||
|
||||
struct epio_softc {
|
||||
struct device sc_dev;
|
||||
struct _Pio *sc_dp;
|
||||
struct gpio_chipset_tag sc_gpio_gc;
|
||||
gpio_pin_t sc_gpio_pins[GPIO_NPINS];
|
||||
};
|
||||
|
||||
static int epio_ebus_match (struct device *, struct cfdata *, void *);
|
||||
static void epio_ebus_attach (struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(epio, sizeof (struct epio_softc),
|
||||
epio_ebus_match, epio_ebus_attach, NULL, NULL);
|
||||
|
||||
static int epio_pin_read(void *, int);
|
||||
static void epio_pin_write(void *, int, int);
|
||||
static void epio_pin_ctl(void *, int, int);
|
||||
|
||||
static int
|
||||
epio_ebus_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia = aux;
|
||||
struct _Pio *f = (struct _Pio *)ia->ia_vaddr;
|
||||
|
||||
if (strcmp("gpio", ia->ia_name) != 0)
|
||||
return (0);
|
||||
if ((f == NULL) ||
|
||||
(f->Tag != PMTTAG_GPIO))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
epio_ebus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia =aux;
|
||||
struct epio_softc *sc = (struct epio_softc *)self;
|
||||
struct gpiobus_attach_args gba;
|
||||
int i;
|
||||
uint32_t data;
|
||||
|
||||
sc->sc_dp = (struct _Pio*)ia->ia_vaddr;
|
||||
data = sc->sc_dp->PinData;
|
||||
|
||||
#if DEBUG
|
||||
printf(" virt=%p data=%zx", (void*)sc->sc_dp, data);
|
||||
#endif
|
||||
printf(": GPIO controller\n");
|
||||
|
||||
/* BUGBUG Initialize pins properly */
|
||||
for (i = 0 ; i < GPIO_NPINS ; i++) {
|
||||
sc->sc_gpio_pins[i].pin_num = i;
|
||||
sc->sc_gpio_pins[i].pin_caps = GPIO_PIN_INOUT
|
||||
| GPIO_PIN_OPENDRAIN
|
||||
| GPIO_PIN_TRISTATE;
|
||||
|
||||
/* current defaults */
|
||||
sc->sc_gpio_pins[i].pin_flags = GPIO_PIN_INOUT;
|
||||
sc->sc_gpio_pins[i].pin_state = (data & (1 << i)) ? GPIO_PIN_HIGH : GPIO_PIN_LOW;
|
||||
sc->sc_gpio_pins[i].pin_mapped = 0;
|
||||
}
|
||||
|
||||
/* Create controller tag */
|
||||
sc->sc_gpio_gc.gp_cookie = sc;
|
||||
sc->sc_gpio_gc.gp_pin_read = epio_pin_read;
|
||||
sc->sc_gpio_gc.gp_pin_write = epio_pin_write;
|
||||
sc->sc_gpio_gc.gp_pin_ctl = epio_pin_ctl;
|
||||
|
||||
gba.gba_gc = &sc->sc_gpio_gc;
|
||||
gba.gba_pins = sc->sc_gpio_pins;
|
||||
gba.gba_npins = GPIO_NPINS;
|
||||
|
||||
/* Attach GPIO framework */
|
||||
(void) config_found(&sc->sc_dev, &gba, gpiobus_print);
|
||||
}
|
||||
|
||||
static int
|
||||
epio_pin_read(void *arg, int pin)
|
||||
{
|
||||
struct epio_softc *sc = arg;
|
||||
uint32_t data = sc->sc_dp->PinData;
|
||||
int p;
|
||||
|
||||
p = pin % GPIO_NPINS;
|
||||
return (data >> p) & 0x01;
|
||||
}
|
||||
|
||||
static void
|
||||
epio_pin_write(void *arg, int pin, int value)
|
||||
{
|
||||
struct epio_softc *sc = arg;
|
||||
uint32_t data;
|
||||
int p;
|
||||
|
||||
p = pin % GPIO_NPINS;
|
||||
data = 1 << p;
|
||||
if (value)
|
||||
sc->sc_dp->PinData = data;
|
||||
else
|
||||
sc->sc_dp->ClearData = data;
|
||||
}
|
||||
|
||||
static void
|
||||
epio_pin_ctl(void *arg, int pin, int flags)
|
||||
{
|
||||
struct epio_softc *sc = arg;
|
||||
uint32_t data;
|
||||
int p;
|
||||
|
||||
p = pin % GPIO_NPINS;
|
||||
data = (1 << p);
|
||||
|
||||
if (flags & GPIO_PIN_INOUT) {
|
||||
sc->sc_dp->Direction = data;
|
||||
}
|
||||
|
||||
if (flags & GPIO_PIN_TRISTATE) {
|
||||
sc->sc_dp->OutDisable = data;
|
||||
}
|
||||
|
||||
if (flags & GPIO_PIN_OPENDRAIN) {
|
||||
sc->sc_dp->Enable = data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,422 @@
|
|||
/* $NetBSD: icap_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: icap_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/bufq.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/conf.h>
|
||||
#include <uvm/uvm_param.h>
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
#define DEBUG_INTR 0x01
|
||||
#define DEBUG_XFERS 0x02
|
||||
#define DEBUG_STATUS 0x04
|
||||
#define DEBUG_FUNCS 0x08
|
||||
#define DEBUG_PROBE 0x10
|
||||
#define DEBUG_WRITES 0x20
|
||||
#define DEBUG_READS 0x40
|
||||
#define DEBUG_ERRORS 0x80
|
||||
#ifdef DEBUG
|
||||
int icap_debug = DEBUG_ERRORS;
|
||||
#define ICAP_DEBUG(x) (icap_debug & (x))
|
||||
#define DBGME(_lev_,_x_) if ((_lev_) & icap_debug) _x_
|
||||
#else
|
||||
#define ICAP_DEBUG(x) (0)
|
||||
#define DBGME(_lev_,_x_)
|
||||
#endif
|
||||
#define DEBUG_PRINT(_args_,_lev_) DBGME(_lev_,printf _args_)
|
||||
|
||||
/*
|
||||
* Device softc
|
||||
*/
|
||||
struct icap_softc {
|
||||
device_t sc_dev;
|
||||
struct _Icap *sc_dp;
|
||||
struct bufq_state *sc_buflist;
|
||||
struct buf *sc_bp;
|
||||
char *sc_data;
|
||||
int sc_count;
|
||||
};
|
||||
|
||||
/* Required funcs
|
||||
*/
|
||||
static int icap_ebus_match (struct device *, struct cfdata *, void *);
|
||||
static void icap_ebus_attach (struct device *, struct device *, void *);
|
||||
|
||||
static dev_type_open(icapopen);
|
||||
static dev_type_close(icapclose);
|
||||
static dev_type_read(icapread);
|
||||
static dev_type_write(icapwrite);
|
||||
static dev_type_ioctl(icapioctl);
|
||||
static dev_type_strategy(icapstrategy);
|
||||
|
||||
/* Other functions
|
||||
*/
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
static void icapstart(struct icap_softc *sc);
|
||||
static int icap_ebus_intr(void *cookie, void *f);
|
||||
static void icap_reset(struct icap_softc *sc);
|
||||
|
||||
/* Config stuff
|
||||
*/
|
||||
extern struct cfdriver icap_cd;
|
||||
|
||||
CFATTACH_DECL_NEW(icap_ebus, sizeof (struct icap_softc),
|
||||
icap_ebus_match, icap_ebus_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
icap_ebus_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia = aux;
|
||||
struct _Icap *f = (struct _Icap *)ia->ia_vaddr;
|
||||
|
||||
DEBUG_PRINT(("icap_match %x\n", (f) ? f->Tag : 0), DEBUG_PROBE);
|
||||
if (strcmp("icap", ia->ia_name) != 0)
|
||||
return (0);
|
||||
if ((f == NULL) ||
|
||||
(! (f->Tag == PMTTAG_ICAP)))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
icap_ebus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct icap_softc *sc = device_private(self);
|
||||
struct ebus_attach_args *ia =aux;
|
||||
|
||||
DEBUG_PRINT(("icap_attach %p\n", sc), DEBUG_PROBE);
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_dp = (struct _Icap*)ia->ia_vaddr;
|
||||
bufq_alloc(&sc->sc_buflist, "fcfs", 0);
|
||||
sc->sc_bp = NULL;
|
||||
sc->sc_data = NULL;
|
||||
sc->sc_count = 0;
|
||||
|
||||
#if DEBUG
|
||||
printf(" virt=%p", (void*)sc->sc_dp);
|
||||
#endif
|
||||
printf(": %s\n", "Internal Configuration Access Port");
|
||||
|
||||
ebus_intr_establish(parent, (void*)ia->ia_cookie, IPL_BIO,
|
||||
icap_ebus_intr, sc);
|
||||
|
||||
icap_reset(sc);
|
||||
}
|
||||
|
||||
/* The character device handlers
|
||||
*/
|
||||
const struct cdevsw icap_cdevsw = {
|
||||
icapopen,
|
||||
icapclose,
|
||||
icapread,
|
||||
icapwrite,
|
||||
icapioctl,
|
||||
nostop,
|
||||
notty,
|
||||
nopoll,
|
||||
nommap,
|
||||
nokqfilter,
|
||||
};
|
||||
|
||||
/*
|
||||
* Handle an open request on the device.
|
||||
*/
|
||||
static int
|
||||
icapopen(dev_t device, int flags, int fmt, struct lwp *process)
|
||||
{
|
||||
struct icap_softc *sc;
|
||||
|
||||
DEBUG_PRINT(("icapopen\n"), DEBUG_FUNCS);
|
||||
sc = device_lookup_private(&icap_cd, minor(device));
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the close request for the device.
|
||||
*/
|
||||
static int
|
||||
icapclose(dev_t device, int flags, int fmt, struct lwp *process)
|
||||
{
|
||||
DEBUG_PRINT(("icapclose\n"), DEBUG_FUNCS);
|
||||
return 0; /* this always succeeds */
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the read request for the device.
|
||||
*/
|
||||
static int
|
||||
icapread(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
DEBUG_PRINT(("icapread\n"), DEBUG_READS);
|
||||
return (physio(icapstrategy, NULL, dev, B_READ, minphys, uio));
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the write request for the device.
|
||||
*/
|
||||
static int
|
||||
icapwrite(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
DEBUG_PRINT(("icapwrite\n"), DEBUG_WRITES);
|
||||
return (physio(icapstrategy, NULL, dev, B_WRITE, minphys, uio));
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the ioctl request for the device.
|
||||
*/
|
||||
static int
|
||||
icapioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
|
||||
{
|
||||
|
||||
return ENOTTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Strategy function for the device.
|
||||
*/
|
||||
static void
|
||||
icapstrategy(struct buf *bp)
|
||||
{
|
||||
struct icap_softc *sc;
|
||||
int s;
|
||||
|
||||
DEBUG_PRINT(("icapstrategy\n"), DEBUG_FUNCS);
|
||||
|
||||
/* We did nothing lest we did */
|
||||
bp->b_resid = bp->b_bcount;
|
||||
|
||||
/* Do we know you. */
|
||||
sc = device_lookup_private(&icap_cd, minor(bp->b_dev));
|
||||
if (sc == NULL) {
|
||||
DEBUG_PRINT(("icapstrategy: nodev %x\n",bp->b_dev),
|
||||
DEBUG_ERRORS);
|
||||
bp->b_error = ENXIO;
|
||||
biodone(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add to Q. If Q was empty get it started */
|
||||
s = splbio();
|
||||
bufq_put(sc->sc_buflist, bp);
|
||||
if (bufq_peek(sc->sc_buflist) == bp) {
|
||||
icapstart(sc);
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the next I/O request started
|
||||
*/
|
||||
static void
|
||||
icapstart(struct icap_softc *sc)
|
||||
{
|
||||
paddr_t phys, phys2;
|
||||
vaddr_t virt;
|
||||
size_t count;
|
||||
uint32_t fl;
|
||||
struct buf *bp = sc->sc_bp;
|
||||
|
||||
DEBUG_PRINT(("icapstart %p %p\n",sc,bp), DEBUG_FUNCS);
|
||||
|
||||
/* Were we idle?
|
||||
*/
|
||||
recheck:
|
||||
if (bp == NULL) {
|
||||
|
||||
/* Yes, get the next request if any
|
||||
*/
|
||||
bp = bufq_get(sc->sc_buflist);
|
||||
DEBUG_PRINT(("icapnext: %p\n",bp), DEBUG_XFERS);
|
||||
if (bp == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Done with this request?
|
||||
*/
|
||||
if ((bp->b_resid == 0) || bp->b_error) {
|
||||
|
||||
/* Yes, complete and move to next, if any
|
||||
*/
|
||||
sc->sc_bp = NULL;
|
||||
biodone(bp);
|
||||
DEBUG_PRINT(("icapdone %p\n",bp), DEBUG_XFERS);
|
||||
bp = NULL;
|
||||
goto recheck;
|
||||
}
|
||||
|
||||
/* If new request init the xfer info
|
||||
*/
|
||||
if (sc->sc_bp == NULL) {
|
||||
sc->sc_bp = bp;
|
||||
sc->sc_data = bp->b_data;
|
||||
sc->sc_count = bp->b_resid;
|
||||
}
|
||||
|
||||
/* Loop filling as many buffers as will fit in the FIFO
|
||||
*/
|
||||
fl = (bp->b_flags & B_READ) ? ICAPS_F_RECV : ICAPS_F_XMIT;
|
||||
for (;;) {
|
||||
|
||||
/* Make sure there's still room in the FIFO, no errors.
|
||||
*/
|
||||
if (sc->sc_dp->Control & (ICAPC_IF_FULL|ICAPC_ERROR))
|
||||
break;
|
||||
|
||||
/* How much data do we xfer and where
|
||||
*/
|
||||
virt = (vaddr_t)sc->sc_data;
|
||||
phys = kvtophys(virt);
|
||||
count = round_page(virt) - virt;
|
||||
if (count == 0) count = PAGE_SIZE;/* could(will) be aligned */
|
||||
|
||||
/* How much of it is contiguous
|
||||
*/
|
||||
while (count < sc->sc_count) {
|
||||
phys2 = kvtophys(virt + count);
|
||||
if (phys2 != (phys + count)) {
|
||||
|
||||
/* No longer contig, ship it
|
||||
*/
|
||||
break;
|
||||
}
|
||||
count += PAGE_SIZE;
|
||||
}
|
||||
|
||||
/* Trim if we went too far
|
||||
*/
|
||||
if (count > sc->sc_count)
|
||||
count = sc->sc_count;
|
||||
|
||||
/* Ship it
|
||||
*/
|
||||
DEBUG_PRINT(("icapship %lx %d\n",phys,count), DEBUG_XFERS);
|
||||
sc->sc_dp->SizeAndFlags = fl | count;
|
||||
sc->sc_dp->BufferAddressHi32 = 0; /* BUGBUG 64bit */
|
||||
sc->sc_dp->BufferAddressLo32 = phys; /* this pushes the fifo */
|
||||
|
||||
/* Adjust pointers and continue
|
||||
*/
|
||||
sc->sc_data += count;
|
||||
sc->sc_count -= count;
|
||||
|
||||
if (sc->sc_count <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt handler
|
||||
*/
|
||||
static int
|
||||
icap_ebus_intr(void *cookie, void *f)
|
||||
{
|
||||
struct icap_softc *sc = cookie;
|
||||
struct buf *bp = sc->sc_bp;
|
||||
u_int32_t isr, saf = 0, hi, lo;
|
||||
|
||||
isr = sc->sc_dp->Control;
|
||||
|
||||
DEBUG_PRINT(("i %x\n",isr), DEBUG_INTR);
|
||||
|
||||
/* Make sure there is an interrupt and that we should take it
|
||||
*/
|
||||
if ((isr & (ICAPC_INTEN|ICAPC_DONE)) != (ICAPC_INTEN|ICAPC_DONE))
|
||||
return (0);
|
||||
|
||||
/* Pull out all completed buffers
|
||||
*/
|
||||
while ((isr & ICAPC_OF_EMPTY) == 0) {
|
||||
|
||||
if (isr & ICAPC_ERROR) {
|
||||
printf("%s: internal error (%x)\n", device_xname(sc->sc_dev),isr);
|
||||
icap_reset(sc);
|
||||
if (bp) {
|
||||
bp->b_error = EIO;
|
||||
icapstart(sc);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Beware, order matters */
|
||||
saf = sc->sc_dp->SizeAndFlags;
|
||||
hi = sc->sc_dp->BufferAddressHi32; /* BUGBUG 64bit */
|
||||
lo = sc->sc_dp->BufferAddressLo32; /* this pops the fifo */
|
||||
|
||||
/* Say its done that much (and sanity)
|
||||
*/
|
||||
if (bp) {
|
||||
size_t count = saf & ICAPS_S_MASK;
|
||||
/* more sanity */
|
||||
if (count > bp->b_resid)
|
||||
count = bp->b_resid;
|
||||
bp->b_resid -= count;
|
||||
}
|
||||
|
||||
/* More? */
|
||||
isr = sc->sc_dp->Control;
|
||||
}
|
||||
|
||||
/* Did we pop at least one */
|
||||
if (saf)
|
||||
icapstart(sc);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* HW (re)Initialization
|
||||
*/
|
||||
static void
|
||||
icap_reset(struct icap_softc *sc)
|
||||
{
|
||||
DEBUG_PRINT(("icap_reset %x\n",sc->sc_dp->Control), DEBUG_STATUS);
|
||||
sc->sc_dp->Control = ICAPC_RESET;
|
||||
DELAY(2);
|
||||
sc->sc_dp->Control = ICAPC_INTEN;
|
||||
}
|
|
@ -0,0 +1,972 @@
|
|||
/* $NetBSD: if_le_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_ether.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_inarp.h>
|
||||
#endif
|
||||
|
||||
#include <net/bpf.h>
|
||||
#include <net/bpfdesc.h>
|
||||
|
||||
#if NRND > 0
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
struct bufmap {
|
||||
struct mbuf *mbuf;
|
||||
paddr_t phys;
|
||||
};
|
||||
|
||||
struct enic_softc {
|
||||
device_t sc_dev; /* base device glue */
|
||||
struct ethercom sc_ethercom; /* Ethernet common part */
|
||||
struct ifmedia sc_media; /* our supported media */
|
||||
|
||||
struct _Enic *sc_regs; /* hw registers */
|
||||
|
||||
int sc_havecarrier; /* carrier status */
|
||||
void *sc_sh; /* shutdownhook cookie */
|
||||
int inited;
|
||||
|
||||
int sc_no_rd;
|
||||
int sc_n_recv;
|
||||
int sc_recv_h;
|
||||
/* BUGBUG really should be malloc-ed */
|
||||
#define SC_MAX_N_RECV 64
|
||||
struct bufmap sc_recv[SC_MAX_N_RECV];
|
||||
|
||||
int sc_no_td;
|
||||
int sc_n_xmit;
|
||||
int sc_xmit_h;
|
||||
/* BUGBUG really should be malloc-ed */
|
||||
#define SC_MAX_N_XMIT 16
|
||||
struct bufmap sc_xmit[SC_MAX_N_XMIT];
|
||||
|
||||
#if DEBUG
|
||||
int xhit;
|
||||
int xmiss;
|
||||
int tfull;
|
||||
int tfull2;
|
||||
int brh;
|
||||
int rf;
|
||||
int bxh;
|
||||
|
||||
int it;
|
||||
#endif
|
||||
|
||||
u_int8_t sc_enaddr[ETHER_ADDR_LEN];
|
||||
u_int8_t sc_pad[2];
|
||||
#if NRND > 0
|
||||
rndsource_element_t rnd_source;
|
||||
#endif
|
||||
};
|
||||
|
||||
void enic_reset(struct ifnet *);
|
||||
int enic_init(struct ifnet *);
|
||||
void enic_stop(struct ifnet *ifp, int suspend);
|
||||
void enic_start(struct ifnet *ifp);
|
||||
void enic_shutdown(void *);
|
||||
void enic_watchdog(struct ifnet *ifp);
|
||||
int enic_mediachange(struct ifnet *ifp);
|
||||
void enic_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr);
|
||||
int enic_ioctl(struct ifnet *ifp, u_long cmd, void *data);
|
||||
int enic_intr(void *cookie, void *f);
|
||||
void enic_rint(struct enic_softc *, uint32_t, paddr_t);
|
||||
void enic_tint(struct enic_softc *, uint32_t, paddr_t);
|
||||
void enic_kill_xmit(struct enic_softc *sc);
|
||||
void enic_post_recv(struct enic_softc *sc, struct mbuf *m);
|
||||
void enic_refill(struct enic_softc *sc);
|
||||
static int enic_gethwinfo(struct enic_softc *sc);
|
||||
int enic_put(struct enic_softc *sc, struct mbuf **pm);
|
||||
|
||||
static int enic_match(struct device *, struct cfdata *, void *);
|
||||
static void enic_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL_NEW(enic_emips, sizeof(struct enic_softc),
|
||||
enic_match, enic_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
enic_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *d = aux;
|
||||
/* donno yet */
|
||||
struct _Enic *et = (struct _Enic *)d->ia_vaddr;
|
||||
|
||||
if (strcmp("enic", d->ia_name) != 0)
|
||||
return (0);
|
||||
if ((et == NULL) || (et->Tag != PMTTAG_ETHERNET))
|
||||
return 0;
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
enic_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct enic_softc *sc = device_private(self);
|
||||
struct ebus_attach_args *ia = aux;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
|
||||
sc->sc_regs = (struct _Enic *)(ia->ia_vaddr);
|
||||
#if DEBUG
|
||||
printf(" virt=%p ", (void*)sc->sc_regs);
|
||||
#endif
|
||||
|
||||
/* Get the MAC and the depth of the FIFOs */
|
||||
if (!enic_gethwinfo(sc)) {
|
||||
printf(" <cannot get hw info> DISABLED.\n");
|
||||
/*
|
||||
* NB: caveat maintainer: make sure what we
|
||||
* did NOT do below does not hurt the system
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_no_td = 0;
|
||||
sc->sc_havecarrier = 1; /* BUGBUG */
|
||||
sc->sc_recv_h = 0;
|
||||
sc->sc_xmit_h = 0;
|
||||
/* uhmm do I need to do this? */
|
||||
memset(sc->sc_recv,0, sizeof sc->sc_recv );
|
||||
memset(sc->sc_xmit,0, sizeof sc->sc_xmit );
|
||||
|
||||
/* Initialize ifnet structure. */
|
||||
strcpy(ifp->if_xname, device_xname(sc->sc_dev));
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_start = enic_start;
|
||||
ifp->if_ioctl = enic_ioctl;
|
||||
ifp->if_watchdog = enic_watchdog;
|
||||
ifp->if_init = enic_init;
|
||||
ifp->if_stop = enic_stop;
|
||||
ifp->if_flags =
|
||||
IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
|
||||
/* Initialize ifmedia structures. */
|
||||
ifmedia_init(&sc->sc_media, 0, enic_mediachange, enic_mediastatus);
|
||||
ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
|
||||
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL);
|
||||
|
||||
/* Make sure the chip is stopped. */
|
||||
enic_stop(ifp, 0);
|
||||
sc->inited = 0;
|
||||
|
||||
/* Get the mac address and print it */
|
||||
printf(": eNIC [%d %d], address %s\n",
|
||||
sc->sc_n_recv, sc->sc_n_xmit, ether_sprintf(sc->sc_enaddr));
|
||||
|
||||
/* claim 802.1q capability */
|
||||
// sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
|
||||
|
||||
/* Attach the interface. */
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp, sc->sc_enaddr);
|
||||
|
||||
sc->sc_sh = shutdownhook_establish(enic_shutdown, ifp);
|
||||
if (sc->sc_sh == NULL)
|
||||
panic("enic_attach: cannot establish shutdown hook");
|
||||
|
||||
#if NRND > 0
|
||||
rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
|
||||
RND_TYPE_NET, 0);
|
||||
#endif
|
||||
|
||||
ebus_intr_establish(parent, (void*)ia->ia_cookie, IPL_NET,
|
||||
enic_intr, sc);
|
||||
}
|
||||
|
||||
/* Beware: does not work while the nic is running
|
||||
*/
|
||||
static int enic_gethwinfo(struct enic_softc *sc)
|
||||
{
|
||||
uint8_t buffer[8];/* 64bits max */
|
||||
PENIC_INFO hw = (PENIC_INFO)buffer;
|
||||
paddr_t phys = kvtophys((vaddr_t)&buffer[0]), phys2;
|
||||
int i;
|
||||
|
||||
/* First thing first, get the MAC address
|
||||
*/
|
||||
memset(buffer,0,sizeof buffer);
|
||||
buffer[0] = ENIC_CMD_GET_ADDRESS;
|
||||
buffer[3] = ENIC_CMD_GET_ADDRESS;/* bswap bug */
|
||||
sc->sc_regs->SizeAndFlags = (sizeof buffer) | ES_F_CMD;
|
||||
sc->sc_regs->BufferAddressHi32 = 0;
|
||||
sc->sc_regs->BufferAddressLo32 = phys; /* go! */
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
DELAY(100);
|
||||
if (0 == (sc->sc_regs->Control & EC_OF_EMPTY))
|
||||
break;
|
||||
}
|
||||
if (i == 100)
|
||||
return 0;
|
||||
|
||||
phys2 = sc->sc_regs->BufferAddressLo32;
|
||||
if (phys2 != phys) {
|
||||
printf("enic uhu? %llx != %llx?\n",(long long)phys,(long long)phys2);
|
||||
return 0;
|
||||
}
|
||||
memcpy(sc->sc_enaddr,buffer,ETHER_ADDR_LEN);
|
||||
|
||||
/* Next get the HW parameters
|
||||
*/
|
||||
memset(buffer,0,sizeof buffer);
|
||||
buffer[0] = ENIC_CMD_GET_INFO;
|
||||
buffer[3] = ENIC_CMD_GET_INFO;/* bswap bug */
|
||||
sc->sc_regs->SizeAndFlags = (sizeof buffer) | ES_F_CMD;
|
||||
sc->sc_regs->BufferAddressHi32 = 0;
|
||||
sc->sc_regs->BufferAddressLo32 = phys; /* go! */
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
DELAY(100);
|
||||
if (0 == (sc->sc_regs->Control & EC_OF_EMPTY))
|
||||
break;
|
||||
}
|
||||
if (i == 100)
|
||||
return 0;
|
||||
|
||||
phys2 = sc->sc_regs->BufferAddressLo32;
|
||||
if (phys2 != phys) {
|
||||
printf("enic uhu2? %llx != %llx?\n",(long long)phys,(long long)phys2);
|
||||
return 0;
|
||||
}
|
||||
//printf("enic: hwinfo: %x %x %x %x %x %x \n", hw->InputFifoSize, hw->OutputFifoSize, hw->CompletionFifoSize,
|
||||
// hw->ErrorCount, hw->FramesDropped, hw->Reserved);
|
||||
|
||||
/* Get FIFO depths and cap them
|
||||
*/
|
||||
sc->sc_n_recv = hw->InputFifoSize;
|
||||
if (sc->sc_n_recv > SC_MAX_N_RECV)
|
||||
sc->sc_n_recv = SC_MAX_N_RECV;
|
||||
if (sc->sc_n_recv == 0) { /* sanity and compat with old hw/simulator */
|
||||
sc->sc_n_recv = 8;
|
||||
sc->sc_n_xmit = 4;
|
||||
} else {
|
||||
sc->sc_n_xmit = hw->OutputFifoSize;
|
||||
if (sc->sc_n_xmit > SC_MAX_N_XMIT)
|
||||
sc->sc_n_xmit = SC_MAX_N_XMIT;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
enic_reset(struct ifnet *ifp)
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splnet();
|
||||
enic_stop(ifp,0);
|
||||
enic_init(ifp);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
enic_stop(struct ifnet *ifp, int suspend)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
|
||||
//printf("enic_stop %x\n", sc->sc_regs->Control);
|
||||
|
||||
/* NB: only "ifconfig down" says suspend=1 (then "up" calls init)
|
||||
* Could simply set RXDIS in this case
|
||||
*/
|
||||
sc->inited = 2;
|
||||
sc->sc_regs->Control = EC_RESET;
|
||||
sc->sc_no_rd = 0; /* they are gone */
|
||||
sc->sc_no_td = 0; /* they are gone */
|
||||
}
|
||||
|
||||
void
|
||||
enic_shutdown(void *arg)
|
||||
{
|
||||
struct ifnet *ifp = arg;
|
||||
|
||||
enic_stop(ifp, 0);
|
||||
}
|
||||
|
||||
void
|
||||
enic_kill_xmit(struct enic_softc *sc)
|
||||
{
|
||||
int i;
|
||||
struct mbuf *m;
|
||||
|
||||
for (i = 0; i < sc->sc_n_xmit; i++)
|
||||
if ((m = sc->sc_xmit[i].mbuf) != NULL) {
|
||||
sc->sc_xmit[i].mbuf = NULL;
|
||||
sc->sc_xmit[i].phys = ~0;
|
||||
m_freem(m);
|
||||
}
|
||||
sc->sc_no_td = 0;
|
||||
sc->sc_xmit_h = 0;
|
||||
}
|
||||
|
||||
void
|
||||
enic_post_recv(struct enic_softc *sc, struct mbuf *m)
|
||||
{
|
||||
int i, waitmode = M_DONTWAIT;
|
||||
paddr_t phys;
|
||||
|
||||
#define rpostone(_p_) \
|
||||
sc->sc_regs->SizeAndFlags = ES_F_RECV | MCLBYTES; \
|
||||
sc->sc_regs->BufferAddressHi32 = 0; \
|
||||
sc->sc_regs->BufferAddressLo32 = _p_;
|
||||
#define tpostone(_p_,_s_) \
|
||||
sc->sc_regs->SizeAndFlags = ES_F_XMIT | (_s_); \
|
||||
sc->sc_regs->BufferAddressHi32 = 0; \
|
||||
sc->sc_regs->BufferAddressLo32 = _p_;
|
||||
|
||||
/* Operational reload? */
|
||||
if (m != NULL) {
|
||||
/* But is the hw ready for it */
|
||||
if (sc->sc_regs->Control & EC_IF_FULL)
|
||||
goto no_room;
|
||||
/* Yes, find a spot. Include empty q case. */
|
||||
for (i = sc->sc_recv_h; i < sc->sc_n_recv; i++)
|
||||
if (sc->sc_recv[i].mbuf == NULL)
|
||||
goto found;
|
||||
for (i = 0; i < sc->sc_recv_h; i++)
|
||||
if (sc->sc_recv[i].mbuf == NULL)
|
||||
goto found;
|
||||
/* no spot, drop it (sigh) */
|
||||
no_room:
|
||||
#if DEBUG
|
||||
sc->rf++;
|
||||
#endif
|
||||
m_freem(m);
|
||||
return;
|
||||
found:
|
||||
phys = kvtophys((vaddr_t)m->m_data);
|
||||
sc->sc_recv[i].mbuf = m;
|
||||
sc->sc_recv[i].phys = phys;
|
||||
rpostone(phys);
|
||||
sc->sc_no_rd++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Repost after reset? */
|
||||
if (sc->inited) {
|
||||
/* order doesnt matter, might as well keep it clean */
|
||||
int j = 0;
|
||||
sc->sc_recv_h = 0;
|
||||
for (i = 0; i < sc->sc_n_recv; i++)
|
||||
if ((m = sc->sc_recv[i].mbuf) != NULL) {
|
||||
phys = sc->sc_recv[i].phys;
|
||||
sc->sc_recv[i].mbuf = NULL;
|
||||
sc->sc_recv[i].phys = ~0;
|
||||
sc->sc_recv[j].mbuf = m;
|
||||
sc->sc_recv[j].phys = phys;
|
||||
#if DEBUG
|
||||
if (sc->sc_regs->Control & EC_IF_FULL)
|
||||
printf("?uhu? postrecv full? %d\n", sc->sc_no_rd);
|
||||
#endif
|
||||
sc->sc_no_rd++;
|
||||
rpostone(phys);
|
||||
j++;
|
||||
}
|
||||
/* Any holes left? */
|
||||
sc->inited = 1;
|
||||
if (j >= sc->sc_n_recv)
|
||||
return;/* no, we are done */
|
||||
/* continue on with the loop below */
|
||||
i = j; m = NULL;
|
||||
goto fillem;
|
||||
}
|
||||
|
||||
/* Initial refill, we can wait */
|
||||
waitmode = M_WAIT;
|
||||
sc->sc_recv_h = 0;
|
||||
memset(sc->sc_recv, 0, sizeof(sc->sc_recv[0]) * sc->sc_n_recv);
|
||||
i = 0;
|
||||
fillem:
|
||||
for (; i < sc->sc_n_recv; i++) {
|
||||
MGETHDR(m, waitmode, MT_DATA);
|
||||
if (m == 0)
|
||||
break;
|
||||
m->m_pkthdr.rcvif = &sc->sc_ethercom.ec_if;
|
||||
m->m_pkthdr.len = 0;
|
||||
|
||||
MCLGET(m, waitmode);
|
||||
if ((m->m_flags & M_EXT) == 0)
|
||||
break;
|
||||
|
||||
/* This offset aligns IP/TCP headers and helps performance
|
||||
*/
|
||||
#if 1
|
||||
#define ADJUST_MBUF_OFFSET(_m_) { \
|
||||
(_m_)->m_data += 2; \
|
||||
(_m_)->m_len -= 2; \
|
||||
}
|
||||
#else
|
||||
#define ADJUST_MBUF_OFFSET(_m_)
|
||||
#endif
|
||||
|
||||
m->m_len = MCLBYTES;
|
||||
|
||||
ADJUST_MBUF_OFFSET(m);
|
||||
phys = kvtophys((vaddr_t)m->m_data);
|
||||
sc->sc_recv[i].mbuf = m;
|
||||
sc->sc_recv[i].phys = phys;
|
||||
#if DEBUG
|
||||
if (sc->sc_regs->Control & EC_IF_FULL)
|
||||
printf("?uhu? postrecv2 full? %d\n", sc->sc_no_rd);
|
||||
#endif
|
||||
sc->sc_no_rd++;
|
||||
rpostone(phys);
|
||||
m = NULL;
|
||||
}
|
||||
|
||||
if (m) m_freem(m);
|
||||
sc->inited = 1;
|
||||
}
|
||||
|
||||
void enic_refill(struct enic_softc *sc)
|
||||
{
|
||||
struct mbuf *m;
|
||||
int waitmode = M_DONTWAIT;
|
||||
|
||||
MGETHDR(m, waitmode, MT_DATA);
|
||||
if (m == 0)
|
||||
return;
|
||||
m->m_pkthdr.rcvif = &sc->sc_ethercom.ec_if;
|
||||
m->m_pkthdr.len = 0;
|
||||
|
||||
MCLGET(m, waitmode);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
|
||||
m->m_len = MCLBYTES;
|
||||
ADJUST_MBUF_OFFSET(m);
|
||||
|
||||
enic_post_recv(sc,m);
|
||||
}
|
||||
|
||||
int
|
||||
enic_init(struct ifnet *ifp)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
uint32_t ctl;
|
||||
|
||||
/* no need to init many times unless we are in reset */
|
||||
if (sc->inited != 1) {
|
||||
|
||||
/* Cancel all xmit buffers */
|
||||
enic_kill_xmit(sc);
|
||||
|
||||
/* Re-post all recv buffers */
|
||||
enic_post_recv(sc,NULL);
|
||||
}
|
||||
|
||||
/* Start the eNIC */
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
ifp->if_timer = 0;
|
||||
ctl = sc->sc_regs->Control | EC_INTEN;
|
||||
ctl &= ~EC_RXDIS;
|
||||
sc->sc_regs->Control = ctl;
|
||||
//printf("enic_init <- %x\n",ctl);
|
||||
|
||||
enic_start(ifp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
enic_watchdog(struct ifnet *ifp)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
|
||||
//printf("enic_watch ctl=%x\n", sc->sc_regs->Control);
|
||||
log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
|
||||
++ifp->if_oerrors;
|
||||
|
||||
enic_reset(ifp);
|
||||
}
|
||||
|
||||
int
|
||||
enic_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
// struct enic_softc *sc = ifp->if_softc;
|
||||
/* more code here.. */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
enic_mediastatus(
|
||||
struct ifnet *ifp,
|
||||
struct ifmediareq *ifmr)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
ifmr->ifm_status = IFM_AVALID;
|
||||
if (sc->sc_havecarrier)
|
||||
ifmr->ifm_status |= IFM_ACTIVE;
|
||||
|
||||
/* more code here someday.. */
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an ioctl request.
|
||||
*/
|
||||
int
|
||||
enic_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
#if 0 /*DEBUG*/
|
||||
{
|
||||
extern int ei_drops[];
|
||||
static int flip = 0;
|
||||
if (flip++ == 2) {
|
||||
int i;
|
||||
flip = 0;
|
||||
printf("enic_ioctl(%x) %qd/%qd %qd/%qd %d/%d %d:%d "
|
||||
"%d+%d %d/%d/%d\n", ifp->if_flags,
|
||||
ifp->if_ierrors, ifp->if_oerrors,
|
||||
ifp->if_ipackets, ifp->if_opackets,
|
||||
sc->sc_no_rd, sc->sc_no_td,
|
||||
sc->xhit, sc->xmiss,
|
||||
sc->tfull, sc->tfull2,
|
||||
sc->brh, sc->rf, sc->bxh);
|
||||
printf(" Ctl %x lt %x tim %d\n",
|
||||
sc->sc_regs->Control, sc->it, ifp->if_timer);
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
if (ei_drops[i])
|
||||
printf(" %d.%d",i,ei_drops[i]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (cmd == SIOCSIFADDR) {
|
||||
/*
|
||||
* hackattack: NFS does not turn us back
|
||||
* on after a stop. So.
|
||||
*/
|
||||
//printf("enic_ioctl(%lx)\n",cmd);
|
||||
enic_init(ifp);
|
||||
}
|
||||
if (error != ENETRESET)
|
||||
break;
|
||||
error = 0;
|
||||
if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
|
||||
break;
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
enic_reset(ifp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
enic_intr(void *cookie, void *f)
|
||||
{
|
||||
struct enic_softc *sc = cookie;
|
||||
u_int32_t isr, saf, hi, lo, fl;
|
||||
|
||||
isr = sc->sc_regs->Control;
|
||||
|
||||
/* Make sure there is one and that we should take it */
|
||||
if ((isr & (EC_INTEN|EC_DONE)) != (EC_INTEN|EC_DONE))
|
||||
return (0);
|
||||
|
||||
if (isr & EC_ERROR) {
|
||||
printf("%s: internal error\n", device_xname(sc->sc_dev));
|
||||
enic_reset(&sc->sc_ethercom.ec_if);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* pull out all completed buffers
|
||||
*/
|
||||
while ((isr & EC_OF_EMPTY) == 0) {
|
||||
|
||||
/* beware, order matters */
|
||||
saf = sc->sc_regs->SizeAndFlags;
|
||||
hi = sc->sc_regs->BufferAddressHi32; /* BUGBUG 64bit */
|
||||
lo = sc->sc_regs->BufferAddressLo32; /* this pops the fifo */
|
||||
|
||||
fl = saf & (ES_F_MASK &~ ES_F_DONE);
|
||||
if (fl == ES_F_RECV)
|
||||
enic_rint(sc,saf,lo);
|
||||
else
|
||||
if (fl == ES_F_XMIT)
|
||||
enic_tint(sc,saf,lo);
|
||||
else
|
||||
/* we do not currently expect or care for command completions? */
|
||||
if (fl != ES_F_CMD)
|
||||
printf("%s: invalid saf=x%x (lo=%x)\n", device_xname(sc->sc_dev), saf, lo);
|
||||
|
||||
isr = sc->sc_regs->Control;
|
||||
}
|
||||
|
||||
#if NRND > 0
|
||||
rnd_add_uint32(&sc->rnd_source, isr);
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
enic_rint(struct enic_softc *sc, uint32_t saf, paddr_t phys)
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int len = saf & ES_S_MASK, i;
|
||||
|
||||
/* Find what buffer it is. Should be the first. */
|
||||
for (i = sc->sc_recv_h; i < sc->sc_n_recv; i++)
|
||||
if (sc->sc_recv[i].phys == phys)
|
||||
goto found;
|
||||
for (i = 0; i < sc->sc_recv_h; i++)
|
||||
if (sc->sc_recv[i].phys == phys)
|
||||
goto found;
|
||||
|
||||
/* uhu?? */
|
||||
printf("%s: bad recv phys %llx\n", device_xname(sc->sc_dev), (long long)phys);
|
||||
ifp->if_ierrors++;
|
||||
return;
|
||||
|
||||
/* got it, pop it */
|
||||
found:
|
||||
sc->sc_no_rd--;
|
||||
m = sc->sc_recv[i].mbuf;
|
||||
sc->sc_recv[i].mbuf = NULL;
|
||||
sc->sc_recv[i].phys = ~0;
|
||||
if (i == sc->sc_recv_h) { /* should be */
|
||||
sc->sc_recv_h = (++i == sc->sc_n_recv) ? 0 : i;
|
||||
}
|
||||
#if DEBUG
|
||||
else sc->brh++;
|
||||
#endif
|
||||
|
||||
if (len <= sizeof(struct ether_header) ||
|
||||
len > ((sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) ?
|
||||
ETHER_VLAN_ENCAP_LEN + ETHERMTU + sizeof(struct ether_header) :
|
||||
ETHERMTU + sizeof(struct ether_header))) {
|
||||
ifp->if_ierrors++;
|
||||
|
||||
/* reuse it */
|
||||
enic_post_recv(sc,m);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Adjust size */
|
||||
m->m_pkthdr.len = len;
|
||||
m->m_len = len; /* recheck */
|
||||
|
||||
ifp->if_ipackets++;
|
||||
|
||||
/*
|
||||
* Check if there's a BPF listener on this interface.
|
||||
* If so, hand off the raw packet to BPF.
|
||||
*/
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp, m);
|
||||
|
||||
/* Pass the packet up. */
|
||||
(*ifp->if_input)(ifp, m);
|
||||
|
||||
/* Need to refill now */
|
||||
enic_refill(sc);
|
||||
}
|
||||
|
||||
void enic_tint(struct enic_softc *sc, uint32_t saf, paddr_t phys)
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int i;
|
||||
|
||||
#if DEBUG
|
||||
sc->it = 1;
|
||||
#endif
|
||||
|
||||
/* BUGBUG should there be a per-buffer error bit in SAF? */
|
||||
|
||||
/* Find what buffer it is. Should be the first. */
|
||||
for (i = sc->sc_xmit_h; i < sc->sc_n_xmit; i++)
|
||||
if (sc->sc_xmit[i].phys == phys)
|
||||
goto found;
|
||||
for (i = 0; i < sc->sc_xmit_h; i++)
|
||||
if (sc->sc_xmit[i].phys == phys)
|
||||
goto found;
|
||||
|
||||
/* uhu?? */
|
||||
printf("%s: bad xmit phys %llx\n", device_xname(sc->sc_dev), (long long)phys);
|
||||
ifp->if_oerrors++;
|
||||
return;
|
||||
|
||||
/* got it, pop it */
|
||||
found:
|
||||
m = sc->sc_xmit[i].mbuf;
|
||||
sc->sc_xmit[i].mbuf = NULL;
|
||||
sc->sc_xmit[i].phys = ~0;
|
||||
if (i == sc->sc_xmit_h) { /* should be */
|
||||
sc->sc_xmit_h = (++i == sc->sc_n_xmit) ? 0 : i;
|
||||
}
|
||||
#if DEBUG
|
||||
else sc->bxh++;
|
||||
#endif
|
||||
m_freem(m);
|
||||
ifp->if_opackets++;
|
||||
|
||||
if (--sc->sc_no_td == 0)
|
||||
ifp->if_timer = 0;
|
||||
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
enic_start(ifp);
|
||||
#if DEBUG
|
||||
sc->it = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup output on interface.
|
||||
* Get another datagram to send off of the interface queue, and map it to the
|
||||
* interface before starting the output.
|
||||
* Called only at splnet or interrupt level.
|
||||
*/
|
||||
void
|
||||
enic_start(struct ifnet *ifp)
|
||||
{
|
||||
struct enic_softc *sc = ifp->if_softc;
|
||||
struct mbuf *m;
|
||||
int len, ix, s;
|
||||
paddr_t phys;
|
||||
|
||||
#if DEBUG
|
||||
sc->it = 0;
|
||||
#endif
|
||||
|
||||
//printf("enic_start(%x)\n", ifp->if_flags);
|
||||
|
||||
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
|
||||
return;
|
||||
|
||||
s = splnet(); /* I know, I dont trust people.. */
|
||||
|
||||
ix = sc->sc_xmit_h;
|
||||
for (;;) {
|
||||
|
||||
/* Anything to do? */
|
||||
IFQ_POLL(&ifp->if_snd, m);
|
||||
if (m == 0)
|
||||
break;
|
||||
|
||||
/* find a spot, if any */
|
||||
for (;ix < sc->sc_n_xmit; ix++)
|
||||
if (sc->sc_xmit[ix].mbuf == NULL)
|
||||
goto found;
|
||||
for (ix = 0; ix < sc->sc_xmit_h; ix++)
|
||||
if (sc->sc_xmit[ix].mbuf == NULL)
|
||||
goto found;
|
||||
/* oh well */
|
||||
ifp->if_flags |= IFF_OACTIVE;
|
||||
#if DEBUG
|
||||
sc->tfull++;
|
||||
#endif
|
||||
break;
|
||||
|
||||
found:
|
||||
IFQ_DEQUEUE(&ifp->if_snd, m);
|
||||
if (m == 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* If BPF is listening on this interface, let it see the packet
|
||||
* before we commit it to the wire.
|
||||
*/
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp, m);
|
||||
|
||||
/*
|
||||
* Copy the mbuf chain into a contiguous transmit buffer.
|
||||
*/
|
||||
len = enic_put(sc, &m);
|
||||
if (len == 0)
|
||||
break; /* sanity */
|
||||
if (len > (ETHERMTU + sizeof(struct ether_header))) {
|
||||
printf("enic? tlen %d > %d\n", len, ETHERMTU + sizeof(struct ether_header));
|
||||
len = ETHERMTU + sizeof(struct ether_header);
|
||||
}
|
||||
|
||||
ifp->if_timer = 5;
|
||||
|
||||
/*
|
||||
* Remember and post the buffer
|
||||
*/
|
||||
phys = kvtophys((vaddr_t)m->m_data);
|
||||
sc->sc_xmit[ix].mbuf = m;
|
||||
sc->sc_xmit[ix].phys = phys;
|
||||
|
||||
sc->sc_no_td++;
|
||||
|
||||
tpostone(phys,len);
|
||||
|
||||
if (sc->sc_regs->Control & EC_IF_FULL) {
|
||||
ifp->if_flags |= IFF_OACTIVE;
|
||||
#if DEBUG
|
||||
sc->tfull2++;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
ix++;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int enic_put(struct enic_softc *sc, struct mbuf **pm)
|
||||
{
|
||||
struct mbuf *n, *m = *pm, *mm;
|
||||
int len, tlen = 0, xlen = m->m_pkthdr.len;
|
||||
uint8_t *cp;
|
||||
|
||||
#if 0
|
||||
/* drop garbage */
|
||||
tlen = xlen;
|
||||
for (; m; m = n) {
|
||||
len = m->m_len;
|
||||
if (len == 0) {
|
||||
MFREE(m, n);
|
||||
if (m == *pm) *pm = n;
|
||||
continue;
|
||||
}
|
||||
tlen -= len;
|
||||
KASSERT(m != m->m_next);
|
||||
n = m->m_next;
|
||||
if (tlen <= 0) break;
|
||||
}
|
||||
|
||||
/* We might be done: (a) empty chain (b) only one segment (c) bad chain */
|
||||
if (((m = *pm) == NULL) || (tlen > 0))
|
||||
xlen = 0;
|
||||
#endif
|
||||
|
||||
if ((xlen == 0) || (xlen <= m->m_len)) {
|
||||
#if DEBUG
|
||||
sc->xhit++;
|
||||
#endif
|
||||
return xlen;
|
||||
}
|
||||
|
||||
/* Nope, true chain. Copy to contig :-(( */
|
||||
tlen = xlen;
|
||||
MGETHDR(n, M_NOWAIT, MT_DATA);
|
||||
if (n == 0)
|
||||
goto Bad;
|
||||
n->m_pkthdr.rcvif = &sc->sc_ethercom.ec_if;
|
||||
n->m_pkthdr.len = tlen;
|
||||
|
||||
MCLGET(n, M_NOWAIT);
|
||||
if ((n->m_flags & M_EXT) == 0) {
|
||||
m_freem(n);
|
||||
goto Bad;
|
||||
}
|
||||
|
||||
n->m_len = tlen;
|
||||
cp = mtod(n, uint8_t *);
|
||||
for (; m && tlen; m = mm) {
|
||||
|
||||
len = m->m_len;
|
||||
if (len > tlen) len = tlen;
|
||||
if (len)
|
||||
memcpy(cp, mtod(m, void *), len);
|
||||
|
||||
cp += len;
|
||||
tlen -= len;
|
||||
MFREE(m, mm);
|
||||
|
||||
}
|
||||
|
||||
*pm = n;
|
||||
#if DEBUG
|
||||
sc->xmiss++;
|
||||
#endif
|
||||
return (xlen);
|
||||
|
||||
Bad:
|
||||
printf("enic_put: no mem?\n");
|
||||
m_freem(m);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: lcd_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: lcd_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#define STUBNAME lcd
|
||||
#define STUBSTRING "lcd"
|
||||
#define STUBBANNER "LCD"
|
||||
#define STUBSTRUCT _Lcd
|
||||
#define STUBMATCH(_f_) (((_f_)->TypeAndTag & LCDBT_TAG) == PMTTAG_LCD)
|
||||
|
||||
#define stub_ebus_match __CONCAT(lcd,_ebus_match)
|
||||
#define stub_ebus_attach __CONCAT(lcd,_ebus_attach)
|
||||
#define stub_ebus __CONCAT(lcd,_ebus)
|
||||
#define stub_softc __CONCAT(lcd,_softc)
|
||||
#define stubopen __CONCAT(lcd,open)
|
||||
#define stubclose __CONCAT(lcd,close)
|
||||
#define stub_cdevsw __CONCAT(lcd,_cdevsw)
|
||||
|
||||
#include "stub_ebus.c"
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: ps2_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ps2_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#define STUBNAME pstwo
|
||||
#define STUBSTRING "ps2"
|
||||
#define STUBBANNER "PS2 port"
|
||||
#define STUBSTRUCT _Cpbdi
|
||||
#define STUBMATCH(_f_) ((_f_)->Tag == PMTTAG_PS2)
|
||||
|
||||
#define stub_ebus_match __CONCAT(pstwo,_ebus_match)
|
||||
#define stub_ebus_attach __CONCAT(pstwo,_ebus_attach)
|
||||
#define stub_ebus __CONCAT(pstwo,_ebus)
|
||||
#define stub_softc __CONCAT(pstwo,_softc)
|
||||
#define stubopen __CONCAT(pstwo,open)
|
||||
#define stubclose __CONCAT(pstwo,close)
|
||||
#define stub_cdevsw __CONCAT(pstwo,_cdevsw)
|
||||
|
||||
#include "stub_ebus.c"
|
|
@ -0,0 +1,130 @@
|
|||
/* $NetBSD: stub_ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Before including this file for "foo" you need to define
|
||||
#define STUBSTRING "foo"
|
||||
#define STUBBANNER "8MB flash memory" -- tell the user what it is
|
||||
#define STUBSTRUCT _Flash -- whatever that struct is defined in emipsreg.h
|
||||
#define STUBMATCH(_f_) (((_f_)->BaseAddressAndTag & FLASHBT_TAG) == PMTTAG_FLASH)
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <emips/ebus/ebusvar.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
/*
|
||||
* Device softc
|
||||
*/
|
||||
struct stub_softc {
|
||||
struct device sc_dev;
|
||||
struct STUBSTRUCT *sc_dp;
|
||||
};
|
||||
|
||||
static int stub_ebus_match (struct device *, struct cfdata *, void *);
|
||||
static void stub_ebus_attach (struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(stub_ebus, sizeof (struct stub_softc),
|
||||
stub_ebus_match, stub_ebus_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
stub_ebus_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia = aux;
|
||||
struct STUBSTRUCT *f = (struct STUBSTRUCT *)ia->ia_vaddr;
|
||||
|
||||
if (strcmp(STUBSTRING, ia->ia_name) != 0)
|
||||
return (0);
|
||||
if ((f == NULL) || (! STUBMATCH(f)))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
stub_ebus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ebus_attach_args *ia =aux;
|
||||
struct stub_softc *sc = (struct stub_softc *)self;
|
||||
|
||||
sc->sc_dp = (struct STUBSTRUCT*)ia->ia_vaddr;
|
||||
|
||||
#if DEBUG
|
||||
printf(" virt=%p", (void*)sc->sc_dp);
|
||||
#endif
|
||||
printf(": %s\n", STUBBANNER);
|
||||
|
||||
}
|
||||
|
||||
/* Required funcs
|
||||
*/
|
||||
static int stubopen(dev_t device, int flags, int fmt, struct lwp *process);
|
||||
static int stubclose(dev_t device, int flags, int fmt, struct lwp *process);
|
||||
|
||||
/* just define the character device handlers because that is all we need */
|
||||
const struct cdevsw stub_cdevsw = {
|
||||
stubopen,
|
||||
stubclose,
|
||||
noread,
|
||||
nowrite,
|
||||
noioctl,
|
||||
nostop,
|
||||
notty,
|
||||
nopoll,
|
||||
nommap,
|
||||
nokqfilter,
|
||||
};
|
||||
|
||||
/*
|
||||
* Handle an open request on the device.
|
||||
*/
|
||||
static int
|
||||
stubopen(dev_t device, int flags, int fmt, struct lwp *process)
|
||||
{
|
||||
return 0; /* this always succeeds */
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the close request for the device.
|
||||
*/
|
||||
static int
|
||||
stubclose(dev_t device, int flags, int fmt, struct lwp *process)
|
||||
{
|
||||
return 0; /* again this always succeeds */
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/* $NetBSD: autoconf.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
* from: Utah Hdr: autoconf.c 1.31 91/01/21
|
||||
*
|
||||
* @(#)autoconf.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* from: Utah Hdr: autoconf.c 1.31 91/01/21
|
||||
*
|
||||
* @(#)autoconf.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/sysconf.h>
|
||||
|
||||
static int booted_bus, booted_unit;
|
||||
static const char *booted_controller;
|
||||
|
||||
/*
|
||||
* Configure all devices on system
|
||||
*/
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
/* Kick off autoconfiguration. */
|
||||
(void)splhigh();
|
||||
|
||||
evcnt_attach_static(&emips_clock_evcnt);
|
||||
evcnt_attach_static(&emips_fpu_evcnt);
|
||||
evcnt_attach_static(&emips_memerr_evcnt);
|
||||
|
||||
if (config_rootfound("mainbus", NULL) == NULL)
|
||||
panic("no mainbus found");
|
||||
|
||||
/* Reset any bus errors due to probing nonexistent devices. */
|
||||
(*platform.bus_reset)();
|
||||
|
||||
/* Configuration is finished, turn on interrupts. */
|
||||
_splnone(); /* enable all source forcing SOFT_INTs cleared */
|
||||
}
|
||||
|
||||
/*
|
||||
* Look at the string 'cp' and decode the boot device.
|
||||
* Boot names are something like '0/ace(0,0)/netbsd' or 'tftp()/nfsnetbsd'
|
||||
* meaning: [BusNumber/]<ControllerName>([<DiskNumber>,<PartitionNumber])/<kernelname>
|
||||
*/
|
||||
void
|
||||
makebootdev(char *cp)
|
||||
{
|
||||
int i;
|
||||
static char booted_controller_name[8];
|
||||
|
||||
booted_device = NULL;
|
||||
booted_bus = booted_unit = booted_partition = 0;
|
||||
booted_controller = NULL;
|
||||
|
||||
if (*cp >= '0' && *cp <= '9') {
|
||||
booted_bus = *cp++ - '0';
|
||||
if (*cp == '/') cp++;
|
||||
}
|
||||
|
||||
if (strncmp(cp, "tftp(", 5) == 0) {
|
||||
booted_controller = "BOOTP";
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Stash away the controller name and use it later
|
||||
*/
|
||||
for (i = 0; i < 7 && *cp && *cp != '('; i++)
|
||||
booted_controller_name[i] = *cp++;
|
||||
booted_controller_name[7] = 0; /* sanity */
|
||||
|
||||
if (*cp == '(') cp++;
|
||||
if (*cp >= '0' && *cp <= '9')
|
||||
booted_unit = *cp++ - '0';
|
||||
|
||||
if (*cp == ',') cp++;
|
||||
if (*cp >= '0' && *cp <= '9')
|
||||
booted_partition = *cp - '0';
|
||||
booted_controller = booted_controller_name;
|
||||
|
||||
out:
|
||||
#if DEBUG
|
||||
printf("bootdev: %d/%s(%d,%d)\n",booted_bus,booted_controller,booted_unit,booted_partition);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
printf("boot device: %s part%d\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>",
|
||||
booted_partition);
|
||||
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to determine the boot device.
|
||||
*/
|
||||
void
|
||||
device_register(struct device *dev,
|
||||
void *aux)
|
||||
{
|
||||
static int found, initted, netboot;
|
||||
static struct device *ebusdev;
|
||||
struct device *parent = device_parent(dev);
|
||||
|
||||
if (found)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
printf("\n[device_register(%s,%d) class %d]\n", dev->dv_xname, dev->dv_unit, dev->dv_class);
|
||||
#endif
|
||||
|
||||
if (!initted) {
|
||||
netboot = (strcmp(booted_controller, "BOOTP") == 0);
|
||||
initted = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remember the EBUS
|
||||
*/
|
||||
if (device_is_a(dev, "ebus")) {
|
||||
ebusdev = dev;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if netbooting.
|
||||
*/
|
||||
if (netboot) {
|
||||
|
||||
/* Only one Ethernet interface (on ebus). */
|
||||
if ((parent == ebusdev)
|
||||
&& device_is_a(dev, "enic")) {
|
||||
booted_device = dev;
|
||||
found = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* allow any network adapter */
|
||||
if (device_class(dev) == DV_IFNET &&
|
||||
device_is_a(parent, "ebus")) {
|
||||
booted_device = dev;
|
||||
found = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* The NIC might be found after the disk, so bail out here */
|
||||
return;
|
||||
}
|
||||
|
||||
/* BUGBUG How would I get to the bus */
|
||||
if (device_is_a(dev,booted_controller) && (dev->dv_unit == booted_unit)) {
|
||||
booted_device = dev;
|
||||
found = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,738 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include "opt_cputype.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#define _EMIPS_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <common/bus_dma/bus_dmamem_common.h>
|
||||
|
||||
#include <mips/cache.h>
|
||||
|
||||
static int _bus_dmamap_load_buffer(bus_dmamap_t,
|
||||
void *, bus_size_t, struct vmspace *, int, vaddr_t *,
|
||||
int *, int);
|
||||
|
||||
paddr_t kvtophys(vaddr_t); /* XXX */
|
||||
|
||||
/*
|
||||
* The default DMA tag for all busses on the DECstation.
|
||||
*/
|
||||
struct emips_bus_dma_tag emips_default_bus_dma_tag = {
|
||||
_bus_dmamap_create,
|
||||
_bus_dmamap_destroy,
|
||||
_bus_dmamap_load,
|
||||
_bus_dmamap_load_mbuf,
|
||||
_bus_dmamap_load_uio,
|
||||
_bus_dmamap_load_raw,
|
||||
_bus_dmamap_unload,
|
||||
NULL,
|
||||
_bus_dmamem_alloc,
|
||||
_bus_dmamem_free,
|
||||
_bus_dmamem_map,
|
||||
_bus_dmamem_unmap,
|
||||
_bus_dmamem_mmap,
|
||||
};
|
||||
|
||||
void
|
||||
emips_bus_dma_init(void)
|
||||
{
|
||||
#ifdef MIPS1
|
||||
if (CPUISMIPS3 == 0)
|
||||
emips_default_bus_dma_tag._dmamap_sync = _bus_dmamap_sync_r3k;
|
||||
#endif
|
||||
#ifdef MIPS3
|
||||
if (CPUISMIPS3)
|
||||
emips_default_bus_dma_tag._dmamap_sync = _bus_dmamap_sync_r4k;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map creation. May be called by bus-specific
|
||||
* DMA map creation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
||||
bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
|
||||
{
|
||||
struct emips_bus_dmamap *map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
/*
|
||||
* Allocate and initialize the DMA map. The end of the map
|
||||
* is a variable-sized array of segments, so we allocate enough
|
||||
* room for them in one shot.
|
||||
*
|
||||
* Note we don't preserve the WAITOK or NOWAIT flags. Preservation
|
||||
* of ALLOCNOW notifies others that we've reserved these resources,
|
||||
* and they are not to be freed.
|
||||
*
|
||||
* The bus_dmamap_t includes one bus_dma_segment_t, hence
|
||||
* the (nsegments - 1).
|
||||
*/
|
||||
mapsize = sizeof(struct emips_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
memset(mapstore, 0, mapsize);
|
||||
map = (struct emips_bus_dmamap *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
map->_dm_maxmaxsegsz = maxsegsz;
|
||||
map->_dm_boundary = boundary;
|
||||
map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
|
||||
map->_dm_vmspace = NULL;
|
||||
map->dm_maxsegsz = maxsegsz;
|
||||
map->dm_mapsize = 0; /* no valid mappings */
|
||||
map->dm_nsegs = 0;
|
||||
|
||||
*dmamp = map;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map destruction. May be called by bus-specific
|
||||
* DMA map destruction functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to load a linear buffer. lastaddrp holds state
|
||||
* between invocations (for multiple-buffer loads). segp contains
|
||||
* the starting segment on entrance, and the ending segment on exit.
|
||||
* first indicates if this is the first invocation of this function.
|
||||
*/
|
||||
static int
|
||||
_bus_dmamap_load_buffer(bus_dmamap_t map, void *buf, bus_size_t buflen,
|
||||
struct vmspace *vm, int flags, vaddr_t *lastaddrp, int *segp, int first)
|
||||
{
|
||||
bus_size_t sgsize;
|
||||
paddr_t pa;
|
||||
bus_addr_t curaddr, lastaddr, baddr, bmask;
|
||||
vaddr_t vaddr = (vaddr_t)buf;
|
||||
int seg;
|
||||
|
||||
lastaddr = *lastaddrp;
|
||||
bmask = ~(map->_dm_boundary - 1);
|
||||
|
||||
for (seg = *segp; buflen > 0 ; ) {
|
||||
/*
|
||||
* Get the physical address for this segment.
|
||||
*/
|
||||
if (!VMSPACE_IS_KERNEL_P(vm))
|
||||
(void) pmap_extract(vm_map_pmap(&vm->vm_map),
|
||||
vaddr, &pa);
|
||||
else
|
||||
pa = kvtophys(vaddr);
|
||||
curaddr = pa;
|
||||
|
||||
/*
|
||||
* Compute the segment size, and adjust counts.
|
||||
*/
|
||||
sgsize = PAGE_SIZE - (vaddr & PGOFSET);
|
||||
if (buflen < sgsize)
|
||||
sgsize = buflen;
|
||||
|
||||
/*
|
||||
* Make sure we don't cross any boundaries.
|
||||
*/
|
||||
if (map->_dm_boundary > 0) {
|
||||
baddr = (curaddr + map->_dm_boundary) & bmask;
|
||||
if (sgsize > (baddr - curaddr))
|
||||
sgsize = (baddr - curaddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert chunk into a segment, coalescing with
|
||||
* the previous segment if possible.
|
||||
*/
|
||||
if (first) {
|
||||
map->dm_segs[seg].ds_addr = curaddr;
|
||||
map->dm_segs[seg].ds_len = sgsize;
|
||||
map->dm_segs[seg]._ds_vaddr = vaddr;
|
||||
first = 0;
|
||||
} else {
|
||||
if (curaddr == lastaddr &&
|
||||
(map->dm_segs[seg].ds_len + sgsize) <=
|
||||
map->dm_maxsegsz &&
|
||||
(map->_dm_boundary == 0 ||
|
||||
(map->dm_segs[seg].ds_addr & bmask) ==
|
||||
(curaddr & bmask)))
|
||||
map->dm_segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= map->_dm_segcnt)
|
||||
break;
|
||||
map->dm_segs[seg].ds_addr = curaddr;
|
||||
map->dm_segs[seg].ds_len = sgsize;
|
||||
map->dm_segs[seg]._ds_vaddr = vaddr;
|
||||
}
|
||||
}
|
||||
|
||||
lastaddr = curaddr + sgsize;
|
||||
vaddr += sgsize;
|
||||
buflen -= sgsize;
|
||||
}
|
||||
|
||||
*segp = seg;
|
||||
*lastaddrp = lastaddr;
|
||||
|
||||
/*
|
||||
* Did we fit?
|
||||
*/
|
||||
if (buflen != 0)
|
||||
return EFBIG; /* XXX better return value here? */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for loading a direct-mapped DMA map with a linear
|
||||
* buffer.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
bus_size_t buflen, struct proc *p, int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, error;
|
||||
struct vmspace *vm;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings".
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
|
||||
|
||||
if (buflen > map->_dm_size)
|
||||
return EINVAL;
|
||||
|
||||
if (p != NULL) {
|
||||
vm = p->p_vmspace;
|
||||
} else {
|
||||
vm = vmspace_kernel();
|
||||
}
|
||||
|
||||
seg = 0;
|
||||
error = _bus_dmamap_load_buffer(map, buf, buflen,
|
||||
vm, flags, &lastaddr, &seg, 1);
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = buflen;
|
||||
map->dm_nsegs = seg + 1;
|
||||
map->_dm_vmspace = vm;
|
||||
|
||||
/*
|
||||
* For linear buffers, we support marking the mapping
|
||||
* as COHERENT.
|
||||
*
|
||||
* XXX Check TLB entries for cache-inhibit bits?
|
||||
*/
|
||||
if (buf >= (void *)MIPS_KSEG1_START &&
|
||||
buf < (void *)MIPS_KSEG2_START)
|
||||
map->_dm_flags |= EMIPS_DMAMAP_COHERENT;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for mbufs.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
|
||||
int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, error, first;
|
||||
struct mbuf *m;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings."
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((m0->m_flags & M_PKTHDR) == 0)
|
||||
panic("_bus_dmamap_load_mbuf: no packet header");
|
||||
#endif
|
||||
|
||||
if (m0->m_pkthdr.len > map->_dm_size)
|
||||
return (EINVAL);
|
||||
|
||||
first = 1;
|
||||
seg = 0;
|
||||
error = 0;
|
||||
for (m = m0; m != NULL && error == 0; m = m->m_next) {
|
||||
if (m->m_len == 0)
|
||||
continue;
|
||||
error = _bus_dmamap_load_buffer(map, m->m_data, m->m_len,
|
||||
vmspace_kernel(), flags, &lastaddr, &seg, first);
|
||||
first = 0;
|
||||
}
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = m0->m_pkthdr.len;
|
||||
map->dm_nsegs = seg + 1;
|
||||
map->_dm_vmspace = vmspace_kernel(); /* always kernel */
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for uios.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
||||
int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, i, error, first;
|
||||
bus_size_t minlen, resid;
|
||||
struct iovec *iov;
|
||||
void *addr;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings."
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
|
||||
|
||||
resid = uio->uio_resid;
|
||||
iov = uio->uio_iov;
|
||||
|
||||
first = 1;
|
||||
seg = 0;
|
||||
error = 0;
|
||||
for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
|
||||
/*
|
||||
* Now at the first iovec to load. Load each iovec
|
||||
* until we have exhausted the residual count.
|
||||
*/
|
||||
minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
|
||||
addr = iov[i].iov_base;
|
||||
|
||||
error = _bus_dmamap_load_buffer(map, addr, minlen,
|
||||
uio->uio_vmspace, flags, &lastaddr, &seg, first);
|
||||
first = 0;
|
||||
|
||||
resid -= minlen;
|
||||
}
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = uio->uio_resid;
|
||||
map->dm_nsegs = seg + 1;
|
||||
map->_dm_vmspace = uio->uio_vmspace;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for raw memory.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
|
||||
int nsegs, bus_size_t size, int flags)
|
||||
{
|
||||
|
||||
panic("_bus_dmamap_load_raw: not implemented");
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for unloading a DMA map. May be called by
|
||||
* chipset-specific DMA map unload functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
/*
|
||||
* No resources to free; just mark the mappings as
|
||||
* invalid.
|
||||
*/
|
||||
map->dm_maxsegsz = map->_dm_maxmaxsegsz;
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
map->_dm_flags &= ~EMIPS_DMAMAP_COHERENT;
|
||||
map->_dm_vmspace = NULL;
|
||||
}
|
||||
|
||||
#ifdef MIPS1
|
||||
/*
|
||||
* Common function for DMA map synchronization. May be called
|
||||
* by chipset-specific DMA map synchronization functions.
|
||||
*
|
||||
* This is the R3000 version.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_sync_r3k(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
bus_size_t minlen;
|
||||
bus_addr_t addr;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Mixing PRE and POST operations is not allowed.
|
||||
*/
|
||||
if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
|
||||
(ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
|
||||
panic("_bus_dmamap_sync_r3k: mix PRE and POST");
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (offset >= map->dm_mapsize)
|
||||
panic("_bus_dmamap_sync_r3k: bad offset %lu (map size is %lu)",
|
||||
offset, map->dm_mapsize);
|
||||
if (len == 0 || (offset + len) > map->dm_mapsize)
|
||||
panic("_bus_dmamap_sync_r3k: bad length");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The R3000 cache is write-though. Therefore, we only need
|
||||
* to drain the write buffer on PREWRITE. The cache is not
|
||||
* coherent, however, so we need to invalidate the data cache
|
||||
* on PREREAD (should we do it POSTREAD instead?).
|
||||
*
|
||||
* POSTWRITE (and POSTREAD, currently) are noops.
|
||||
*/
|
||||
|
||||
if (ops & BUS_DMASYNC_PREWRITE) {
|
||||
/*
|
||||
* Flush the write buffer.
|
||||
*/
|
||||
wbflush();
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're not doing PREREAD, nothing more to do.
|
||||
*/
|
||||
if ((ops & BUS_DMASYNC_PREREAD) == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* No cache invlidation is necessary if the DMA map covers
|
||||
* COHERENT DMA-safe memory (which is mapped un-cached).
|
||||
*/
|
||||
if (map->_dm_flags & EMIPS_DMAMAP_COHERENT)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If we are going to hit something as large or larger
|
||||
* than the entire data cache, just nail the whole thing.
|
||||
*
|
||||
* NOTE: Even though this is `wbinv_all', since the cache is
|
||||
* write-though, it just invalidates it.
|
||||
*/
|
||||
if (len >= mips_pdcache_size) {
|
||||
mips_dcache_wbinv_all();
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < map->dm_nsegs && len != 0; i++) {
|
||||
/* Find the beginning segment. */
|
||||
if (offset >= map->dm_segs[i].ds_len) {
|
||||
offset -= map->dm_segs[i].ds_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now at the first segment to sync; nail
|
||||
* each segment until we have exhausted the
|
||||
* length.
|
||||
*/
|
||||
minlen = len < map->dm_segs[i].ds_len - offset ?
|
||||
len : map->dm_segs[i].ds_len - offset;
|
||||
|
||||
addr = map->dm_segs[i].ds_addr;
|
||||
|
||||
#ifdef BUS_DMA_DEBUG
|
||||
printf("bus_dmamap_sync_r3k: flushing segment %d "
|
||||
"(0x%lx..0x%lx) ...", i, addr + offset,
|
||||
addr + offset + minlen - 1);
|
||||
#endif
|
||||
mips_dcache_inv_range(
|
||||
MIPS_PHYS_TO_KSEG0(addr + offset), minlen);
|
||||
#ifdef BUS_DMA_DEBUG
|
||||
printf("\n");
|
||||
#endif
|
||||
offset = 0;
|
||||
len -= minlen;
|
||||
}
|
||||
}
|
||||
#endif /* MIPS1 */
|
||||
|
||||
#ifdef MIPS3
|
||||
/*
|
||||
* Common function for DMA map synchronization. May be called
|
||||
* by chipset-specific DMA map synchronization functions.
|
||||
*
|
||||
* This is the R4000 version.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_sync_r4k(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
bus_size_t minlen;
|
||||
bus_addr_t addr;
|
||||
int i, useindex;
|
||||
|
||||
/*
|
||||
* Mixing PRE and POST operations is not allowed.
|
||||
*/
|
||||
if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
|
||||
(ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
|
||||
panic("_bus_dmamap_sync_r4k: mix PRE and POST");
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (offset >= map->dm_mapsize)
|
||||
panic("_bus_dmamap_sync_r4k: bad offset %lu (map size is %lu)",
|
||||
offset, map->dm_mapsize);
|
||||
if (len == 0 || (offset + len) > map->dm_mapsize)
|
||||
panic("_bus_dmamap_sync_r4k: bad length");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The R4000 cache is virtually-indexed, write-back. This means
|
||||
* we need to do the following things:
|
||||
*
|
||||
* PREREAD -- Invalidate D-cache. Note we might have
|
||||
* to also write-back here if we have to use an Index
|
||||
* op, or if the buffer start/end is not cache-line aligned.
|
||||
*
|
||||
* PREWRITE -- Write-back the D-cache. If we have to use
|
||||
* an Index op, we also have to invalidate. Note that if
|
||||
* we are doing PREREAD|PREWRITE, we can collapse everything
|
||||
* into a single op.
|
||||
*
|
||||
* POSTREAD -- Nothing.
|
||||
*
|
||||
* POSTWRITE -- Nothing.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Flush the write buffer.
|
||||
* XXX Is this always necessary?
|
||||
*/
|
||||
wbflush();
|
||||
|
||||
ops &= (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
|
||||
if (ops == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If the mapping is of COHERENT DMA-safe memory, no cache
|
||||
* flush is necessary.
|
||||
*/
|
||||
if (map->_dm_flags & EMIPS_DMAMAP_COHERENT)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If the mapping belongs to the kernel, or if it belongs
|
||||
* to the currently-running process (XXX actually, vmspace),
|
||||
* then we can use Hit ops. Otherwise, Index ops.
|
||||
*
|
||||
* This should be true the vast majority of the time.
|
||||
*/
|
||||
if (__predict_true(VMSPACE_IS_KERNEL_P(map->_dm_vmspace) ||
|
||||
map->_dm_vmspace == curproc->p_vmspace))
|
||||
useindex = 0;
|
||||
else
|
||||
useindex = 1;
|
||||
|
||||
for (i = 0; i < map->dm_nsegs && len != 0; i++) {
|
||||
/* Find the beginning segment. */
|
||||
if (offset >= map->dm_segs[i].ds_len) {
|
||||
offset -= map->dm_segs[i].ds_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now at the first segment to sync; nail
|
||||
* each segment until we have exhausted the
|
||||
* length.
|
||||
*/
|
||||
minlen = len < map->dm_segs[i].ds_len - offset ?
|
||||
len : map->dm_segs[i].ds_len - offset;
|
||||
|
||||
addr = map->dm_segs[i]._ds_vaddr;
|
||||
|
||||
#ifdef BUS_DMA_DEBUG
|
||||
printf("bus_dmamap_sync: flushing segment %d "
|
||||
"(0x%lx..0x%lx) ...", i, addr + offset,
|
||||
addr + offset + minlen - 1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we are forced to use Index ops, it's always a
|
||||
* Write-back,Invalidate, so just do one test.
|
||||
*/
|
||||
if (__predict_false(useindex)) {
|
||||
mips_dcache_wbinv_range_index(addr + offset, minlen);
|
||||
#ifdef BUS_DMA_DEBUG
|
||||
printf("\n");
|
||||
#endif
|
||||
offset = 0;
|
||||
len -= minlen;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (ops) {
|
||||
case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
|
||||
mips_dcache_wbinv_range(addr + offset, minlen);
|
||||
break;
|
||||
|
||||
case BUS_DMASYNC_PREREAD:
|
||||
#if 1
|
||||
mips_dcache_wbinv_range(addr + offset, minlen);
|
||||
#else
|
||||
mips_dcache_inv_range(addr + offset, minlen);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case BUS_DMASYNC_PREWRITE:
|
||||
mips_dcache_wb_range(addr + offset, minlen);
|
||||
break;
|
||||
}
|
||||
#ifdef BUS_DMA_DEBUG
|
||||
printf("\n");
|
||||
#endif
|
||||
offset = 0;
|
||||
len -= minlen;
|
||||
}
|
||||
}
|
||||
#endif /* MIPS3 */
|
||||
|
||||
/*
|
||||
* Common function for DMA-safe memory allocation. May be called
|
||||
* by bus-specific DMA memory allocation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
|
||||
int flags)
|
||||
{
|
||||
extern paddr_t avail_start, avail_end; /* XXX */
|
||||
|
||||
return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
|
||||
segs, nsegs, rsegs, flags,
|
||||
avail_start /*low*/,
|
||||
avail_end - PAGE_SIZE /*high*/));
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for freeing DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory free functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs)
|
||||
{
|
||||
|
||||
_bus_dmamem_free_common(t, segs, nsegs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for mapping DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory map functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
|
||||
size_t size, void **kvap, int flags)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we're only mapping 1 segment, use KSEG0 or KSEG1, to avoid
|
||||
* TLB thrashing.
|
||||
*/
|
||||
if (nsegs == 1) {
|
||||
if (flags & BUS_DMA_COHERENT)
|
||||
*kvap = (void *)MIPS_PHYS_TO_KSEG1(segs[0].ds_addr);
|
||||
else
|
||||
*kvap = (void *)MIPS_PHYS_TO_KSEG0(segs[0].ds_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (_bus_dmamem_map_common(t, segs, nsegs, size, kvap, flags, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for unmapping DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory unmapping functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_unmap(bus_dma_tag_t t, void *kva, size_t size)
|
||||
{
|
||||
|
||||
/*
|
||||
* Nothing to do if we mapped it with KSEG0 or KSEG1 (i.e.
|
||||
* not in KSEG2).
|
||||
*/
|
||||
if (kva >= (void *)MIPS_KSEG0_START &&
|
||||
kva < (void *)MIPS_KSEG2_START)
|
||||
return;
|
||||
|
||||
_bus_dmamem_unmap_common(t, kva, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common functin for mmap(2)'ing DMA-safe memory. May be called by
|
||||
* bus-specific DMA mmap(2)'ing functions.
|
||||
*/
|
||||
paddr_t
|
||||
_bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
|
||||
int prot, int flags)
|
||||
{
|
||||
bus_addr_t rv;
|
||||
|
||||
rv = _bus_dmamem_mmap_common(t, segs, nsegs, off, prot, flags);
|
||||
if (rv == (bus_addr_t)-1)
|
||||
return (-1);
|
||||
|
||||
return (mips_btop((char *)rv));
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/* $NetBSD: bus_space.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Implementation of bus_space mapping for the DECstation.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
bus_space_map(t, bpa, size, flags, bshp)
|
||||
bus_space_tag_t t;
|
||||
bus_addr_t bpa;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
bus_space_handle_t *bshp;
|
||||
{
|
||||
int cacheable = flags & BUS_SPACE_MAP_CACHEABLE;
|
||||
|
||||
/* Mappings on the DECstation are always linear. */
|
||||
if (cacheable)
|
||||
*bshp = MIPS_PHYS_TO_KSEG0(bpa);
|
||||
else
|
||||
*bshp = MIPS_PHYS_TO_KSEG1(bpa);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags,
|
||||
bpap, bshp)
|
||||
bus_space_tag_t t;
|
||||
bus_addr_t rstart, rend;
|
||||
bus_size_t size, alignment, boundary;
|
||||
int flags;
|
||||
bus_addr_t *bpap;
|
||||
bus_space_handle_t *bshp;
|
||||
{
|
||||
|
||||
/*
|
||||
* Not meaningful on any currently-supported DECstation bus.
|
||||
*/
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
bus_space_free(t, bsh, size)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t size;
|
||||
{
|
||||
|
||||
/*
|
||||
* Not meaningful on any currently-supported DECstation bus.
|
||||
*/
|
||||
panic("bus_space_free: shouldn't be here");
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_unmap(t, bsh, size)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t size;
|
||||
{
|
||||
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
bus_space_subregion(t, bsh, offset, size, nbshp)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t offset, size;
|
||||
bus_space_handle_t *nbshp;
|
||||
{
|
||||
|
||||
*nbshp = bsh + offset;
|
||||
return (0);
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/* $NetBSD: clock.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
* from: Utah Hdr: clock.c 1.18 91/01/21
|
||||
*
|
||||
* @(#)clock.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* from: Utah Hdr: clock.c 1.18 91/01/21
|
||||
*
|
||||
* @(#)clock.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
/* Maybe someday will need more flexibility */
|
||||
extern void eclock_init(struct device *dev);
|
||||
|
||||
|
||||
/* Start the real-time and statistics clocks. Leave stathz 0 since there
|
||||
* are no other timers available.
|
||||
*/
|
||||
void
|
||||
cpu_initclocks(void)
|
||||
{
|
||||
eclock_init(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* We assume newhz is either stathz or profhz, and that neither will
|
||||
* change after being set up above. Could recalculate intervals here
|
||||
* but that would be a drag.
|
||||
*/
|
||||
void
|
||||
setstatclockrate(int newhz)
|
||||
{
|
||||
/* nothing we can do */
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/* $NetBSD: cons.h,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Andrew Doran.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _EMIPS_CONS_H_
|
||||
#define _EMIPS_CONS_H_
|
||||
|
||||
void dz_ebus_cnsetup(paddr_t);
|
||||
|
||||
#endif /* _EMIPS_CONS_H_ */
|
|
@ -0,0 +1,71 @@
|
|||
/* $NetBSD: cpu.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <mips/locore.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
static int cpumatch __P((struct device *, struct cfdata *, void *));
|
||||
static void cpuattach __P((struct device *, struct device *, void *));
|
||||
|
||||
CFATTACH_DECL(cpu, sizeof (struct device),
|
||||
cpumatch, cpuattach, NULL, NULL);
|
||||
extern struct cfdriver cpu_cd;
|
||||
|
||||
static int
|
||||
cpumatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
|
||||
/* make sure that we're looking for a CPU. */
|
||||
if (strcmp(ma->ma_name, cpu_cd.cd_name) != 0) {
|
||||
return (0);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
cpuattach(parent, dev, aux)
|
||||
struct device *parent, *dev;
|
||||
void *aux;
|
||||
{
|
||||
|
||||
printf(": ");
|
||||
cpu_identify();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: emipstype.h,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* The Mach Operating System project at Carnegie-Mellon University,
|
||||
* Ralph Campbell and Rick Macklem.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
* @(#)emipstype.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <emips/stand/common/prom_iface.h>
|
||||
|
||||
extern int systype; /* motherboard-type bits from PROM variable */
|
|
@ -0,0 +1,197 @@
|
|||
/* $NetBSD: interrupt.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <mips/psl.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/sysconf.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
struct intrhand intrtab[MAX_DEV_NCOOKIES];
|
||||
|
||||
struct evcnt emips_clock_evcnt =
|
||||
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "clock", "intr");
|
||||
struct evcnt emips_fpu_evcnt =
|
||||
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "fpu", "intr");
|
||||
struct evcnt emips_memerr_evcnt =
|
||||
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "memerr", "intr");
|
||||
|
||||
extern void MachFPInterrupt(unsigned, unsigned, unsigned, struct frame *);
|
||||
|
||||
static const char * const intrnames[MAX_DEV_NCOOKIES] = {
|
||||
"int-0", "int-1", "int-2", "int-3", "int-4",
|
||||
"int-5", "int-6", "int-7", "int-8", "int-9",
|
||||
"int-10", "int-11", "int-12", "int-13", "int-14",
|
||||
"int-15", "int-16", "int-17", "int-18", "int-19",
|
||||
"int-20", "int-21`", "int-22", "int-23", "int-24",
|
||||
"int-25", "int-26", "int-27", "int-28", "int-29",
|
||||
"int-30", "int-31"
|
||||
};
|
||||
|
||||
void
|
||||
intr_init(int phase)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (phase == 0) {
|
||||
for (i = 0; i < MAX_DEV_NCOOKIES; i++)
|
||||
evcnt_attach_dynamic(&intrtab[i].ih_count,
|
||||
EVCNT_TYPE_INTR, NULL, "emips", intrnames[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (phase == 1) {
|
||||
/* I am trying to make this standard so its here. Bah. */
|
||||
struct mips1_tlb {
|
||||
u_int32_t tlb_hi;
|
||||
u_int32_t tlb_lo;
|
||||
} tlb;
|
||||
void mips1_TLBWrite(int, struct mips1_tlb *);
|
||||
|
||||
/* This is ugly but efficient. Sigh. */
|
||||
#define TheAic ((struct _Aic *)INTERRUPT_CONTROLLER_DEFAULT_ADDRESS)
|
||||
|
||||
tlb.tlb_hi = INTERRUPT_CONTROLLER_DEFAULT_ADDRESS;
|
||||
tlb.tlb_lo = INTERRUPT_CONTROLLER_DEFAULT_ADDRESS | 0xf02;
|
||||
mips1_TLBWrite(4, &tlb);
|
||||
tlb.tlb_hi = TIMER_DEFAULT_ADDRESS;
|
||||
tlb.tlb_lo = TIMER_DEFAULT_ADDRESS | 0xf02;
|
||||
mips1_TLBWrite(5, &tlb);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* emips uses one line for all I/O interrupts (0x8000).
|
||||
*/
|
||||
void
|
||||
cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
|
||||
{
|
||||
|
||||
curcpu()->ci_data.cpu_nintr++;
|
||||
|
||||
/* device interrupts */
|
||||
if (ipending & MIPS_INT_MASK_5) {
|
||||
(*platform.iointr)(status, cause, pc, ipending);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
ipending &= (MIPS_SOFT_INT_MASK_1|MIPS_SOFT_INT_MASK_0);
|
||||
if (ipending == 0)
|
||||
return;
|
||||
|
||||
_clrsoftintr(ipending);
|
||||
mips_softint_dispatch(ipending);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Rightmost 1. BUGBUG optimize in assembly
|
||||
*/
|
||||
static int __inline Rightmost1(uint32_t Val);
|
||||
|
||||
static int __inline Rightmost1(uint32_t Val)
|
||||
{
|
||||
uint32_t Mask;
|
||||
|
||||
Mask = Val & -Val;
|
||||
return ((Mask & 0xFFFF0000)!=0) << 4
|
||||
| ((Mask & 0xFF00FF00)!=0) << 3
|
||||
| ((Mask & 0xF0F0F0F0)!=0) << 2
|
||||
| ((Mask & 0xCCCCCCCC)!=0) << 1
|
||||
| ((Mask & 0xAAAAAAAA)!=0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt dispatcher for standard AIC-style interrupt controller
|
||||
*/
|
||||
void
|
||||
emips_aic_intr(unsigned status, unsigned cause, unsigned pc, unsigned ipending)
|
||||
{
|
||||
int index;
|
||||
struct clockframe cf;
|
||||
|
||||
cf.pc = pc;
|
||||
cf.sr = status;
|
||||
|
||||
ipending = TheAic->IrqStatus;
|
||||
|
||||
while (ipending) {
|
||||
/* Take one (most likely, the only one) */
|
||||
index = Rightmost1(ipending);
|
||||
ipending = ipending & ~(1 << index);
|
||||
|
||||
intrtab[index].ih_count.ev_count++;
|
||||
(*intrtab[index].ih_func)(intrtab[index].ih_arg, &cf);
|
||||
}
|
||||
|
||||
/* Not so sure about this. Why dont we just return and reload status? */
|
||||
_splset(MIPS_SR_INT_IE | (status & ~(cause & MIPS_HARD_INT_MASK)));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
emips_intr_establish(struct device *dev, void *cookie, int level,
|
||||
int (*handler) (void *, void *), void *arg)
|
||||
{
|
||||
int index = (int) cookie;
|
||||
|
||||
/*
|
||||
* First disable that interrupt source, in case it was enabled.
|
||||
* This prevents us from getting very confused with ISRs and arguments.
|
||||
*/
|
||||
TheAic->IrqEnableClear = 1 << index;
|
||||
|
||||
/* Second, the argument & isr. */
|
||||
intrtab[index].ih_func = handler;
|
||||
intrtab[index].ih_arg = arg;
|
||||
|
||||
/* Third, enable and done. */
|
||||
TheAic->IrqEnable = 1 << index;
|
||||
}
|
||||
|
||||
const int *ipl2spl_table;
|
||||
|
||||
ipl_cookie_t
|
||||
makeiplcookie(ipl_t ipl)
|
||||
{
|
||||
|
||||
return (ipl_cookie_t){._spl = ipl2spl_table[ipl]};
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
/* $NetBSD: locore_machdep.S,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code was written by Alessandro Forin and Neil Pittman
|
||||
* at Microsoft Research and contributed to The NetBSD Foundation
|
||||
* by Microsoft Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Access to the eMIPS special registers.
|
||||
*/
|
||||
|
||||
#include <mips/asm.h>
|
||||
#include <mips/cpuregs.h>
|
||||
|
||||
.set noreorder
|
||||
.set mips32
|
||||
|
||||
#define MIPS_COP_0_EXT_CTL _(22)
|
||||
#define MIPS_COP_0_EXT_MISS _(23)
|
||||
#define MIPS_COP_0_EXT_HIT _(24)
|
||||
|
||||
/*
|
||||
* Extension control register bits, definitions and semantics
|
||||
*/
|
||||
/* The Opcode field holds the opcode assigned to the given Extension slot (Z).
|
||||
* When this field is written to, the CAM used for decoding the Extension Instructions is updated
|
||||
* (in CAM Decoding mode). The value can be one of the eight Extension Opcodes, or any other opcode
|
||||
* iff the Extension has priority and is meant to mask an existing instruction.
|
||||
*/
|
||||
#define EXTCTL_OP 0xfc000000
|
||||
/* The Kernel/User flag denotes that Extension Z is a Kernel[0] or User[1] mode Extension.
|
||||
*/
|
||||
#define EXTCTL_KU 0x02000000
|
||||
/* The Scope flag denotes that Extension Z is a Local[0] (per process) or Global[1] (shared) Extension.
|
||||
*/
|
||||
#define EXTCTL_SC 0x01000000
|
||||
/* The Peripheral flag denotes that Extension Z is a Peripheral Extension.
|
||||
*/
|
||||
#define EXTCTL_PER 0x00080000
|
||||
/* The Interrupt flag denotes that Extension Z has an interrupt.
|
||||
*/
|
||||
#define EXTCTL_INT 0x00040000
|
||||
/* The Virtual/Physical flag denotes that Extension Z uses Virtual[0] or Physical[0] addresses
|
||||
* when accessing the memory bus.
|
||||
*/
|
||||
#define EXTCTL_VP 0x00020000
|
||||
/* The State field denotes the state of Extension Z. (Loaded, Config, Running, Suspend, etc)
|
||||
*/
|
||||
#define EXTCTL_ST 0x0000f000
|
||||
/* The Priority field denotes the execution priority for Extension Z during arbitration.
|
||||
*/
|
||||
#define EXTCTL_PR 0x00000f00
|
||||
/* The Privileged flag denotes that Extension Z has access to security sensitive system resources.
|
||||
*/
|
||||
#define EXTCTL_PRV 0x00000080
|
||||
/* The Trap flag denotes whether an RI exception will be generated for an Extension Z's instruction
|
||||
* if Extension Z is disabled.
|
||||
*/
|
||||
#define EXTCTL_TR 0x00000010
|
||||
/* The Trapped flag denotes that a trap occurred during Extension Z's last execution and it was unable
|
||||
* to complete.
|
||||
*/
|
||||
#define EXTCTL_TD 0x00000008
|
||||
/* The Clock Enable flag denotes that the clock for Extension Z is active.
|
||||
*/
|
||||
#define EXTCTL_CE 0x00000004
|
||||
/* The Enable flag denotes that Extension Z is enabled for execution.
|
||||
*/
|
||||
#define EXTCTL_EN 0x00000002
|
||||
/* The Loaded flag denotes that Extension Z has been loaded
|
||||
*/
|
||||
#define EXTCTL_LD 0x00000001
|
||||
|
||||
/*
|
||||
* unsigned int acc_get_misses(int op_number);
|
||||
*
|
||||
* Get the number of misses for the given opcode on the current processor
|
||||
* nb: clears the counter too
|
||||
*/
|
||||
LEAF(acc_get_misses)
|
||||
la v0,1f
|
||||
andi a0,a0,7
|
||||
sll a0,a0,3
|
||||
addu a0,v0,a0
|
||||
jr a0
|
||||
nop
|
||||
1:
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 0
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 1
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 2
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 3
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 4
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 5
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 6
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_MISS, 7
|
||||
END(acc_get_misses)
|
||||
|
||||
/*
|
||||
* unsigned int acc_get_hits(int slot_number);
|
||||
*
|
||||
* Get the number of hits for the given accelerator slot on the current processor
|
||||
* nb: clears the counter too
|
||||
*/
|
||||
LEAF(acc_get_hits)
|
||||
la v0,1f
|
||||
andi a0,a0,7
|
||||
sll a0,a0,3
|
||||
addu a0,v0,a0
|
||||
jr a0
|
||||
nop
|
||||
1:
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 0
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 1
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 2
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 3
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 4
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 5
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 6
|
||||
j ra
|
||||
mfc0 v0, MIPS_COP_0_EXT_HIT, 7
|
||||
END(acc_get_hits)
|
||||
|
||||
/*
|
||||
* unsigned int acc_activate(int slot_number, uint32_t value);
|
||||
*
|
||||
* Make the given accelerator slot in/active
|
||||
* Returns the previous value in the control register
|
||||
*/
|
||||
LEAF(acc_activate)
|
||||
la v0,1f
|
||||
andi a0,a0,7
|
||||
sll a0,a0,4
|
||||
addu a0,v0,a0
|
||||
jr a0
|
||||
nop
|
||||
1:
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 0
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 0
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 1
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 1
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 2
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 2
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 3
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 3
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 4
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 4
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 5
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 5
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 6
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 6
|
||||
j ra
|
||||
nop
|
||||
|
||||
mfc0 v0, MIPS_COP_0_EXT_CTL, 7
|
||||
mtc0 a1, MIPS_COP_0_EXT_CTL, 7
|
||||
j ra
|
||||
nop
|
||||
END(acc_activate)
|
|
@ -0,0 +1,802 @@
|
|||
/* $NetBSD: machdep.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department, The Mach Operating System project at
|
||||
* Carnegie-Mellon University and Ralph Campbell.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
* @(#)machdep.c 8.3 (Berkeley) 1/12/94
|
||||
* from: Utah Hdr: machdep.c 1.63 91/04/24
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department, The Mach Operating System project at
|
||||
* Carnegie-Mellon University and Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)machdep.c 8.3 (Berkeley) 1/12/94
|
||||
* from: Utah Hdr: machdep.c 1.63 91/04/24
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <sys/boot_flag.h>
|
||||
#include <sys/ksyms.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
|
||||
|
||||
#include <mips/cache.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <emips/stand/common/prom_iface.h>
|
||||
#include <machine/sysconf.h>
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/locore.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
#include <machine/emipsreg.h>
|
||||
|
||||
#define _EMIPS_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#endif
|
||||
|
||||
extern vaddr_t iospace;
|
||||
extern vsize_t iospace_size;
|
||||
|
||||
#include "ksyms.h"
|
||||
|
||||
/* Our exported CPU info; we can have only one. */
|
||||
struct cpu_info cpu_info_store;
|
||||
|
||||
/*
|
||||
* Extent map to manage I/O register space. We allocate storage for
|
||||
* 32 regions in the map. iomap_ex_malloc_safe will indicate that it's
|
||||
* safe to use malloc() to dynamically allocate region descriptors in
|
||||
* case we run out.
|
||||
*/
|
||||
static long iomap_ex_storage[EXTENT_FIXED_STORAGE_SIZE(32) / sizeof(long)];
|
||||
static struct extent *iomap_ex;
|
||||
static int iomap_ex_malloc_safe;
|
||||
|
||||
/* maps for VM objects */
|
||||
struct vm_map *phys_map = NULL;
|
||||
|
||||
int systype; /* mother board type */
|
||||
char *bootinfo = NULL; /* pointer to bootinfo structure */
|
||||
int cpuspeed = 30; /* approx # instr per usec. */
|
||||
int physmem; /* max supported memory, changes to actual */
|
||||
intptr_t physmem_boardmax; /* {model,SIMM}-specific bound on physmem */
|
||||
int mem_cluster_cnt;
|
||||
phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
|
||||
|
||||
/*
|
||||
* During autoconfiguration or after a panic, a sleep will simply
|
||||
* lower the priority briefly to allow interrupts, then return.
|
||||
* The priority to be used (safepri) is machine-dependent, thus this
|
||||
* value is initialized and maintained in the machine-dependent layers.
|
||||
* This priority will typically be 0, or the lowest priority
|
||||
* that is safe for use on the interrupt stack; it can be made
|
||||
* higher to block network software interrupts after panics.
|
||||
*/
|
||||
/*
|
||||
* safepri is a safe priority for sleep to set for a spin-wait
|
||||
* during autoconfiguration or after a panic.
|
||||
* Used as an argument to splx().
|
||||
*/
|
||||
int safepri = MIPS3_PSL_LOWIPL; /* XXX */
|
||||
|
||||
void mach_init (int, char *[], int, intptr_t, u_int, char *); /* XXX */
|
||||
|
||||
/* Motherboard or system-specific initialization vector */
|
||||
static void unimpl_bus_reset(void);
|
||||
static void unimpl_cons_init(void);
|
||||
static void unimpl_iointr(unsigned, unsigned, unsigned, unsigned);
|
||||
static void unimpl_intr_establish(struct device *, void *, int,
|
||||
int (*)(void *, void *), void *);
|
||||
static int unimpl_memsize(void *);
|
||||
|
||||
struct platform platform = {
|
||||
"iobus not set",
|
||||
unimpl_bus_reset,
|
||||
unimpl_cons_init,
|
||||
unimpl_iointr,
|
||||
unimpl_intr_establish,
|
||||
unimpl_memsize
|
||||
};
|
||||
|
||||
extern char *esym; /* XXX */
|
||||
extern struct consdev promcd; /* XXX */
|
||||
extern const struct callback *callv;
|
||||
extern const struct callback callvec;
|
||||
|
||||
/*
|
||||
* Do all the stuff that locore normally does before calling main().
|
||||
* The first 4 argments are passed by PROM monitor, and remaining two
|
||||
* are built on temporary stack by our boot loader.
|
||||
*/
|
||||
void
|
||||
mach_init(int argc, char *argv[], int code, intptr_t cv, u_int bim, char *bip)
|
||||
{
|
||||
char *cp;
|
||||
const char *bootinfo_msg;
|
||||
u_long first, last;
|
||||
int i, howtoboot;
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
void *ssym = 0;
|
||||
struct btinfo_symtab *bi_syms;
|
||||
#endif
|
||||
void *kernend;
|
||||
extern char edata[], end[]; /* XXX */
|
||||
|
||||
/* Set up bootinfo structure looking at stack. */
|
||||
if (bim == BOOTINFO_MAGIC) {
|
||||
struct btinfo_magic *bi_magic;
|
||||
|
||||
bootinfo = bip;
|
||||
bi_magic = lookup_bootinfo(BTINFO_MAGIC);
|
||||
if (bi_magic == NULL || bi_magic->magic != BOOTINFO_MAGIC)
|
||||
bootinfo_msg =
|
||||
"invalid magic number in bootinfo structure.\n";
|
||||
else
|
||||
bootinfo_msg = NULL;
|
||||
} else
|
||||
bootinfo_msg = "invalid bootinfo pointer (old bootblocks?)\n";
|
||||
|
||||
/*
|
||||
* Look at arguments passed to us and compute boothowto.
|
||||
* Do it before we decide to keep symbols.
|
||||
* NB: "boothowto" is in the BSS.
|
||||
*/
|
||||
howtoboot = 0;
|
||||
#ifdef KADB
|
||||
howtoboot |= RB_KDB;
|
||||
#endif
|
||||
for (i = 1; i < argc; i++) {
|
||||
for (cp = argv[i]; *cp; cp++) {
|
||||
switch (*cp) {
|
||||
|
||||
#define RB_NOSYMBOLS 0x10000000
|
||||
case 'e': /* empty the symtable */
|
||||
howtoboot |= RB_NOSYMBOLS;
|
||||
break;
|
||||
|
||||
case 'n': /* ask for names */
|
||||
howtoboot |= RB_ASKNAME;
|
||||
break;
|
||||
|
||||
case 'N': /* don't ask for names */
|
||||
howtoboot &= ~RB_ASKNAME;
|
||||
break;
|
||||
|
||||
default:
|
||||
BOOT_FLAG(*cp, howtoboot); /* see sys/boot_flag.h */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* clear the BSS segment */
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
bi_syms = lookup_bootinfo(BTINFO_SYMTAB);
|
||||
|
||||
/* Was it a valid bootinfo symtab info? */
|
||||
if ((bi_syms != NULL) && (!(howtoboot & RB_NOSYMBOLS))) {
|
||||
ssym = (void *)(intptr_t)bi_syms->ssym;
|
||||
esym = (void *)(intptr_t)bi_syms->esym;
|
||||
kernend = (void *)mips_round_page(esym);
|
||||
memset(edata, 0, end - edata);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
kernend = (char *)mips_round_page(end);
|
||||
/* should be done by bootloader? */
|
||||
memset(edata, 0, (char *)kernend - (char *)edata);
|
||||
}
|
||||
|
||||
/* Initialize callv so we can do PROM output... */
|
||||
callv = (code == PROM_MAGIC) ? (void *)cv : &callvec;
|
||||
|
||||
/* Use PROM console output until we initialize a console driver. */
|
||||
cn_tab = &promcd;
|
||||
|
||||
#if 1
|
||||
if (bootinfo_msg != NULL)
|
||||
printf(bootinfo_msg);
|
||||
#endif
|
||||
/*
|
||||
* Set the VM page size.
|
||||
*/
|
||||
uvm_setpagesize();
|
||||
|
||||
/*
|
||||
* Copy exception-dispatch code down to exception vector.
|
||||
* Initialize locore-function vector.
|
||||
* Clear out the I and D caches.
|
||||
*/
|
||||
mips_vector_init();
|
||||
|
||||
/*
|
||||
* We know the CPU type now. Initialize our DMA tags (might
|
||||
* need this early, for certain types of console devices!!).
|
||||
*/
|
||||
emips_bus_dma_init();
|
||||
|
||||
/* Look at argv[0] and compute bootdev */
|
||||
makebootdev(argv[0]);
|
||||
|
||||
boothowto = howtoboot & ~RB_NOSYMBOLS;
|
||||
|
||||
/*
|
||||
* Check to see if a mini-root was loaded into memory. It resides
|
||||
* at the start of the next page just after the end of BSS.
|
||||
*/
|
||||
if (boothowto & RB_MINIROOT)
|
||||
kernend = (char *)kernend
|
||||
+ round_page(mfs_initminiroot(kernend));
|
||||
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
/* init symbols if present */
|
||||
if (esym) {
|
||||
ksyms_addsyms_elf((char *)esym - (char *)ssym, ssym, esym);
|
||||
}
|
||||
#endif
|
||||
#ifdef DDB
|
||||
if (boothowto & RB_KDB)
|
||||
Debugger();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize physmem_boardmax; assume no SIMM-bank limits.
|
||||
* Adjust later in model-specific code if necessary.
|
||||
*/
|
||||
physmem_boardmax = MIPS_MAX_MEM_ADDR;
|
||||
|
||||
/*
|
||||
* Determine what model of computer we are running on.
|
||||
*/
|
||||
systype = ((prom_systype() >> 16) & 0xff);
|
||||
if (systype >= nsysinit) {
|
||||
platform_not_supported();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* Machine specific initialization. */
|
||||
(*sysinit[systype].init)();
|
||||
|
||||
/* Interrupt initialization, phase 0 */
|
||||
intr_init(0);
|
||||
|
||||
/* Find out how much memory is available. */
|
||||
physmem = (*platform.memsize)(kernend);
|
||||
|
||||
/*
|
||||
* Load the rest of the available pages into the VM system.
|
||||
* NB: The kernel can span multiple segments.
|
||||
*/
|
||||
for (i = 0, physmem = 0; i < mem_cluster_cnt; ++i) {
|
||||
first = mem_clusters[i].start;
|
||||
if (first < round_page(MIPS_KSEG0_TO_PHYS(kernend)))
|
||||
first = round_page(MIPS_KSEG0_TO_PHYS(kernend));
|
||||
last = mem_clusters[i].start + mem_clusters[i].size;
|
||||
physmem += atop(mem_clusters[i].size);
|
||||
|
||||
/* if the kernel spans multiple segments (does on ML40x) */
|
||||
if (last <= first)
|
||||
continue;
|
||||
|
||||
uvm_page_physload(atop(first), atop(last), atop(first),
|
||||
atop(last), VM_FREELIST_DEFAULT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize error message buffer (at end of core).
|
||||
*/
|
||||
mips_init_msgbuf();
|
||||
|
||||
/*
|
||||
* Initialize the virtual memory system.
|
||||
*/
|
||||
iospace_size = 64*1024; /* BUGBUG make it an option? */
|
||||
pmap_bootstrap();
|
||||
|
||||
mips_init_lwp0_uarea();
|
||||
}
|
||||
|
||||
void
|
||||
mips_machdep_cache_config(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
consinit(void)
|
||||
{
|
||||
/*
|
||||
* Init I/O memory extent map. Must be done before cninit()
|
||||
* is called; we may want to use iospace in the console routines.
|
||||
*/
|
||||
KASSERT(iospace != 0);
|
||||
iomap_ex = extent_create("iomap", iospace,
|
||||
iospace + iospace_size - 1, M_DEVBUF,
|
||||
(void *) iomap_ex_storage, sizeof(iomap_ex_storage),
|
||||
EX_NOCOALESCE|EX_NOWAIT);
|
||||
|
||||
/*
|
||||
* Up until now we have kept the TLB disabled,
|
||||
* and that allowed the "PROM" to work.
|
||||
* Specifically, romputc() and the debugger's getc() functions worked.
|
||||
* Now is the last chance we get to turn it on.
|
||||
* That means no more console I/O until autoconf() [sigh!], or..
|
||||
* The platform-specific code will have to map [1:1 probably]
|
||||
* the I/O registers.
|
||||
*/
|
||||
register_t s = mips_cp0_status_read();
|
||||
s &= ~MIPS_SR_TS;
|
||||
mips_cp0_status_write(s);
|
||||
|
||||
(*platform.cons_init)();
|
||||
|
||||
/* Do NOT call cninit(); It will clobber cn_tab using constab[] which we do not use
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates a virtual range suitable for mapping in physical memory.
|
||||
* Uses resource maps when allocating space, which is allocated from
|
||||
* the IOMAP submap. SIZE is a linear range (NOT vax-pages like the VAX).
|
||||
* If the page requested is bigger than a logical page, space is
|
||||
* allocated from the kernel map instead.
|
||||
*/
|
||||
vaddr_t
|
||||
mips_map_physmem(paddr_t phys, vsize_t size)
|
||||
{
|
||||
vaddr_t addr;
|
||||
int error;
|
||||
static int warned = 0;
|
||||
|
||||
size += phys & PAGE_MASK;
|
||||
if (size >= PAGE_SIZE) {
|
||||
addr = uvm_km_alloc(kernel_map, size, 0, UVM_KMF_VAONLY);
|
||||
if (addr == 0)
|
||||
panic("mips_map_physmem: kernel map full");
|
||||
} else {
|
||||
error = extent_alloc(iomap_ex, size, PAGE_SIZE, 0,
|
||||
EX_FAST | EX_NOWAIT |
|
||||
(iomap_ex_malloc_safe ? EX_MALLOCOK : 0), (u_long *)&addr);
|
||||
if (error) {
|
||||
if (warned++ == 0) /* Warn only once */
|
||||
printf("mips_map_physmem: iomap too small");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
ioaccess(addr, phys, size);
|
||||
#ifdef PHYSMEMDEBUG
|
||||
printf("mips_map_physmem: alloc'ed %lx bytes for paddr %lx, at %lx\n",
|
||||
size, phys, addr);
|
||||
#endif
|
||||
return addr | (phys & PAGE_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmaps the previous mapped (addr, size) pair.
|
||||
*/
|
||||
void
|
||||
mips_unmap_physmem(vaddr_t addr, vsize_t size)
|
||||
{
|
||||
#ifdef PHYSMEMDEBUG
|
||||
printf("mips_unmap_physmem: unmapping %lx bytes at addr %lx\n",
|
||||
size, addr);
|
||||
#endif
|
||||
size += addr & PAGE_MASK;
|
||||
addr &= ~PAGE_MASK;
|
||||
|
||||
iounaccess(addr, size);
|
||||
if (size >= PAGE_SIZE)
|
||||
uvm_km_free(kernel_map, addr, size, UVM_KMF_VAONLY);
|
||||
else if (extent_free(iomap_ex, addr, size,
|
||||
EX_NOWAIT | (iomap_ex_malloc_safe ? EX_MALLOCOK : 0)))
|
||||
printf("mips_unmap_physmem: addr 0x%llx size %llx: "
|
||||
"can't free region\n", (long long)addr, (long long)size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine-dependent startup code: allocate memory for variable-sized
|
||||
* tables.
|
||||
*/
|
||||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
vaddr_t minaddr, maxaddr;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug; /* XXX */
|
||||
int opmapdebug = pmapdebug;
|
||||
|
||||
pmapdebug = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
printf("%s%s", copyright, version);
|
||||
printf("%s\n", cpu_model);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
minaddr = 0;
|
||||
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, 0, false, NULL);
|
||||
|
||||
/*
|
||||
* No need to allocate an mbuf cluster submap. Mbuf clusters
|
||||
* are allocated via the pool allocator, and we use KSEG to
|
||||
* map those pages.
|
||||
*/
|
||||
|
||||
iomap_ex_malloc_safe = 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up information in bootinfo of boot loader.
|
||||
*/
|
||||
void *
|
||||
lookup_bootinfo(int type)
|
||||
{
|
||||
struct btinfo_common *bt;
|
||||
char *help = bootinfo;
|
||||
|
||||
/* Check for a bootinfo record first. */
|
||||
if (help == NULL)
|
||||
return (NULL);
|
||||
|
||||
do {
|
||||
bt = (struct btinfo_common *)help;
|
||||
if (bt->type == type)
|
||||
return ((void *)help);
|
||||
help += bt->next;
|
||||
} while (bt->next != 0 &&
|
||||
(size_t)help < (size_t)bootinfo + BOOTINFO_SIZE);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_reboot(volatile int howto, /* XXX volatile to keep gcc happy */
|
||||
char *bootstr)
|
||||
{
|
||||
int s = 0;
|
||||
|
||||
/* take a snap shot before clobbering any registers */
|
||||
if (curlwp)
|
||||
savectx(curpcb);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (panicstr)
|
||||
stacktrace();
|
||||
#endif
|
||||
|
||||
/* If system is cold, just halt. */
|
||||
if (cold) {
|
||||
howto |= RB_HALT;
|
||||
goto haltsys;
|
||||
}
|
||||
|
||||
/* If "always halt" was specified as a boot flag, obey. */
|
||||
if ((boothowto & RB_HALT) != 0)
|
||||
howto |= RB_HALT;
|
||||
|
||||
boothowto = howto;
|
||||
if ((howto & RB_NOSYNC) == 0) {
|
||||
/*
|
||||
* Synchronize the disks....
|
||||
*/
|
||||
vfs_shutdown();
|
||||
|
||||
/*
|
||||
* If we've been adjusting the clock, the todr
|
||||
* will be out of synch; adjust it now.
|
||||
*/
|
||||
resettodr();
|
||||
}
|
||||
|
||||
/* Disable interrupts. */
|
||||
s = splhigh();
|
||||
|
||||
/* If rebooting and a dump is requested do it. */
|
||||
if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
|
||||
dumpsys();
|
||||
|
||||
haltsys:
|
||||
/* run any shutdown hooks */
|
||||
doshutdownhooks();
|
||||
|
||||
pmf_system_shutdown(boothowto);
|
||||
|
||||
/* Finally, halt/reboot the system. */
|
||||
printf("%s\n\n", ((howto & RB_HALT) != 0) ? "halted." : "rebooting...");
|
||||
|
||||
prom_halt(howto);
|
||||
for (;;) ;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#if defined(MIPS_4GB_PHYSICAL_MEMORY)
|
||||
#define trim_memory(n) n
|
||||
#else
|
||||
#if 0
|
||||
#define TOO_MUCH (MIPS_PHYS_MASK+1)
|
||||
#else
|
||||
#define TOO_MUCH (2*64*1024*1024)
|
||||
#endif
|
||||
u_long trim_memory(uint32_t nbytes);/*cheat*/
|
||||
u_long trim_memory(uint32_t nbytes)
|
||||
{
|
||||
int i;
|
||||
u_long first, last;
|
||||
|
||||
nbytes *= 4096;
|
||||
if (nbytes <= TOO_MUCH)
|
||||
return nbytes;
|
||||
|
||||
/* We have more memory than we can handle */
|
||||
|
||||
mem_clusters[mem_cluster_cnt].start = 0;/* sentinel record */
|
||||
mem_clusters[mem_cluster_cnt].size = 0;
|
||||
for (i = 0; i < mem_cluster_cnt;) {
|
||||
first = mem_clusters[i].start;
|
||||
last = mem_clusters[i].start + mem_clusters[i].size;
|
||||
|
||||
if (first > TOO_MUCH) {
|
||||
printf("Too much memory, ignoring memory "
|
||||
"range %08lx..%08lx\n", first, last);
|
||||
memcpy(mem_clusters+i,mem_clusters+i+1,
|
||||
(sizeof(mem_clusters[0])*(mem_cluster_cnt-i)));
|
||||
mem_cluster_cnt--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (last > TOO_MUCH) {
|
||||
last = TOO_MUCH;
|
||||
printf("Too much memory in cluster %d, trimming "
|
||||
"memory to range %08lx..%08lx\n",
|
||||
i, first, last);
|
||||
mem_clusters[i].size = last - mem_clusters[i].start;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return TOO_MUCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find out how much memory is available by testing memory.
|
||||
*/
|
||||
int
|
||||
memsize_scan(void *first)
|
||||
{
|
||||
int i, mem;
|
||||
char *cp;
|
||||
|
||||
mem = btoc((paddr_t)first - MIPS_KSEG0_START);
|
||||
cp = (char *)MIPS_PHYS_TO_KSEG1(mem << PGSHIFT);
|
||||
while (cp < (char *)physmem_boardmax) {
|
||||
int j;
|
||||
if (badaddr(cp, 4))
|
||||
break;
|
||||
i = *(int *)cp;
|
||||
j = ((int *)cp)[4];
|
||||
*(int *)cp = 0xa5a5a5a5;
|
||||
/*
|
||||
* Data will persist on the bus if we read it right away.
|
||||
* Have to be tricky here.
|
||||
*/
|
||||
((int *)cp)[4] = 0x5a5a5a5a;
|
||||
wbflush();
|
||||
if (*(int *)cp != 0xa5a5a5a5)
|
||||
break;
|
||||
*(int *)cp = i;
|
||||
((int *)cp)[4] = j;
|
||||
cp += PAGE_SIZE;
|
||||
mem++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now that we know how much memory we have, initialize the
|
||||
* mem cluster array.
|
||||
*/
|
||||
mem_clusters[0].start = 0; /* XXX is this correct? */
|
||||
mem_clusters[0].size = ctob(mem);
|
||||
mem_cluster_cnt = 1;
|
||||
|
||||
/* clear any memory error conditions possibly caused by probe */
|
||||
(*platform.bus_reset)();
|
||||
return (mem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out how much memory is available by testing memory, starting at first.
|
||||
* Returns the total number of pages.
|
||||
*/
|
||||
int
|
||||
memsize_pmt(void * first)
|
||||
{
|
||||
int i, mem;
|
||||
struct _Pmt *Pmt = ThePmt;
|
||||
struct _Sram *ram;
|
||||
uint32_t addr, len;
|
||||
|
||||
/*
|
||||
* Build the RAM memory map from the PMT.
|
||||
*/
|
||||
mem = 0;
|
||||
for (i = 0; i < VM_PHYSSEG_MAX; Pmt--) {
|
||||
uint16_t tag = Pmt->Tag;
|
||||
|
||||
if (tag == PMTTAG_END_OF_TABLE)
|
||||
break;
|
||||
|
||||
if ((tag != PMTTAG_SRAM) && (tag != PMTTAG_DDRAM))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Got a memory controller segment,
|
||||
* scan all the controllers in it
|
||||
*/
|
||||
ram = (struct _Sram *)(Pmt->TopOfPhysicalAddress << 16);
|
||||
|
||||
for (;(ram->BaseAddressAndTag & SRAMBT_TAG) == tag;) {
|
||||
addr = ram->BaseAddressAndTag & SRAMBT_BASE;
|
||||
len = ram->Control & SRAMST_SIZE;
|
||||
|
||||
mem_clusters[i].start = addr;
|
||||
mem_clusters[i].size = len;
|
||||
printf("memory segment %2d start %08lx size %08lx\n", i,
|
||||
(long)mem_clusters[i].start,
|
||||
(long)mem_clusters[i].size);
|
||||
i++;
|
||||
mem += len;
|
||||
|
||||
/* SRAM and DDRAM have different sizes */
|
||||
ram = (tag == PMTTAG_SRAM) ? ram+1 : ram+2;
|
||||
}
|
||||
}
|
||||
mem_cluster_cnt = i;
|
||||
|
||||
return trim_memory(btoc(mem));
|
||||
}
|
||||
/*
|
||||
* Ensure all platform vectors are always initialized.
|
||||
*/
|
||||
static void
|
||||
unimpl_bus_reset(void)
|
||||
{
|
||||
|
||||
panic("sysconf.init didn't set bus_reset");
|
||||
}
|
||||
|
||||
static void
|
||||
unimpl_cons_init(void)
|
||||
{
|
||||
|
||||
panic("sysconf.init didn't set cons_init");
|
||||
}
|
||||
|
||||
static void
|
||||
unimpl_iointr(u_int mask, u_int pc, u_int statusreg, u_int causereg)
|
||||
{
|
||||
|
||||
panic("sysconf.init didn't set intr");
|
||||
}
|
||||
|
||||
static void
|
||||
unimpl_intr_establish(struct device *dev, void *cookie, int level,
|
||||
int (*handler) (void *,void *), void *arg)
|
||||
{
|
||||
|
||||
panic("sysconf.init didn't set intr_establish");
|
||||
}
|
||||
|
||||
static int
|
||||
unimpl_memsize(void * first)
|
||||
{
|
||||
|
||||
panic("sysconf.init didn't set memsize");
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait "n" microseconds.
|
||||
*/
|
||||
void
|
||||
delay(int n)
|
||||
{
|
||||
|
||||
DELAY(n);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: machdep.h,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Jonathan Stone. 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 Jonathan Stone for
|
||||
* the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* PROM callback routines - see emips/promcall.c */
|
||||
void prom_halt (int howto) __attribute__((__noreturn__));
|
||||
int prom_systype (void);
|
||||
|
||||
/* I/O space mapping, when outside the K1SEG
|
||||
*/
|
||||
vaddr_t mips_map_physmem(paddr_t phys, vsize_t size);
|
||||
void mips_unmap_physmem(vaddr_t addr, vsize_t size);
|
|
@ -0,0 +1,91 @@
|
|||
/* $NetBSD: mainbus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
* DECstation port: Jonathan Stone
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/sysconf.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
/* Definition of the mainbus driver. */
|
||||
static int mbmatch(struct device *, struct cfdata *, void *);
|
||||
static void mbattach(struct device *, struct device *, void *);
|
||||
static int mbprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(mainbus, sizeof(struct device),
|
||||
mbmatch, mbattach, NULL, NULL);
|
||||
|
||||
static int mainbus_found;
|
||||
|
||||
static int
|
||||
mbmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
if (mainbus_found)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ncpus = 0; /* only support uniprocessors, for now */
|
||||
|
||||
static void
|
||||
mbattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct mainbus_attach_args ma;
|
||||
|
||||
mainbus_found = 1;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Interrupt initialization, phase 1 */
|
||||
intr_init(1);
|
||||
|
||||
ma.ma_name = "cpu";
|
||||
ma.ma_slot = 0;
|
||||
config_found(self, &ma, mbprint);
|
||||
|
||||
ma.ma_name = platform.iobus;
|
||||
ma.ma_slot = 0;
|
||||
config_found(self, &ma, mbprint);
|
||||
}
|
||||
|
||||
static int
|
||||
mbprint(void *aux, const char *pnp)
|
||||
{
|
||||
|
||||
if (pnp)
|
||||
return (QUIET);
|
||||
return (UNCONF);
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
|
||||
/* $NetBSD: promcall.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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. 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.
|
||||
*
|
||||
* from: Utah Hdr: cons.c 1.1 90/07/09
|
||||
*
|
||||
* @(#)cons.c 8.2 (Berkeley) 1/11/94
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* from: Utah Hdr: cons.c 1.1 90/07/09
|
||||
*
|
||||
* @(#)cons.c 8.2 (Berkeley) 1/11/94
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: promcall.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <mips/cpuregs.h>
|
||||
#include <emips/stand/common/prom_iface.h>
|
||||
#include <emips/emips/machdep.h>
|
||||
|
||||
static int romgetc(dev_t);
|
||||
static void romputc(dev_t, int);
|
||||
static void *nope(void);
|
||||
static int nogetchar(void);
|
||||
static void noprintf(const char *, ...);
|
||||
static int nogetsysid(void);
|
||||
static void nohalt(int *, int);
|
||||
|
||||
/* Callback vector. We keep this fall-back copy jic the bootloader is broken.
|
||||
*/
|
||||
static void *nope(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int nogetchar(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void noprintf(const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
static int nogetsysid(void)
|
||||
{
|
||||
/* say its an eMIPS, ML board */
|
||||
return MAKESYSID(1,1,XS_ML40x,MIPS_eMIPS);
|
||||
}
|
||||
|
||||
static void nohalt(int *unused, int howto)
|
||||
{
|
||||
while(1) ; /* fool gcc */
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
const struct callback callvec = {
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nogetchar,
|
||||
nope,
|
||||
nope,
|
||||
noprintf,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nogetsysid,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nope,
|
||||
nohalt
|
||||
};
|
||||
|
||||
const struct callback *callv = &callvec;
|
||||
|
||||
/*
|
||||
* Default consdev, for errors or warnings before
|
||||
* consinit runs: use the PROM.
|
||||
*/
|
||||
struct consdev promcd = {
|
||||
NULL, /* probe */
|
||||
NULL, /* init */
|
||||
romgetc, /* getc */
|
||||
romputc, /* putc */
|
||||
nullcnpollc, /* pollc */
|
||||
NULL, /* bell */
|
||||
makedev(0, 0),
|
||||
CN_DEAD,
|
||||
};
|
||||
|
||||
/*
|
||||
* Get character from PROM console.
|
||||
*/
|
||||
static int
|
||||
romgetc(dev_t dev)
|
||||
{
|
||||
int chr, s;
|
||||
|
||||
s = splhigh();
|
||||
chr = (*callv->_getchar)();
|
||||
splx(s);
|
||||
return chr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a character on PROM console.
|
||||
*/
|
||||
static void
|
||||
romputc(dev_t dev,
|
||||
int c)
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
(*callv->_printf)("%c", c);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get 32bit system type:
|
||||
* cputype, u_int8_t [3]
|
||||
* systype, u_int8_t [2]
|
||||
* firmware revision, u_int8_t [1]
|
||||
* hardware revision. u_int8_t [0]
|
||||
*/
|
||||
int
|
||||
prom_systype(void)
|
||||
{
|
||||
return (*callv->_getsysid)();
|
||||
}
|
||||
|
||||
/*
|
||||
* Halt/reboot machine.
|
||||
*/
|
||||
void __attribute__((__noreturn__))
|
||||
prom_halt(int howto)
|
||||
{
|
||||
(*callv->_halt)((int *)0, howto);
|
||||
while(1) ; /* fool gcc */
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/* $NetBSD: sysconf.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christopher G. Demetriou
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysconf.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <machine/sysconf.h>
|
||||
#include <emips/emips/emipstype.h>
|
||||
|
||||
#include "opt_xilinx_ml40x.h"
|
||||
#ifdef XILINX_ML40X
|
||||
void xilinx_ml40x_init (void);
|
||||
#else
|
||||
# define xilinx_ml40x_init platform_not_configured
|
||||
#endif
|
||||
|
||||
#include "opt_xs_bee3.h"
|
||||
#ifdef XS_BEE3
|
||||
void xs_bee3_init (void);
|
||||
#else
|
||||
# define xs_bee3_init platform_not_configured
|
||||
#endif
|
||||
|
||||
/* Platform-specific configuration functions
|
||||
*/
|
||||
struct sysinit sysinit[] = {
|
||||
sys_notsupp(NULL), /* 0: ??? */
|
||||
sys_init(xilinx_ml40x_init,"XILINX_ML40x"), /* 1: Xilinx ML50x (XUP), same as ML40x */
|
||||
sys_notsupp(NULL), /* 2: ??? */
|
||||
sys_notsupp(NULL), /* 3: ??? */
|
||||
sys_notsupp(NULL), /* 4: ??? */
|
||||
sys_notsupp(NULL), /* 5: ??? */
|
||||
sys_notsupp(NULL), /* 6: ??? */
|
||||
sys_notsupp(NULL), /* 7: ??? */
|
||||
sys_init(xilinx_ml40x_init,"XILINX_ML40x"), /* 8: Xilinx ML401/2 */
|
||||
sys_init(xs_bee3_init,"XS_BEE3"), /* 9: BeCube BE3 */
|
||||
};
|
||||
int nsysinit = (sizeof(sysinit) / sizeof(sysinit[0]));
|
||||
|
||||
|
||||
void
|
||||
platform_not_configured()
|
||||
{
|
||||
printf("\n");
|
||||
printf("Support for system type %d is not present in this kernel.\n",
|
||||
systype);
|
||||
printf("Please build a kernel with \"options %s\" and reboot.\n",
|
||||
sysinit[systype].option);
|
||||
printf("\n");
|
||||
panic("platform not configured");
|
||||
}
|
||||
|
||||
void
|
||||
platform_not_supported()
|
||||
{
|
||||
const char *typestr = NULL;
|
||||
|
||||
if (systype < nsysinit)
|
||||
typestr = sysinit[systype].option;
|
||||
|
||||
printf("\n");
|
||||
printf("NetBSD does not (yet?) support system type %d (%s).\n", systype,
|
||||
(typestr) ? typestr : "???");
|
||||
printf("\n");
|
||||
panic("platform not supported");
|
||||
}
|
||||
|
||||
void noop(void)
|
||||
{
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue