Bring back the playstation2 port - now that a toolchain for it is
available again.
This commit is contained in:
parent
c264ca3c9f
commit
aad6ef8bb5
5
build.sh
5
build.sh
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env sh
|
||||
# $NetBSD: build.sh,v 1.276 2014/02/24 07:23:38 skrll Exp $
|
||||
# $NetBSD: build.sh,v 1.277 2014/03/31 11:25:47 martin Exp $
|
||||
#
|
||||
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -644,6 +644,7 @@ MACHINE=newsmips MACHINE_ARCH=mipseb
|
|||
MACHINE=next68k MACHINE_ARCH=m68k
|
||||
MACHINE=ofppc MACHINE_ARCH=powerpc DEFAULT
|
||||
MACHINE=ofppc MACHINE_ARCH=powerpc64 ALIAS=ofppc64
|
||||
MACHINE=playstations2 MACHINE_ARCH=mipsel
|
||||
MACHINE=pmax MACHINE_ARCH=mips64el ALIAS=pmax64
|
||||
MACHINE=pmax MACHINE_ARCH=mipsel DEFAULT
|
||||
MACHINE=prep MACHINE_ARCH=powerpc
|
||||
|
@ -1745,7 +1746,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.276 2014/02/24 07:23:38 skrll Exp $
|
||||
# Generated from: \$NetBSD: build.sh,v 1.277 2014/03/31 11:25:47 martin Exp $
|
||||
# with these arguments: ${_args}
|
||||
#
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.49 2009/12/05 16:29:10 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.50 2014/03/31 11:25:47 martin Exp $
|
||||
#
|
||||
# Consult "*.conf" for the configuration variables; this Makefile is typically
|
||||
# not edited for basic configuration changes.
|
||||
|
@ -172,6 +172,7 @@ MACHINE_ARCH.news68k= m68k
|
|||
MACHINE_ARCH.newsmips= mipseb
|
||||
MACHINE_ARCH.next68k= m68k
|
||||
MACHINE_ARCH.ofppc= powerpc
|
||||
MACHINE_ARCH.playstation2=mipsel
|
||||
MACHINE_ARCH.pmax= mipsel
|
||||
MACHINE_ARCH.prep= powerpc
|
||||
MACHINE_ARCH.sandpoint= powerpc
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: macros,v 1.39 2014/02/24 07:23:39 skrll Exp $
|
||||
.\" $NetBSD: macros,v 1.40 2014/03/31 11:25:47 martin Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -398,7 +398,7 @@
|
|||
.if \n[sun2] .ds A m68000
|
||||
.if \n[amiga]:\n[atari]:\n[cesfic]:\n[hp300]:\n[luna68k]:\n[mac68k]:\n[mvme68k]:\n[news68k]:\n[next68k]:\n[sun3]:\n[x68k] .ds A m68k
|
||||
.if \n[ews4800mips]:\n[mipsco]:\n[newsmips]:\n[sbmips]:\n[sgimips] .ds A mipseb
|
||||
.if \n[algor]:\n[arc]:\n[cobalt]:\n[evbmips]:\n[hpcmips]:\n[pmax] .ds A mipsel
|
||||
.if \n[algor]:\n[arc]:\n[cobalt]:\n[evbmips]:\n[hpcmips]:\n[playstation2]:\n[pmax] .ds A mipsel
|
||||
.if \n[amigappc]:\n[bebox]:\n[evbppc]:\n[ibmnws]:\n[macppc]:\n[mvmeppc]:\n[ofppc]:\n[prep]:\n[rs6000]:\n[sandpoint] .ds A powerpc
|
||||
.if \n[evbsh3]:\n[mmeye] .ds A sh3eb
|
||||
.if \n[dreamcast]:\n[hpcsh]:\n[landisk] .ds A sh3el
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: main,v 1.509 2014/03/28 08:24:06 hsuenaga Exp $
|
||||
.\" $NetBSD: main,v 1.510 2014/03/31 11:25:47 martin Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -46,7 +46,7 @@
|
|||
.as MACHINE_LIST " evbsh3 ews4800mips hp300 hppa hpcarm hpcmips hpcsh i386
|
||||
.as MACHINE_LIST " ibmnws iyonix landisk luna68k mac68k macppc mipsco mmeye
|
||||
.as MACHINE_LIST " mvme68k mvmeppc netwinder news68k newsmips next68k ofppc
|
||||
.as MACHINE_LIST " pmax prep rs6000 sandpoint sbmips
|
||||
.as MACHINE_LIST " playstation2 pmax prep rs6000 sandpoint sbmips
|
||||
.as MACHINE_LIST " sgimips shark sparc sparc64 sun2 sun3 vax x68k xen zaurus .
|
||||
.so \*[.CURDIR]/../common/macros
|
||||
.
|
||||
|
@ -1023,7 +1023,7 @@ If you're one of them, and would like to be mentioned, tell us!)
|
|||
.Pp
|
||||
.
|
||||
.
|
||||
.Bl -column xxx "Jun-ichiro itojun Hagino" ".Mt sommerfeld@NetBSD.org" ".Sy ews4800mips"
|
||||
.Bl -column xxx "Jun-ichiro itojun Hagino" ".Mt sommerfeld@NetBSD.org" ".Sy playstation2"
|
||||
.
|
||||
.br_ne 1i
|
||||
.It Em "The NetBSD core group:"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: sysinst,v 1.103 2014/02/24 07:23:39 skrll Exp $
|
||||
.\" $NetBSD: sysinst,v 1.104 2014/03/31 11:25:47 martin Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -49,7 +49,7 @@
|
|||
.\}
|
||||
.if \n[amiga]:\n[amigappc]:\n[arc]:\n[atari]:\n[cobalt]:\n[evbmips]:\
|
||||
\n[evbppc]:\n[hppa]:\n[hpcmips]:\n[i386]:\n[macppc]:\n[ofppc]:\
|
||||
\n[sandpoint]:\n[sbmips]:\n[sgimips]:\n[x86_64] \{\
|
||||
\n[playstation2]:\n[sandpoint]:\n[sbmips]:\n[sgimips]:\n[x86_64] \{\
|
||||
. ds part_max p
|
||||
.\}
|
||||
.if \n[acorn26]:\n[acorn32]:\n[cats]:\n[evbarm]:\n[evbppc]:\n[ews4800mips]:\
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# $NetBSD: Makefile,v 1.15 2014/03/31 11:25:47 martin Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
|
||||
|
||||
MINIROOTDIR!= cd ${.CURDIR}/../miniroot && ${PRINTOBJDIR}
|
||||
MINIROOT= ${MINIROOTDIR}/miniroot.fs
|
||||
|
||||
MDSETTARGETS= RAMDISK ${MINIROOT} netbsd
|
||||
MDSET_RELEASEDIR= installation
|
||||
|
||||
.include "${DISTRIBDIR}/common/Makefile.mdset"
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
SUBDIR= cdroms
|
||||
TARGETS+= release
|
||||
|
||||
iso_image:
|
||||
${MAKEDIRTARGET} cdroms iso_image
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.3 2014/03/31 11:25:47 martin Exp $
|
||||
|
||||
SUBDIR= installcd
|
||||
TARGETS+= release iso_image
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.3 2014/03/31 11:25:47 martin Exp $
|
||||
CDBASE= playstation2cd # gives ${CDBASE}.iso
|
||||
CDRELEASE= true # include $RELEASEDIR/$MACHINE
|
||||
|
||||
.include "${.CURDIR}/../../../common/Makefile.bootcd"
|
|
@ -0,0 +1,13 @@
|
|||
# $NetBSD: Makefile.inc,v 1.14 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
DBG= -Os
|
||||
|
||||
IMAGESIZE= 5m
|
||||
MAKEFS_FLAGS= -o density=2k
|
||||
IMAGEENDIAN= le
|
||||
MAKEDEVTARGETS= all
|
||||
LISTS+= ${DISTRIBDIR}/common/list.sysinst
|
||||
MTREECONF+= ${.CURDIR}/mtree.usr.install
|
||||
IMAGEDEPENDS+= ${ARCHDIR}/dot.profile ${DISTRIBDIR}/common/termcap \
|
||||
${DESTDIR}/.profile
|
||||
SMALLPROG_INET6=1
|
|
@ -0,0 +1,74 @@
|
|||
# $NetBSD: dot.profile,v 1.4 2014/03/31 11:25:48 martin 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
|
||||
BLOCKSIZE=1k
|
||||
export BLOCKSIZE
|
||||
EDITOR=ed
|
||||
export EDITOR
|
||||
|
||||
umask 022
|
||||
|
||||
ROOTDEV=/dev/md0a
|
||||
|
||||
if [ "X${DONEPROFILE}" = "X" ]; then
|
||||
DONEPROFILE=YES
|
||||
export DONEPROFILE
|
||||
|
||||
# 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
|
||||
|
||||
# pull in the functions that people will use from the shell prompt.
|
||||
# . /.commonutils
|
||||
# . /.instutils
|
||||
dmesg() cat /kern/msgbuf
|
||||
grep() sed -n "/$1/p"
|
||||
|
||||
# run the installation or upgrade script.
|
||||
sysinst
|
||||
fi
|
|
@ -0,0 +1,36 @@
|
|||
# $NetBSD: list,v 1.10 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
# extras in bin
|
||||
#PROG bin/csh
|
||||
PROG bin/date
|
||||
PROG bin/rcp
|
||||
PROG bin/rcmd
|
||||
|
||||
# extras in sbin
|
||||
PROG sbin/disklabel
|
||||
PROG sbin/fdisk
|
||||
PROG sbin/mount_ext2fs
|
||||
PROG sbin/fsck_ext2fs
|
||||
PROG sbin/mount_kernfs
|
||||
PROG sbin/mount_msdos
|
||||
|
||||
# extras in /usr.bin
|
||||
#PROG usr/bin/netstat
|
||||
PROG usr/bin/rsh
|
||||
#PROG usr/bin/tset usr/bin/reset
|
||||
#PROG usr/bin/vi
|
||||
|
||||
# crunchgen source directory specials: progs built in nonstandard places
|
||||
#SPECIAL vi srcdir usr.bin/nvi/build
|
||||
|
||||
# Minimize use of MFS
|
||||
SYMLINK /tmp var/tmp
|
||||
|
||||
# termcap file
|
||||
COPY ${DISTRIBDIR}/common/termcap usr/share/misc/termcap
|
||||
|
||||
# and the installation tools
|
||||
COPY ${ARCHDIR}/dot.profile .profile
|
||||
|
||||
# and a spare .profile
|
||||
COPY ${DESTDIR}/.profile tmp/.hdprofile
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1063 2014/03/06 12:17:11 skrll Exp $
|
||||
# $NetBSD: mi,v 1.1064 2014/03/31 11:25:48 martin Exp $
|
||||
#
|
||||
# Note: Don't delete entries from here - mark them as "obsolete" instead,
|
||||
# unless otherwise stated below.
|
||||
|
@ -3989,7 +3989,7 @@
|
|||
./usr/share/man/cat8/next68k base-man-share
|
||||
./usr/share/man/cat8/ofppc base-man-share
|
||||
./usr/share/man/cat8/pc532 base-obsolete obsolete
|
||||
./usr/share/man/cat8/playstation2 base-obsolete obsolete
|
||||
./usr/share/man/cat8/playstation2 base-man-share
|
||||
./usr/share/man/cat8/pmax base-man-share
|
||||
./usr/share/man/cat8/pmppc base-obsolete obsolete
|
||||
./usr/share/man/cat8/prep base-man-share
|
||||
|
@ -4119,7 +4119,7 @@
|
|||
./usr/share/man/html8/ofppc base-man-share
|
||||
./usr/share/man/html8/pc532 base-obsolete obsolete
|
||||
./usr/share/man/html8/playstation base-obsolete obsolete
|
||||
./usr/share/man/html8/playstation2 base-obsolete obsolete
|
||||
./usr/share/man/html8/playstation2 base-man-share
|
||||
./usr/share/man/html8/pmax base-man-share
|
||||
./usr/share/man/html8/pmppc base-obsolete obsolete
|
||||
./usr/share/man/html8/prep base-man-share
|
||||
|
@ -4250,7 +4250,7 @@
|
|||
./usr/share/man/man8/next68k base-man-share
|
||||
./usr/share/man/man8/ofppc base-man-share
|
||||
./usr/share/man/man8/pc532 base-obsolete obsolete
|
||||
./usr/share/man/man8/playstation2 base-obsolete obsolete
|
||||
./usr/share/man/man8/playstation2 base-man-share
|
||||
./usr/share/man/man8/pmax base-man-share
|
||||
./usr/share/man/man8/pmppc base-obsolete obsolete
|
||||
./usr/share/man/man8/prep base-man-share
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
# $NetBSD: md.playstation2,v 1.11 2014/03/31 11:25:48 martin Exp $
|
||||
./usr/include/ieeefp.h comp-c-include
|
||||
./usr/include/playstation2 comp-c-include
|
||||
./usr/include/playstation2/_G_config.h comp-obsolete obsolete
|
||||
./usr/include/playstation2/ansi.h comp-c-include
|
||||
./usr/include/playstation2/aout_machdep.h comp-c-include
|
||||
./usr/include/playstation2/asm.h comp-c-include
|
||||
./usr/include/playstation2/bswap.h comp-c-include
|
||||
./usr/include/playstation2/cdefs.h comp-c-include
|
||||
./usr/include/playstation2/cpu.h comp-c-include
|
||||
./usr/include/playstation2/db_machdep.h comp-obsolete obsolete
|
||||
./usr/include/playstation2/disklabel.h comp-c-include
|
||||
./usr/include/playstation2/ecoff_machdep.h comp-c-include
|
||||
./usr/include/playstation2/elf_machdep.h comp-c-include
|
||||
./usr/include/playstation2/endian.h comp-c-include
|
||||
./usr/include/playstation2/endian_machdep.h comp-c-include
|
||||
./usr/include/playstation2/float.h comp-c-include
|
||||
./usr/include/playstation2/ieee.h comp-c-include
|
||||
./usr/include/playstation2/ieeefp.h comp-c-include
|
||||
./usr/include/playstation2/int_const.h comp-c-include
|
||||
./usr/include/playstation2/int_fmtio.h comp-c-include
|
||||
./usr/include/playstation2/int_limits.h comp-c-include
|
||||
./usr/include/playstation2/int_mwgwtypes.h comp-c-include
|
||||
./usr/include/playstation2/int_types.h comp-c-include
|
||||
./usr/include/playstation2/intr.h comp-c-include
|
||||
./usr/include/playstation2/kcore.h comp-c-include
|
||||
./usr/include/playstation2/kdbparam.h comp-c-include
|
||||
./usr/include/playstation2/limits.h comp-c-include
|
||||
./usr/include/playstation2/lock.h comp-c-include
|
||||
./usr/include/playstation2/locore.h comp-c-include
|
||||
./usr/include/playstation2/math.h comp-c-include
|
||||
./usr/include/playstation2/mcontext.h comp-c-include
|
||||
./usr/include/playstation2/mips_opcode.h comp-c-include
|
||||
./usr/include/playstation2/param.h comp-c-include
|
||||
./usr/include/playstation2/pcb.h comp-c-include
|
||||
./usr/include/playstation2/pmap.h comp-c-include
|
||||
./usr/include/playstation2/pmc.h comp-c-include
|
||||
./usr/include/playstation2/proc.h comp-c-include
|
||||
./usr/include/playstation2/profile.h comp-c-include
|
||||
./usr/include/playstation2/psl.h comp-c-include
|
||||
./usr/include/playstation2/pte.h comp-c-include
|
||||
./usr/include/playstation2/ptrace.h comp-c-include
|
||||
./usr/include/playstation2/reg.h comp-c-include
|
||||
./usr/include/playstation2/regdef.h comp-c-include
|
||||
./usr/include/playstation2/regnum.h comp-c-include
|
||||
./usr/include/playstation2/reloc.h comp-c-include
|
||||
./usr/include/playstation2/setjmp.h comp-c-include
|
||||
./usr/include/playstation2/signal.h comp-c-include
|
||||
./usr/include/playstation2/stdarg.h comp-c-include
|
||||
./usr/include/playstation2/trap.h comp-c-include
|
||||
./usr/include/playstation2/types.h comp-c-include
|
||||
./usr/include/playstation2/varargs.h comp-c-include
|
||||
./usr/include/playstation2/vmparam.h comp-c-include
|
||||
./usr/include/playstation2/wchar_limits.h comp-c-include
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.17 2014/02/24 07:23:39 skrll Exp $
|
||||
# $NetBSD: Makefile,v 1.18 2014/03/31 11:25:48 martin Exp $
|
||||
#
|
||||
# sysinst is usually built when the crunched install binary is built,
|
||||
# but can be built here as a normal program for testing.
|
||||
|
@ -36,6 +36,7 @@ SUBDIR += arch/mvme68k
|
|||
SUBDIR += arch/news68k
|
||||
SUBDIR += arch/newsmips
|
||||
SUBDIR += arch/ofppc
|
||||
SUBDIR += arch/playstation2
|
||||
SUBDIR += arch/pmax
|
||||
SUBDIR += arch/prep
|
||||
SUBDIR += arch/sandpoint
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.10 2014/03/31 11:25:48 martin Exp $
|
||||
#
|
||||
# Makefile for playstation2
|
||||
#
|
||||
|
||||
MENUS_MD= menus.md.${SYSINSTLANG} menus.mbr
|
||||
MSG_MD= msg.md.${SYSINSTLANG} msg.mbr.${SYSINSTLANG}
|
||||
|
||||
.include "../../Makefile.inc"
|
|
@ -0,0 +1,8 @@
|
|||
#ifdef __mips__
|
||||
.abicalls
|
||||
.bss
|
||||
.align 2
|
||||
.space 2
|
||||
.globl mbr
|
||||
mbr: .space 512
|
||||
#endif
|
|
@ -0,0 +1,183 @@
|
|||
/* $NetBSD: md.c,v 1.26 2014/03/31 11:25:48 martin 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 -- playstation2 machine specific routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <util.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.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)
|
||||
{
|
||||
int cyl, head;
|
||||
daddr_t sec;
|
||||
|
||||
read_mbr(diskdev, &mbr);
|
||||
|
||||
msg_display(MSG_nobiosgeom, dlcyl, dlhead, dlsec);
|
||||
|
||||
if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0)
|
||||
msg_display_add(MSG_biosguess, cyl, head, sec);
|
||||
set_bios_geom(cyl, head, sec);
|
||||
|
||||
edit_mbr(&mbr);
|
||||
|
||||
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)
|
||||
{
|
||||
msg_display(MSG_dofdisk);
|
||||
|
||||
/* write edited MBR onto disk. */
|
||||
if (write_mbr(diskdev, &mbr, 1) != 0) {
|
||||
msg_display(MSG_wmbrfail);
|
||||
process_menu(MENU_ok, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* hook called after writing disklabel to new target disk.
|
||||
*/
|
||||
int
|
||||
md_post_disklabel(void)
|
||||
{
|
||||
/* Sector forwarding / badblocks ... */
|
||||
if (*doessf) {
|
||||
msg_display(MSG_dobad144);
|
||||
return (run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
|
||||
diskdev));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
md_post_extract(void)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
md_check_mbr(mbr_info_t *mbri)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
int
|
||||
md_mbr_use_wholedisk(mbr_info_t *mbri)
|
||||
{
|
||||
return mbr_use_wholedisk(mbri);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/* $NetBSD: md.h,v 1.17 2014/03/31 11:25:48 martin 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 playstation2 */
|
||||
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mbr.h"
|
||||
|
||||
#define PART_ROOT PART_A
|
||||
#define PART_SWAP PART_B
|
||||
#define PART_RAW PART_C
|
||||
#define PART_USR PART_D
|
||||
#define PART_FIRST_FREE PART_D
|
||||
|
||||
#define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */
|
||||
#define DEFROOTSIZE 32 /* Default root size */
|
||||
#define DEFVARSIZE 0 /* Default /var size, if created */
|
||||
#define DEFUSRSIZE 0 /* Default /usr size, if created */
|
||||
#define XNEEDMB 0 /* Extra megs for full X installation(not yet)*/
|
||||
|
||||
/*
|
||||
* Default filesets to fetch and install during installation
|
||||
* or upgrade. The standard sets are:
|
||||
* base, etc, comp, games, man, misc, tests, text
|
||||
*/
|
||||
#define SET_KERNEL_1_NAME "kern-GENERIC"
|
||||
#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM
|
||||
|
||||
/*
|
||||
* Machine-specific command to write a new label to a disk.
|
||||
*/
|
||||
#define DISKLABEL_CMD "disklabel -w -r"
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.en,v 1.14 2014/03/31 11:25:48 martin 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Menu definitions for sysinst. playstation2 version, machine dependent. */
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.es,v 1.3 2014/03/31 11:25:48 martin 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Menu definitions for sysinst. playstation2 version, machine dependent. */
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: menus.md.fr,v 1.15 2014/03/31 11:25:48 martin 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Menu definitions for sysinst. playstation2 version, machine dependent. */
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/* $NetBSD: menus.md.pl,v 1.13 2014/03/31 11:25:48 martin Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: menus.md.en,v 1.2 2001/11/29 23:21:00 thorpej 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Menu definitions for sysinst. playstation2 version, machine dependent. */
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/* $NetBSD: msg.md.de,v 1.5 2014/03/31 11:25:48 martin 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 Message catalog -- German, playstation2 version */
|
||||
|
||||
message md_hello
|
||||
{
|
||||
}
|
||||
|
||||
message dobad144
|
||||
{Installiere die Tabelle der defekten Blöcke ...
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installiere die Bootblöcke auf %s ...
|
||||
}
|
||||
|
||||
message onebiosmatch
|
||||
{Diese Festplatte entspricht der folgenden BIOS Disk:
|
||||
|
||||
}
|
||||
|
||||
message onebiosmatch_header
|
||||
{BIOS # Zylinder Köpfe Sektoren
|
||||
------ ---------- ------- --------
|
||||
}
|
||||
|
||||
message onebiosmatch_row
|
||||
{%-6x %-10d %-7d %d\n}
|
||||
|
||||
message biosmultmatch
|
||||
{Diese Festplatte entspricht der folgenden BIOS Disk:
|
||||
|
||||
}
|
||||
|
||||
message biosmultmatch_header
|
||||
{ BIOS # Zylinder Köpfe Sektoren
|
||||
------ ---------- ------- --------
|
||||
}
|
||||
|
||||
message biosmultmatch_row
|
||||
{%-1d: %-6x %-10d %-7d %d\n}
|
||||
|
||||
message pickdisk
|
||||
{Wählen Sie eine Festplatte: }
|
||||
|
||||
|
||||
message partabovechs
|
||||
{Der NetBSD Teil der Festplatte liegt außerhalb des vom BIOS dieser Maschine
|
||||
adressierbaren Bereichs. Eventuell können Sie von dieser Partition nicht
|
||||
booten. Sind Sie sicher, daß Sie fortfahren möchten?
|
||||
|
||||
(Antworten Sie mit 'nein' um die Partitionen erneut zu editieren.)}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/* $NetBSD: msg.md.en,v 1.11 2014/03/31 11:25:48 martin 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 Message catalog -- english, playstation2 version */
|
||||
|
||||
message md_hello
|
||||
{
|
||||
}
|
||||
|
||||
message dobad144
|
||||
{Installing the bad block table ...
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installing boot blocks on %s....
|
||||
}
|
||||
|
||||
message onebiosmatch
|
||||
{This disk matches the following BIOS disk:
|
||||
|
||||
}
|
||||
|
||||
message onebiosmatch_header
|
||||
{BIOS # cylinders heads sectors
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message onebiosmatch_row
|
||||
{%-6x %-10d %-7d %d\n}
|
||||
|
||||
message biosmultmatch
|
||||
{This disk matches the following BIOS disks:
|
||||
|
||||
}
|
||||
|
||||
message biosmultmatch_header
|
||||
{ BIOS # cylinders heads sectors
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message biosmultmatch_row
|
||||
{%-1d: %-6x %-10d %-7d %d\n}
|
||||
|
||||
message pickdisk
|
||||
{Choose disk: }
|
||||
|
||||
message partabovechs
|
||||
{The NetBSD part of the disk lies outside of the range that the BIOS on
|
||||
your machine can address. Booting from it may not be possible. Are you
|
||||
sure you that you want to do this?
|
||||
|
||||
(Answering 'no' will take you back to the partition edit menu.)}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/* $NetBSD: msg.md.es,v 1.4 2014/03/31 11:25:48 martin 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 Message catalog -- spanish, playstation2 version */
|
||||
|
||||
message md_hello
|
||||
{
|
||||
}
|
||||
|
||||
message dobad144
|
||||
{Instalando la tabla de bloques malos ...
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Instalando bloques de arranque en %s....
|
||||
}
|
||||
|
||||
message onebiosmatch
|
||||
{Este disco coincide con el siguiente disco de BIOS:
|
||||
|
||||
}
|
||||
|
||||
message onebiosmatch_header
|
||||
{BIOS # cilindros cabezal sectore
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message onebiosmatch_row
|
||||
{%-6x %-10d %-7d %d\n}
|
||||
|
||||
message biosmultmatch
|
||||
{Este disco coincide con los siguientes discos de BIOS:
|
||||
|
||||
}
|
||||
|
||||
message biosmultmatch_header
|
||||
{ BIOS # cilindros cabez sectore
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message biosmultmatch_row
|
||||
{%-1d: %-6x %-10d %-7d %d\n}
|
||||
|
||||
message pickdisk
|
||||
{Escoja disco: }
|
||||
|
||||
message partabovechs
|
||||
{La parte NetBSD del disco está fuera del rango que la BIOS de su maquina
|
||||
puede acceder.
|
||||
Puede que no sea posible iniciar desde ahi.
|
||||
¿Está seguro de que quiere hacer eso?
|
||||
|
||||
(Seleccionando 'no' le devolverá al menú de edición de particiones.)}
|
||||
|
||||
message set_kernel_1
|
||||
{Núcleo (GENERIC)}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/* $NetBSD: msg.md.fr,v 1.12 2014/03/31 11:25:48 martin 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 Message catalog -- french, playstation2 version */
|
||||
|
||||
message md_hello
|
||||
{
|
||||
}
|
||||
|
||||
message dobad144
|
||||
{Installation de la table des blocs défectueux ...
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Installation des blocs de démarrage sur %s ...
|
||||
}
|
||||
|
||||
message onebiosmatch
|
||||
{Ce disque correspond au disque du BIOS suivant :
|
||||
|
||||
}
|
||||
|
||||
message onebiosmatch_header
|
||||
{BIOS # cylinders heads sectors
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message onebiosmatch_row
|
||||
{%-6x %-10d %-7d %-10d\n}
|
||||
|
||||
message biosmultmatch
|
||||
{Ce disque correspond aux disques du BIOS suivants :
|
||||
|
||||
}
|
||||
|
||||
message biosmultmatch_header
|
||||
{ BIOS # cylinders heads sectors
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message biosmultmatch_row
|
||||
{%-1d: %-6x %-10d %-7d %d\n}
|
||||
|
||||
message pickdisk
|
||||
{Choisissez un disque : }
|
||||
|
||||
message partabovechs
|
||||
{La partition de votre disque réservée à NetBSD se trouve en-dehors de l'espace
|
||||
que le BIOS de votre machine peut adresser. L'amorçage depuis cette partition
|
||||
ne sera peut-être pas possible. Voulez-vous réellement faire ceci ?
|
||||
|
||||
('Non' vous ramènera au menu d'édition des partitions.)}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/* $NetBSD: msg.md.pl,v 1.12 2014/03/31 11:25:48 martin Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: msg.md.en,v 1.1 2001/10/15 16:22:52 uch 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 Message catalog -- Polish, playstation2 version */
|
||||
|
||||
message md_hello
|
||||
{
|
||||
}
|
||||
|
||||
message dobad144
|
||||
{Instalowanie tablicy zlych blokow ...
|
||||
}
|
||||
|
||||
message dobootblks
|
||||
{Instalowanie bootblokow na %s....
|
||||
}
|
||||
|
||||
message onebiosmatch
|
||||
{Ten dysk odpowiada ponizszemu dyskowi BIOS:
|
||||
|
||||
}
|
||||
|
||||
message onebiosmatch_header
|
||||
{BIOS # cylindry glowice sektory
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message onebiosmatch_row
|
||||
{%-6x %-10d %-7d %d\n}
|
||||
|
||||
message biosmultmatch
|
||||
{Ten dysk odpowiada ponizszym dyskom BIOS:
|
||||
|
||||
}
|
||||
|
||||
message biosmultmatch_header
|
||||
{ BIOS # cylindry glowice sektory
|
||||
------ ---------- ------- -------
|
||||
}
|
||||
|
||||
message biosmultmatch_row
|
||||
{%-1d: %-6x %-10d %-7d %d\n}
|
||||
|
||||
message pickdisk
|
||||
{Wybierz dysk: }
|
||||
|
||||
message partabovechs
|
||||
{Czesc NetBSD dysku lezy poza obszarem, ktory BIOS w twojej maszynie moze
|
||||
zaadresowac. Nie mozliwe bedzie bootowanie z tego dysku. Jestes pewien, ze
|
||||
chcesz to zrobic?
|
||||
|
||||
(Odpowiedz 'nie' zabierze cie spowrotem do menu edycji partycji.)}
|
||||
|
||||
message set_kernel_1
|
||||
{Kernel (GENERIC)}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: RESPONSIBLE,v 1.107 2014/02/24 07:23:40 skrll Exp $
|
||||
# $NetBSD: RESPONSIBLE,v 1.108 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
List of sections of the system, and who is responsible for them (or at
|
||||
least considered an expert on them).
|
||||
|
@ -294,6 +294,7 @@ news68k tsutsui
|
|||
newsmips core
|
||||
next68k core
|
||||
ofppc garbled
|
||||
playstation2 martin
|
||||
pmax simonb
|
||||
pmax simonb
|
||||
pmppc core
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: MAKEDEV.conf,v 1.4 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
all_md)
|
||||
makedev wscons wd0 wd1
|
||||
makedev usbs
|
||||
;;
|
||||
|
||||
ramdisk)
|
||||
makedev md0
|
||||
;;
|
|
@ -0,0 +1,14 @@
|
|||
# $NetBSD: Makefile.inc,v 1.8 2014/03/31 11:25:48 martin Exp $
|
||||
#
|
||||
# etc.playstation2/Makefile.inc --
|
||||
# playstation2-specific etc Makefile targets
|
||||
#
|
||||
|
||||
# If you change the list of distributed kernels, don't forget
|
||||
# to update the release documentation in distrib/notes/common/contents
|
||||
|
||||
KERNEL_SETS= GENERIC
|
||||
|
||||
BUILD_KERNELS= RAMDISK
|
||||
|
||||
INSTALLATION_DIRS+= installation/miniroot
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# $NetBSD: ttys,v 1.6 2014/03/31 11:25:48 martin Exp $
|
||||
#
|
||||
# name getty type status comments
|
||||
|
||||
constty "/usr/libexec/getty std.9600" vt100 off secure
|
||||
|
||||
# Workstation console (framebuffer) ttys
|
||||
ttyE0 "/usr/libexec/getty std.9600" vt100 on secure
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: NetBSD.dist.base,v 1.134 2014/02/24 07:23:40 skrll Exp $
|
||||
# $NetBSD: NetBSD.dist.base,v 1.135 2014/03/31 11:25:48 martin Exp $
|
||||
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
|
||||
|
||||
# Do not customize this file as it may be overwritten on upgrades.
|
||||
|
@ -944,6 +944,7 @@
|
|||
./usr/share/man/cat8/newsmips
|
||||
./usr/share/man/cat8/next68k
|
||||
./usr/share/man/cat8/ofppc
|
||||
./usr/share/man/cat8/playstation2
|
||||
./usr/share/man/cat8/pmax
|
||||
./usr/share/man/cat8/prep
|
||||
./usr/share/man/cat8/sandpoint
|
||||
|
@ -1055,6 +1056,7 @@
|
|||
./usr/share/man/html8/newsmips
|
||||
./usr/share/man/html8/next68k
|
||||
./usr/share/man/html8/ofppc
|
||||
./usr/share/man/html8/playstation2
|
||||
./usr/share/man/html8/pmax
|
||||
./usr/share/man/html8/prep
|
||||
./usr/share/man/html8/sandpoint
|
||||
|
@ -1166,6 +1168,7 @@
|
|||
./usr/share/man/man8/newsmips
|
||||
./usr/share/man/man8/next68k
|
||||
./usr/share/man/man8/ofppc
|
||||
./usr/share/man/man8/playstation2
|
||||
./usr/share/man/man8/pmax
|
||||
./usr/share/man/man8/prep
|
||||
./usr/share/man/man8/sandpoint
|
||||
|
|
|
@ -47,6 +47,7 @@ port-news68k
|
|||
port-newsmips
|
||||
port-next68k
|
||||
port-ofppc
|
||||
port-playstation2
|
||||
port-pmax
|
||||
port-powerpc
|
||||
port-prep
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: fdisk.8,v 1.81 2013/10/06 12:27:15 apb Exp $
|
||||
.\" $NetBSD: fdisk.8,v 1.82 2014/03/31 11:25:48 martin Exp $
|
||||
.\"
|
||||
.Dd October 6, 2013
|
||||
.Dt FDISK 8
|
||||
|
@ -36,7 +36,7 @@ The following
|
|||
.Nx
|
||||
ports use this style of disk partitioning:
|
||||
amd64, arc, bebox, cobalt, hpcarm, hpcmips, hpcsh, i386, macppc,
|
||||
mvmeppc, netwinder, ofppc, and prep.
|
||||
mvmeppc, netwinder, ofppc, playstation2, and prep.
|
||||
.Pp
|
||||
The MBR contains bootable code, a partition table,
|
||||
an indication of which partition is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: kloader.4,v 1.3 2009/12/05 16:29:11 pooka Exp $
|
||||
.\" $NetBSD: kloader.4,v 1.4 2014/03/31 11:25:48 martin Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2004 Valeriy E. Ushakov
|
||||
.\" All rights reserved.
|
||||
|
@ -44,7 +44,7 @@ Some platforms supported by
|
|||
do not have a firmware that can boot the
|
||||
.Nx
|
||||
kernel.
|
||||
Examples are game consoles (dreamcast port), and
|
||||
Examples are game consoles (dreamcast and playstation2 ports), and
|
||||
handhelds (hpcarm, hpcmips, and hpcsh ports).
|
||||
On such platforms the bootloader is usually a host program that runs
|
||||
under the native OS.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: hier.7,v 1.108 2014/02/24 07:23:40 skrll Exp $
|
||||
.\" $NetBSD: hier.7,v 1.109 2014/03/31 11:25:48 martin Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -729,7 +729,7 @@ kernel source files
|
|||
.It Sy arch/
|
||||
architecture-specific support
|
||||
.Pp
|
||||
.Bl -tag -width "ews4800mips/" -compact
|
||||
.Bl -tag -width "playstation2/" -compact
|
||||
.It Sy acorn26/
|
||||
Acorn Archimedes, A-series and R-series systems
|
||||
.It Sy acorn32/
|
||||
|
@ -818,6 +818,8 @@ Sony's MIPS-based NEWS workstations
|
|||
NeXT 68k "black" hardware
|
||||
.It Sy ofppc/
|
||||
Open Firmware PowerPC workstations
|
||||
.It Sy playstation2/
|
||||
SONY PlayStation 2
|
||||
.It Sy pmax/
|
||||
Digital MIPS-based DECstations and DECsystems
|
||||
.It Sy powerpc/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.42 2013/05/02 03:56:40 matt Exp $
|
||||
# $NetBSD: Makefile,v 1.43 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
# For now, we install the machine and arch includes, and symlink 'machine'
|
||||
# to the location of the machine includes (usually).
|
||||
|
@ -51,7 +51,7 @@ SUBDIR+= xen
|
|||
# m68k mac68k macppc mips mipsco mmeye mvme68k \
|
||||
# netwinder news68k newsmips next68k \
|
||||
# ofppc \
|
||||
# pmax powerpc prep \
|
||||
# playstation2 pmax powerpc prep \
|
||||
# sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
|
||||
# rs6000 \
|
||||
# vax \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: README,v 1.61 2014/02/24 07:23:41 skrll Exp $
|
||||
$NetBSD: README,v 1.62 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
acorn26 arm 20000509 Acorn ARM2- and ARM3-based machines
|
||||
acorn32 arm 20011118 Acorn computers Ltd. ARM 6/7/SA based machines
|
||||
|
@ -43,6 +43,7 @@ news68k m68k 19991209 Sony's m68k based NET WORK STATION
|
|||
newsmips mipseb 19980218 Sony's MIPS based NET WORK STATION
|
||||
next68k m68k 19980609 NeXT Computer's cubes and slabs
|
||||
ofppc powerpc,powerpc64 19980528 Open Firmware based PowerPC machines
|
||||
playstation2 mipsel 20011016 Sony PlayStation 2
|
||||
pmax mipsel,mips64el 19931012 Digital Equipment Corp. MIPS based machines
|
||||
prep powerpc 20000229 PowerPC Reference Platform machines
|
||||
rs6000 powerpc 20071217 MCA-based IBM RS/6000 wokstations
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.4 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
SUBDIR= compile include
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,3 @@
|
|||
# $NetBSD: Makefile,v 1.3 2014/03/31 11:25:48 martin Exp $
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# -- SCPH-18000 used by uch@NetBSD.org
|
||||
#
|
||||
# $NetBSD: AGATE,v 1.12 2014/03/31 11:25:49 martin Exp $
|
||||
#
|
||||
|
||||
include "arch/playstation2/conf/std.playstation2"
|
||||
include "arch/playstation2/conf/config.playstation2"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
config netbsd root on wd0a type ffs
|
||||
config nfsnetbsd root on smap0 type nfs
|
||||
|
||||
#makeoptions DEFGP="-G 40"
|
||||
|
||||
options KLOADER_KERNEL_PATH="\"/netbsd\""
|
||||
options KLOADER
|
||||
|
||||
options DDB # in-kernel debugger
|
||||
|
||||
options NMBCLUSTERS=4096 # Max. number of mbuf clusters
|
||||
|
||||
options GATEWAY # packet forwarding
|
||||
|
||||
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)
|
||||
|
||||
uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial adapter
|
||||
ucom* at uplcom? portno ?
|
||||
|
||||
pseudo-device ppp # Point-to-Point Protocol
|
|
@ -0,0 +1,117 @@
|
|||
#
|
||||
# kernel config file for debugging.
|
||||
#
|
||||
# $NetBSD: DEBUG,v 1.18 2014/03/31 11:25:49 martin Exp $
|
||||
#
|
||||
|
||||
include "arch/playstation2/conf/std.playstation2"
|
||||
include "arch/playstation2/conf/config.playstation2"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
makeoptions DEFGP="-G 0"
|
||||
|
||||
options KLOADER_KERNEL_PATH="\"/netbsd\""
|
||||
options KLOADER
|
||||
|
||||
options NMBCLUSTERS=4096 # Max. number of mbuf clusters
|
||||
|
||||
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 NFSSERVER # Network File System server
|
||||
|
||||
# Standard system options
|
||||
#options DIAGNOSTIC # expensive kernel consistency checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
options KMEMSTATS # kernel memory statistics (vmstat -m)
|
||||
options DDB # in-kernel debugger
|
||||
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
|
||||
options KTRACE # system call tracing support
|
||||
options MSGBUFSIZE=8192 # dmesg buffer size
|
||||
#options SYSCALL_DEBUG
|
||||
#options LOCKDEBUG
|
||||
options GPROF # kernel profiling
|
||||
makeoptions PROF="-pg"
|
||||
options USERCONF # userconf(4) support
|
||||
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
#options USBVERBOSE # verbose USB device autoconfig messages
|
||||
#options MIIVERBOSE # verbose PHY autoconfig messages
|
||||
|
||||
options GSFB_DEBUG_MONITOR, INTR_DEBUG, SIF_DEBUG, SMAP_DEBUG
|
||||
options EMAC3_DEBUG
|
||||
|
||||
# USB Generic HID devices
|
||||
uhidev* at uhub? port ? configuration ? interface ?
|
||||
uhid* at uhidev? reportid ?
|
||||
|
||||
# USB Printer
|
||||
ulpt* at uhub? port ? configuration ? interface ?
|
||||
|
||||
# USB Modem
|
||||
umodem* at uhub? port ? configuration ?
|
||||
ucom* at umodem?
|
||||
|
||||
# USB Mass Storage
|
||||
umass* at uhub? port ? configuration ? interface ?
|
||||
atapibus* at umass? channel ?
|
||||
scsibus* at umass? channel ?
|
||||
|
||||
# USB audio
|
||||
uaudio* at uhub? port ? configuration ?
|
||||
|
||||
# USB MIDI
|
||||
umidi* at uhub? port ? configuration ?
|
||||
|
||||
# USB Ethernet adapters
|
||||
aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
|
||||
axe* at uhub? port ? # ASIX AX88172 based adapters
|
||||
cue* at uhub? port ? # CATC USB-EL1201A based adapters
|
||||
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters
|
||||
url* at uhub? port ? # Realtek RTL8150L based adapters
|
||||
|
||||
# Prolific PL2301/PL2302 host-to-host adapter
|
||||
upl* at uhub? port ?
|
||||
|
||||
# Serial adapters
|
||||
# FTDI FT8U100AX serial adapter
|
||||
uftdi* at uhub? port ?
|
||||
ucom* at uftdi? portno ?
|
||||
|
||||
uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial adapter
|
||||
ucom* at uplcom? portno ?
|
||||
|
||||
umct* at uhub? port ? # MCT USB-RS232 serial adapter
|
||||
ucom* at umct? portno ?
|
||||
|
||||
# Diamond Multimedia Rio 500
|
||||
urio* at uhub? port ?
|
||||
|
||||
# USB Handspring Visor
|
||||
uvisor* at uhub? port ?
|
||||
ucom* at uvisor?
|
||||
|
||||
# Kyocera AIR-EDGE PHONE
|
||||
ukyopon* at uhub? port ?
|
||||
ucom* at ukyopon? portno ?
|
||||
|
||||
# USB scanners
|
||||
uscanner* at uhub? port ?
|
||||
|
||||
# USB scanners that use SCSI emulation, e.g., HP5300
|
||||
usscanner* at uhub? port ?
|
||||
scsibus* at usscanner? channel ?
|
||||
|
||||
# Y@P firmware loader
|
||||
uyap* at uhub? port ?
|
||||
|
||||
audio* at uaudio?
|
||||
|
||||
pseudo-device ppp # Point-to-Point Protocol
|
||||
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
# $NetBSD: GENERIC,v 1.10 2014/03/31 11:25:49 martin 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/playstation2/conf/std.playstation2"
|
||||
include "arch/playstation2/conf/config.playstation2"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
#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
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#makeoptions DEFGP="-G 48"
|
||||
|
||||
# Veriexec
|
||||
#
|
||||
# a pseudo device needed for veriexec
|
||||
#pseudo-device veriexec 1
|
||||
#
|
||||
# Uncomment the fingerprint methods below that are desired. Note that
|
||||
# removing fingerprint methods will have almost no impact on the kernel
|
||||
# code size.
|
||||
#
|
||||
#options VERIFIED_EXEC_FP_RMD160
|
||||
#options VERIFIED_EXEC_FP_SHA256
|
||||
#options VERIFIED_EXEC_FP_SHA384
|
||||
#options VERIFIED_EXEC_FP_SHA512
|
||||
#options VERIFIED_EXEC_FP_SHA1
|
||||
#options VERIFIED_EXEC_FP_MD5
|
|
@ -0,0 +1,20 @@
|
|||
# $NetBSD: Makefile.playstation2.inc,v 1.4 2014/03/31 11:25:49 martin Exp $
|
||||
|
||||
EETOOLDIR = /usr/pkg/cross-ps2
|
||||
TARGET = mipsEEel-netbsd
|
||||
|
||||
CC = ${EETOOLDIR}/bin/${TARGET}-gcc
|
||||
LD = ${EETOOLDIR}/bin/${TARGET}-ld
|
||||
CXX = ${EETOOLDIR}/bin/${TARGET}-g++
|
||||
AS = ${EETOOLDIR}/bin/${TARGET}-as
|
||||
CPP = ${EETOOLDIR}/bin/${TARGET}-cpp
|
||||
RANLIB = ${EETOOLDIR}/bin/${TARGET}-ranlib
|
||||
AR = ${EETOOLDIR}/bin/${TARGET}-ar
|
||||
NM = ${EETOOLDIR}/bin/${TARGET}-nm
|
||||
SIZE = ${EETOOLDIR}/bin/${TARGET}-size
|
||||
STRIP = ${EETOOLDIR}/bin/${TARGET}-strip
|
||||
|
||||
CFLAGS+= -mcpu=r5900 -mips1 -fno-pic \
|
||||
-D__NetBSD__ -Ulinux -U__linux__ -U__linux
|
||||
AFLAGS+= -mcpu=r5900 -mips1 -fno-pic \
|
||||
-D__NetBSD__ -Ulinux -U__linux__ -U__linux
|
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# kernel config file for memory(RAM) disk
|
||||
#
|
||||
# $NetBSD: RAMDISK,v 1.13 2014/03/31 11:25:49 martin Exp $
|
||||
#
|
||||
|
||||
include "arch/playstation2/conf/std.playstation2"
|
||||
include "arch/playstation2/conf/config.playstation2"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#makeoptions DEFGP="-G 48"
|
||||
|
||||
# disk/mass storage pseudo-devices
|
||||
pseudo-device md 1 # memory disk device (ramdisk)
|
||||
|
||||
# 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=10240 # size of memory disk, in blocks
|
||||
options MEMORY_DISK_RBFLAGS=RB_SINGLE # boot in single-user mode
|
||||
|
||||
# Reboot from HDD
|
||||
options KLOADER_KERNEL_PATH="\"/mnt/netbsd\""
|
||||
options KLOADER
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
DESTDIR=/work/playstation2/root; export DESTDIR
|
||||
RELEASEDIR=/work/playstation2/release; export RELEASEDIR
|
||||
root=/usr/pkg/cross-ps2
|
||||
target=mipsEEel-netbsd
|
||||
|
||||
PATH=\
|
||||
$PATH:\
|
||||
${root}/${target}/bin:\
|
||||
${root}/bin
|
||||
export PATH
|
||||
|
||||
CC=${root}/bin/${target}-gcc; export CC
|
||||
LD=${root}/bin/${target}-ld; export LD
|
||||
CXX=${root}/bin/${target}-g++; export CXX
|
||||
AS=${root}/bin/${target}-as; export AS
|
||||
CPP=${root}/bin/${target}-cpp; export CPP
|
||||
RANLIB=${root}/bin/${target}-ranlib; export RANLIB
|
||||
AR=${root}/bin/${target}-ar; export AR
|
||||
NM=${root}/bin/${target}-nm; export NM
|
||||
SIZE=${root}/bin/${target}-size; export SIZE
|
||||
STRIP=${root}/bin/${target}-strip; export STRIP
|
||||
|
||||
STRIPFLAGS="--strip-debug"; export STRIPFLAGS
|
||||
STRIPPROG=${target}-strip; export STRIPPROG
|
||||
|
||||
HOSTED_CC=cc; export HOSTED_CC
|
||||
|
||||
TARGET=mipsel; export TARGET
|
||||
MACHINE=playstation2; export MACHINE
|
||||
MACHINE_ARCH=mipsel; export MACHINE_ARCH
|
||||
MACHINE_CPU=mips; export MACHINE_CPU
|
||||
|
||||
DESTDIR=${bsd_root}; export DESTDIR
|
||||
|
||||
MAKE="make"; export MAKE
|
||||
#MAKE="make -f /work/cvsrep/sharesrc/share/mk/sys.mk -f Makefile"; export MAKE
|
||||
#MAKEFLAGS="-I /work/cvsrep/sharesrc/share/mk"; export MAKEFLAGS
|
||||
|
||||
set -x
|
||||
exec $MAKE "$@"
|
|
@ -0,0 +1,89 @@
|
|||
#
|
||||
# deafult config file.
|
||||
#
|
||||
# $NetBSD: config.playstation2,v 1.24 2014/03/31 11:25:49 martin Exp $
|
||||
#
|
||||
|
||||
maxusers 16
|
||||
|
||||
options NTP # NTP phase/frequency locked loop
|
||||
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem with user and group quotas
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system MFS # memory-based filesystem
|
||||
file-system NULLFS
|
||||
file-system UNION # union file system
|
||||
file-system KERNFS # /kern
|
||||
file-system PROCFS # /proc
|
||||
file-system PTYFS # /dev/pts/N support
|
||||
|
||||
options WAPBL # File system journaling support - Experimental
|
||||
options FFS_NO_SNAPSHOT # No FFS snapshot support
|
||||
|
||||
# Networking options
|
||||
options INET # IP + ICMP + TCP + UDP
|
||||
options INET6 # IPV6
|
||||
|
||||
options NFS_BOOT_DHCP
|
||||
|
||||
options WSEMUL_VT100 # VT100 / VT220 emulation
|
||||
options FONT_SONY8x16
|
||||
options WS_KERNEL_FG=WSCOL_BROWN
|
||||
options WS_KERNEL_BG=WSCOL_BLUE
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
cpu0 at mainbus?
|
||||
|
||||
gsfb* at mainbus?
|
||||
sbus* at mainbus?
|
||||
|
||||
spd* at sbus? # HDD and Ethernet I/F for PS2
|
||||
ohci* at sbus?
|
||||
|
||||
wdc* at spd?
|
||||
smap* at spd?
|
||||
|
||||
atabus* at ata?
|
||||
wd* at atabus? drive ? flags 0x0ff0 # disable DMA/UDMA
|
||||
ukphy* at mii? phy ? # generic unknown PHYs (IEEE Std. 802.3u)
|
||||
|
||||
wsdisplay* at gsfb? console?
|
||||
|
||||
# USB bus support
|
||||
usb* at ohci?
|
||||
|
||||
# USB Hubs
|
||||
uhub* at usb?
|
||||
uhub* at uhub? port ?
|
||||
|
||||
# USB HID device
|
||||
uhidev* at uhub? port ? configuration ? interface ?
|
||||
|
||||
# USB Mice
|
||||
ums* at uhidev? reportid ?
|
||||
wsmouse* at ums? mux 0
|
||||
|
||||
# USB Keyboards
|
||||
ukbd* at uhidev? reportid ?
|
||||
wskbd* at ukbd? console ? mux 1
|
||||
|
||||
# USB Generic driver
|
||||
ugen* at uhub? port ?
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device pty # pseudo-terminals
|
||||
|
||||
pseudo-device bpfilter # packet filter ports
|
||||
pseudo-device ipfilter # IP filter, NAT
|
||||
|
||||
pseudo-device vnd # virtual disk ick
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
|
||||
pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
|
||||
|
||||
pseudo-device wsmux # mouse & keyboard multiplexor
|
||||
pseudo-device ksyms # /dev/ksyms
|
|
@ -0,0 +1,102 @@
|
|||
# $NetBSD: files.playstation2,v 1.20 2014/03/31 11:25:49 martin Exp $
|
||||
|
||||
maxpartitions 8
|
||||
|
||||
maxusers 2 8 64
|
||||
|
||||
defflag debug_playstation2.h GSFB_DEBUG_MONITOR INTR_DEBUG SIF_DEBUG
|
||||
SMAP_DEBUG EMAC3_DEBUG
|
||||
|
||||
device mainbus {}
|
||||
attach mainbus at root
|
||||
file arch/playstation2/playstation2/mainbus.c mainbus
|
||||
|
||||
device cpu
|
||||
attach cpu at mainbus
|
||||
file arch/playstation2/playstation2/cpu.c cpu
|
||||
|
||||
file arch/playstation2/playstation2/autoconf.c
|
||||
file arch/playstation2/playstation2/interrupt.c
|
||||
file arch/playstation2/playstation2/bus_space.c
|
||||
file arch/playstation2/playstation2/bus_dma.c
|
||||
file arch/playstation2/playstation2/clock.c
|
||||
file arch/playstation2/playstation2/disksubr.c disk
|
||||
file arch/playstation2/playstation2/machdep.c
|
||||
file arch/playstation2/playstation2/sifbios.c
|
||||
file arch/mips/mips/mips3_clock.c
|
||||
|
||||
file common/bus_dma/bus_dmamem_common.c
|
||||
|
||||
file dev/kloader.c kloader
|
||||
file arch/playstation2/playstation2/kloader_machdep.c kloader
|
||||
defparam opt_kloader_kernel_path.h KLOADER_KERNEL_PATH
|
||||
defflag opt_kloader.h KLOADER
|
||||
defflag debug_kloader.h KLOADER_DEBUG
|
||||
|
||||
|
||||
#
|
||||
# PlayStation 2 internal devices (not optional)
|
||||
#
|
||||
file arch/playstation2/ee/intc.c
|
||||
file arch/playstation2/ee/dmac.c
|
||||
file arch/playstation2/ee/timer.c
|
||||
file arch/playstation2/ee/gs.c
|
||||
file arch/playstation2/ee/sif.c
|
||||
|
||||
#
|
||||
# PlayStation 2 internal devices (optional)
|
||||
#
|
||||
device gsfb: wsemuldisplaydev
|
||||
attach gsfb at mainbus
|
||||
file arch/playstation2/ee/gsfb.c gsfb
|
||||
|
||||
define sbus {}
|
||||
device sbus: sbus
|
||||
attach sbus at mainbus
|
||||
file arch/playstation2/dev/sbus.c sbus
|
||||
|
||||
attach ohci at sbus with ohci_sbus
|
||||
file arch/playstation2/dev/ohci_sbus.c ohci_sbus
|
||||
|
||||
#
|
||||
# HardDisk Unit (for SCPH-18000) SCPH-10190 + SCPH-200400
|
||||
#
|
||||
define spd {}
|
||||
device spd: spd
|
||||
attach spd at sbus
|
||||
file arch/playstation2/dev/spd.c
|
||||
|
||||
define emac3
|
||||
file arch/playstation2/dev/emac3.c emac3
|
||||
|
||||
attach wdc at spd with wdc_spd
|
||||
file arch/playstation2/dev/wdc_spd.c wdc_spd
|
||||
|
||||
device smap: emac3, ether, ifnet, arp, mii
|
||||
attach smap at spd
|
||||
file arch/playstation2/dev/if_smap.c smap
|
||||
|
||||
# Console autoconfiguration code: selects between a framebuffers
|
||||
file arch/playstation2/playstation2/console.c
|
||||
file dev/cons.c
|
||||
file dev/cninit.c
|
||||
|
||||
|
||||
# Memory Disk for boot tape
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
include "dev/usb/files.usb"
|
||||
|
||||
#
|
||||
# Machine-independent SCSI drivers
|
||||
#
|
||||
|
||||
include "dev/scsipi/files.scsipi"
|
||||
|
||||
#
|
||||
# Machine-independent ATA drivers
|
||||
#
|
||||
|
||||
include "dev/ata/files.ata"
|
||||
|
||||
include "arch/playstation2/conf/majors.playstation2"
|
|
@ -0,0 +1,52 @@
|
|||
# $NetBSD: majors.playstation2,v 1.22 2014/03/31 11:25:49 martin Exp $
|
||||
#
|
||||
# Device majors for playstation2
|
||||
#
|
||||
|
||||
device-major mem char 0
|
||||
device-major swap char 1 block 0 vmswap
|
||||
device-major cons char 2
|
||||
device-major ctty char 3
|
||||
device-major filedesc char 4
|
||||
device-major log char 5
|
||||
device-major ptc char 6 pty
|
||||
device-major pts char 7 pty
|
||||
|
||||
device-major wd char 10 block 1 wd
|
||||
|
||||
device-major md char 12 block 6 md
|
||||
device-major ccd char 13 block 7 ccd
|
||||
device-major vnd char 14 block 8 vnd
|
||||
device-major raid char 15 block 9 raid
|
||||
device-major scsibus char 16 scsibus
|
||||
device-major sd char 17 block 3 sd
|
||||
device-major st char 18 block 4 st
|
||||
device-major cd char 19 block 5 cd
|
||||
device-major ch char 20 ch
|
||||
device-major uk char 21 uk
|
||||
device-major ss char 22 ss
|
||||
device-major ipl char 23 ipfilter
|
||||
device-major tun char 24 tun
|
||||
device-major bpf char 25 bpfilter
|
||||
device-major rnd char 26 rnd
|
||||
device-major wsdisplay char 27 wsdisplay
|
||||
device-major wskbd char 28 wskbd
|
||||
device-major wsmouse char 29 wsmouse
|
||||
device-major wsmux char 30 wsmux
|
||||
device-major usb char 31 usb
|
||||
device-major uhid char 32 uhid
|
||||
device-major ulpt char 33 ulpt
|
||||
device-major ugen char 34 ugen
|
||||
device-major ucom char 35 ucom
|
||||
device-major urio char 36 urio
|
||||
device-major uscanner char 37 uscanner
|
||||
device-major clockctl char 38 clockctl
|
||||
device-major cgd char 40 block 10 cgd
|
||||
device-major ksyms char 41 ksyms
|
||||
device-major wsfont char 42 wsfont
|
||||
|
||||
device-major nsmb char 98 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,22 @@
|
|||
# $NetBSD: std.playstation2,v 1.10 2014/03/31 11:25:49 martin Exp $
|
||||
|
||||
machine playstation2 mips
|
||||
include "conf/std" # MI standard options
|
||||
makeoptions MACHINE_ARCH="mipsel"
|
||||
|
||||
options MIPS3
|
||||
options MIPS3_5900
|
||||
|
||||
options IPL_ICU_MASK
|
||||
|
||||
options NOFPU # Don't use FPU (R5900 FPU is single float only)
|
||||
options SOFTFLOAT # emulate FPU insn
|
||||
|
||||
options EXEC_ELF32 # exec ELF32 binaries
|
||||
options EXEC_SCRIPT # exec #! scripts
|
||||
|
||||
options __NO_LEADING_UNDERSCORES__
|
||||
options __GP_SUPPORT__
|
||||
|
||||
makeoptions DEFTEXTADDR="0x80010000"
|
||||
makeoptions DEFCOPTS="-Os -mmemcpy"
|
|
@ -0,0 +1,395 @@
|
|||
/* $NetBSD: emac3.c,v 1.9 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EMAC3 (Ethernet Media Access Controller)
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.9 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/dev/emac3reg.h>
|
||||
#include <playstation2/dev/emac3var.h>
|
||||
|
||||
#ifdef EMAC3_DEBUG
|
||||
#define STATIC
|
||||
int emac3_debug = 0;
|
||||
#define DPRINTF(fmt, args...) \
|
||||
if (emac3_debug) \
|
||||
printf("%s: " fmt, __func__ , ##args)
|
||||
#define DPRINTFN(n, arg) \
|
||||
if (emac3_debug > (n)) \
|
||||
n printf("%s: " fmt, __func__ , ##args)
|
||||
#else
|
||||
#define STATIC static
|
||||
#define DPRINTF(arg...) ((void)0)
|
||||
#define DPRINTFN(n, arg...) ((void)0)
|
||||
#endif
|
||||
|
||||
/* SMAP specific EMAC3 define */
|
||||
#define EMAC3_BASE MIPS_PHYS_TO_KSEG1(0x14002000)
|
||||
static inline u_int32_t
|
||||
_emac3_reg_read_4(int ofs)
|
||||
{
|
||||
bus_addr_t a_ = EMAC3_BASE + ofs;
|
||||
|
||||
return (_reg_read_2(a_) << 16) | _reg_read_2(a_ + 2);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_emac3_reg_write_4(int ofs, u_int32_t v)
|
||||
{
|
||||
bus_addr_t a_ = EMAC3_BASE + ofs;
|
||||
|
||||
_reg_write_2(a_, (v >> 16) & 0xffff);
|
||||
_reg_write_2(a_ + 2, v & 0xffff);
|
||||
}
|
||||
|
||||
STATIC int emac3_phy_ready(void);
|
||||
STATIC int emac3_soft_reset(void);
|
||||
STATIC void emac3_config(const u_int8_t *);
|
||||
|
||||
int
|
||||
emac3_init(struct emac3_softc *sc)
|
||||
{
|
||||
u_int32_t r;
|
||||
|
||||
/* save current mode before reset */
|
||||
r = _emac3_reg_read_4(EMAC3_MR1);
|
||||
|
||||
if (emac3_soft_reset() != 0) {
|
||||
printf("%s: reset failed.\n", sc->dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* set operation mode */
|
||||
r |= MR1_RFS_2KB | MR1_TFS_1KB | MR1_TR0_SINGLE | MR1_TR1_SINGLE;
|
||||
_emac3_reg_write_4(EMAC3_MR1, r);
|
||||
|
||||
sc->mode1_reg = _emac3_reg_read_4(EMAC3_MR1);
|
||||
|
||||
emac3_intr_clear();
|
||||
emac3_intr_disable();
|
||||
|
||||
emac3_config(sc->eaddr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_exit(struct emac3_softc *sc)
|
||||
{
|
||||
int retry = 10000;
|
||||
|
||||
/* wait for kicked transmission */
|
||||
while (((_emac3_reg_read_4(EMAC3_TMR0) & TMR0_GNP0) != 0) &&
|
||||
--retry > 0)
|
||||
;
|
||||
|
||||
if (retry == 0)
|
||||
printf("%s: still running.\n", sc->dev.dv_xname);
|
||||
}
|
||||
|
||||
int
|
||||
emac3_reset(struct emac3_softc *sc)
|
||||
{
|
||||
|
||||
if (emac3_soft_reset() != 0) {
|
||||
printf("%s: reset failed.\n", sc->dev.dv_xname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* restore previous mode */
|
||||
_emac3_reg_write_4(EMAC3_MR1, sc->mode1_reg);
|
||||
|
||||
emac3_config(sc->eaddr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_enable()
|
||||
{
|
||||
|
||||
_emac3_reg_write_4(EMAC3_MR0, MR0_TXE | MR0_RXE);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_disable()
|
||||
{
|
||||
int retry = 10000;
|
||||
|
||||
_emac3_reg_write_4(EMAC3_MR0,
|
||||
_emac3_reg_read_4(EMAC3_MR0) & ~(MR0_TXE | MR0_RXE));
|
||||
|
||||
/* wait for idling state */
|
||||
while (((_emac3_reg_read_4(EMAC3_MR0) & (MR0_RXI | MR0_TXI)) !=
|
||||
(MR0_RXI | MR0_TXI)) && --retry > 0)
|
||||
;
|
||||
|
||||
if (retry == 0)
|
||||
printf("emac3 running.\n");
|
||||
}
|
||||
|
||||
void
|
||||
emac3_intr_enable()
|
||||
{
|
||||
|
||||
_emac3_reg_write_4(EMAC3_ISER, ~0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_intr_disable()
|
||||
{
|
||||
|
||||
_emac3_reg_write_4(EMAC3_ISER, 0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_intr_clear()
|
||||
{
|
||||
|
||||
_emac3_reg_write_4(EMAC3_ISR, _emac3_reg_read_4(EMAC3_ISR));
|
||||
}
|
||||
|
||||
int
|
||||
emac3_intr(void *arg)
|
||||
{
|
||||
u_int32_t r = _emac3_reg_read_4(EMAC3_ISR);
|
||||
|
||||
DPRINTF("%08x\n", r);
|
||||
_emac3_reg_write_4(EMAC3_ISR, r);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_tx_kick()
|
||||
{
|
||||
|
||||
_emac3_reg_write_4(EMAC3_TMR0, TMR0_GNP0);
|
||||
}
|
||||
|
||||
int
|
||||
emac3_tx_done()
|
||||
{
|
||||
|
||||
return (_emac3_reg_read_4(EMAC3_TMR0) & TMR0_GNP0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_setmulti(struct emac3_softc *sc, struct ethercom *ec)
|
||||
{
|
||||
struct ether_multi *enm;
|
||||
struct ether_multistep step;
|
||||
struct ifnet *ifp = &ec->ec_if;
|
||||
u_int32_t r;
|
||||
|
||||
r = _emac3_reg_read_4(EMAC3_RMR);
|
||||
r &= ~(RMR_PME | RMR_PMME | RMR_MIAE);
|
||||
|
||||
if (ifp->if_flags & IFF_PROMISC) {
|
||||
allmulti:
|
||||
ifp->if_flags |= IFF_ALLMULTI;
|
||||
r |= RMR_PME;
|
||||
_emac3_reg_write_4(EMAC3_RMR, r);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ETHER_FIRST_MULTI(step, ec, enm);
|
||||
while (enm != NULL) {
|
||||
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
|
||||
ETHER_ADDR_LEN) != 0)
|
||||
goto allmulti;
|
||||
|
||||
ETHER_NEXT_MULTI(step, enm)
|
||||
}
|
||||
|
||||
/* XXX always multicast promiscuous mode. XXX use hash table.. */
|
||||
ifp->if_flags |= IFF_ALLMULTI;
|
||||
r |= RMR_PMME;
|
||||
_emac3_reg_write_4(EMAC3_RMR, r);
|
||||
}
|
||||
|
||||
int
|
||||
emac3_soft_reset()
|
||||
{
|
||||
int retry = 10000;
|
||||
|
||||
_emac3_reg_write_4(EMAC3_MR0, MR0_SRST);
|
||||
|
||||
while ((_emac3_reg_read_4(EMAC3_MR0) & MR0_SRST) == MR0_SRST &&
|
||||
--retry > 0)
|
||||
;
|
||||
|
||||
return (retry == 0);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_config(const u_int8_t *eaddr)
|
||||
{
|
||||
|
||||
/* set ethernet address */
|
||||
_emac3_reg_write_4(EMAC3_IAHR, (eaddr[0] << 8) | eaddr[1]);
|
||||
_emac3_reg_write_4(EMAC3_IALR, (eaddr[2] << 24) | (eaddr[3] << 16) |
|
||||
(eaddr[4] << 8) | eaddr[5]);
|
||||
|
||||
/* inter-frame GAP */
|
||||
_emac3_reg_write_4(EMAC3_IPGVR, 4);
|
||||
|
||||
/* RX mode */
|
||||
_emac3_reg_write_4(EMAC3_RMR,
|
||||
RMR_SP | /* strip padding */
|
||||
RMR_SFCS | /* strip FCS */
|
||||
RMR_IAE | /* individual address enable */
|
||||
RMR_BAE); /* boradcast address enable */
|
||||
|
||||
/* TX mode */
|
||||
_emac3_reg_write_4(EMAC3_TMR1,
|
||||
((7 << TMR1_TLR_SHIFT) & TMR1_TLR_MASK) | /* 16 word burst */
|
||||
((15 << TMR1_TUR_SHIFT) & TMR1_TUR_MASK));
|
||||
|
||||
/* TX threshold */
|
||||
_emac3_reg_write_4(EMAC3_TRTR,
|
||||
(12 << TRTR_SHIFT) & TRTR_MASK); /* 832 bytes */
|
||||
|
||||
/* RX watermark */
|
||||
_emac3_reg_write_4(EMAC3_RWMR,
|
||||
((16 << RWMR_RLWM_SHIFT) & RWMR_RLWM_MASK) |
|
||||
((128 << RWMR_RHWM_SHIFT) & RWMR_RHWM_MASK));
|
||||
}
|
||||
|
||||
/*
|
||||
* PHY/MII
|
||||
*/
|
||||
void
|
||||
emac3_phy_writereg(struct device *self, int phy, int reg, int data)
|
||||
{
|
||||
|
||||
if (emac3_phy_ready() != 0)
|
||||
return;
|
||||
|
||||
_emac3_reg_write_4(EMAC3_STACR, STACR_WRITE |
|
||||
((phy << STACR_PCDASHIFT) & STACR_PCDA) | /* command dest addr*/
|
||||
((reg << STACR_PRASHIFT) & STACR_PRA) | /* register addr */
|
||||
((data << STACR_PHYDSHIFT) & STACR_PHYD)); /* data */
|
||||
|
||||
if (emac3_phy_ready() != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
emac3_phy_readreg(struct device *self, int phy, int reg)
|
||||
{
|
||||
|
||||
if (emac3_phy_ready() != 0)
|
||||
return (0);
|
||||
|
||||
_emac3_reg_write_4(EMAC3_STACR, STACR_READ |
|
||||
((phy << STACR_PCDASHIFT) & STACR_PCDA) | /* command dest addr*/
|
||||
((reg << STACR_PRASHIFT) & STACR_PRA)); /* register addr */
|
||||
|
||||
if (emac3_phy_ready() != 0)
|
||||
return (0);
|
||||
|
||||
return ((_emac3_reg_read_4(EMAC3_STACR) >> STACR_PHYDSHIFT) & 0xffff);
|
||||
}
|
||||
|
||||
void
|
||||
emac3_phy_statchg(struct device *dev)
|
||||
{
|
||||
#define EMAC3_FDX (MR1_FDE | MR1_EIFC | MR1_APP)
|
||||
struct emac3_softc *sc = (void *)dev;
|
||||
int media;
|
||||
u_int32_t r;
|
||||
|
||||
media = sc->mii.mii_media_active;
|
||||
|
||||
r = _emac3_reg_read_4(EMAC3_MR1);
|
||||
|
||||
r &= ~(MR1_MF_MASK | MR1_IST | EMAC3_FDX);
|
||||
|
||||
switch (media & 0x1f) {
|
||||
default:
|
||||
printf("unknown media type. %08x", media);
|
||||
/* FALLTHROUGH */
|
||||
case IFM_100_TX:
|
||||
r |= (MR1_MF_100MBS | MR1_IST);
|
||||
if (media & IFM_FDX)
|
||||
r |= EMAC3_FDX;
|
||||
|
||||
break;
|
||||
case IFM_10_T:
|
||||
r |= MR1_MF_10MBS;
|
||||
if (media & IFM_FDX)
|
||||
r |= (EMAC3_FDX | MR1_IST);
|
||||
break;
|
||||
}
|
||||
|
||||
_emac3_reg_write_4(EMAC3_MR1, r);
|
||||
|
||||
/* store current state for re-initialize */
|
||||
sc->mode1_reg = _emac3_reg_read_4(EMAC3_MR1);
|
||||
#undef EMAC3_FDX
|
||||
}
|
||||
|
||||
int
|
||||
emac3_phy_ready()
|
||||
{
|
||||
int retry = 10000;
|
||||
|
||||
while ((_emac3_reg_read_4(EMAC3_STACR) & STACR_OC) == 0 &&
|
||||
--retry > 0)
|
||||
;
|
||||
if (retry == 0) {
|
||||
printf("emac3: phy busy.\n");
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
/* $NetBSD: emac3reg.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge and Eduardo Horvath for Wasabi 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
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi 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 WASABI 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 WASABI 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCPH-10190 EMAC3
|
||||
* Ethernet MAC Registers
|
||||
* based on arch/powerpc/include/ibm4xx/ibm405gp.h of EMAC0 register define.
|
||||
*/
|
||||
|
||||
#define EMAC3_MR0 0x00 /* Mode Register 0 */
|
||||
#define MR0_RXI 0x80000000 /* Receive MAC Idle */
|
||||
#define MR0_TXI 0x40000000 /* Transmit MAC Idle */
|
||||
#define MR0_SRST 0x20000000 /* Soft Reset */
|
||||
#define MR0_TXE 0x10000000 /* Transmit MAC Enable */
|
||||
#define MR0_RXE 0x08000000 /* Receive MAC Enable */
|
||||
#define MR0_WKE 0x04000000 /* Wake-up Enable */
|
||||
|
||||
#define EMAC3_MR1 0x04 /* Mode Register 1 */
|
||||
#define MR1_FDE 0x80000000 /* Full-Duplex Enable */
|
||||
#define MR1_ILE 0x40000000 /* Internal Loop-back Enable */
|
||||
#define MR1_VLE 0x20000000 /* VLAN Enable */
|
||||
#define MR1_EIFC 0x10000000 /* Enable Integrated Flow Control */
|
||||
#define MR1_APP 0x08000000 /* Allow Pause Packet */
|
||||
#define MR1_IST 0x01000000 /* Ignore SQE Test */
|
||||
#define MR1_MF_MASK 0x00c00000 /* Medium Frequency mask */
|
||||
#define MR1_MF_10MBS 0x00000000 /* 10MB/sec */
|
||||
#define MR1_MF_100MBS 0x00400000 /* 100MB/sec */
|
||||
#define MR1_RFS_MASK 0x00300000 /* Receive FIFO size */
|
||||
#define MR1_RFS_512 0x00000000 /* 512 bytes */
|
||||
#define MR1_RFS_1KB 0x00100000 /* 1kByte */
|
||||
#define MR1_RFS_2KB 0x00200000 /* 2kByte */
|
||||
#define MR1_RFS_4KB 0x00300000 /* 4kByte */
|
||||
#define MR1_TFS_MASK 0x000c0000 /* Transmit FIFO size */
|
||||
#define MR1_TFS_1KB 0x00040000 /* 1kByte */
|
||||
#define MR1_TFS_2KB 0x00080000 /* 2kByte */
|
||||
#define MR1_TR0_MASK 0x00018000 /* Transmit Request 0 */
|
||||
#define MR1_TR0_SINGLE 0x00000000 /* Single Packet mode */
|
||||
#define MR1_TR0_MULTIPLE 0x00008000 /* Multiple Packet mode */
|
||||
#define MR1_TR0_DEPENDANT 0x00010000 /* Dependent Mode */
|
||||
#define MR1_TR1_MASK 0x00006000 /* Transmit Request 1 */
|
||||
#define MR1_TR1_SINGLE 0x00000000 /* Single Packet mode */
|
||||
#define MR1_TR1_MULTIPLE 0x00002000 /* Multiply Packet mode */
|
||||
#define MR1_TR1_DEPENDANT 0x00004000 /* Dependent Mode */
|
||||
|
||||
#define EMAC3_TMR0 0x08 /* Transmit Mode Register 0 */
|
||||
#define TMR0_GNP0 0x80000000 /* Get New Packet for Channel 0 */
|
||||
#define TMR0_GNP1 0x40000000 /* Get New Packet for Channel 1 */
|
||||
#define TMR0_GNPD 0x20000000 /* Get New Packet for Dependent mode */
|
||||
#define TMR0_FC_MASK 0x10000000 /* First Channel */
|
||||
#define TMR0_FC_CHAN0 0x00000000 /* Channel 0 */
|
||||
#define TMR0_FC_CHAN1 0x10000000 /* Channel 1 */
|
||||
|
||||
#define EMAC3_TMR1 0x0c /* Transmit Mode Register 1 */
|
||||
#define TMR1_TLR_MASK 0xf8000000 /* Transmit Low Request */
|
||||
#define TMR1_TLR_SHIFT 27
|
||||
#define TMR1_TUR_MASK 0x00ff0000 /* Transmit Urgent Request */
|
||||
#define TMR1_TUR_SHIFT 16
|
||||
|
||||
#define EMAC3_RMR 0x10 /* Receive Mode Register */
|
||||
#define RMR_SP 0x80000000 /* Strip Padding */
|
||||
#define RMR_SFCS 0x40000000 /* Strip FCS */
|
||||
#define RMR_RRP 0x20000000 /* Receive Runt Packets */
|
||||
#define RMR_RFP 0x10000000 /* Receive FCS Packets */
|
||||
#define RMR_ROP 0x08000000 /* Receive Oversize Packets */
|
||||
#define RMR_RPIR 0x04000000 /* Receive Packets with In Range Error */
|
||||
#define RMR_PPP 0x02000000 /* Propagate Pause Packet */
|
||||
#define RMR_PME 0x01000000 /* Promiscuous Mode Enable */
|
||||
#define RMR_PMME 0x00800000 /* Promiscuous Multicast Mode Enable */
|
||||
#define RMR_IAE 0x00400000 /* Individual Address Enable */
|
||||
#define RMR_MIAE 0x00200000 /* Multiple Individual Address Enable */
|
||||
#define RMR_BAE 0x00100000 /* Broadcast Address Enable */
|
||||
#define RMR_MAE 0x00080000 /* Multicast Address Enable */
|
||||
|
||||
#define EMAC3_ISR 0x14 /* Interrupt Status Register */
|
||||
#define ISR_OVR 0x02000000 /* Overrun Error */
|
||||
#define ISR_PP 0x01000000 /* Pause Packet */
|
||||
#define ISR_BP 0x00800000 /* Bad Packet */
|
||||
#define ISR_RP 0x00400000 /* Runt Packet */
|
||||
#define ISR_SE 0x00200000 /* Short Event */
|
||||
#define ISR_ALE 0x00100000 /* Alignment Error */
|
||||
#define ISR_BFCS 0x00080000 /* Bad FCS */
|
||||
#define ISR_PTLE 0x00040000 /* Packet Too Long Error */
|
||||
#define ISR_ORE 0x00020000 /* Out of Range Error */
|
||||
#define ISR_IRE 0x00010000 /* In Range Error */
|
||||
#define ISR_DBDM 0x00000200 /* Dead Bit Dependent Mode */
|
||||
#define ISR_DB0 0x00000100 /* Dead Bit 0 */
|
||||
#define ISR_SE0 0x00000080 /* SQE Error 0 */
|
||||
#define ISR_TE0 0x00000040 /* Transmit Error 0 */
|
||||
#define ISR_DB1 0x00000020 /* Dead Bit 1 */
|
||||
#define ISR_SE1 0x00000010 /* SQE Error 1 */
|
||||
#define ISR_TE1 0x00000008 /* Transmit Error 1 */
|
||||
#define ISR_MOS 0x00000002 /* MMA Operation Succeeded */
|
||||
#define ISR_MOF 0x00000001 /* MMA Operation Failed */
|
||||
|
||||
#define EMAC3_ISER 0x18 /* Interrupt Status Enable Register */
|
||||
#define ISER_OVR ISR_OVR
|
||||
#define ISER_PP ISR_PP
|
||||
#define ISER_BP ISR_BP
|
||||
#define ISER_RP ISR_RP
|
||||
#define ISER_SE ISR_SE
|
||||
#define ISER_ALE ISR_ALE
|
||||
#define ISER_BFCS ISR_BFCS
|
||||
#define ISER_PTLE ISR_PTLE
|
||||
#define ISER_ORE ISR_ORE
|
||||
#define ISER_IRE ISR_IRE
|
||||
#define ISER_DBDM ISR_DBDM
|
||||
#define ISER_DB0 ISR_DB0
|
||||
#define ISER_SE0 ISR_SE0
|
||||
#define ISER_TE0 ISR_TE0
|
||||
#define ISER_DB1 ISR_DB1
|
||||
#define ISER_SE1 ISR_SE1
|
||||
#define ISER_TE1 ISR_TE1
|
||||
#define ISER_MOS ISR_MOS
|
||||
#define ISER_MOF ISR_MOF
|
||||
|
||||
#define EMAC3_IAHR 0x1c /* Individual Address High Register */
|
||||
#define EMAC3_IALR 0x20 /* Individual Address Low Register */
|
||||
#define EMAC3_VTPID 0x24 /* VLAN TPID Register */
|
||||
#define EMAC3_VTCI 0x28 /* VLAN TCI Register */
|
||||
#define EMAC3_PTR 0x2c /* Pause Timer Register */
|
||||
#define EMAC3_IAHT1 0x30 /* Individual Address Hash Table 1 */
|
||||
#define EMAC3_IAHT2 0x34 /* Individual Address Hash Table 2 */
|
||||
#define EMAC3_IAHT3 0x38 /* Individual Address Hash Table 3 */
|
||||
#define EMAC3_IAHT4 0x3c /* Individual Address Hash Table 4 */
|
||||
#define EMAC3_GAHT1 0x40 /* Group Address Hash Table 1 */
|
||||
#define EMAC3_GAHT2 0x44 /* Group Address Hash Table 2 */
|
||||
#define EMAC3_GAHT3 0x48 /* Group Address Hash Table 3 */
|
||||
#define EMAC3_GAHT4 0x4c /* Group Address Hash Table 4 */
|
||||
#define EMAC3_LSAH 0x50 /* Last Source Address High */
|
||||
#define EMAC3_LSAL 0x54 /* Last Source Address Low */
|
||||
#define EMAC3_IPGVR 0x58 /* Inter-Packet Gap Value Register */
|
||||
|
||||
#define EMAC3_STACR 0x5c /* STA Control Register */
|
||||
#define STACR_PHYD 0xffff0000 /* PHY data mask */
|
||||
#define STACR_PHYDSHIFT 16
|
||||
#define STACR_OC 0x00008000 /* operation complete */
|
||||
#define STACR_PHYE 0x00004000 /* PHY error */
|
||||
#define STACR_WRITE 0x00002000 /* STA command - write */
|
||||
#define STACR_READ 0x00001000 /* STA command - read */
|
||||
#define STACR_OPBC_MASK 0x00000c00 /* OPB bus clock freq mask */
|
||||
#define STACR_OPBC_50MHZ 0x00000000 /* OPB bus clock freq - 50MHz */
|
||||
#define STACR_OPBC_66MHZ 0x00000400 /* OPB bus clock freq - 66MHz */
|
||||
#define STACR_OPBC_83MHZ 0x00000800 /* OPB bus clock freq - 83MHz */
|
||||
#define STACR_OPBC_100MHZ 0x00000c00 /* OPB bus clock freq - 100MHz */
|
||||
#define STACR_PCDA 0x000003e0 /* PHY cmd dest address mask */
|
||||
#define STACR_PCDASHIFT 5
|
||||
#define STACR_PRA 0x0000001f /* PHY register address mask */
|
||||
#define STACR_PRASHIFT 0
|
||||
|
||||
#define EMAC3_TRTR 0x60 /* Transmit Request Threshold Register */
|
||||
#define TRTR_64 0x00000000 /* 64 bytes */
|
||||
#define TRTR_128 0x08000000 /* 128 bytes */
|
||||
#define TRTR_192 0x10000000 /* 192 bytes */
|
||||
#define TRTR_256 0x18000000 /* 256 bytes */
|
||||
/* ... and so on +64 until ... */
|
||||
#define TRTR_2048 0xf8000000 /* 2048 bytes */
|
||||
#define TRTR_MASK 0xf8000000
|
||||
#define TRTR_SHIFT 27
|
||||
|
||||
#define EMAC3_RWMR 0x64 /* Receive Low/High Water Mark Register */
|
||||
#define RWMR_RLWM_MASK 0xff800000 /* Receive Low Water Mark */
|
||||
#define RWMR_RLWM_SHIFT 23
|
||||
#define RWMR_RHWM_MASK 0x0000ff80 /* Receive High Water Mark */
|
||||
#define RWMR_RHWM_SHIFT 7
|
||||
|
||||
#define EMAC3_OCTX 0x68 /* Number of Octets Transmitted */
|
||||
#define EMAC3_OCRX 0x6c /* Number of Octets Received */
|
||||
|
||||
|
||||
/*
|
||||
* MAL buffer descriptor control/status bit definitions, in the
|
||||
* md_stat_ctrl field of the MAL descriptor <playstation2/dev/if_smapreg.h>
|
||||
*/
|
||||
|
||||
/* EMAC transmit control definitions */
|
||||
#define EMAC_TXC_GFCS 0x0200 /* Generate FCS */
|
||||
#define EMAC_TXC_GPAD 0x0100 /* Generate padding */
|
||||
#define EMAC_TXC_ISA 0x0080 /* Insert Source Address */
|
||||
#define EMAC_TXC_RSA 0x0040 /* Replace Source Address */
|
||||
#define EMAC_TXC_IVT 0x0020 /* Insert VLAN Tag */
|
||||
#define EMAC_TXC_RVT 0x0010 /* Replace VLAN Tag */
|
||||
|
||||
/* EMAC transmit status definitions */
|
||||
#define EMAC_TXS_BFCS 0x0200 /* Bad FCS */
|
||||
#define EMAC_TXS_BPP 0x0100 /* Bad previous packet */
|
||||
#define EMAC_TXS_LCS 0x0080 /* Loss of carrier sense */
|
||||
#define EMAC_TXS_ED 0x0040 /* Excessive deferral */
|
||||
#define EMAC_TXS_EC 0x0020 /* Excessive collisions */
|
||||
#define EMAC_TXS_LC 0x0010 /* Late collision */
|
||||
#define EMAC_TXS_MC 0x0008 /* Multiple collision */
|
||||
#define EMAC_TXS_SC 0x0004 /* Single collision */
|
||||
#define EMAC_TXS_UR 0x0002 /* Underrun */
|
||||
#define EMAC_TXS_SQE 0x0001 /* Signal Quality Error */
|
||||
|
||||
/* EMAC receive status definitions */
|
||||
#define EMAC_RXS_OE 0x0200 /* Overrun error */
|
||||
#define EMAC_RXS_PP 0x0100 /* Pause packet received */
|
||||
#define EMAC_RXS_BP 0x0080 /* Bad packet */
|
||||
#define EMAC_RXS_RP 0x0040 /* Runt packet */
|
||||
#define EMAC_RXS_SE 0x0020 /* Short event */
|
||||
#define EMAC_RXS_AE 0x0010 /* Alignment error */
|
||||
#define EMAC_RXS_BFCS 0x0008 /* Bad FCS */
|
||||
#define EMAC_RXS_PTL 0x0004 /* Packet too long */
|
||||
#define EMAC_RXS_ORE 0x0002 /* Out of range error */
|
||||
#define EMAC_RXS_IRE 0x0001 /* In range error */
|
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: emac3var.h,v 1.5 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct emac3_softc {
|
||||
struct device dev;
|
||||
struct mii_data mii;
|
||||
u_int8_t eaddr[ETHER_ADDR_LEN];
|
||||
u_int32_t mode1_reg;
|
||||
};
|
||||
|
||||
int emac3_init(struct emac3_softc *);
|
||||
int emac3_reset(struct emac3_softc *);
|
||||
void emac3_exit(struct emac3_softc *);
|
||||
|
||||
void emac3_enable(void);
|
||||
void emac3_disable(void);
|
||||
|
||||
void emac3_intr_enable(void);
|
||||
void emac3_intr_disable(void);
|
||||
void emac3_intr_clear(void);
|
||||
int emac3_intr(void *);
|
||||
|
||||
void emac3_tx_kick(void);
|
||||
int emac3_tx_done(void);
|
||||
|
||||
void emac3_setmulti(struct emac3_softc *, struct ethercom *);
|
||||
|
||||
int emac3_phy_readreg(struct device *, int, int);
|
||||
void emac3_phy_writereg(struct device *, int, int, int);
|
||||
void emac3_phy_statchg(struct device *);
|
|
@ -0,0 +1,763 @@
|
|||
/* $NetBSD: if_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
|
||||
#if NRND > 0
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <net/if_ether.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/if_inarp.h>
|
||||
|
||||
#if NBPFILTER > 0
|
||||
#include <net/bpf.h>
|
||||
#include <net/bpfdesc.h>
|
||||
#endif
|
||||
|
||||
#include <playstation2/dev/spdvar.h>
|
||||
#include <playstation2/dev/spdreg.h>
|
||||
#include <playstation2/dev/emac3var.h>
|
||||
#include <playstation2/dev/if_smapreg.h>
|
||||
|
||||
#ifdef SMAP_DEBUG
|
||||
#include <playstation2/ee/gsvar.h>
|
||||
int smap_debug = 0;
|
||||
#define DPRINTF(fmt, args...) \
|
||||
if (smap_debug) \
|
||||
printf("%s: " fmt, __func__ , ##args)
|
||||
#define DPRINTFN(n, arg) \
|
||||
if (smap_debug > (n)) \
|
||||
printf("%s: " fmt, __func__ , ##args)
|
||||
#define STATIC
|
||||
struct smap_softc *__sc;
|
||||
void __smap_status(int);
|
||||
void __smap_lock_check(const char *, int);
|
||||
#define FUNC_ENTER() __smap_lock_check(__func__, 1)
|
||||
#define FUNC_EXIT() __smap_lock_check(__func__, 0)
|
||||
#else
|
||||
#define DPRINTF(arg...) ((void)0)
|
||||
#define DPRINTFN(n, arg...) ((void)0)
|
||||
#define STATIC static
|
||||
#define FUNC_ENTER() ((void)0)
|
||||
#define FUNC_EXIT() ((void)0)
|
||||
#endif
|
||||
|
||||
struct smap_softc {
|
||||
struct emac3_softc emac3;
|
||||
struct ethercom ethercom;
|
||||
|
||||
u_int32_t *tx_buf;
|
||||
u_int32_t *rx_buf;
|
||||
struct smap_desc *tx_desc;
|
||||
struct smap_desc *rx_desc;
|
||||
|
||||
#define SMAP_FIFO_ALIGN 4
|
||||
int tx_buf_freesize; /* buffer usage */
|
||||
int tx_desc_cnt; /* descriptor usage */
|
||||
u_int16_t tx_fifo_ptr;
|
||||
int tx_done_index, tx_start_index;
|
||||
int rx_done_index;
|
||||
|
||||
#if NRND > 0
|
||||
rndsource_element_t rnd_source;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define DEVNAME (sc->emac3.dev.dv_xname)
|
||||
#define ROUND4(x) (((x) + 3) & ~3)
|
||||
#define ROUND16(x) (((x) + 15) & ~15)
|
||||
|
||||
STATIC int smap_match(struct device *, struct cfdata *, void *);
|
||||
STATIC void smap_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(smap, sizeof (struct smap_softc),
|
||||
smap_match, smap_attach, NULL, NULL);
|
||||
|
||||
STATIC int smap_intr(void *);
|
||||
STATIC void smap_rxeof(void *);
|
||||
STATIC void smap_txeof(void *);
|
||||
STATIC void smap_start(struct ifnet *);
|
||||
STATIC void smap_watchdog(struct ifnet *);
|
||||
STATIC int smap_ioctl(struct ifnet *, u_long, void *);
|
||||
STATIC int smap_init(struct ifnet *);
|
||||
STATIC void smap_stop(struct ifnet *, int);
|
||||
|
||||
STATIC int smap_get_eaddr(struct smap_softc *, u_int8_t *);
|
||||
STATIC int smap_fifo_init(struct smap_softc *);
|
||||
STATIC int smap_fifo_reset(bus_addr_t);
|
||||
STATIC void smap_desc_init(struct smap_softc *);
|
||||
|
||||
int
|
||||
smap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct spd_attach_args *spa = aux;
|
||||
|
||||
if (spa->spa_slot != SPD_NIC)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
smap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct spd_attach_args *spa = aux;
|
||||
struct smap_softc *sc = (void *)self;
|
||||
struct emac3_softc *emac3 = &sc->emac3;
|
||||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
struct mii_data *mii = &emac3->mii;
|
||||
void *txbuf, *rxbuf;
|
||||
u_int16_t r;
|
||||
|
||||
#ifdef SMAP_DEBUG
|
||||
__sc = sc;
|
||||
#endif
|
||||
|
||||
printf(": %s\n", spa->spa_product_name);
|
||||
|
||||
/* SPD EEPROM */
|
||||
if (smap_get_eaddr(sc, emac3->eaddr) != 0)
|
||||
return;
|
||||
|
||||
printf("%s: Ethernet address %s\n", DEVNAME,
|
||||
ether_sprintf(emac3->eaddr));
|
||||
|
||||
/* disable interrupts */
|
||||
r = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
r &= ~(SPD_INTR_RXEND | SPD_INTR_TXEND | SPD_INTR_RXDNV |
|
||||
SPD_INTR_EMAC3);
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r);
|
||||
emac3_intr_disable();
|
||||
|
||||
/* clear pending interrupts */
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, SPD_INTR_RXEND | SPD_INTR_TXEND |
|
||||
SPD_INTR_RXDNV);
|
||||
emac3_intr_clear();
|
||||
|
||||
/* buffer descriptor mode */
|
||||
_reg_write_1(SMAP_DESC_MODE_REG8, 0);
|
||||
|
||||
if (smap_fifo_init(sc) != 0)
|
||||
return;
|
||||
|
||||
if (emac3_init(&sc->emac3) != 0)
|
||||
return;
|
||||
emac3_intr_disable();
|
||||
emac3_disable();
|
||||
|
||||
smap_desc_init(sc);
|
||||
|
||||
/* allocate temporary buffer */
|
||||
txbuf = malloc(ETHER_MAX_LEN - ETHER_CRC_LEN + SMAP_FIFO_ALIGN + 16,
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
if (txbuf == NULL) {
|
||||
printf("%s: no memory.\n", DEVNAME);
|
||||
return;
|
||||
}
|
||||
|
||||
rxbuf = malloc(ETHER_MAX_LEN + SMAP_FIFO_ALIGN + 16,
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
if (rxbuf == NULL) {
|
||||
printf("%s: no memory.\n", DEVNAME);
|
||||
free(txbuf, M_DEVBUF);
|
||||
return;
|
||||
}
|
||||
|
||||
sc->tx_buf = (u_int32_t *)ROUND16((vaddr_t)txbuf);
|
||||
sc->rx_buf = (u_int32_t *)ROUND16((vaddr_t)rxbuf);
|
||||
|
||||
/*
|
||||
* setup MI layer
|
||||
*/
|
||||
strcpy(ifp->if_xname, DEVNAME);
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_start = smap_start;
|
||||
ifp->if_ioctl = smap_ioctl;
|
||||
ifp->if_init = smap_init;
|
||||
ifp->if_stop = smap_stop;
|
||||
ifp->if_watchdog= smap_watchdog;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS |
|
||||
IFF_MULTICAST;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
|
||||
/* ifmedia setup. */
|
||||
mii->mii_ifp = ifp;
|
||||
mii->mii_readreg = emac3_phy_readreg;
|
||||
mii->mii_writereg = emac3_phy_writereg;
|
||||
mii->mii_statchg = emac3_phy_statchg;
|
||||
sc->ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(&emac3->dev, mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
/* Choose a default media. */
|
||||
if (LIST_FIRST(&mii->mii_phys) == NULL) {
|
||||
ifmedia_add(&mii->mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
|
||||
ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_NONE);
|
||||
} else {
|
||||
ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_AUTO);
|
||||
}
|
||||
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp, emac3->eaddr);
|
||||
|
||||
spd_intr_establish(SPD_NIC, smap_intr, sc);
|
||||
|
||||
#if NRND > 0
|
||||
rnd_attach_source(&sc->rnd_source, DEVNAME,
|
||||
RND_TYPE_NET, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
smap_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
int error, s;
|
||||
|
||||
s = splnet();
|
||||
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
emac3_setmulti(&sc->emac3, &sc->ethercom);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
smap_intr(void *arg)
|
||||
{
|
||||
struct smap_softc *sc = arg;
|
||||
struct ifnet *ifp;
|
||||
u_int16_t cause, disable, r;
|
||||
|
||||
cause = _reg_read_2(SPD_INTR_STATUS_REG16) &
|
||||
_reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
|
||||
disable = cause & (SPD_INTR_RXDNV | SPD_INTR_TXDNV);
|
||||
if (disable) {
|
||||
r = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
r &= ~disable;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r);
|
||||
|
||||
printf("%s: invalid descriptor. (%c%c)\n", DEVNAME,
|
||||
disable & SPD_INTR_RXDNV ? 'R' : '_',
|
||||
disable & SPD_INTR_TXDNV ? 'T' : '_');
|
||||
|
||||
if (disable & SPD_INTR_RXDNV)
|
||||
smap_rxeof(arg);
|
||||
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, disable);
|
||||
}
|
||||
|
||||
if (cause & SPD_INTR_TXEND) {
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, SPD_INTR_TXEND);
|
||||
if (_reg_read_1(SMAP_RXFIFO_FRAME_REG8) > 0)
|
||||
cause |= SPD_INTR_RXEND;
|
||||
smap_txeof(arg);
|
||||
}
|
||||
|
||||
if (cause & SPD_INTR_RXEND) {
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, SPD_INTR_RXEND);
|
||||
smap_rxeof(arg);
|
||||
if (sc->tx_desc_cnt > 0 &&
|
||||
sc->tx_desc_cnt > _reg_read_1(SMAP_TXFIFO_FRAME_REG8))
|
||||
smap_txeof(arg);
|
||||
}
|
||||
|
||||
if (cause & SPD_INTR_EMAC3)
|
||||
emac3_intr(arg);
|
||||
|
||||
/* if transmission is pending, start here */
|
||||
ifp = &sc->ethercom.ec_if;
|
||||
if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
|
||||
smap_start(ifp);
|
||||
#if NRND > 0
|
||||
rnd_add_uint32(&sc->rnd_source, cause | sc->tx_fifo_ptr << 16);
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
smap_rxeof(void *arg)
|
||||
{
|
||||
struct smap_softc *sc = arg;
|
||||
struct smap_desc *d;
|
||||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
struct mbuf *m;
|
||||
u_int16_t r16, stat;
|
||||
u_int32_t *p;
|
||||
int i, j, sz, rxsz, cnt;
|
||||
|
||||
FUNC_ENTER();
|
||||
|
||||
i = sc->rx_done_index;
|
||||
|
||||
for (cnt = 0;; cnt++, i = (i + 1) & 0x3f) {
|
||||
m = NULL;
|
||||
d = &sc->rx_desc[i];
|
||||
stat = d->stat;
|
||||
|
||||
if ((stat & SMAP_RXDESC_EMPTY) != 0) {
|
||||
break;
|
||||
} else if (stat & 0x7fff) {
|
||||
ifp->if_ierrors++;
|
||||
goto next_packet;
|
||||
}
|
||||
|
||||
sz = d->sz;
|
||||
rxsz = ROUND4(sz);
|
||||
|
||||
KDASSERT(sz >= ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN);
|
||||
KDASSERT(sz <= ETHER_MAX_LEN);
|
||||
|
||||
/* load data from FIFO */
|
||||
_reg_write_2(SMAP_RXFIFO_PTR_REG16, d->ptr & 0x3ffc);
|
||||
p = sc->rx_buf;
|
||||
for (j = 0; j < rxsz; j += sizeof(u_int32_t)) {
|
||||
*p++ = _reg_read_4(SMAP_RXFIFO_DATA_REG);
|
||||
}
|
||||
|
||||
/* put to mbuf */
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == NULL) {
|
||||
printf("%s: unable to allocate Rx mbuf\n", DEVNAME);
|
||||
ifp->if_ierrors++;
|
||||
goto next_packet;
|
||||
}
|
||||
|
||||
if (sz > (MHLEN - 2)) {
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
printf("%s: unable to allocate Rx cluster\n",
|
||||
DEVNAME);
|
||||
m_freem(m);
|
||||
m = NULL;
|
||||
ifp->if_ierrors++;
|
||||
goto next_packet;
|
||||
}
|
||||
}
|
||||
|
||||
m->m_data += 2; /* for alignment */
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = sz;
|
||||
memcpy(mtod(m, void *), (void *)sc->rx_buf, sz);
|
||||
|
||||
next_packet:
|
||||
ifp->if_ipackets++;
|
||||
|
||||
_reg_write_1(SMAP_RXFIFO_FRAME_DEC_REG8, 1);
|
||||
|
||||
/* free descriptor */
|
||||
d->sz = 0;
|
||||
d->ptr = 0;
|
||||
d->stat = SMAP_RXDESC_EMPTY;
|
||||
_wbflush();
|
||||
|
||||
if (m != NULL) {
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
}
|
||||
sc->rx_done_index = i;
|
||||
|
||||
r16 = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
if (((r16 & SPD_INTR_RXDNV) == 0) && cnt > 0) {
|
||||
r16 |= SPD_INTR_RXDNV;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r16);
|
||||
}
|
||||
|
||||
FUNC_EXIT();
|
||||
}
|
||||
|
||||
void
|
||||
smap_txeof(void *arg)
|
||||
{
|
||||
struct smap_softc *sc = arg;
|
||||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
struct smap_desc *d;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER();
|
||||
|
||||
/* clear the timeout timer. */
|
||||
ifp->if_timer = 0;
|
||||
|
||||
/* garbage collect */
|
||||
for (i = sc->tx_done_index;; i = (i + 1) & 0x3f) {
|
||||
u_int16_t stat;
|
||||
|
||||
d = &sc->tx_desc[i];
|
||||
stat = d->stat;
|
||||
if (stat & SMAP_TXDESC_READY) {
|
||||
/* all descriptor processed. */
|
||||
break;
|
||||
} else if (stat & 0x7fff) {
|
||||
if (stat & (SMAP_TXDESC_ECOLL | SMAP_TXDESC_LCOLL |
|
||||
SMAP_TXDESC_MCOLL | SMAP_TXDESC_SCOLL))
|
||||
ifp->if_collisions++;
|
||||
else
|
||||
ifp->if_oerrors++;
|
||||
} else {
|
||||
ifp->if_opackets++;
|
||||
}
|
||||
|
||||
if (sc->tx_desc_cnt == 0)
|
||||
break;
|
||||
|
||||
sc->tx_buf_freesize += ROUND4(d->sz);
|
||||
sc->tx_desc_cnt--;
|
||||
|
||||
d->sz = 0;
|
||||
d->ptr = 0;
|
||||
d->stat = 0;
|
||||
_wbflush();
|
||||
}
|
||||
sc->tx_done_index = i;
|
||||
|
||||
/* OK to start transmit */
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
FUNC_EXIT();
|
||||
}
|
||||
|
||||
void
|
||||
smap_start(struct ifnet *ifp)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
struct smap_desc *d;
|
||||
struct mbuf *m0, *m;
|
||||
u_int8_t *p, *q;
|
||||
u_int32_t *r;
|
||||
int i, sz, pktsz;
|
||||
u_int16_t fifop;
|
||||
u_int16_t r16;
|
||||
|
||||
KDASSERT(ifp->if_flags & IFF_RUNNING);
|
||||
FUNC_ENTER();
|
||||
|
||||
while (1) {
|
||||
IFQ_POLL(&ifp->if_snd, m0);
|
||||
if (m0 == NULL)
|
||||
goto end;
|
||||
|
||||
pktsz = m0->m_pkthdr.len;
|
||||
KDASSERT(pktsz <= ETHER_MAX_LEN - ETHER_CRC_LEN);
|
||||
sz = ROUND4(pktsz);
|
||||
|
||||
if (sz > sc->tx_buf_freesize ||
|
||||
sc->tx_desc_cnt >= SMAP_DESC_MAX ||
|
||||
emac3_tx_done() != 0) {
|
||||
ifp->if_flags |= IFF_OACTIVE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
IFQ_DEQUEUE(&ifp->if_snd, m0);
|
||||
KDASSERT(m0 != NULL);
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m0);
|
||||
#endif
|
||||
|
||||
p = (u_int8_t *)sc->tx_buf;
|
||||
q = p + sz;
|
||||
/* copy to temporary buffer area */
|
||||
for (m = m0; m != 0; m = m->m_next) {
|
||||
memcpy(p, mtod(m, void *), m->m_len);
|
||||
p += m->m_len;
|
||||
}
|
||||
m_freem(m0);
|
||||
|
||||
/* zero padding area */
|
||||
for (; p < q; p++)
|
||||
*p = 0;
|
||||
|
||||
/* put to FIFO */
|
||||
fifop = sc->tx_fifo_ptr;
|
||||
KDASSERT((fifop & 3) == 0);
|
||||
_reg_write_2(SMAP_TXFIFO_PTR_REG16, fifop);
|
||||
sc->tx_fifo_ptr = (fifop + sz) & 0xfff;
|
||||
|
||||
r = sc->tx_buf;
|
||||
for (i = 0; i < sz; i += sizeof(u_int32_t))
|
||||
*(volatile u_int32_t *)SMAP_TXFIFO_DATA_REG = *r++;
|
||||
_wbflush();
|
||||
|
||||
/* put FIFO to EMAC3 */
|
||||
d = &sc->tx_desc[sc->tx_start_index];
|
||||
KDASSERT((d->stat & SMAP_TXDESC_READY) == 0);
|
||||
|
||||
d->sz = pktsz;
|
||||
d->ptr = fifop + SMAP_TXBUF_BASE;
|
||||
d->stat = SMAP_TXDESC_READY | SMAP_TXDESC_GENFCS |
|
||||
SMAP_TXDESC_GENPAD;
|
||||
_wbflush();
|
||||
|
||||
sc->tx_buf_freesize -= sz;
|
||||
sc->tx_desc_cnt++;
|
||||
sc->tx_start_index = (sc->tx_start_index + 1) & 0x3f;
|
||||
_reg_write_1(SMAP_TXFIFO_FRAME_INC_REG8, 1);
|
||||
|
||||
emac3_tx_kick();
|
||||
r16 = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
if ((r16 & SPD_INTR_TXDNV) == 0) {
|
||||
r16 |= SPD_INTR_TXDNV;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r16);
|
||||
}
|
||||
}
|
||||
end:
|
||||
/* set watchdog timer */
|
||||
ifp->if_timer = 5;
|
||||
|
||||
FUNC_EXIT();
|
||||
}
|
||||
|
||||
void
|
||||
smap_watchdog(struct ifnet *ifp)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
|
||||
printf("%s: watchdog timeout\n",DEVNAME);
|
||||
sc->ethercom.ec_if.if_oerrors++;
|
||||
|
||||
smap_fifo_init(sc);
|
||||
smap_desc_init(sc);
|
||||
emac3_reset(&sc->emac3);
|
||||
}
|
||||
|
||||
int
|
||||
smap_init(struct ifnet *ifp)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
u_int16_t r16;
|
||||
int rc;
|
||||
|
||||
smap_fifo_init(sc);
|
||||
emac3_reset(&sc->emac3);
|
||||
smap_desc_init(sc);
|
||||
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, SPD_INTR_RXEND | SPD_INTR_TXEND |
|
||||
SPD_INTR_RXDNV);
|
||||
emac3_intr_clear();
|
||||
|
||||
r16 = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
r16 |= SPD_INTR_EMAC3 | SPD_INTR_RXEND | SPD_INTR_TXEND |
|
||||
SPD_INTR_RXDNV;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r16);
|
||||
emac3_intr_enable();
|
||||
|
||||
emac3_enable();
|
||||
|
||||
/* Program the multicast filter, if necessary. */
|
||||
emac3_setmulti(&sc->emac3, &sc->ethercom);
|
||||
|
||||
/* Set current media. */
|
||||
if ((rc = mii_mediachg(&sc->emac3.mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
return rc;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
smap_stop(struct ifnet *ifp, int disable)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_down(&sc->emac3.mii);
|
||||
|
||||
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
|
||||
|
||||
if (disable)
|
||||
emac3_disable();
|
||||
}
|
||||
|
||||
/*
|
||||
* FIFO
|
||||
*/
|
||||
int
|
||||
smap_fifo_init(struct smap_softc *sc)
|
||||
{
|
||||
|
||||
if (smap_fifo_reset(SMAP_TXFIFO_CTRL_REG8) != 0)
|
||||
goto error;
|
||||
|
||||
if (smap_fifo_reset(SMAP_RXFIFO_CTRL_REG8) != 0)
|
||||
goto error;
|
||||
|
||||
return (0);
|
||||
error:
|
||||
printf("%s: FIFO reset not complete.\n", DEVNAME);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
smap_fifo_reset(bus_addr_t a)
|
||||
{
|
||||
int retry = 10000;
|
||||
|
||||
_reg_write_1(a, SMAP_FIFO_RESET);
|
||||
|
||||
while ((_reg_read_1(a) & SMAP_FIFO_RESET) && --retry > 0)
|
||||
;
|
||||
|
||||
return (retry == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Buffer descriptor
|
||||
*/
|
||||
void
|
||||
smap_desc_init(struct smap_softc *sc)
|
||||
{
|
||||
struct smap_desc *d;
|
||||
int i;
|
||||
|
||||
sc->tx_desc = (void *)SMAP_TXDESC_BASE;
|
||||
sc->rx_desc = (void *)SMAP_RXDESC_BASE;
|
||||
|
||||
sc->tx_buf_freesize = SMAP_TXBUF_SIZE;
|
||||
sc->tx_fifo_ptr = 0;
|
||||
sc->tx_start_index = 0;
|
||||
sc->tx_done_index = 0;
|
||||
sc->rx_done_index = 0;
|
||||
|
||||
/* intialize entry */
|
||||
d = sc->tx_desc;
|
||||
for (i = 0; i < SMAP_DESC_MAX; i++, d++) {
|
||||
d->stat = 0;
|
||||
d->__reserved = 0;
|
||||
d->sz = 0;
|
||||
d->ptr = 0;
|
||||
}
|
||||
|
||||
d = sc->rx_desc;
|
||||
for (i = 0; i < SMAP_DESC_MAX; i++, d++) {
|
||||
d->stat = SMAP_RXDESC_EMPTY;
|
||||
d->__reserved = 0;
|
||||
d->sz = 0;
|
||||
d->ptr = 0;
|
||||
}
|
||||
_wbflush();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* EEPROM
|
||||
*/
|
||||
int
|
||||
smap_get_eaddr(struct smap_softc *sc, u_int8_t *eaddr)
|
||||
{
|
||||
u_int16_t checksum, *p = (u_int16_t *)eaddr;
|
||||
|
||||
spd_eeprom_read(0, p, 3);
|
||||
spd_eeprom_read(3, &checksum, 1);
|
||||
|
||||
if (checksum != (u_int16_t)(p[0] + p[1] + p[2])) {
|
||||
printf("%s: Ethernet address checksum error.(%s)\n",
|
||||
DEVNAME, ether_sprintf(eaddr));
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef SMAP_DEBUG
|
||||
#include <mips/locore.h>
|
||||
void
|
||||
__smap_lock_check(const char *func, int enter)
|
||||
{
|
||||
static int cnt;
|
||||
static const char *last;
|
||||
|
||||
cnt += enter ? 1 : -1;
|
||||
|
||||
if (cnt < 0 || cnt > 1)
|
||||
panic("%s cnt=%d last=%s", func, cnt, last);
|
||||
|
||||
last = func;
|
||||
}
|
||||
|
||||
void
|
||||
__smap_status(int msg)
|
||||
{
|
||||
static int cnt;
|
||||
__gsfb_print(1, "%d: tx=%d rx=%d txcnt=%d free=%d cnt=%d\n", msg,
|
||||
_reg_read_1(SMAP_TXFIFO_FRAME_REG8),
|
||||
_reg_read_1(SMAP_RXFIFO_FRAME_REG8), __sc->tx_desc_cnt,
|
||||
__sc->tx_buf_freesize, cnt++);
|
||||
}
|
||||
#endif /* SMAP_DEBUG */
|
|
@ -0,0 +1,115 @@
|
|||
/* $NetBSD: if_smapreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SMAP memory access layer.
|
||||
*
|
||||
* <-> FIFO <-> BUF
|
||||
* CPU +<-----> EMAC3
|
||||
* <----------> DESC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Buffer (accessed by FIFO or EMAC3. indexed by descriptor)
|
||||
*/
|
||||
#define SMAP_TXBUF_BASE 0x1000
|
||||
#define SMAP_TXBUF_SIZE 0x1000
|
||||
#define SMAP_RXBUF_BASE 0x4000
|
||||
#define SMAP_RXBUF_SIZE 0x4000
|
||||
|
||||
/*
|
||||
* FIFO access
|
||||
*/
|
||||
#define SMAP_TXFIFO_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14001000)
|
||||
#define SMAP_TXFIFO_PTR_REG16 MIPS_PHYS_TO_KSEG1(0x14001004)
|
||||
#define SMAP_TXFIFO_FRAME_REG8 MIPS_PHYS_TO_KSEG1(0x1400100c)
|
||||
#define SMAP_TXFIFO_FRAME_INC_REG8 MIPS_PHYS_TO_KSEG1(0x14001010)
|
||||
#define SMAP_TXFIFO_DATA_REG MIPS_PHYS_TO_KSEG1(0x14001100)
|
||||
#define SMAP_RXFIFO_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14001030)
|
||||
#define SMAP_RXFIFO_PTR_REG16 MIPS_PHYS_TO_KSEG1(0x14001034)
|
||||
#define SMAP_RXFIFO_FRAME_REG8 MIPS_PHYS_TO_KSEG1(0x1400103c)
|
||||
#define SMAP_RXFIFO_FRAME_DEC_REG8 MIPS_PHYS_TO_KSEG1(0x14001040)
|
||||
#define SMAP_RXFIFO_DATA_REG MIPS_PHYS_TO_KSEG1(0x14001200)
|
||||
#define SMAP_FIFO_RESET 0x01
|
||||
|
||||
/*
|
||||
* Descriptor access
|
||||
*/
|
||||
#define SMAP_DESC_MODE_REG8 MIPS_PHYS_TO_KSEG1(0x14000102)
|
||||
#define SMAP_DESC_MODE_SWAP 0x0001
|
||||
|
||||
#define SMAP_TXDESC_BASE MIPS_PHYS_TO_KSEG1(0x14003000)
|
||||
#define SMAP_RXDESC_BASE MIPS_PHYS_TO_KSEG1(0x14003200)
|
||||
#define SMAP_DESC_MAX 64
|
||||
struct smap_desc {
|
||||
u_int16_t stat;
|
||||
u_int16_t __reserved;
|
||||
u_int16_t sz;
|
||||
u_int16_t ptr;
|
||||
}__attribute__((__packed__, __aligned__(8)));
|
||||
|
||||
/* TX Control */
|
||||
#define SMAP_TXDESC_READY 0x8000
|
||||
#define SMAP_TXDESC_GENFCS 0x0200
|
||||
#define SMAP_TXDESC_GENPAD 0x0100
|
||||
#define SMAP_TXDESC_INSSA 0x0080
|
||||
#define SMAP_TXDESC_RPLSA 0x0040
|
||||
#define SMAP_TXDESC_INSVLAN 0x0020
|
||||
#define SMAP_TXDESC_RPLVLAN 0x0010
|
||||
|
||||
/* TX Status */
|
||||
#define SMAP_TXDESC_READY 0x8000
|
||||
#define SMAP_TXDESC_BADFCS 0x0200
|
||||
#define SMAP_TXDESC_BADPKT 0x0100
|
||||
#define SMAP_TXDESC_LOSSCR 0x0080
|
||||
#define SMAP_TXDESC_EDEFER 0x0040
|
||||
#define SMAP_TXDESC_ECOLL 0x0020
|
||||
#define SMAP_TXDESC_LCOLL 0x0010
|
||||
#define SMAP_TXDESC_MCOLL 0x0008
|
||||
#define SMAP_TXDESC_SCOLL 0x0004
|
||||
#define SMAP_TXDESC_UNDERRUN 0x0002
|
||||
#define SMAP_TXDESC_SQE 0x0001
|
||||
|
||||
/* RX Control */
|
||||
#define SMAP_RXDESC_EMPTY 0x8000
|
||||
|
||||
/* RX Status */
|
||||
#define SMAP_RXDESC_EMPTY 0x8000
|
||||
#define SMAP_RXDESC_OVERRUN 0x0200
|
||||
#define SMAP_RXDESC_PFRM 0x0100
|
||||
#define SMAP_RXDESC_BADFRM 0x0080
|
||||
#define SMAP_RXDESC_RUNTFRM 0x0040
|
||||
#define SMAP_RXDESC_SHORTEVNT 0x0020
|
||||
#define SMAP_RXDESC_ALIGNERR 0x0010
|
||||
#define SMAP_RXDESC_BADFCS 0x0008
|
||||
#define SMAP_RXDESC_FRMTOOLONG 0x0004
|
||||
#define SMAP_RXDESC_OUTRANGE 0x0002
|
||||
#define SMAP_RXDESC_INRANGE 0x0001
|
|
@ -0,0 +1,245 @@
|
|||
/* $NetBSD: ohci_sbus.c,v 1.11 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: ohci_sbus.c,v 1.11 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
/* bus_dma */
|
||||
#include <sys/mbuf.h>
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#define _PLAYSTATION2_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdivar.h>
|
||||
#include <dev/usb/usb_mem.h>
|
||||
|
||||
#include <dev/usb/ohcireg.h>
|
||||
#include <dev/usb/ohcivar.h>
|
||||
|
||||
#include <playstation2/ee/sifvar.h> /* DMA staff */
|
||||
#include <playstation2/ee/dmacvar.h>
|
||||
#include <playstation2/dev/sbusvar.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
#define SBUS_OHCI_REGBASE MIPS_PHYS_TO_KSEG1(0x1f801600)
|
||||
#define SBUS_OHCI_REGSIZE 0x1000
|
||||
|
||||
STATIC int ohci_sbus_match(struct device *, struct cfdata *, void *);
|
||||
STATIC void ohci_sbus_attach(struct device *, struct device *, void *);
|
||||
|
||||
STATIC void _ohci_sbus_map_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
|
||||
bus_size_t, int);
|
||||
STATIC int _ohci_sbus_mem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
|
||||
bus_size_t, bus_dma_segment_t *, int, int *, int);
|
||||
STATIC void _ohci_sbus_mem_free(bus_dma_tag_t, bus_dma_segment_t *, int);
|
||||
STATIC int _ohci_sbus_mem_map(bus_dma_tag_t, bus_dma_segment_t *, int, size_t,
|
||||
void **, int);
|
||||
STATIC void _ohci_sbus_mem_unmap(bus_dma_tag_t, void *, size_t);
|
||||
|
||||
struct playstation2_bus_dma_tag ohci_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,
|
||||
_ohci_sbus_map_sync,
|
||||
_ohci_sbus_mem_alloc,
|
||||
_ohci_sbus_mem_free,
|
||||
_ohci_sbus_mem_map,
|
||||
_ohci_sbus_mem_unmap,
|
||||
_bus_dmamem_mmap,
|
||||
};
|
||||
|
||||
struct ohci_dma_segment {
|
||||
struct iopdma_segment ds_iopdma_seg;
|
||||
|
||||
LIST_ENTRY(ohci_dma_segment) ds_link;
|
||||
};
|
||||
|
||||
struct ohci_sbus_softc {
|
||||
struct ohci_softc sc;
|
||||
|
||||
LIST_HEAD(, ohci_dma_segment) sc_dmaseg_head;
|
||||
};
|
||||
|
||||
CFATTACH_DECL_NEW(ohci_sbus, sizeof(struct ohci_sbus_softc),
|
||||
ohci_sbus_match, ohci_sbus_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
ohci_sbus_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
ohci_sbus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ohci_sbus_softc *sc = device_private(self);
|
||||
usbd_status result;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc.sc_dev = self;
|
||||
sc->sc.sc_bus.hci_private = sc;
|
||||
|
||||
sc->sc.iot = bus_space_create(0, "OHCI I/O space", SBUS_OHCI_REGBASE,
|
||||
SBUS_OHCI_REGSIZE);
|
||||
sc->sc.ioh = SBUS_OHCI_REGBASE;
|
||||
|
||||
ohci_bus_dma_tag._dmachip_cookie = sc;
|
||||
sc->sc.sc_bus.dmatag = &ohci_bus_dma_tag;
|
||||
|
||||
/* Disable interrupts, so we don't can any spurious ones. */
|
||||
bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,
|
||||
OHCI_ALL_INTRS);
|
||||
|
||||
sbus_intr_establish(SBUS_IRQ_USB, ohci_intr, sc);
|
||||
|
||||
/* IOP/EE DMA relay segment list */
|
||||
LIST_INIT(&sc->sc_dmaseg_head);
|
||||
|
||||
result = ohci_init(&sc->sc);
|
||||
|
||||
if (result != USBD_NORMAL_COMPLETION) {
|
||||
printf(": init failed. error=%d\n", result);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Attach usb device. */
|
||||
sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint);
|
||||
}
|
||||
|
||||
void
|
||||
_ohci_sbus_map_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
|
||||
dmac_sync_buffer(); /* XXX over flush */
|
||||
}
|
||||
|
||||
int
|
||||
_ohci_sbus_mem_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)
|
||||
{
|
||||
struct ohci_sbus_softc *sc = t->_dmachip_cookie;
|
||||
struct ohci_dma_segment *ds;
|
||||
struct iopdma_segment *iopdma_seg;
|
||||
int error;
|
||||
|
||||
KDASSERT(sc);
|
||||
ds = malloc(sizeof(struct ohci_dma_segment), M_DEVBUF, M_NOWAIT);
|
||||
if (ds == NULL)
|
||||
return (1);
|
||||
/*
|
||||
* Allocate DMA Area (IOP DMA Area <-> SIF DMA <-> EE DMA Area)
|
||||
*/
|
||||
iopdma_seg = &ds->ds_iopdma_seg;
|
||||
error = iopdma_allocate_buffer(iopdma_seg, size);
|
||||
|
||||
if (error) {
|
||||
free(ds, M_DEVBUF);
|
||||
return (1);
|
||||
}
|
||||
|
||||
segs[0].ds_len = iopdma_seg->size;
|
||||
segs[0].ds_addr = iopdma_seg->iop_paddr;
|
||||
segs[0]._ds_vaddr = iopdma_seg->ee_vaddr;
|
||||
|
||||
LIST_INSERT_HEAD(&sc->sc_dmaseg_head, ds, ds_link);
|
||||
|
||||
*rsegs = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
_ohci_sbus_mem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs)
|
||||
{
|
||||
struct ohci_sbus_softc *sc = t->_dmachip_cookie;
|
||||
struct ohci_dma_segment *ds;
|
||||
paddr_t addr = segs[0].ds_addr;
|
||||
|
||||
for (ds = LIST_FIRST(&sc->sc_dmaseg_head); ds != NULL;
|
||||
ds = LIST_NEXT(ds, ds_link)) {
|
||||
if (ds->ds_iopdma_seg.iop_paddr == addr) {
|
||||
iopdma_free_buffer(&ds->ds_iopdma_seg);
|
||||
|
||||
LIST_REMOVE(ds, ds_link);
|
||||
free(ds, M_DEVBUF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
panic("_dmamem_free: can't find corresponding handle.");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
int
|
||||
_ohci_sbus_mem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
|
||||
void **kvap, int flags)
|
||||
{
|
||||
struct ohci_sbus_softc *sc = t->_dmachip_cookie;
|
||||
struct ohci_dma_segment *ds;
|
||||
paddr_t addr = segs[0].ds_addr;
|
||||
|
||||
for (ds = LIST_FIRST(&sc->sc_dmaseg_head); ds != NULL;
|
||||
ds = LIST_NEXT(ds, ds_link)) {
|
||||
if (ds->ds_iopdma_seg.iop_paddr == addr) {
|
||||
|
||||
*kvap = (void *)ds->ds_iopdma_seg.ee_vaddr;
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
_ohci_sbus_mem_unmap(bus_dma_tag_t t, void *kva, size_t size)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
|
@ -0,0 +1,307 @@
|
|||
/* $NetBSD: sbus.c,v 1.12 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PlayStation 2 internal PCMCIA/USB interface unit.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.12 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <playstation2/playstation2/interrupt.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/intcvar.h>
|
||||
#include <playstation2/dev/sbusvar.h>
|
||||
#include <playstation2/dev/sbusreg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC void sbus_type2_pcmcia_intr_clear(void);
|
||||
STATIC void sbus_type2_pcmcia_intr_enable(void);
|
||||
STATIC void sbus_type2_pcmcia_intr_disable(void);
|
||||
STATIC void sbus_type2_pcmcia_intr_reinstall(void);
|
||||
STATIC void sbus_type3_pcmcia_intr_clear(void);
|
||||
STATIC void sbus_type3_pcmcia_intr_enable(void);
|
||||
STATIC void sbus_type3_pcmcia_intr_disable(void);
|
||||
STATIC void sbus_type3_pcmcia_intr_reinstall(void);
|
||||
STATIC int sbus_spurious_intr(void *);
|
||||
|
||||
STATIC void (*sbus_pcmcia_intr_clear)(void);
|
||||
STATIC void (*sbus_pcmcia_intr_enable)(void);
|
||||
STATIC void (*sbus_pcmcia_intr_disable)(void);
|
||||
STATIC void (*sbus_pcmcia_intr_reinstall)(void);
|
||||
|
||||
STATIC int (*sbus_pcmcia_intr)(void *) = sbus_spurious_intr;
|
||||
STATIC void *sbus_pcmcia_context;
|
||||
STATIC int (*sbus_usb_intr)(void *) = sbus_spurious_intr;
|
||||
STATIC void *sbus_usb_context;
|
||||
|
||||
STATIC void sbus_init(int);
|
||||
STATIC int sbus_intr(void *);
|
||||
|
||||
STATIC int sbus_match(struct device *, struct cfdata *, void *);
|
||||
STATIC void sbus_attach(struct device *, struct device *, void *);
|
||||
STATIC int sbus_search(struct device *, struct cfdata *,
|
||||
const int *, void *);
|
||||
STATIC int sbus_print(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(sbus, sizeof (struct device),
|
||||
sbus_match, sbus_attach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver sbus_cd;
|
||||
STATIC int __sbus_attached;
|
||||
|
||||
int
|
||||
sbus_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
|
||||
if (strcmp(ma->ma_name, sbus_cd.cd_name) != 0)
|
||||
return (0);
|
||||
|
||||
return (!__sbus_attached);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
int type = BOOTINFO_REF(BOOTINFO_PCMCIA_TYPE);
|
||||
|
||||
printf(": controller type %d\n", type);
|
||||
|
||||
/* Initialize SBUS controller */
|
||||
sbus_init(type);
|
||||
|
||||
config_search_ia(sbus_search, self, "sbus", 0);
|
||||
}
|
||||
|
||||
int
|
||||
sbus_search(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
{
|
||||
struct sbus_attach_args sa;
|
||||
|
||||
if (config_match(parent, cf, &sa))
|
||||
config_attach(parent, cf, &sa, sbus_print);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sbus_print(void *aux, const char *pnp)
|
||||
{
|
||||
|
||||
return (pnp ? QUIET : UNCONF);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_init(int type)
|
||||
{
|
||||
/* install model dependent hook */
|
||||
#define SET_PCMCIA_INTR_OPS(x) \
|
||||
sbus_pcmcia_intr_clear = sbus_type##x##_pcmcia_intr_clear; \
|
||||
sbus_pcmcia_intr_enable = sbus_type##x##_pcmcia_intr_enable; \
|
||||
sbus_pcmcia_intr_disable = sbus_type##x##_pcmcia_intr_disable; \
|
||||
sbus_pcmcia_intr_reinstall = sbus_type##x##_pcmcia_intr_reinstall
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
panic("unknown pcmcia controller type = %d", type);
|
||||
break;
|
||||
case 0:
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
SET_PCMCIA_INTR_OPS(2);
|
||||
break;
|
||||
case 3:
|
||||
SET_PCMCIA_INTR_OPS(3);
|
||||
break;
|
||||
}
|
||||
#undef SET_PCMCIA_INTR_OPS
|
||||
/* disable interrupt */
|
||||
(*sbus_pcmcia_intr_disable)();
|
||||
|
||||
/* clear interrupt */
|
||||
(*sbus_pcmcia_intr_clear)();
|
||||
_reg_write_4(SBUS_SMFLG_REG, SMFLG_PCMCIA_INT);
|
||||
_reg_write_4(SBUS_SMFLG_REG, SMFLG_USB_INT);
|
||||
|
||||
/* connect to INTC */
|
||||
intc_intr_establish(I_CH1_SBUS, IPL_BIO, sbus_intr, 0);
|
||||
}
|
||||
|
||||
void *
|
||||
sbus_intr_establish(enum sbus_irq irq, int (*ih_func)(void *), void *ih_arg)
|
||||
{
|
||||
switch (irq) {
|
||||
default:
|
||||
panic("unknown IRQ");
|
||||
break;
|
||||
case SBUS_IRQ_PCMCIA:
|
||||
sbus_pcmcia_intr = ih_func;
|
||||
sbus_pcmcia_context = ih_arg;
|
||||
(*sbus_pcmcia_intr_enable)();
|
||||
break;
|
||||
case SBUS_IRQ_USB:
|
||||
sbus_usb_intr = ih_func;
|
||||
sbus_usb_context = ih_arg;
|
||||
break;
|
||||
}
|
||||
|
||||
return (void *)irq;
|
||||
}
|
||||
|
||||
void
|
||||
sbus_intr_disestablish(void *handle)
|
||||
{
|
||||
int irq = (int)handle;
|
||||
|
||||
switch (irq) {
|
||||
default:
|
||||
panic("unknown IRQ");
|
||||
break;
|
||||
case SBUS_IRQ_PCMCIA:
|
||||
sbus_pcmcia_intr = sbus_spurious_intr;
|
||||
(*sbus_pcmcia_intr_disable)();
|
||||
break;
|
||||
case SBUS_IRQ_USB:
|
||||
sbus_usb_intr = sbus_spurious_intr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
sbus_intr(void *arg)
|
||||
{
|
||||
u_int32_t stat;
|
||||
|
||||
_playstation2_evcnt.sbus.ev_count++;
|
||||
stat = _reg_read_4(SBUS_SMFLG_REG);
|
||||
|
||||
if (stat & SMFLG_PCMCIA_INT) {
|
||||
(*sbus_pcmcia_intr_clear)();
|
||||
_reg_write_4(SBUS_SMFLG_REG, SMFLG_PCMCIA_INT);
|
||||
(*sbus_pcmcia_intr)(sbus_pcmcia_context);
|
||||
}
|
||||
|
||||
if (stat & SMFLG_USB_INT) {
|
||||
_reg_write_4(SBUS_SMFLG_REG, SMFLG_USB_INT);
|
||||
(*sbus_usb_intr)(sbus_usb_context);
|
||||
}
|
||||
|
||||
(*sbus_pcmcia_intr_reinstall)();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
sbus_spurious_intr(void *arg)
|
||||
{
|
||||
|
||||
printf("spurious interrupt.\n");
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* SCPH-18000 */
|
||||
void
|
||||
sbus_type2_pcmcia_intr_clear()
|
||||
{
|
||||
|
||||
if (_reg_read_2(SBUS_PCMCIA_CSC1_REG16) & 0x080)
|
||||
_reg_write_2(SBUS_PCMCIA_CSC1_REG16, 0xffff);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type2_pcmcia_intr_enable()
|
||||
{
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA_TIMR_REG16, 0);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type2_pcmcia_intr_disable()
|
||||
{
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA_TIMR_REG16, 1);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type2_pcmcia_intr_reinstall()
|
||||
{
|
||||
u_int16_t r = _reg_read_2(SBUS_PCMCIA_TIMR_REG16);
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA_TIMR_REG16, 1);
|
||||
_reg_write_2(SBUS_PCMCIA_TIMR_REG16, r);
|
||||
}
|
||||
|
||||
/* SCPH-30000/35000 */
|
||||
void
|
||||
sbus_type3_pcmcia_intr_clear()
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type3_pcmcia_intr_enable()
|
||||
{
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA3_TIMR_REG16, 0);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type3_pcmcia_intr_disable()
|
||||
{
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA3_TIMR_REG16, 1);
|
||||
}
|
||||
|
||||
void
|
||||
sbus_type3_pcmcia_intr_reinstall()
|
||||
{
|
||||
u_int16_t r = _reg_read_2(SBUS_PCMCIA3_TIMR_REG16);
|
||||
|
||||
_reg_write_2(SBUS_PCMCIA3_TIMR_REG16, 1);
|
||||
_reg_write_2(SBUS_PCMCIA3_TIMR_REG16, r);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* $NetBSD: sbusreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define SBUS_SMFLG_REG MIPS_PHYS_TO_KSEG1(0x1000f230)
|
||||
#define SMFLG_PCMCIA_INT 0x00000100
|
||||
#define SMFLG_USB_INT 0x00000400
|
||||
|
||||
#define SBUS_AIF_INTSR_REG16 MIPS_PHYS_TO_KSEG1(0x18000004)
|
||||
#define SBUS_AIF_INTEN_REG16 MIPS_PHYS_TO_KSEG1(0x18000006)
|
||||
|
||||
#define SBUS_PCMCIA_EXC1_REG16 MIPS_PHYS_TO_KSEG1(0x1f801476)
|
||||
#define SBUS_PCMCIA_CSC1_REG16 MIPS_PHYS_TO_KSEG1(0x1f801464)
|
||||
#define SBUS_PCMCIA_IMR1_REG16 MIPS_PHYS_TO_KSEG1(0x1f801468)
|
||||
#define SBUS_PCMCIA_TIMR_REG16 MIPS_PHYS_TO_KSEG1(0x1f80147e)
|
||||
#define SBUS_PCMCIA3_TIMR_REG16 MIPS_PHYS_TO_KSEG1(0x1f801466)
|
|
@ -0,0 +1,42 @@
|
|||
/* $NetBSD: sbusvar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum sbus_irq {
|
||||
SBUS_IRQ_PCMCIA,
|
||||
SBUS_IRQ_USB
|
||||
};
|
||||
|
||||
struct sbus_attach_args {
|
||||
/* none */
|
||||
};
|
||||
|
||||
void *sbus_intr_establish(enum sbus_irq, int (*)(void *), void *);
|
||||
void sbus_intr_disestablish(void *);
|
|
@ -0,0 +1,275 @@
|
|||
/* $NetBSD: spd.c,v 1.9 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: spd.c,v 1.9 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bootinfo.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/dev/sbusvar.h>
|
||||
#include <playstation2/dev/spdvar.h>
|
||||
#include <playstation2/dev/spdreg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC int spd_match(struct device *, struct cfdata *, void *);
|
||||
STATIC void spd_attach(struct device *, struct device *, void *);
|
||||
STATIC int spd_print(void *, const char *);
|
||||
STATIC int spd_intr(void *);
|
||||
STATIC void __spd_eeprom_out(u_int8_t *, int);
|
||||
STATIC int __spd_eeprom_in(u_int8_t *);
|
||||
|
||||
/* SPD device can't attach twice. because PS2 PC-Card slot is only one. */
|
||||
STATIC struct {
|
||||
int (*func)(void *);
|
||||
void *arg;
|
||||
const char *name;
|
||||
} __spd_table[2];
|
||||
|
||||
CFATTACH_DECL(spd, sizeof(struct device),
|
||||
spd_match, spd_attach, NULL, NULL);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LEGAL_SLOT(slot) ((slot) >= 0 && (slot) < 2)
|
||||
#endif
|
||||
|
||||
int
|
||||
spd_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
return ((BOOTINFO_REF(BOOTINFO_DEVCONF) ==
|
||||
BOOTINFO_DEVCONF_SPD_PRESENT));
|
||||
}
|
||||
|
||||
void
|
||||
spd_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct spd_attach_args spa;
|
||||
|
||||
printf(": PlayStation 2 HDD Unit\n");
|
||||
|
||||
switch (BOOTINFO_REF(BOOTINFO_PCMCIA_TYPE)) {
|
||||
default:
|
||||
__spd_table[0].name = "<unknown product>";
|
||||
break;
|
||||
case 0:
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
__spd_table[SPD_HDD].name = "SCPH-20400";
|
||||
__spd_table[SPD_NIC].name = "SCPH-10190";
|
||||
break;
|
||||
case 3:
|
||||
__spd_table[SPD_HDD].name = "SCPH-10260";
|
||||
__spd_table[SPD_NIC].name = "SCPH-10260";
|
||||
break;
|
||||
}
|
||||
|
||||
/* disable all */
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, 0);
|
||||
_reg_write_2(SPD_INTR_CLEAR_REG16, _reg_read_2(SPD_INTR_STATUS_REG16));
|
||||
|
||||
spa.spa_slot = SPD_HDD;
|
||||
spa.spa_product_name = __spd_table[SPD_HDD].name;
|
||||
config_found(self, &spa, spd_print);
|
||||
|
||||
spa.spa_slot = SPD_NIC;
|
||||
spa.spa_product_name = __spd_table[SPD_NIC].name;
|
||||
config_found(self, &spa, spd_print);
|
||||
|
||||
sbus_intr_establish(SBUS_IRQ_PCMCIA, spd_intr, 0);
|
||||
}
|
||||
|
||||
int
|
||||
spd_print(void *aux, const char *pnp)
|
||||
{
|
||||
struct spd_attach_args *spa = aux;
|
||||
|
||||
if (pnp)
|
||||
aprint_normal("%s at %s", __spd_table[spa->spa_slot].name, pnp);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
int
|
||||
spd_intr(void *arg)
|
||||
{
|
||||
u_int16_t r;
|
||||
|
||||
r = _reg_read_2(SPD_INTR_STATUS_REG16);
|
||||
|
||||
/* HDD (SCPH-20400) */
|
||||
if ((r & SPD_INTR_HDD) != 0)
|
||||
if (__spd_table[SPD_HDD].func != NULL)
|
||||
(*__spd_table[SPD_HDD].func)(__spd_table[SPD_HDD].arg);
|
||||
|
||||
/* Network (SCPH-10190) */
|
||||
if ((r & (SPD_INTR_EMAC3 | SPD_INTR_RXEND | SPD_INTR_TXEND |
|
||||
SPD_INTR_RXDNV | SPD_INTR_TXDNV)) != 0)
|
||||
if (__spd_table[SPD_NIC].func)
|
||||
(*__spd_table[SPD_NIC].func)(__spd_table[SPD_NIC].arg);
|
||||
|
||||
/* reinstall */
|
||||
r = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, 0);
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void *
|
||||
spd_intr_establish(enum spd_slot slot, int (*func)(void *), void *arg)
|
||||
{
|
||||
|
||||
KDASSERT(LEGAL_SLOT(slot));
|
||||
KDASSERT(__spd_table[slot].func == 0);
|
||||
|
||||
__spd_table[slot].func = func;
|
||||
__spd_table[slot].arg = arg;
|
||||
|
||||
return ((void *)slot);
|
||||
}
|
||||
|
||||
void
|
||||
spd_intr_disestablish(void *handle)
|
||||
{
|
||||
int slot = (int)handle;
|
||||
|
||||
KDASSERT(LEGAL_SLOT(slot));
|
||||
|
||||
__spd_table[slot].func = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* EEPROM access
|
||||
*/
|
||||
void
|
||||
spd_eeprom_read(int addr, u_int16_t *data, int n)
|
||||
{
|
||||
int i, j, s;
|
||||
u_int8_t r;
|
||||
|
||||
s = _intr_suspend();
|
||||
|
||||
/* set direction */
|
||||
_reg_write_1(SPD_IO_DIR_REG8, SPD_IO_CLK | SPD_IO_CS | SPD_IO_IN);
|
||||
|
||||
/* chip select high */
|
||||
r = 0;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
r |= SPD_IO_CS;
|
||||
r &= ~(SPD_IO_IN | SPD_IO_CLK);
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
/* put start bit */
|
||||
__spd_eeprom_out(&r, 1);
|
||||
|
||||
/* put op code (read) */
|
||||
__spd_eeprom_out(&r, 1);
|
||||
__spd_eeprom_out(&r, 0);
|
||||
|
||||
/* set address */
|
||||
for (i = 0; i < 6; i++, addr <<= 1)
|
||||
__spd_eeprom_out(&r, addr & 0x20);
|
||||
|
||||
/* get data */
|
||||
for (i = 0; i < n; i++, data++)
|
||||
for (*data = 0, j = 15; j >= 0; j--)
|
||||
*data |= (__spd_eeprom_in(&r) << j);
|
||||
|
||||
/* chip select low */
|
||||
r &= ~(SPD_IO_CS | SPD_IO_IN | SPD_IO_CLK);
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(2);
|
||||
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
||||
void
|
||||
__spd_eeprom_out(u_int8_t *rp, int onoff)
|
||||
{
|
||||
u_int8_t r = *rp;
|
||||
|
||||
if (onoff)
|
||||
r |= SPD_IO_IN;
|
||||
else
|
||||
r &= ~SPD_IO_IN;
|
||||
|
||||
r &= ~SPD_IO_CLK;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
r |= SPD_IO_CLK;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
r &= ~SPD_IO_CLK;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
*rp = r;
|
||||
}
|
||||
|
||||
int
|
||||
__spd_eeprom_in(u_int8_t *rp)
|
||||
{
|
||||
int ret;
|
||||
u_int8_t r = *rp;
|
||||
|
||||
r &= ~(SPD_IO_IN | SPD_IO_CLK);
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
r |= SPD_IO_CLK;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
ret = (_reg_read_1(SPD_IO_DATA_REG8) >> 4) & 0x1;
|
||||
|
||||
r &= ~SPD_IO_CLK;
|
||||
_reg_write_1(SPD_IO_DATA_REG8, r);
|
||||
delay(1);
|
||||
|
||||
*rp = r;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/* $NetBSD: spdreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* spd (PlayStation 2 HDD UNIT) common register define.
|
||||
*/
|
||||
|
||||
/* interrupt */
|
||||
#define SPD_INTR_ENABLE_REG16 MIPS_PHYS_TO_KSEG1(0x1400002a)
|
||||
#define SPD_INTR_STATUS_REG16 MIPS_PHYS_TO_KSEG1(0x14000028)
|
||||
#define SPD_INTR_CLEAR_REG16 MIPS_PHYS_TO_KSEG1(0x14000128)
|
||||
#define SPD_INTR_EMAC3 0x0040
|
||||
#define SPD_INTR_RXEND 0x0020
|
||||
#define SPD_INTR_TXEND 0x0010
|
||||
#define SPD_INTR_RXDNV 0x0008
|
||||
#define SPD_INTR_TXDNV 0x0004
|
||||
#define SPD_INTR_HDD 0x0001
|
||||
|
||||
/* I/O port */
|
||||
#define SPD_IO_DIR_REG8 MIPS_PHYS_TO_KSEG1(0x1400002c)
|
||||
#define SPD_IO_DATA_REG8 MIPS_PHYS_TO_KSEG1(0x1400002e)
|
||||
/* HDD LED */
|
||||
#define SPD_IO_LED 0x0001
|
||||
/* EEPROM (ethernet address) */
|
||||
#define SPD_IO_OUT 0x0010
|
||||
#define SPD_IO_IN 0x0020
|
||||
#define SPD_IO_CLK 0x0040
|
||||
#define SPD_IO_CS 0x0080
|
||||
|
||||
/* HDD interface */
|
||||
#define SPD_XFR_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14000032)
|
||||
#define SPD_HDD_IO_BASE MIPS_PHYS_TO_KSEG1(0x14000040)
|
||||
#define SPD_IF_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14000064)
|
||||
#define SPD_IF_CTRL_ATA_RST 0x80
|
||||
#define SPD_IF_CTRL_DMA_EN 0x04
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: spdvar.h,v 1.5 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum spd_slot {
|
||||
SPD_HDD,
|
||||
SPD_NIC
|
||||
};
|
||||
|
||||
struct spd_attach_args {
|
||||
enum spd_slot spa_slot;
|
||||
const char *spa_product_name;
|
||||
};
|
||||
|
||||
/* interrupt */
|
||||
void *spd_intr_establish(enum spd_slot, int (*)(void *), void *);
|
||||
void spd_intr_disestablish(void *);
|
||||
|
||||
/* EEPROM */
|
||||
void spd_eeprom_read(int, u_int16_t *, int);
|
||||
|
||||
/* HDD LED */
|
||||
#define SPD_LED_OFF() \
|
||||
{ \
|
||||
*(volatile u_int8_t *)SPD_IO_DIR_REG8 = SPD_IO_LED; \
|
||||
*(volatile u_int8_t *)SPD_IO_DATA_REG8 = SPD_IO_LED;\
|
||||
}
|
||||
#define SPD_LED_ON() \
|
||||
{ \
|
||||
*(volatile u_int8_t *)SPD_IO_DIR_REG8 = SPD_IO_LED; \
|
||||
*(volatile u_int8_t *)SPD_IO_DATA_REG8 = 0; \
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
/* $NetBSD: wdc_spd.c,v 1.27 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: wdc_spd.c,v 1.27 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#define __read_1(a) \
|
||||
({ \
|
||||
u_int32_t ra_ = (a); \
|
||||
u_int8_t r = (*(volatile u_int8_t *)ra_); \
|
||||
\
|
||||
if (ra_ == 0xb400004e) /* (wdc)STAT LED off */ \
|
||||
SPD_LED_OFF(); \
|
||||
\
|
||||
(r); \
|
||||
})
|
||||
#define __write_1(a, v) \
|
||||
{ \
|
||||
u_int32_t wa_ = (a); \
|
||||
(*(volatile u_int8_t *)wa_) = (v); \
|
||||
\
|
||||
if (wa_ == 0xb400004e) /* (wdc)CMD LED on */ \
|
||||
SPD_LED_ON(); \
|
||||
}
|
||||
#define _PLAYSTATION2_BUS_SPACE_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ata/atavar.h>
|
||||
#include <dev/ic/wdcvar.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/dev/spdvar.h>
|
||||
#include <playstation2/dev/spdreg.h>
|
||||
|
||||
#define WDC_SPD_HDD_AUXREG_OFFSET 0x1c
|
||||
|
||||
struct wdc_spd_softc {
|
||||
struct wdc_softc sc_wdcdev;
|
||||
struct ata_channel *sc_chanlist[1];
|
||||
struct ata_channel sc_channel;
|
||||
struct ata_queue sc_chqueue;
|
||||
struct wdc_regs sc_wdc_regs;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC int wdc_spd_match(device_t, cfdata_t, void *);
|
||||
STATIC void wdc_spd_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL_NEW(wdc_spd, sizeof (struct wdc_spd_softc),
|
||||
wdc_spd_match, wdc_spd_attach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver wdc_cd;
|
||||
|
||||
STATIC void __wdc_spd_enable(void);
|
||||
STATIC void __wdc_spd_disable(void) __attribute__((__unused__));
|
||||
STATIC void __wdc_spd_bus_space(struct ata_channel *);
|
||||
|
||||
/*
|
||||
* wdc register is 16 bit wide.
|
||||
*/
|
||||
#define VADDR(h, o) ((h) + (o))
|
||||
_BUS_SPACE_READ(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_READ(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_READ_MULTI(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_READ_MULTI(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_READ_REGION(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_READ_REGION(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_WRITE(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_WRITE(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_WRITE_MULTI(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_WRITE_MULTI(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_WRITE_REGION(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_WRITE_REGION(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_SET_MULTI(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_SET_MULTI(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_SET_REGION(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_SET_REGION(_wdc_spd, 2, 16)
|
||||
_BUS_SPACE_COPY_REGION(_wdc_spd, 1, 8)
|
||||
_BUS_SPACE_COPY_REGION(_wdc_spd, 2, 16)
|
||||
#undef VADDR
|
||||
|
||||
STATIC const struct playstation2_bus_space _wdc_spd_space = {
|
||||
pbs_map : _BUS_SPACE_NO_MAP,
|
||||
pbs_unmap : _BUS_SPACE_NO_UNMAP,
|
||||
pbs_subregion : _BUS_SPACE_NO_SUBREGION,
|
||||
pbs_alloc : _BUS_SPACE_NO_ALLOC,
|
||||
pbs_free : _BUS_SPACE_NO_FREE,
|
||||
pbs_vaddr : _BUS_SPACE_NO_VADDR,
|
||||
pbs_r_1 : _wdc_spd_read_1,
|
||||
pbs_r_2 : _wdc_spd_read_2,
|
||||
pbs_r_4 : _BUS_SPACE_NO_READ(4, 32),
|
||||
pbs_r_8 : _BUS_SPACE_NO_READ(8, 64),
|
||||
pbs_rm_1 : _wdc_spd_read_multi_1,
|
||||
pbs_rm_2 : _wdc_spd_read_multi_2,
|
||||
pbs_rm_4 : _BUS_SPACE_NO_READ_MULTI(4, 32),
|
||||
pbs_rm_8 : _BUS_SPACE_NO_READ_MULTI(8, 64),
|
||||
pbs_rr_1 : _wdc_spd_read_region_1,
|
||||
pbs_rr_2 : _wdc_spd_read_region_2,
|
||||
pbs_rr_4 : _BUS_SPACE_NO_READ_REGION(4, 32),
|
||||
pbs_rr_8 : _BUS_SPACE_NO_READ_REGION(8, 64),
|
||||
pbs_w_1 : _wdc_spd_write_1,
|
||||
pbs_w_2 : _wdc_spd_write_2,
|
||||
pbs_w_4 : _BUS_SPACE_NO_WRITE(4, 32),
|
||||
pbs_w_8 : _BUS_SPACE_NO_WRITE(8, 64),
|
||||
pbs_wm_1 : _wdc_spd_write_multi_1,
|
||||
pbs_wm_2 : _wdc_spd_write_multi_2,
|
||||
pbs_wm_4 : _BUS_SPACE_NO_WRITE_MULTI(4, 32),
|
||||
pbs_wm_8 : _BUS_SPACE_NO_WRITE_MULTI(8, 64),
|
||||
pbs_wr_1 : _wdc_spd_write_region_1,
|
||||
pbs_wr_2 : _wdc_spd_write_region_2,
|
||||
pbs_wr_4 : _BUS_SPACE_NO_WRITE_REGION(4, 32),
|
||||
pbs_wr_8 : _BUS_SPACE_NO_WRITE_REGION(8, 64),
|
||||
pbs_sm_1 : _wdc_spd_set_multi_1,
|
||||
pbs_sm_2 : _wdc_spd_set_multi_2,
|
||||
pbs_sm_4 : _BUS_SPACE_NO_SET_MULTI(4, 32),
|
||||
pbs_sm_8 : _BUS_SPACE_NO_SET_MULTI(8, 64),
|
||||
pbs_sr_1 : _wdc_spd_set_region_1,
|
||||
pbs_sr_2 : _wdc_spd_set_region_2,
|
||||
pbs_sr_4 : _BUS_SPACE_NO_SET_REGION(4, 32),
|
||||
pbs_sr_8 : _BUS_SPACE_NO_SET_REGION(8, 64),
|
||||
pbs_c_1 : _wdc_spd_copy_region_1,
|
||||
pbs_c_2 : _wdc_spd_copy_region_2,
|
||||
pbs_c_4 : _BUS_SPACE_NO_COPY_REGION(4, 32),
|
||||
pbs_c_8 : _BUS_SPACE_NO_COPY_REGION(8, 64),
|
||||
};
|
||||
|
||||
int
|
||||
wdc_spd_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct spd_attach_args *spa = aux;
|
||||
struct ata_channel ch;
|
||||
struct wdc_softc wdc;
|
||||
struct wdc_regs wdr;
|
||||
int i, result;
|
||||
|
||||
if (spa->spa_slot != SPD_HDD)
|
||||
return (0);
|
||||
|
||||
memset(&wdc, 0, sizeof(wdc));
|
||||
memset(&ch, 0, sizeof(ch));
|
||||
ch.ch_atac = &wdc.sc_atac;
|
||||
wdc.regs = &wdr;
|
||||
|
||||
__wdc_spd_bus_space(&ch);
|
||||
|
||||
for (i = 0, result = 0; i < 8; i++) { /* 8 sec */
|
||||
if (result == 0)
|
||||
result = wdcprobe(&ch);
|
||||
delay(1000000);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
wdc_spd_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct spd_attach_args *spa = aux;
|
||||
struct wdc_spd_softc *sc = device_private(self);
|
||||
struct wdc_softc *wdc = &sc->sc_wdcdev;
|
||||
struct ata_channel *ch = &sc->sc_channel;
|
||||
|
||||
aprint_normal(": %s\n", spa->spa_product_name);
|
||||
|
||||
sc->sc_wdcdev.sc_atac.atac_dev = self;
|
||||
sc->sc_wdcdev.regs = &sc->sc_wdc_regs;
|
||||
|
||||
wdc->sc_atac.atac_cap =
|
||||
ATAC_CAP_DMA | ATAC_CAP_UDMA | ATAC_CAP_DATA16;
|
||||
wdc->sc_atac.atac_pio_cap = 0;
|
||||
sc->sc_chanlist[0] = &sc->sc_channel;
|
||||
wdc->sc_atac.atac_channels = sc->sc_chanlist;
|
||||
wdc->sc_atac.atac_nchannels = 1;
|
||||
ch->ch_channel = 0;
|
||||
ch->ch_atac = &sc->sc_wdcdev.sc_atac;
|
||||
ch->ch_queue = &sc->sc_chqueue;
|
||||
ch->ch_ndrive = 2;
|
||||
|
||||
__wdc_spd_bus_space(ch);
|
||||
|
||||
spd_intr_establish(SPD_HDD, wdcintr, &sc->sc_channel);
|
||||
|
||||
__wdc_spd_enable();
|
||||
|
||||
wdcattach(&sc->sc_channel);
|
||||
}
|
||||
|
||||
void
|
||||
__wdc_spd_bus_space(struct ata_channel *ch)
|
||||
{
|
||||
struct wdc_regs *wdr = CHAN_TO_WDC_REGS(ch);
|
||||
int i;
|
||||
|
||||
wdr->cmd_iot = &_wdc_spd_space;
|
||||
for (i = 0; i < 8; i++)
|
||||
wdr->cmd_iohs[i] = SPD_HDD_IO_BASE + i * 2; /* wdc register is 16 bit wide. */
|
||||
wdc_init_shadow_regs(ch);
|
||||
wdr->ctl_iot = &_wdc_spd_space;
|
||||
wdr->ctl_ioh = SPD_HDD_IO_BASE + WDC_SPD_HDD_AUXREG_OFFSET;
|
||||
wdr->data32iot = wdr->cmd_iot;
|
||||
wdr->data32ioh = SPD_HDD_IO_BASE;
|
||||
}
|
||||
|
||||
void
|
||||
__wdc_spd_enable(void)
|
||||
{
|
||||
u_int16_t r;
|
||||
|
||||
r = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
r |= SPD_INTR_HDD;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r);
|
||||
}
|
||||
|
||||
void
|
||||
__wdc_spd_disable(void)
|
||||
{
|
||||
u_int16_t r;
|
||||
|
||||
r = _reg_read_2(SPD_INTR_ENABLE_REG16);
|
||||
r &= ~SPD_INTR_HDD;
|
||||
_reg_write_2(SPD_INTR_ENABLE_REG16, r);
|
||||
}
|
|
@ -0,0 +1,383 @@
|
|||
/* $NetBSD: dmac.c,v 1.12 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: dmac.c,v 1.12 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <mips/cache.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/dmacvar.h>
|
||||
#include <playstation2/ee/dmacreg.h>
|
||||
#include <playstation2/ee/gsvar.h> /* debug monitor */
|
||||
|
||||
#include <playstation2/playstation2/interrupt.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LEGAL_CHANNEL(x) ((x) >= 0 && (x) <= 15)
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
#define _DMAC_NINTR 10
|
||||
|
||||
STATIC vaddr_t __dmac_channel_base[_DMAC_NINTR] = {
|
||||
D0_REGBASE,
|
||||
D1_REGBASE,
|
||||
D2_REGBASE,
|
||||
D3_REGBASE,
|
||||
D4_REGBASE,
|
||||
D5_REGBASE,
|
||||
D6_REGBASE,
|
||||
D7_REGBASE,
|
||||
D8_REGBASE,
|
||||
D9_REGBASE
|
||||
};
|
||||
|
||||
u_int32_t __dmac_enabled_channel;
|
||||
|
||||
STATIC int __dmac_initialized;
|
||||
STATIC struct _ipl_dispatcher __dmac_dispatcher[_DMAC_NINTR];
|
||||
STATIC struct _ipl_holder __dmac_ipl_holder[_IPL_N];
|
||||
STATIC SLIST_HEAD(, _ipl_dispatcher) __dmac_dispatcher_head =
|
||||
SLIST_HEAD_INITIALIZER(__dmac_dispatcher_head);
|
||||
|
||||
void
|
||||
dmac_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (__dmac_initialized++)
|
||||
return;
|
||||
|
||||
/* disable DMAC */
|
||||
_reg_write_4(D_ENABLEW_REG, D_ENABLE_SUSPEND);
|
||||
|
||||
/* disable all interrupt */
|
||||
for (i = 0; i < _DMAC_NINTR; i++)
|
||||
dmac_intr_disable(i);
|
||||
|
||||
for (i = 0; i < _IPL_N; i++)
|
||||
__dmac_ipl_holder[i].mask = 0xffffffff;
|
||||
|
||||
if (_reg_read_4(D_STAT_REG) & D_STAT_SIM)
|
||||
_reg_write_4(D_STAT_REG, D_STAT_SIM);
|
||||
if (_reg_read_4(D_STAT_REG) & D_STAT_MEIM)
|
||||
_reg_write_4(D_STAT_REG, D_STAT_MEIM);
|
||||
|
||||
/* clear all status */
|
||||
_reg_write_4(D_STAT_REG, _reg_read_4(D_STAT_REG) & D_STAT_CIS_MASK);
|
||||
|
||||
/* enable DMAC */
|
||||
_reg_write_4(D_ENABLEW_REG, 0);
|
||||
_reg_write_4(D_CTRL_REG, D_CTRL_DMAE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt
|
||||
*/
|
||||
int
|
||||
dmac_intr(u_int32_t mask)
|
||||
{
|
||||
struct _ipl_dispatcher *dispatcher;
|
||||
u_int32_t r, dispatch, pending;
|
||||
|
||||
r = _reg_read_4(D_STAT_REG);
|
||||
mask = D_STAT_CIM(mask);
|
||||
dispatch = r & ~mask & __dmac_enabled_channel;
|
||||
pending = r & mask & __dmac_enabled_channel;
|
||||
#if 0
|
||||
__gsfb_print(2,
|
||||
"DMAC stat=%08x, mask=%08x, pend=%08x, disp=%08x enable=%08x\n",
|
||||
r, mask, pending, dispatch, __dmac_enabled_channel);
|
||||
#endif
|
||||
if (dispatch == 0)
|
||||
return (pending == 0 ? 1 : 0);
|
||||
|
||||
/* clear interrupt */
|
||||
_reg_write_4(D_STAT_REG, dispatch);
|
||||
|
||||
/* dispatch interrupt handler */
|
||||
SLIST_FOREACH(dispatcher, &__dmac_dispatcher_head, link) {
|
||||
if (dispatcher->bit & dispatch) {
|
||||
KDASSERT(dispatcher->func);
|
||||
(*dispatcher->func)(dispatcher->arg);
|
||||
dispatch &= ~dispatcher->bit;
|
||||
}
|
||||
}
|
||||
|
||||
/* disable spurious interrupt source */
|
||||
if (dispatch) {
|
||||
int i, bit;
|
||||
for (i = 0, bit = 1; i < _DMAC_NINTR; i++, bit <<= 1) {
|
||||
if (bit & dispatch) {
|
||||
dmac_intr_disable(i);
|
||||
printf("%s: spurious interrupt %d disabled.\n",
|
||||
__func__, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (pending == 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
void
|
||||
dmac_intr_enable(enum dmac_channel ch)
|
||||
{
|
||||
u_int32_t mask;
|
||||
|
||||
KDASSERT(LEGAL_CHANNEL(ch));
|
||||
|
||||
mask = D_STAT_CIM_BIT(ch);
|
||||
_reg_write_4(D_STAT_REG, (_reg_read_4(D_STAT_REG) & mask) ^ mask);
|
||||
}
|
||||
|
||||
void
|
||||
dmac_intr_disable(enum dmac_channel ch)
|
||||
{
|
||||
KDASSERT(LEGAL_CHANNEL(ch));
|
||||
|
||||
_reg_write_4(D_STAT_REG, _reg_read_4(D_STAT_REG) & D_STAT_CIM_BIT(ch));
|
||||
}
|
||||
|
||||
void
|
||||
dmac_update_mask(u_int32_t mask)
|
||||
{
|
||||
u_int32_t cur_mask;
|
||||
|
||||
mask = D_STAT_CIM(mask);
|
||||
cur_mask = _reg_read_4(D_STAT_REG);
|
||||
|
||||
_reg_write_4(D_STAT_REG, ((cur_mask ^ ~mask) | (cur_mask & mask)) &
|
||||
D_STAT_CIM(__dmac_enabled_channel));
|
||||
}
|
||||
|
||||
void *
|
||||
dmac_intr_establish(enum dmac_channel ch, int ipl, int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct _ipl_dispatcher *dispatcher = &__dmac_dispatcher[ch];
|
||||
struct _ipl_dispatcher *d;
|
||||
int i, s;
|
||||
|
||||
KDASSERT(dispatcher->func == NULL);
|
||||
|
||||
s = _intr_suspend();
|
||||
dispatcher->func = func;
|
||||
dispatcher->arg = arg;
|
||||
dispatcher->ipl = ipl;
|
||||
dispatcher->channel = ch;
|
||||
dispatcher->bit = D_STAT_CIS_BIT(ch);
|
||||
|
||||
for (i = 0; i < _IPL_N; i++) {
|
||||
if (i < ipl)
|
||||
__dmac_ipl_holder[i].mask &= ~D_STAT_CIM_BIT(ch);
|
||||
else
|
||||
__dmac_ipl_holder[i].mask |= D_STAT_CIM_BIT(ch);
|
||||
}
|
||||
|
||||
/* insert queue IPL order */
|
||||
if (SLIST_EMPTY(&__dmac_dispatcher_head)) {
|
||||
SLIST_INSERT_HEAD(&__dmac_dispatcher_head, dispatcher, link);
|
||||
} else {
|
||||
SLIST_FOREACH(d, &__dmac_dispatcher_head, link) {
|
||||
if (SLIST_NEXT(d, link) == 0 ||
|
||||
SLIST_NEXT(d, link)->ipl < ipl) {
|
||||
SLIST_INSERT_AFTER(d, dispatcher, link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
md_ipl_register(IPL_DMAC, __dmac_ipl_holder);
|
||||
|
||||
dmac_intr_enable(ch);
|
||||
__dmac_enabled_channel |= D_STAT_CIS_BIT(ch);
|
||||
|
||||
_intr_resume(s);
|
||||
|
||||
return ((void *)ch);
|
||||
}
|
||||
|
||||
void
|
||||
dmac_intr_disestablish(void *handle)
|
||||
{
|
||||
int ch = (int)(handle);
|
||||
struct _ipl_dispatcher *dispatcher = &__dmac_dispatcher[ch];
|
||||
int i, s;
|
||||
|
||||
s = _intr_suspend();
|
||||
|
||||
dmac_intr_disable(ch);
|
||||
dispatcher->func = NULL;
|
||||
|
||||
SLIST_REMOVE(&__dmac_dispatcher_head, dispatcher,
|
||||
_ipl_dispatcher, link);
|
||||
|
||||
for (i = 0; i < _IPL_N; i++)
|
||||
__dmac_ipl_holder[i].mask |= D_STAT_CIM_BIT(ch);
|
||||
|
||||
md_ipl_register(IPL_DMAC, __dmac_ipl_holder);
|
||||
__dmac_enabled_channel &= ~D_STAT_CIS_BIT(ch);
|
||||
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start/Stop
|
||||
*/
|
||||
void
|
||||
dmac_start_channel(enum dmac_channel ch)
|
||||
{
|
||||
bus_addr_t chcr = D_CHCR_REG(__dmac_channel_base[ch]);
|
||||
u_int32_t r;
|
||||
int s;
|
||||
|
||||
/* suspend all channels */
|
||||
s = _intr_suspend();
|
||||
r = _reg_read_4(D_ENABLER_REG);
|
||||
_reg_write_4(D_ENABLEW_REG, r | D_ENABLE_SUSPEND);
|
||||
|
||||
/* access CHCR */
|
||||
_reg_write_4(chcr, (_reg_read_4(chcr) | D_CHCR_STR));
|
||||
|
||||
/* start all channels */
|
||||
_reg_write_4(D_ENABLEW_REG, r & ~D_ENABLE_SUSPEND);
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
||||
void
|
||||
dmac_stop_channel(enum dmac_channel ch)
|
||||
{
|
||||
bus_addr_t chcr = D_CHCR_REG(__dmac_channel_base[ch]);
|
||||
u_int32_t r;
|
||||
int s;
|
||||
|
||||
/* suspend all channels */
|
||||
s = _intr_suspend();
|
||||
r = _reg_read_4(D_ENABLER_REG);
|
||||
_reg_write_4(D_ENABLEW_REG, r | D_ENABLE_SUSPEND);
|
||||
|
||||
/* access CHCR */
|
||||
_reg_write_4(chcr, (_reg_read_4(chcr) & ~D_CHCR_STR));
|
||||
|
||||
/* resume all chanells */
|
||||
_reg_write_4(D_ENABLEW_REG, r);
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
||||
void
|
||||
dmac_sync_buffer(void)
|
||||
{
|
||||
|
||||
mips_dcache_wbinv_all();
|
||||
__asm volatile("sync.l");
|
||||
}
|
||||
|
||||
/*
|
||||
* Polling
|
||||
* DMAC status connected to CPCOND[0].
|
||||
*/
|
||||
void
|
||||
dmac_cpc_set(enum dmac_channel ch)
|
||||
{
|
||||
u_int32_t r;
|
||||
|
||||
r = _reg_read_4(D_PCR_REG);
|
||||
KDASSERT((D_PCR_CPC(r) & ~D_PCR_CPC_BIT(ch)) == 0);
|
||||
|
||||
/* clear interrupt status */
|
||||
_reg_write_4(D_STAT_REG, D_STAT_CIS_BIT(ch));
|
||||
|
||||
_reg_write_4(D_PCR_REG, r | D_PCR_CPC_BIT(ch));
|
||||
}
|
||||
|
||||
void
|
||||
dmac_cpc_clear(enum dmac_channel ch)
|
||||
{
|
||||
|
||||
_reg_write_4(D_PCR_REG, _reg_read_4(D_PCR_REG) & ~D_PCR_CPC_BIT(ch))
|
||||
}
|
||||
|
||||
void
|
||||
dmac_cpc_poll(void)
|
||||
{
|
||||
__asm volatile(
|
||||
".set noreorder;"
|
||||
"1: nop;"
|
||||
"nop;"
|
||||
"nop;"
|
||||
"nop;"
|
||||
"nop;"
|
||||
"bc0f 1b;"
|
||||
" nop;"
|
||||
".set reorder");
|
||||
}
|
||||
|
||||
/* not recommended. use dmac_cpc_poll as possible */
|
||||
void
|
||||
dmac_bus_poll(enum dmac_channel ch)
|
||||
{
|
||||
bus_addr_t chcr = D_CHCR_REG(__dmac_channel_base[ch]);
|
||||
|
||||
while (_reg_read_4(chcr) & D_CHCR_STR)
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
* Misc
|
||||
*/
|
||||
void
|
||||
dmac_chcr_write(enum dmac_channel ch, u_int32_t v)
|
||||
{
|
||||
u_int32_t r;
|
||||
int s;
|
||||
|
||||
/* suspend all channels */
|
||||
s = _intr_suspend();
|
||||
r = _reg_read_4(D_ENABLER_REG);
|
||||
_reg_write_4(D_ENABLEW_REG, r | D_ENABLE_SUSPEND);
|
||||
|
||||
/* write CHCR reg */
|
||||
_reg_write_4(D_CHCR_REG(__dmac_channel_base[ch]), v);
|
||||
|
||||
/* resume all chanells */
|
||||
_reg_write_4(D_ENABLEW_REG, r);
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
|
@ -0,0 +1,510 @@
|
|||
/* $NetBSD: dmacreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
typedef u_int64_t dmatag_t;
|
||||
|
||||
#define DMAC_BLOCK_SIZE 16
|
||||
#define DMAC_SLICE_SIZE 128
|
||||
#define DMAC_TRANSFER_QWCMAX 0xffff
|
||||
|
||||
/* all register length are 32bit */
|
||||
#define DMAC_REGBASE MIPS_PHYS_TO_KSEG1(0x10008000)
|
||||
#define DMAC_REGSIZE 0x00010000
|
||||
|
||||
/*
|
||||
* DMAC common registers.
|
||||
*/
|
||||
#define D_CTRL_REG MIPS_PHYS_TO_KSEG1(0x1000e000) /* DMA control */
|
||||
#define D_STAT_REG MIPS_PHYS_TO_KSEG1(0x1000e010) /* interrupt status */
|
||||
#define D_PCR_REG MIPS_PHYS_TO_KSEG1(0x1000e020) /* priority control */
|
||||
#define D_SQWC_REG MIPS_PHYS_TO_KSEG1(0x1000e030) /* interleave size */
|
||||
#define D_RBOR_REG MIPS_PHYS_TO_KSEG1(0x1000e040) /* ring buffer addr */
|
||||
#define D_RBSR_REG MIPS_PHYS_TO_KSEG1(0x1000e050) /* ring buffer size */
|
||||
#define D_STADR_REG MIPS_PHYS_TO_KSEG1(0x1000e060) /* stall address */
|
||||
#define D_ENABLER_REG MIPS_PHYS_TO_KSEG1(0x1000f520) /* DMA enable (r) */
|
||||
#define D_ENABLEW_REG MIPS_PHYS_TO_KSEG1(0x1000f590) /* DMA enable (w) */
|
||||
|
||||
/*
|
||||
* Channel registers. (10ch)
|
||||
*/
|
||||
#define DMA_CH_VIF0 0 /* to (priority 0) */
|
||||
#define DMA_CH_VIF1 1 /* both */
|
||||
#define DMA_CH_GIF 2 /* to */
|
||||
#define DMA_CH_FROMIPU 3
|
||||
#define DMA_CH_TOIPU 4
|
||||
#define DMA_CH_SIF0 5 /* from */
|
||||
#define DMA_CH_SIF1 6 /* to */
|
||||
#define DMA_CH_SIF2 7 /* both (priority 1) */
|
||||
#define DMA_CH_FROMSPR 8 /* burst channel */
|
||||
#define DMA_CH_TOSPR 9 /* burst channel */
|
||||
#define DMA_CH_VALID(x) (((x) >= 0) && ((x) <= 9))
|
||||
|
||||
#define D_CHCR_OFS 0x00
|
||||
#define D_MADR_OFS 0x10
|
||||
#define D_QWC_OFS 0x20
|
||||
#define D_TADR_OFS 0x30
|
||||
#define D_ASR0_OFS 0x40
|
||||
#define D_ASR1_OFS 0x50
|
||||
#define D_SADR_OFS 0x80
|
||||
|
||||
#define D0_REGBASE MIPS_PHYS_TO_KSEG1(0x10008000)
|
||||
#define D1_REGBASE MIPS_PHYS_TO_KSEG1(0x10009000)
|
||||
#define D2_REGBASE MIPS_PHYS_TO_KSEG1(0x1000a000)
|
||||
#define D3_REGBASE MIPS_PHYS_TO_KSEG1(0x1000b000)
|
||||
#define D4_REGBASE MIPS_PHYS_TO_KSEG1(0x1000b400)
|
||||
#define D5_REGBASE MIPS_PHYS_TO_KSEG1(0x1000c000)
|
||||
#define D6_REGBASE MIPS_PHYS_TO_KSEG1(0x1000c400)
|
||||
#define D7_REGBASE MIPS_PHYS_TO_KSEG1(0x1000c800)
|
||||
#define D8_REGBASE MIPS_PHYS_TO_KSEG1(0x1000d000)
|
||||
#define D9_REGBASE MIPS_PHYS_TO_KSEG1(0x1000d400)
|
||||
|
||||
#define D_CHCR_REG(base) (base)
|
||||
#define D_MADR_REG(base) (base + D_MADR_OFS)
|
||||
#define D_QWC_REG(base) (base + D_QWC_OFS)
|
||||
#define D_TADR_REG(base) (base + D_TADR_OFS)
|
||||
#define D_ASR0_REG(base) (base + D_ASR0_OFS)
|
||||
#define D_ASR1_REG(base) (base + D_ASR1_OFS)
|
||||
#define D_SADR_REG(base) (base + D_SADR_OFS)
|
||||
|
||||
#define D0_CHCR_REG MIPS_PHYS_TO_KSEG1(0x10008000)
|
||||
#define D0_MADR_REG MIPS_PHYS_TO_KSEG1(0x10008010)
|
||||
#define D0_QWC_REG MIPS_PHYS_TO_KSEG1(0x10008020)
|
||||
#define D0_TADR_REG MIPS_PHYS_TO_KSEG1(0x10008030)
|
||||
#define D0_ASR0_REG MIPS_PHYS_TO_KSEG1(0x10008040)
|
||||
#define D0_ASR1_REG MIPS_PHYS_TO_KSEG1(0x10008050)
|
||||
|
||||
#define D1_CHCR_REG MIPS_PHYS_TO_KSEG1(0x10009000)
|
||||
#define D1_MADR_REG MIPS_PHYS_TO_KSEG1(0x10009010)
|
||||
#define D1_QWC_REG MIPS_PHYS_TO_KSEG1(0x10009020)
|
||||
#define D1_TADR_REG MIPS_PHYS_TO_KSEG1(0x10009030)
|
||||
#define D1_ASR0_REG MIPS_PHYS_TO_KSEG1(0x10009040)
|
||||
#define D1_ASR1_REG MIPS_PHYS_TO_KSEG1(0x10009050)
|
||||
|
||||
#define D2_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000a000)
|
||||
#define D2_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000a010)
|
||||
#define D2_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000a020)
|
||||
#define D2_TADR_REG MIPS_PHYS_TO_KSEG1(0x1000a030)
|
||||
#define D2_ASR0_REG MIPS_PHYS_TO_KSEG1(0x1000a040)
|
||||
#define D2_ASR1_REG MIPS_PHYS_TO_KSEG1(0x1000a050)
|
||||
|
||||
#define D3_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000b000)
|
||||
#define D3_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000b010)
|
||||
#define D3_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000b020)
|
||||
|
||||
#define D4_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000b400)
|
||||
#define D4_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000b410)
|
||||
#define D4_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000b420)
|
||||
#define D4_TADR_REG MIPS_PHYS_TO_KSEG1(0x1000b430)
|
||||
|
||||
#define D5_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000c000)
|
||||
#define D5_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000c010)
|
||||
#define D5_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000c020)
|
||||
|
||||
#define D6_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000c400)
|
||||
#define D6_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000c410)
|
||||
#define D6_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000c420)
|
||||
#define D6_TADR_REG MIPS_PHYS_TO_KSEG1(0x1000c430)
|
||||
|
||||
#define D7_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000c800)
|
||||
#define D7_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000c810)
|
||||
#define D7_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000c820)
|
||||
|
||||
#define D8_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000d000)
|
||||
#define D8_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000d010)
|
||||
#define D8_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000d020)
|
||||
#define D8_SADR_REG MIPS_PHYS_TO_KSEG1(0x1000d080)
|
||||
|
||||
#define D9_CHCR_REG MIPS_PHYS_TO_KSEG1(0x1000d400)
|
||||
#define D9_MADR_REG MIPS_PHYS_TO_KSEG1(0x1000d410)
|
||||
#define D9_QWC_REG MIPS_PHYS_TO_KSEG1(0x1000d420)
|
||||
#define D9_TADR_REG MIPS_PHYS_TO_KSEG1(0x1000d430)
|
||||
#define D9_SADR_REG MIPS_PHYS_TO_KSEG1(0x1000d480)
|
||||
|
||||
/*
|
||||
* DMA control
|
||||
*/
|
||||
#define D_CTRL_DMAE 0x00000001 /* all DMA enable/disable */
|
||||
#define D_CTRL_RELE 0x00000002 /* Cycle stealing on/off */
|
||||
/* Memory FIFO drain control */
|
||||
#define D_CTRL_MFD_MASK 0x3
|
||||
#define D_CTRL_MFD_SHIFT 2
|
||||
#define D_CTRL_MFD(x) \
|
||||
(((x) >> D_CTRL_MFD_SHIFT) & D_CTRL_MFD_MASK)
|
||||
#define D_CTRL_MFD_CLR(x) \
|
||||
((x) & ~(D_CTRL_MFD_MASK << D_CTRL_MFD_SHIFT))
|
||||
#define D_CTRL_MFD_SET(x, val) \
|
||||
((x) | (((val) << D_CTRL_MFD_SHIFT) & \
|
||||
(D_CTRL_MFD_MASK << D_CTRL_MFD_SHIFT)))
|
||||
#define D_CTRL_MFD_DISABLE 0
|
||||
#define D_CTRL_MFD_VIF1 2
|
||||
#define D_CTRL_MFD_GIF 3
|
||||
|
||||
/* Stall control source channel */
|
||||
#define D_CTRL_STS_MASK 0x3
|
||||
#define D_CTRL_STS_SHIFT 4
|
||||
#define D_CTRL_STS(x) \
|
||||
(((x) >> D_CTRL_STS_SHIFT) & D_CTRL_STS_MASK)
|
||||
#define D_CTRL_STS_CLR(x) \
|
||||
((x) & ~(D_CTRL_STS_MASK << D_CTRL_STS_SHIFT))
|
||||
#define D_CTRL_STS_SET(x, val) \
|
||||
((x) | (((val) << D_CTRL_STS_SHIFT) & \
|
||||
(D_CTRL_STS_MASK << D_CTRL_STS_SHIFT)))
|
||||
#define D_CTRL_STS_NONE 0
|
||||
#define D_CTRL_STS_SIF0 1
|
||||
#define D_CTRL_STS_FROMSPR 2
|
||||
#define D_CTRL_STS_FROMIPU 3
|
||||
|
||||
/* Stall control drain channel */
|
||||
#define D_CTRL_STD_MASK 0x3
|
||||
#define D_CTRL_STD_SHIFT 6
|
||||
#define D_CTRL_STD(x) \
|
||||
(((x) >> D_CTRL_STD_SHIFT) & D_CTRL_STD_MASK)
|
||||
#define D_CTRL_STD_CLR(x) \
|
||||
((x) & ~(D_CTRL_STD_MASK << D_CTRL_STD_SHIFT))
|
||||
#define D_CTRL_STD_SET(x, val) \
|
||||
((x) | (((val) << D_CTRL_STD_SHIFT) & \
|
||||
(D_CTRL_STD_MASK << D_CTRL_STD_SHIFT)))
|
||||
#define D_CTRL_STD_NONE 0
|
||||
#define D_CTRL_STD_VIF1 1
|
||||
#define D_CTRL_STD_GIF 2
|
||||
#define D_CTRL_STD_SIF1 3
|
||||
|
||||
/*
|
||||
* Release cycle
|
||||
* for burst channel Cycle steanling on mode only.
|
||||
*/
|
||||
#define D_CTRL_RCYC_MASK 0x7
|
||||
#define D_CTRL_RCYC_SHIFT 8
|
||||
#define D_CTRL_RCYC(x) \
|
||||
(((x) >> D_CTRL_RCYC_SHIFT) & D_CTRL_RCYC_MASK)
|
||||
#define D_CTRL_RCYC_CLR(x) \
|
||||
((x) & ~(D_CTRL_RCYC_MASK << D_CTRL_RCYC_SHIFT))
|
||||
#define D_CTRL_RCYC_SET(x, val) \
|
||||
((x) | (((val) << D_CTRL_RCYC_SHIFT) & \
|
||||
(D_CTRL_RCYC_MASK << D_CTRL_RCYC_SHIFT)))
|
||||
#define D_CTRL_RCYC_CYCLE(x) (8 << (x))
|
||||
|
||||
/*
|
||||
* Interrupt status register (write clear/invert)
|
||||
* DMAC interrupt line connected to MIPS HwINT1
|
||||
*/
|
||||
/* MFIFO empty interrupt enable */
|
||||
#define D_STAT_MEIM 0x40000000
|
||||
/* DMA stall interrupt enable */
|
||||
#define D_STAT_SIM 0x20000000
|
||||
/* Channel interrupt enable */
|
||||
#define D_STAT_CIM_MASK 0x3ff
|
||||
#define D_STAT_CIM_SHIFT 16
|
||||
#define D_STAT_CIM(x) (((x) >> D_STAT_CIM_SHIFT) & D_STAT_CIM_MASK)
|
||||
#define D_STAT_CIM_BIT(x) ((1 << (x)) << D_STAT_CIM_SHIFT)
|
||||
#define D_STAT_CIM9 0x02000000
|
||||
#define D_STAT_CIM8 0x01000000
|
||||
#define D_STAT_CIM7 0x00800000
|
||||
#define D_STAT_CIM6 0x00400000
|
||||
#define D_STAT_CIM5 0x00200000
|
||||
#define D_STAT_CIM4 0x00100000
|
||||
#define D_STAT_CIM3 0x00080000
|
||||
#define D_STAT_CIM2 0x00040000
|
||||
#define D_STAT_CIM1 0x00020000
|
||||
#define D_STAT_CIM0 0x00010000
|
||||
/* BUSERR interrupt status */
|
||||
#define D_STAT_BEIS 0x00008000
|
||||
/* MFIFO empty interrupt status */
|
||||
#define D_STAT_MEIS 0x00004000
|
||||
/* DMA stall interrupt status */
|
||||
#define D_STAT_SIS 0x00002000
|
||||
/* Channel interrupt status */
|
||||
#define D_STAT_CIS_MASK 0x3ff
|
||||
#define D_STAT_CIS_SHIFT 0
|
||||
#define D_STAT_CIS_BIT(x) (1 << (x))
|
||||
#define D_STAT_CIS9 0x00000200
|
||||
#define D_STAT_CIS8 0x00000100
|
||||
#define D_STAT_CIS7 0x00000080
|
||||
#define D_STAT_CIS6 0x00000040
|
||||
#define D_STAT_CIS5 0x00000020
|
||||
#define D_STAT_CIS4 0x00000010
|
||||
#define D_STAT_CIS3 0x00000008
|
||||
#define D_STAT_CIS2 0x00000004
|
||||
#define D_STAT_CIS1 0x00000002
|
||||
#define D_STAT_CIS0 0x00000001
|
||||
|
||||
/*
|
||||
* Priority control register.
|
||||
*/
|
||||
/* Priority control enable */
|
||||
#define D_PCR_PCE 0x80000000
|
||||
/* Channel DMA enable (packet priority control enable) */
|
||||
#define D_PCR_CDE_MASK 0x3ff
|
||||
#define D_PCR_CDE_SHIFT 16
|
||||
#define D_PCR_CDE(x) \
|
||||
(((x) >> D_PCR_CDE_SHIFT) & D_PCR_CDE_MASK)
|
||||
#define D_PCR_CDE_CLR(x) \
|
||||
((x) & ~(D_PCR_CDE_MASK << D_PCR_CDE_SHIFT))
|
||||
#define D_PCR_CDE_SET(x, val) \
|
||||
((x) | (((val) << D_PCR_CDE_SHIFT) & \
|
||||
(D_PCR_CDE_MASK << D_PCR_CDE_SHIFT)))
|
||||
#define D_PCR_CDE9 0x02000000
|
||||
#define D_PCR_CDE8 0x01000000
|
||||
#define D_PCR_CDE7 0x00800000
|
||||
#define D_PCR_CDE6 0x00400000
|
||||
#define D_PCR_CDE5 0x00200000
|
||||
#define D_PCR_CDE4 0x00100000
|
||||
#define D_PCR_CDE3 0x00080000
|
||||
#define D_PCR_CDE2 0x00040000
|
||||
#define D_PCR_CDE1 0x00020000
|
||||
#define D_PCR_CDE0 0x00010000
|
||||
/* COP control (interrupt status connect to CPCOND[0] or not) */
|
||||
#define D_PCR_CPC_MASK 0x3ff
|
||||
#define D_PCR_CPC_SHIFT 0
|
||||
#define D_PCR_CPC(x) ((x) & D_PCR_CPC_MASK)
|
||||
#define D_PCR_CPC_CLR(x) ((x) & ~D_PCR_CPC_MASK)
|
||||
#define D_PCR_CPC_SET(x, val) ((x) | ((val) & D_PCR_CPC_MASK))
|
||||
#define D_PCR_CPC_BIT(x) (1 << (x))
|
||||
#define D_PCR_CPC9 0x00000200
|
||||
#define D_PCR_CPC8 0x00000100
|
||||
#define D_PCR_CPC7 0x00000080
|
||||
#define D_PCR_CPC6 0x00000040
|
||||
#define D_PCR_CPC5 0x00000020
|
||||
#define D_PCR_CPC4 0x00000010
|
||||
#define D_PCR_CPC3 0x00000008
|
||||
#define D_PCR_CPC2 0x00000004
|
||||
#define D_PCR_CPC1 0x00000002
|
||||
#define D_PCR_CPC0 0x00000001
|
||||
|
||||
/*
|
||||
* Interleave size register
|
||||
*/
|
||||
/* Transfer quadword counter */
|
||||
#define D_SQWC_TQWC_MASK 0xff
|
||||
#define D_SQWC_TQWC_SHIFT 16
|
||||
#define D_SQWC_TQWC(x) \
|
||||
(((x) >> D_SQWC_TQWC_SHIFT) & D_SQWC_TQWC_MASK)
|
||||
#define D_SQWC_TQWC_CLR(x) \
|
||||
((x) & ~(D_SQWC_TQWC_MASK << D_SQWC_TQWC_SHIFT))
|
||||
#define D_SQWC_TQWC_SET(x, val) \
|
||||
((x) | (((val) << D_SQWC_TQWC_SHIFT) & \
|
||||
(D_SQWC_TQWC_MASK << D_SQWC_TQWC_SHIFT)))
|
||||
/* Skip quadword counter */
|
||||
#define D_SQWC_SQWC_MASK 0xff
|
||||
#define D_SQWC_SQWC_SHIFT 0
|
||||
#define D_SQWC_SQWC(x) \
|
||||
(((x) >> D_SQWC_SQWC_SHIFT) & D_SQWC_SQWC_MASK)
|
||||
#define D_SQWC_SQWC_CLR(x) \
|
||||
((x) & ~(D_SQWC_SQWC_MASK << D_SQWC_SQWC_SHIFT))
|
||||
#define D_SQWC_SQWC_SET(x, val) \
|
||||
((x) | (((val) << D_SQWC_SQWC_SHIFT) & \
|
||||
(D_SQWC_SQWC_MASK << D_SQWC_SQWC_SHIFT)))
|
||||
|
||||
/*
|
||||
* Ring buffer address register
|
||||
* 16byte alignment address [30:4]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ring buffer size register
|
||||
* must be 2 ** n qword. [30:4]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Stall address register
|
||||
* [30:0] (qword alignment)
|
||||
*/
|
||||
|
||||
/*
|
||||
* DMA suspend register
|
||||
*/
|
||||
#define D_ENABLE_SUSPEND 0x00010000
|
||||
|
||||
|
||||
/*
|
||||
* Channel specific register.
|
||||
*/
|
||||
|
||||
/* CHANNEL CONTROL REGISTER */
|
||||
/* upper 16bit of DMA tag last read. */
|
||||
#define D_CHCR_TAG_MASK 0xff
|
||||
#define D_CHCR_TAG_SHIFT 16
|
||||
#define D_CHCR_TAG(x) \
|
||||
(((x) >> D_CHCR_TAG_SHIFT) & D_CHCR_TAG_MASK)
|
||||
#define D_CHCR_TAG_CLR(x) \
|
||||
((x) & ~(D_CHCR_TAG_MASK << D_CHCR_TAG_SHIFT))
|
||||
#define D_CHCR_TAG_SET(x, val) \
|
||||
((x) | (((val) << D_CHCR_TAG_SHIFT) & \
|
||||
(D_CHCR_TAG_MASK << D_CHCR_TAG_SHIFT)))
|
||||
/* DMA start */
|
||||
#define D_CHCR_STR 0x00000100
|
||||
/* Tag interrupt enable (IRQ bit of DMAtag) */
|
||||
#define D_CHCR_TIE 0x00000080
|
||||
/* Tag transfer enable (Source chain mode only) */
|
||||
#define D_CHCR_TTE 0x00000040
|
||||
/* Address stack pointer */
|
||||
#define D_CHCR_ASP_MASK 0x3
|
||||
#define D_CHCR_ASP_SHIFT 4
|
||||
#define D_CHCR_ASP(x) \
|
||||
(((x) >> D_CHCR_ASP_SHIFT) & D_CHCR_ASP_MASK)
|
||||
#define D_CHCR_ASP_CLR(x) \
|
||||
((x) & ~(D_CHCR_ASP_MASK << D_CHCR_ASP_SHIFT))
|
||||
#define D_CHCR_ASP_SET(x, val) \
|
||||
((x) | (((val) << D_CHCR_ASP_SHIFT) & \
|
||||
(D_CHCR_ASP_MASK << D_CHCR_ASP_SHIFT)))
|
||||
#define D_CHCR_ASP_PUSHED_NONE 0
|
||||
#define D_CHCR_ASP_PUSHED_1 1
|
||||
#define D_CHCR_ASP_PUSHED_2 2
|
||||
/* Logical transfer mode */
|
||||
#define D_CHCR_MOD_MASK 0x3
|
||||
#define D_CHCR_MOD_SHIFT 2
|
||||
#define D_CHCR_MOD(x) \
|
||||
(((x) >> D_CHCR_MOD_SHIFT) & D_CHCR_MOD_MASK)
|
||||
#define D_CHCR_MOD_CLR(x) \
|
||||
((x) & ~(D_CHCR_MOD_MASK << D_CHCR_MOD_SHIFT))
|
||||
#define D_CHCR_MOD_SET(x, val) \
|
||||
((x) | (((val) << D_CHCR_MOD_SHIFT) & \
|
||||
(D_CHCR_MOD_MASK << D_CHCR_MOD_SHIFT)))
|
||||
#define D_CHCR_MOD_NORMAL 0
|
||||
#define D_CHCR_MOD_CHAIN 1
|
||||
#define D_CHCR_MOD_INTERLEAVE 2
|
||||
/*
|
||||
* DMA transfer direction (1 ... from Memory, 0 ... to Memory)
|
||||
* (VIF1, SIF2 only. i.e. `both'-direction channel requires this)
|
||||
*/
|
||||
#define D_CHCR_DIR 0x00000001
|
||||
|
||||
/*
|
||||
* TRANSFER ADDRESS REGISTER (D-RAM address)
|
||||
* 16 byte alignment. In FROMSPR, TOSPR channel, D_MADR_SPR always 0
|
||||
*/
|
||||
#define D_MADR_SPR 0x80000000
|
||||
|
||||
/*
|
||||
* TAG ADDRESS REGISTER (next tag address)
|
||||
* 16 byte alignment.
|
||||
*/
|
||||
#define D_TADR_SPR 0x80000000
|
||||
|
||||
/*
|
||||
* TAG ADDRESS STACK REGISTER (2 stage)
|
||||
* 16 byte alignment.
|
||||
*/
|
||||
#define D_ASR_SPR 0x80000000
|
||||
|
||||
/*
|
||||
* SPR TRANSFER ADDRESS REGISTER (SPR address)
|
||||
* 16 byte alignment. FROMSPR, TOSPR only.
|
||||
*/
|
||||
#define D_SADR_MASK 0x3fff
|
||||
#define D_SADR_SHIFT 0
|
||||
#define D_SADR(x) \
|
||||
((u_int32_t)(x) & D_SADR_MASK)
|
||||
/*
|
||||
* TRANSFER SIZE REGISTER
|
||||
* min 16 byte to max 1 Mbyte.
|
||||
*/
|
||||
#define D_QWC_MASK 0xffff
|
||||
#define D_QWC_SHIFT 0
|
||||
#define D_QWC(x) (((x) >> D_QWC_SHIFT) & D_QWC_MASK)
|
||||
#define D_QWC_CLR(x) ((x) & ~(D_QWC_MASK << D_QWC_SHIFT))
|
||||
#define D_QWC_SET(x, val) \
|
||||
((x) | (((val) << D_QWC_SHIFT) & D_QWC_MASK << D_QWC_SHIFT))
|
||||
|
||||
/*
|
||||
* Source/Destination Chain Tag definition.
|
||||
* SC ... VIF0, VIF1, GIF, toIPU, SIF1, toSPR
|
||||
* DC ... SIF0, fromSPR
|
||||
*/
|
||||
/*
|
||||
* DMA address
|
||||
* At least, 16byte align.
|
||||
* but 64byte align is recommended. because EE D-cash line size is 64byte.
|
||||
* To gain maximum DMA speed, use 128 byte align.
|
||||
*/
|
||||
#define DMATAG_ADDR_MASK 0xffffffff
|
||||
#define DMATAG_ADDR_SHIFT 32
|
||||
#define DMATAG_ADDR(x) \
|
||||
((u_int32_t)(((x) >> DMATAG_ADDR_SHIFT) & DMATAG_ADDR_MASK))
|
||||
#define DMATAG_ADDR_SET(x, val) \
|
||||
((dmatag_t)(x) | (((dmatag_t)(val)) << DMATAG_ADDR_SHIFT))
|
||||
|
||||
#define DMATAG_ADDR32_INVALID(x) ((x) & 0xf) /* 16byte alignment */
|
||||
|
||||
/*
|
||||
* DMA controller command
|
||||
*/
|
||||
#define DMATAG_CMD_MASK 0xffffffff
|
||||
#define DMATAG_CMD_SHIFT 0
|
||||
#define DMATAG_CMD(x) \
|
||||
((u_int32_t)((x) & DMATAG_CMD_MASK))
|
||||
|
||||
#define DMATAG_CMD_IRQ 0x80000000
|
||||
|
||||
#define DMATAG_CMD_ID_MASK 0x7
|
||||
#define DMATAG_CMD_ID_SHIFT 28
|
||||
#define DMATAG_CMD_ID(x) \
|
||||
(((x) >> DMATAG_CMD_ID_SHIFT) & DMATAG_CMD_ID_MASK)
|
||||
#define DMATAG_CMD_ID_CLR(x) \
|
||||
((x) & ~(DMATAG_CMD_ID_MASK << DMATAG_CMD_ID_SHIFT))
|
||||
#define DMATAG_CMD_ID_SET(x, val) \
|
||||
((x) | (((val) << DMATAG_CMD_ID_SHIFT) & \
|
||||
(DMATAG_CMD_ID_MASK << DMATAG_CMD_ID_SHIFT)))
|
||||
#define DMATAG_CMD_SCID_REFE 0
|
||||
#define DMATAG_CMD_SCID_CNT 1
|
||||
#define DMATAG_CMD_SCID_NEXT 2
|
||||
#define DMATAG_CMD_SCID_REF 3
|
||||
#define DMATAG_CMD_SCID_REFS 4 /* VIF1, GIF, SIF1 only */
|
||||
#define DMATAG_CMD_SCID_CALL 5 /* VIF0, VIF1, GIF only */
|
||||
#define DMATAG_CMD_SCID_RET 6 /* VIF0, VIF1, GIF only */
|
||||
#define DMATAG_CMD_SCID_END 7
|
||||
|
||||
#define DMATAG_CMD_DCID_CNTS 0 /* SIF0, fromSPR only */
|
||||
#define DMATAG_CMD_DCID_CNT 1
|
||||
#define DMATAG_CMD_DCID_END 7
|
||||
|
||||
#define DMATAG_CMD_PCE_MASK 0x3
|
||||
#define DMATAG_CMD_PCE_SHIFT 26
|
||||
#define DMATAG_CMD_PCE(x) \
|
||||
(((x) >> DMATAG_CMD_PCE_SHIFT) & DMATAG_CMD_PCE_MASK)
|
||||
#define DMATAG_CMD_PCE_CLR(x) \
|
||||
((x) & ~(DMATAG_CMD_PCE_MASK << DMATAG_CMD_PCE_SHIFT))
|
||||
#define DMATAG_CMD_PCE_SET(x, val) \
|
||||
((x) | (((val) << DMATAG_CMD_PCE_SHIFT) & \
|
||||
(DMATAG_CMD_PCE_MASK << DMATAG_CMD_PCE_SHIFT)))
|
||||
#define DMATAG_CMD_PCE_NONE 0
|
||||
#define DMATAG_CMD_PCE_DISABLE 2
|
||||
#define DMATAG_CMD_PCE_ENABLE 3
|
||||
|
||||
#define DMATAG_CMD_QWC_MASK 0xffff
|
||||
#define DMATAG_CMD_QWC_SHIFT 0
|
||||
#define DMATAG_CMD_QWC(x) \
|
||||
(((x) >> DMATAG_CMD_QWC_SHIFT) & DMATAG_CMD_QWC_MASK)
|
||||
#define DMATAG_CMD_QWC_CLR(x) \
|
||||
((x) & ~(DMATAG_CMD_QWC_MASK << DMATAG_CMD_QWC_SHIFT))
|
||||
#define DMATAG_CMD_QWC_SET(x, val) \
|
||||
((x) | (((val) << DMATAG_CMD_QWC_SHIFT) & \
|
||||
(DMATAG_CMD_QWC_MASK << DMATAG_CMD_QWC_SHIFT)))
|
|
@ -0,0 +1,70 @@
|
|||
/* $NetBSD: dmacvar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* DO NOT REORDER */
|
||||
enum dmac_channel {
|
||||
D_CH0_VIF0 = 0,
|
||||
D_CH1_VIF1,
|
||||
D_CH2_GIF,
|
||||
D_CH3_FROMIPU,
|
||||
D_CH4_TOIPU,
|
||||
D_CH5_SIF0,
|
||||
D_CH6_SIF1,
|
||||
D_CH7_SIF2,
|
||||
D_CH8_FROMSPR,
|
||||
D_CH9_TOSPR
|
||||
};
|
||||
|
||||
extern u_int32_t __dmac_enabled_channel;
|
||||
|
||||
void dmac_init(void);
|
||||
|
||||
/* start/stop */
|
||||
void dmac_start_channel(enum dmac_channel);
|
||||
void dmac_stop_channel(enum dmac_channel);
|
||||
void dmac_sync_buffer(void);
|
||||
|
||||
/* interrupt */
|
||||
int dmac_intr(u_int32_t);
|
||||
void *dmac_intr_establish(enum dmac_channel, int, int (*)(void *), void *);
|
||||
void dmac_intr_disestablish(void *);
|
||||
void dmac_intr_disable(enum dmac_channel);
|
||||
void dmac_intr_enable(enum dmac_channel);
|
||||
void dmac_update_mask(u_int32_t);
|
||||
|
||||
/* polling */
|
||||
void dmac_cpc_set(enum dmac_channel);
|
||||
void dmac_cpc_clear(enum dmac_channel);
|
||||
void dmac_cpc_poll(void);
|
||||
void dmac_bus_poll(enum dmac_channel); /* slow */
|
||||
|
||||
/* misc */
|
||||
void dmac_chcr_write(enum dmac_channel, u_int32_t);
|
|
@ -0,0 +1,51 @@
|
|||
/* $NetBSD: eevar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EE embeded device's memory mapped register access method.
|
||||
*/
|
||||
|
||||
#define _PLAYSTATION2_BUS_SPACE_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#define _reg_read_1(a) __read_1(a)
|
||||
#define _reg_read_2(a) __read_2(a)
|
||||
#define _reg_read_4(a) __read_4(a)
|
||||
#define _reg_read_8(a) __read_8(a)
|
||||
#define _reg_read_16(a) __read_16(a)
|
||||
#define _reg_write_1(a, v) __write_1(a, v)
|
||||
#define _reg_write_2(a, v) __write_2(a, v)
|
||||
#define _reg_write_4(a, v) __write_4(a, v)
|
||||
#define _reg_write_8(a, v) __write_8(a, v)
|
||||
#define _reg_write_16(a, v) __write_16(a, v)
|
||||
|
||||
#define qwctobyte(x) ((x) << 4)
|
||||
#define bytetoqwc(x) ((x) >> 4)
|
|
@ -0,0 +1,32 @@
|
|||
/* $NetBSD: gifreg.h,v 1.6 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Takuya SHIOZAKI (tshiozak@NetBSD.org).
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define GIF_CTRL_REG MIPS_PHYS_TO_KSEG1(0x10003000)
|
|
@ -0,0 +1,164 @@
|
|||
/* $NetBSD: gs.c,v 1.6 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: gs.c,v 1.6 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <playstation2/playstation2/sifbios.h>
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/gsvar.h>
|
||||
#include <playstation2/ee/gsreg.h>
|
||||
#include <playstation2/ee/gifreg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC const struct gs_crt_param {
|
||||
int w, h, dvemode;
|
||||
u_int64_t smode1, smode2, srfsh, synch1, synch2, syncv, display;
|
||||
} gs_crt_param[] = {
|
||||
[NTSC_NONINTER] = {
|
||||
.w = 640,
|
||||
.h = 240,
|
||||
.dvemode= 0,
|
||||
.smode1 = SMODE1(0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 1, 1, 0, 2, 0, 1, 32, 4),
|
||||
.smode2 = SMODE2(0, 0, 0),
|
||||
.srfsh = SRFSH(8),
|
||||
.synch1 = SYNCH1(254, 1462, 124, 222, 64),
|
||||
.synch2 = SYNCH2(1652, 1240),
|
||||
.syncv = SYNCV(6, 480, 6, 26, 6, 2),
|
||||
.display=DISPLAY(239, 2559, 0, 3, 25, 632)
|
||||
},
|
||||
[NTSC_INTER] = {
|
||||
.w = 640,
|
||||
.h = 480,
|
||||
.dvemode= 0,
|
||||
.smode1 = SMODE1(0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 1, 1, 0, 2, 0, 1, 32, 4),
|
||||
.smode2 = SMODE2(0, 0, 1),
|
||||
.srfsh = SRFSH(8),
|
||||
.synch1 = SYNCH1(254, 1462, 124, 222, 64),
|
||||
.synch2 = SYNCH2(1652, 1240),
|
||||
.syncv = SYNCV(6, 480, 6, 26, 6, 1),
|
||||
.display= DISPLAY(479, 2559, 0, 3, 50, 632)
|
||||
},
|
||||
[PAL_NONINTER] = {
|
||||
.w = 640,
|
||||
.h = 288,
|
||||
.dvemode= 1,
|
||||
.smode1 = SMODE1(0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 1, 1, 0, 3, 0, 1, 32, 4),
|
||||
.smode2 = SMODE2(0, 0, 0),
|
||||
.srfsh = SRFSH(8),
|
||||
.synch1 = SYNCH1(254, 1474, 127, 262, 48),
|
||||
.synch2 = SYNCH2(1680, 1212),
|
||||
.syncv = SYNCV(5, 576, 5, 33, 5, 4),
|
||||
.display= DISPLAY(287, 2559, 0, 3, 36, 652)
|
||||
},
|
||||
[PAL_INTER] = {
|
||||
.w = 640,
|
||||
.h = 576,
|
||||
.dvemode= 1,
|
||||
.smode1 = SMODE1(0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 1, 1, 0, 3, 0, 1, 32, 4),
|
||||
.smode2 = SMODE2(0, 0, 1),
|
||||
.srfsh = SRFSH(8),
|
||||
.synch1 = SYNCH1(254, 1474, 127, 262, 48),
|
||||
.synch2 = SYNCH2(1680, 1212),
|
||||
.syncv = SYNCV(5, 576, 5, 33, 5, 4),
|
||||
.display= DISPLAY(575,2559,0,3,72,652)
|
||||
},
|
||||
[VESA_1A] = {
|
||||
.w = 640,
|
||||
.h = 480,
|
||||
.dvemode= 2,
|
||||
.smode1 = SMODE1(1, 0, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 1, 0, 0, 0, 0, 1, 15, 2),
|
||||
.smode2 = SMODE2(0, 0, 0),
|
||||
.srfsh = SRFSH(4),
|
||||
.synch1 = SYNCH1(192, 608, 192, 84, 32),
|
||||
.synch2 = SYNCH2(768, 524),
|
||||
.syncv = SYNCV(2, 480, 0, 33, 0, 10),
|
||||
.display= DISPLAY(479, 1279, 0, 1, 34, 276)
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
gs_init(enum gs_crt_type type)
|
||||
{
|
||||
const struct gs_crt_param *p = &gs_crt_param[type];
|
||||
u_int64_t smode1 = p->smode1;
|
||||
|
||||
/* GS reset */
|
||||
_reg_write_8(GS_S_CSR_REG, 1 << 9);
|
||||
|
||||
/* setup PCRTC */
|
||||
_reg_write_8(GS_S_PMODE_REG, 0); /* disable circuit 1/2 */
|
||||
|
||||
_reg_write_8(GS_S_SMODE1_REG, smode1 | ((u_int64_t)1 << 16));
|
||||
_reg_write_8(GS_S_SYNCH1_REG, p->synch1);
|
||||
_reg_write_8(GS_S_SYNCH2_REG, p->synch2);
|
||||
_reg_write_8(GS_S_SYNCV_REG, p->syncv);
|
||||
_reg_write_8(GS_S_SMODE2_REG, p->smode2);
|
||||
_reg_write_8(GS_S_SRFSH_REG, p->srfsh);
|
||||
|
||||
if (p->dvemode == 2) { /* PLL on */
|
||||
_reg_write_8(GS_S_SMODE1_REG, smode1 & ~((u_int64_t)1 << 16));
|
||||
delay(2500);
|
||||
}
|
||||
|
||||
/* start sync */
|
||||
_reg_write_8(GS_S_SMODE1_REG,
|
||||
smode1 & ~((u_int64_t)1 << 16) & ~((u_int64_t)1 << 17));
|
||||
|
||||
sifbios_setdve(p->dvemode);
|
||||
|
||||
/* enable circuit */
|
||||
_reg_write_8(GS_S_PMODE_REG, 0x66);
|
||||
|
||||
/* display environment */
|
||||
_reg_write_8(GS_S_DISPLAY2_REG, p->display);
|
||||
_reg_write_8(GS_S_DISPFB2_REG, (p->w >> 6) << 9);
|
||||
_reg_write_8(GS_S_SMODE2_REG, p->smode2);
|
||||
_reg_write_8(GS_S_BGCOLOR_REG, 0);
|
||||
|
||||
/* Flush GS FIFO */
|
||||
_reg_write_8(GS_S_CSR_REG, 1 << 8);
|
||||
|
||||
/* GIF reset */
|
||||
_reg_write_4(GIF_CTRL_REG, 1);
|
||||
}
|
|
@ -0,0 +1,659 @@
|
|||
/* $NetBSD: gsfb.c,v 1.21 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: gsfb.c,v 1.21 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <dev/wscons/wsdisplayvar.h>
|
||||
#include <dev/wscons/wscons_callbacks.h>
|
||||
|
||||
#include <dev/wsfont/wsfont.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/gsvar.h>
|
||||
#include <playstation2/ee/gsreg.h>
|
||||
#include <playstation2/ee/dmacvar.h>
|
||||
#include <playstation2/ee/dmacreg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC struct gsfb {
|
||||
int initialized;
|
||||
int attached;
|
||||
int is_console;
|
||||
const struct wsscreen_descr *screen;
|
||||
struct wsdisplay_font *font;
|
||||
} gsfb;
|
||||
|
||||
STATIC void gsfb_dma_kick(paddr_t, size_t);
|
||||
STATIC void gsfb_font_expand_psmct32(const struct wsdisplay_font *, u_int,
|
||||
long, u_int32_t *);
|
||||
STATIC inline void gsfb_set_cursor_pos(u_int32_t *, int, int, int, int);
|
||||
|
||||
#define ATTR_FG_GET(a) (((a )>> 24) & 0xf)
|
||||
#define ATTR_BG_GET(a) (((a )>> 16) & 0xf)
|
||||
#define ATTR_FG_SET(x) (((x) << 24) & 0x0f000000)
|
||||
#define ATTR_BG_SET(x) (((x) << 16) & 0x000f0000)
|
||||
|
||||
STATIC const u_int32_t gsfb_ansi_psmct32[] = {
|
||||
0x80000000, /* black */
|
||||
0x800000aa, /* red */
|
||||
0x8000aa00, /* green */
|
||||
0x8000aaaa, /* brown */
|
||||
0x80aa0000, /* blue */
|
||||
0x80aa00aa, /* magenta */
|
||||
0x80aaaa00, /* cyan */
|
||||
0x80aaaaaa, /* white */
|
||||
0x80000000, /* black */
|
||||
0x800000ff, /* red */
|
||||
0x8000ff00, /* green */
|
||||
0x8000ffff, /* brown */
|
||||
0x80ff0000, /* blue */
|
||||
0x80ff00ff, /* magenta */
|
||||
0x80ffff00, /* cyan */
|
||||
0x80ffffff, /* black */
|
||||
};
|
||||
|
||||
#define TRXPOS_DXY(f, x, y) \
|
||||
({ \
|
||||
f[9] = ((x) & 0x000007ff) | (((y) << 16) & 0x07ff0000); \
|
||||
})
|
||||
|
||||
#define TRXPOS_SY_DY(f, sy, dy) \
|
||||
({ \
|
||||
f[8] = (((sy) << 16) & 0x07ff0000); \
|
||||
f[9] = (((dy) << 16) & 0x07ff0000); \
|
||||
})
|
||||
|
||||
#define TRXPOS_DXY_SXY(f, dx, dy, sx, sy) \
|
||||
({ \
|
||||
f[8] = ((((sy) << 16) & 0x07ff0000) | ((sx) & 0x000007ff)); \
|
||||
f[9] = ((((dy) << 16) & 0x07ff0000) | ((dx) & 0x000007ff)); \
|
||||
})
|
||||
|
||||
STATIC u_int32_t gsfb_scroll_cmd_640x16[] __attribute__((__aligned__(16))) = {
|
||||
0x00008004, 0x10000000, 0x0000000e, 0x00000000,
|
||||
0x000a0000, 0x000a0000, 0x00000050, 0x00000000,
|
||||
0x07ff0000, 0x07ff0000, 0x00000051, 0x00000000,
|
||||
0x00000280, 0x00000010, 0x00000052, 0x00000000,
|
||||
0x00000002, 0x00000000, 0x00000053, 0x00000000,
|
||||
};
|
||||
|
||||
STATIC u_int32_t gsfb_cursor_cmd[] __attribute__((__aligned__(16))) = {
|
||||
0x00008007, 0x10000000, 0x0000000e, 0x00000000,
|
||||
0x00000001, 0x00000000, 0x0000001a, 0x00000000,
|
||||
0x000000a4, 0x00000080, 0x00000042, 0x00000000,
|
||||
0x00000046, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x80ffffff, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x0000000d, 0x00000000,
|
||||
0x80ffffff, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000005, 0x00000000,
|
||||
};
|
||||
|
||||
STATIC u_int32_t gsfb_copy_cmd_8x16[] __attribute__((__aligned__(16))) = {
|
||||
0x00008004, 0x10000000, 0x0000000e, 0x00000000,
|
||||
0x000a0000, 0x000a0000, 0x00000050, 0x00000000,
|
||||
0x07ff07ff, 0x07ff07ff, 0x00000051, 0x00000000,
|
||||
0x00000008, 0x00000010, 0x00000052, 0x00000000,
|
||||
0x00000002, 0x00000000, 0x00000053, 0x00000000,
|
||||
};
|
||||
|
||||
STATIC u_int32_t gsfb_init_cmd_640x480[] __attribute__((__aligned__(16))) = {
|
||||
0x00008008, 0x10000000, 0x0000000e, 0x00000000,
|
||||
0x000a0000, 0x00000000, 0x0000004c, 0x00000000,
|
||||
0x00000096, 0x00000000, 0x0000004e, 0x00000000,
|
||||
0x02800000, 0x01e00000, 0x00000040, 0x00000000,
|
||||
0x00000006, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x80000000, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x0000000d, 0x00000000,
|
||||
0x80000000, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x1e002800, 0x00000000, 0x00000005, 0x00000000,
|
||||
};
|
||||
|
||||
STATIC u_int32_t gsfb_load_cmd_8x16_psmct32[(6 + 32) * 4]
|
||||
__attribute__((__aligned__(16))) = {
|
||||
/* GIF tag + GS command */
|
||||
0x00000004, 0x10000000, 0x0000000e, 0x00000000,
|
||||
0x00000000, 0x000a0000, 0x00000050, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000051, 0x00000000,
|
||||
0x00000008, 0x00000016, 0x00000052, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000053, 0x00000000,
|
||||
0x00008020, 0x08000000, 0x00000000, 0x00000000,
|
||||
/* Load area */
|
||||
#define FONT_SCRATCH_BASE (6 * 4)
|
||||
};
|
||||
|
||||
#ifdef GSFB_DEBUG_MONITOR
|
||||
#include <machine/stdarg.h>
|
||||
STATIC const struct _gsfb_debug_window {
|
||||
int start, nrow, attr;
|
||||
} _gsfb_debug_window[3] = {
|
||||
{ 24, 2 , ATTR_BG_SET(WSCOL_BROWN) | ATTR_FG_SET(WSCOL_BLUE) },
|
||||
{ 26, 2 , ATTR_BG_SET(WSCOL_CYAN) | ATTR_FG_SET(WSCOL_BLUE) },
|
||||
{ 28, 2 , ATTR_BG_SET(WSCOL_WHITE) | ATTR_FG_SET(WSCOL_BLUE) },
|
||||
};
|
||||
STATIC char _gsfb_debug_buf[80 * 2];
|
||||
#endif /* GSFB_DEBUG_MONITOR */
|
||||
|
||||
STATIC int gsfb_match(struct device *, struct cfdata *, void *);
|
||||
STATIC void gsfb_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(gsfb, sizeof(struct device),
|
||||
gsfb_match, gsfb_attach, NULL, NULL);
|
||||
|
||||
STATIC void gsfb_hwinit(void);
|
||||
STATIC int gsfb_swinit(void);
|
||||
|
||||
/* console */
|
||||
void gsfbcnprobe(struct consdev *);
|
||||
void gsfbcninit(struct consdev *);
|
||||
|
||||
/* emul ops */
|
||||
STATIC void _gsfb_cursor(void *, int, int, int);
|
||||
STATIC int _gsfb_mapchar(void *, int, unsigned int *);
|
||||
STATIC void _gsfb_putchar(void *, int, int, u_int, long);
|
||||
STATIC void _gsfb_copycols(void *, int, int, int, int);
|
||||
STATIC void _gsfb_erasecols(void *, int, int, int, long);
|
||||
STATIC void _gsfb_copyrows(void *, int, int, int);
|
||||
STATIC void _gsfb_eraserows(void *, int, int, long);
|
||||
STATIC int _gsfb_allocattr(void *, int, int, int, long *);
|
||||
|
||||
/* access ops */
|
||||
STATIC int _gsfb_ioctl(void *, void *, u_long, void *, int, struct lwp *);
|
||||
STATIC paddr_t _gsfb_mmap(void *, void *, off_t, int);
|
||||
STATIC int _gsfb_alloc_screen(void *, const struct wsscreen_descr *, void **,
|
||||
int *, int *, long *);
|
||||
STATIC void _gsfb_free_screen(void *, void *);
|
||||
STATIC int _gsfb_show_screen(void *, void *, int, void (*)(void *, int, int),
|
||||
void *);
|
||||
STATIC void _gsfb_pollc(void *, int);
|
||||
|
||||
/*
|
||||
* wsdisplay attach args
|
||||
* std: screen size 640 x 480, font size 8 x 16
|
||||
*/
|
||||
#define GSFB_STD_SCREEN_WIDTH 640
|
||||
#define GSFB_STD_SCREEN_HEIGHT 480
|
||||
#define GSFB_STD_FONT_WIDTH 8
|
||||
#define GSFB_STD_FONT_HEIGHT 16
|
||||
const struct wsdisplay_emulops _gsfb_emulops = {
|
||||
.cursor = _gsfb_cursor,
|
||||
.mapchar = _gsfb_mapchar,
|
||||
.putchar = _gsfb_putchar,
|
||||
.copycols = _gsfb_copycols,
|
||||
.erasecols = _gsfb_erasecols,
|
||||
.copyrows = _gsfb_copyrows,
|
||||
.eraserows = _gsfb_eraserows,
|
||||
.allocattr = _gsfb_allocattr
|
||||
};
|
||||
|
||||
const struct wsscreen_descr _gsfb_std_screen = {
|
||||
.name = "std",
|
||||
.ncols = 80,
|
||||
#ifdef GSFB_DEBUG_MONITOR
|
||||
.nrows = 24,
|
||||
#else
|
||||
.nrows = 30,
|
||||
#endif
|
||||
.textops = &_gsfb_emulops,
|
||||
.fontwidth = 8,
|
||||
.fontheight = 16,
|
||||
.capabilities = WSSCREEN_UNDERLINE | WSSCREEN_HILIT |
|
||||
WSSCREEN_WSCOLORS
|
||||
};
|
||||
|
||||
const struct wsscreen_descr *_gsfb_screen_table[] = {
|
||||
&_gsfb_std_screen,
|
||||
};
|
||||
|
||||
struct wsscreen_list _gsfb_screen_list = {
|
||||
.nscreens = sizeof(_gsfb_screen_table) /
|
||||
sizeof(_gsfb_screen_table[0]),
|
||||
.screens = _gsfb_screen_table
|
||||
};
|
||||
|
||||
struct wsdisplay_accessops _gsfb_accessops = {
|
||||
.ioctl = _gsfb_ioctl,
|
||||
.mmap = _gsfb_mmap,
|
||||
.alloc_screen = _gsfb_alloc_screen,
|
||||
.free_screen = _gsfb_free_screen,
|
||||
.show_screen = _gsfb_show_screen,
|
||||
.load_font = 0,
|
||||
.pollc = _gsfb_pollc
|
||||
};
|
||||
|
||||
int
|
||||
gsfb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
extern struct cfdriver gsfb_cd;
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
|
||||
if (strcmp(ma->ma_name, gsfb_cd.cd_name) != 0)
|
||||
return (0);
|
||||
|
||||
return (!gsfb.attached);
|
||||
}
|
||||
|
||||
void
|
||||
gsfb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct wsemuldisplaydev_attach_args wa;
|
||||
|
||||
gsfb.attached = 1;
|
||||
if (!gsfb.is_console && gsfb_swinit() != 0)
|
||||
return;
|
||||
|
||||
printf("\n");
|
||||
|
||||
wa.console = gsfb.is_console;
|
||||
wa.scrdata = &_gsfb_screen_list;
|
||||
wa.accessops = &_gsfb_accessops;
|
||||
wa.accesscookie = &gsfb;
|
||||
|
||||
config_found(self, &wa, wsdisplaydevprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* console
|
||||
*/
|
||||
void
|
||||
gsfbcnprobe(struct consdev *cndev)
|
||||
{
|
||||
|
||||
cndev->cn_pri = CN_INTERNAL;
|
||||
}
|
||||
|
||||
void
|
||||
gsfbcninit(struct consdev *cndev)
|
||||
{
|
||||
paddr_t paddr = MIPS_KSEG0_TO_PHYS(gsfb_init_cmd_640x480);
|
||||
u_int32_t *buf = (void *)MIPS_PHYS_TO_KSEG1(paddr);
|
||||
long defattr = ATTR_BG_SET(WS_DEFAULT_BG) | ATTR_FG_SET(WS_DEFAULT_FG);
|
||||
|
||||
gsfb.is_console = 1;
|
||||
|
||||
gsfb_hwinit();
|
||||
gsfb_swinit();
|
||||
|
||||
/* Set the screen to the default background color at boot */
|
||||
buf[28] = gsfb_ansi_psmct32[ATTR_BG_GET(defattr)];
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_init_cmd_640x480);
|
||||
#ifdef GSFB_DEBUG_MONITOR
|
||||
{
|
||||
const struct _gsfb_debug_window *win;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
win = &_gsfb_debug_window[i];
|
||||
_gsfb_eraserows(0, win->start, win->nrow, win->attr);
|
||||
}
|
||||
}
|
||||
#endif /* GSFB_DEBUG_MONITOR */
|
||||
|
||||
wsdisplay_cnattach(&_gsfb_std_screen, &gsfb, 0, 0, defattr);
|
||||
}
|
||||
|
||||
void
|
||||
gsfb_hwinit(void)
|
||||
{
|
||||
/*
|
||||
gs_init(VESA_1A) hang up on SCPH-50000.
|
||||
use bootloader's setting.
|
||||
EN1 | CRTMOD | MMOD | AMOD | ALP(all 1.0)
|
||||
*/
|
||||
_reg_write_8(GS_S_PMODE_REG, 0xffa5);
|
||||
|
||||
dmac_init();
|
||||
|
||||
/* reset GIF channel DMA */
|
||||
_reg_write_4(D2_QWC_REG, 0);
|
||||
_reg_write_4(D2_MADR_REG, 0);
|
||||
_reg_write_4(D2_TADR_REG, 0);
|
||||
_reg_write_4(D2_CHCR_REG, 0);
|
||||
}
|
||||
|
||||
int
|
||||
gsfb_swinit(void)
|
||||
{
|
||||
int font;
|
||||
|
||||
wsfont_init();
|
||||
font = wsfont_find(NULL, 8, 16, 0, WSDISPLAY_FONTORDER_L2R,
|
||||
WSDISPLAY_FONTORDER_L2R);
|
||||
if (font < 0)
|
||||
return (1);
|
||||
|
||||
if (wsfont_lock(font, &gsfb.font))
|
||||
return (1);
|
||||
|
||||
gsfb.screen = &_gsfb_std_screen;
|
||||
gsfb.initialized = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* wsdisplay
|
||||
*/
|
||||
void
|
||||
_gsfb_cursor(void *cookie, int on, int row, int col)
|
||||
{
|
||||
paddr_t paddr = MIPS_KSEG0_TO_PHYS(gsfb_cursor_cmd);
|
||||
u_int32_t *buf = (void *)MIPS_PHYS_TO_KSEG1(paddr);
|
||||
struct wsdisplay_font *font = gsfb.font;
|
||||
|
||||
gsfb_set_cursor_pos(buf, col, row, font->fontwidth, font->fontheight);
|
||||
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_cursor_cmd);
|
||||
}
|
||||
|
||||
inline void
|
||||
gsfb_set_cursor_pos(u_int32_t *p, int x, int y, int w, int h)
|
||||
{
|
||||
|
||||
x *= w;
|
||||
y *= h;
|
||||
p[20] = ((x << 4) & 0xffff) | ((y << 20) & 0xffff0000);
|
||||
p[28] = (((x + w) << 4) & 0xffff) | (((y + h) << 20) & 0xffff0000);
|
||||
}
|
||||
|
||||
int
|
||||
_gsfb_mapchar(void *cookie, int c, unsigned int *cp)
|
||||
{
|
||||
struct wsdisplay_font *font = gsfb.font;
|
||||
|
||||
if (font->encoding != WSDISPLAY_FONTENC_ISO)
|
||||
if ((c = wsfont_map_unichar(font, c)) < 0)
|
||||
goto nomap;
|
||||
|
||||
if (c < font->firstchar || c >= font->firstchar + font->numchars)
|
||||
goto nomap;
|
||||
|
||||
*cp = c;
|
||||
return (5);
|
||||
|
||||
nomap:
|
||||
*cp = ' ';
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_putchar(void *cookie, int row, int col, u_int uc, long attr)
|
||||
{
|
||||
paddr_t paddr = MIPS_KSEG0_TO_PHYS(gsfb_load_cmd_8x16_psmct32);
|
||||
u_int32_t *buf = (void *)MIPS_PHYS_TO_KSEG1(paddr);
|
||||
struct wsdisplay_font *font = gsfb.font;
|
||||
|
||||
/* copy font data to DMA region */
|
||||
gsfb_font_expand_psmct32(font, uc, attr, &buf[FONT_SCRATCH_BASE]);
|
||||
|
||||
/* set destination position */
|
||||
TRXPOS_DXY(buf, col * font->fontwidth, row * font->fontheight);
|
||||
|
||||
/* kick to GIF */
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_load_cmd_8x16_psmct32);
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
|
||||
{
|
||||
paddr_t paddr = MIPS_KSEG0_TO_PHYS(gsfb_copy_cmd_8x16);
|
||||
u_int32_t *cmd = (void *)MIPS_PHYS_TO_KSEG1(paddr);
|
||||
int y = gsfb.font->fontheight * row;
|
||||
int w = gsfb.font->fontwidth;
|
||||
int i;
|
||||
|
||||
if (dstcol > srccol) {
|
||||
for (i = ncols - 1; i >= 0; i--) {
|
||||
TRXPOS_DXY_SXY(cmd, (dstcol + i) * w, y, (srccol + i) * w, y);
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_copy_cmd_8x16);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < ncols; i++) {
|
||||
TRXPOS_DXY_SXY(cmd, (dstcol + i) * w, y, (srccol + i) * w, y);
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_copy_cmd_8x16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_erasecols(void *cookie, int row, int startcol, int ncols, long attr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ncols; i++)
|
||||
_gsfb_putchar(cookie, row, startcol + i, ' ', attr);
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_copyrows(void *cookie, int src, int dst, int num)
|
||||
{
|
||||
paddr_t paddr = MIPS_KSEG0_TO_PHYS(gsfb_scroll_cmd_640x16);
|
||||
u_int32_t *cmd = (void *)MIPS_PHYS_TO_KSEG1(paddr);
|
||||
int i;
|
||||
int h = gsfb.font->fontheight;
|
||||
|
||||
if (dst > src) {
|
||||
for (i = num - 1; i >= 0; i--) {
|
||||
TRXPOS_SY_DY(cmd, (src + i) * h, (dst + i) * h);
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_scroll_cmd_640x16);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < num; i++) {
|
||||
TRXPOS_SY_DY(cmd, (src + i) * h, (dst + i) * h);
|
||||
gsfb_dma_kick(paddr, sizeof gsfb_scroll_cmd_640x16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_eraserows(void *cookie, int row, int nrow, long attr)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < nrow; j++)
|
||||
for (i = 0; i < gsfb.screen->ncols; i++)
|
||||
_gsfb_putchar(cookie, row + j, i, ' ', attr);
|
||||
}
|
||||
|
||||
int
|
||||
_gsfb_allocattr(void *cookie, int fg, int bg, int flags, long *attr)
|
||||
{
|
||||
|
||||
if ((flags & WSATTR_BLINK) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & WSATTR_WSCOLORS) == 0) {
|
||||
fg = WS_DEFAULT_FG;
|
||||
bg = WS_DEFAULT_BG;
|
||||
}
|
||||
|
||||
if ((flags & WSATTR_HILIT) != 0)
|
||||
fg += 8;
|
||||
|
||||
flags = (flags & WSATTR_UNDERLINE) ? 1 : 0;
|
||||
|
||||
|
||||
*attr = ATTR_BG_SET(bg) | ATTR_FG_SET(fg) | flags;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
_gsfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
|
||||
struct lwp *l)
|
||||
{
|
||||
|
||||
return (EPASSTHROUGH); /* Inappropriate ioctl for device */
|
||||
}
|
||||
|
||||
paddr_t
|
||||
_gsfb_mmap(void *v, void *vs, off_t offset, int prot)
|
||||
{
|
||||
|
||||
return (-1); /* can't mmap */
|
||||
}
|
||||
|
||||
int
|
||||
_gsfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
||||
int *curxp, int *curyp, long *attrp)
|
||||
{
|
||||
|
||||
*attrp = ATTR_BG_SET(WS_DEFAULT_BG) | ATTR_FG_SET(WS_DEFAULT_FG);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_free_screen(void *v, void *cookie)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
_gsfb_show_screen(void *v, void *cookie, int waitok,
|
||||
void (*cb)(void *, int, int), void *cbarg)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
_gsfb_pollc(void *v, int on)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* font expansion
|
||||
* PSMCT32 only
|
||||
*/
|
||||
void
|
||||
gsfb_font_expand_psmct32(const struct wsdisplay_font *font, u_int c, long attr,
|
||||
u_int32_t *buf)
|
||||
{
|
||||
u_int32_t fg, bg;
|
||||
u_int8_t *bitmap;
|
||||
int i, j;
|
||||
|
||||
KDASSERT(((u_int32_t)buf & 15) == 0);
|
||||
|
||||
fg = gsfb_ansi_psmct32[ATTR_FG_GET(attr)];
|
||||
bg = gsfb_ansi_psmct32[ATTR_BG_GET(attr)];
|
||||
|
||||
bitmap = (u_int8_t *)font->data + (c - font->firstchar) *
|
||||
font->fontheight * font->stride;
|
||||
for (i = 0; i < font->fontheight; i++, bitmap++) {
|
||||
u_int32_t b = *bitmap;
|
||||
for (j = 0; j < font->fontwidth; j++, b <<= 1)
|
||||
*buf++ = (b & 0x80) ? fg : bg;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gsfb_dma_kick(paddr_t addr, size_t size)
|
||||
{
|
||||
/* Wait for previous DMA request complete */
|
||||
while (_reg_read_4(D2_QWC_REG))
|
||||
;
|
||||
|
||||
/* Wait until GS FIFO empty */
|
||||
while ((_reg_read_8(GS_S_CSR_REG) & (3 << 14)) != (1 << 14))
|
||||
;
|
||||
|
||||
/* wait for DMA complete */
|
||||
dmac_bus_poll(D_CH2_GIF);
|
||||
|
||||
/* transfer addr */
|
||||
_reg_write_4(D2_MADR_REG, addr);
|
||||
/* transfer data size (unit qword) */
|
||||
_reg_write_4(D2_QWC_REG, bytetoqwc(size));
|
||||
|
||||
/* kick DMA (normal-mode) */
|
||||
dmac_chcr_write(D_CH2_GIF, D_CHCR_STR);
|
||||
}
|
||||
|
||||
#ifdef GSFB_DEBUG_MONITOR
|
||||
void
|
||||
__gsfb_print(int window, const char *fmt, ...)
|
||||
{
|
||||
const struct _gsfb_debug_window *win;
|
||||
int i, s, x, y, n, a;
|
||||
u_int c;
|
||||
va_list ap;
|
||||
|
||||
if (!gsfb.initialized)
|
||||
return;
|
||||
|
||||
s = _intr_suspend();
|
||||
win = &_gsfb_debug_window[window];
|
||||
x = 0;
|
||||
y = win->start;
|
||||
n = win->nrow * 80;
|
||||
a = win->attr;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(_gsfb_debug_buf, n, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
_gsfb_eraserows(0, y, win->nrow, a);
|
||||
|
||||
for (i = 0; i < n &&
|
||||
(c = (u_int)_gsfb_debug_buf[i] & 0x7f) != 0; i++) {
|
||||
if (c == '\n')
|
||||
x = 0, y++;
|
||||
else
|
||||
_gsfb_putchar(0, y, x++, c, a);
|
||||
}
|
||||
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
||||
void
|
||||
__gsfb_print_hex(int a0, int a1, int a2, int a3)
|
||||
{
|
||||
__gsfb_print(2, "a0=%08x a1=%08x a2=%08x a3=%08x",
|
||||
a0, a1, a2, a3);
|
||||
}
|
||||
#endif /* GSFB_DEBUG_MONITOR */
|
|
@ -0,0 +1,108 @@
|
|||
/* $NetBSD: gsreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define GS_S_PMODE_REG MIPS_PHYS_TO_KSEG1(0x12000000)
|
||||
#define GS_S_SMODE1_REG MIPS_PHYS_TO_KSEG1(0x12000010)
|
||||
#define GS_S_SMODE2_REG MIPS_PHYS_TO_KSEG1(0x12000020)
|
||||
#define GS_S_SRFSH_REG MIPS_PHYS_TO_KSEG1(0x12000030)
|
||||
#define GS_S_SYNCH1_REG MIPS_PHYS_TO_KSEG1(0x12000040)
|
||||
#define GS_S_SYNCH2_REG MIPS_PHYS_TO_KSEG1(0x12000050)
|
||||
#define GS_S_SYNCV_REG MIPS_PHYS_TO_KSEG1(0x12000060)
|
||||
#define GS_S_DISPFB1_REG MIPS_PHYS_TO_KSEG1(0x12000070)
|
||||
#define GS_S_DISPLAY1_REG MIPS_PHYS_TO_KSEG1(0x12000080)
|
||||
#define GS_S_DISPFB2_REG MIPS_PHYS_TO_KSEG1(0x12000090)
|
||||
#define GS_S_DISPLAY2_REG MIPS_PHYS_TO_KSEG1(0x120000a0)
|
||||
#define GS_S_EXTBUF_REG MIPS_PHYS_TO_KSEG1(0x120000b0)
|
||||
#define GS_S_EXTDATA_REG MIPS_PHYS_TO_KSEG1(0x120000c0)
|
||||
#define GS_S_EXTWRITE_REG MIPS_PHYS_TO_KSEG1(0x120000d0)
|
||||
#define GS_S_BGCOLOR_REG MIPS_PHYS_TO_KSEG1(0x120000e0)
|
||||
#define GS_S_CSR_REG MIPS_PHYS_TO_KSEG1(0x12001000)
|
||||
#define GS_S_IMR_REG MIPS_PHYS_TO_KSEG1(0x12001010)
|
||||
#define GS_S_BUSDIR_REG MIPS_PHYS_TO_KSEG1(0x12001040)
|
||||
#define GS_S_SIGLBLID_REG MIPS_PHYS_TO_KSEG1(0x12001080)
|
||||
|
||||
#define SMODE1(vhp, vcksel, slck2, nvck, clksel, pevs, pehs, pvs, phs, \
|
||||
gcont, spml, pck2, xpck, sint, prst, ex, cmod, slck, t1248, lc, rc) \
|
||||
(((u_int64_t)(vhp) << 36) | \
|
||||
((u_int64_t)(vcksel) << 34) | \
|
||||
((u_int64_t)(slck2) << 33) | \
|
||||
((u_int64_t)(nvck) << 32) | \
|
||||
((u_int64_t)(clksel) << 30) | \
|
||||
((u_int64_t)(pevs) << 29) | \
|
||||
((u_int64_t)(pehs) << 28) | \
|
||||
((u_int64_t)(pvs) << 27) | \
|
||||
((u_int64_t)(phs) << 26) | \
|
||||
((u_int64_t)(gcont) << 25) | \
|
||||
((u_int64_t)(spml) << 21) | \
|
||||
((u_int64_t)(pck2) << 19) | \
|
||||
((u_int64_t)(xpck) << 18) | \
|
||||
((u_int64_t)(sint) << 17) | \
|
||||
((u_int64_t)(prst) << 16) | \
|
||||
((u_int64_t)(ex) << 15) | \
|
||||
((u_int64_t)(cmod) << 13) | \
|
||||
((u_int64_t)(slck) << 12) | \
|
||||
((u_int64_t)(t1248) << 10) | \
|
||||
((u_int64_t)(lc) << 3) | \
|
||||
((u_int64_t)(rc) << 0))
|
||||
|
||||
#define SMODE2(dpms, ffmd, inter) \
|
||||
(((u_int64_t)(dpms) << 2) | \
|
||||
((u_int64_t)(ffmd) << 1) | \
|
||||
((u_int64_t)(inter) << 0))
|
||||
|
||||
#define SRFSH(x) (x)
|
||||
|
||||
#define SYNCH1(hs, hsvs, hseq, hbp, hfp) \
|
||||
(((u_int64_t)(hs) << 43) | \
|
||||
((u_int64_t)(hsvs) << 32) | \
|
||||
((u_int64_t)(hseq) << 22) | \
|
||||
((u_int64_t)(hbp) << 11) | \
|
||||
((u_int64_t)(hfp) << 0))
|
||||
|
||||
#define SYNCH2(hb, hf) \
|
||||
(((u_int64_t)(hb) << 11) | \
|
||||
((u_int64_t)(hf) << 0))
|
||||
|
||||
#define SYNCV(vs, vdp, vbpe, vbp, vfpe, vfp) \
|
||||
(((u_int64_t)(vs) << 53) | \
|
||||
((u_int64_t)(vdp) << 42) | \
|
||||
((u_int64_t)(vbpe) << 32) | \
|
||||
((u_int64_t)(vbp) << 20) | \
|
||||
((u_int64_t)(vfpe) << 10) | \
|
||||
((u_int64_t)(vfp) << 0))
|
||||
|
||||
#define DISPLAY(dh, dw, magv, magh, dy, dx) \
|
||||
(((u_int64_t)(dh) << 44) | \
|
||||
((u_int64_t)(dw) << 32) | \
|
||||
((u_int64_t)(magv) << 27) | \
|
||||
((u_int64_t)(magh) << 23) | \
|
||||
((u_int64_t)(dy) << 12) | \
|
||||
((u_int64_t)(dx) << 0))
|
|
@ -0,0 +1,44 @@
|
|||
/* $NetBSD: gsvar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum gs_crt_type {
|
||||
NTSC_NONINTER, /* NTSC Non-Interlace (640x240(224)) */
|
||||
NTSC_INTER, /* NTSC Interlace (640x480(448)) */
|
||||
PAL_NONINTER, /* PAL Non-Interlace (640x288(256)) */
|
||||
PAL_INTER, /* PAL Interlace (640x288(512)) */
|
||||
VESA_1A, /* 4 VESA 1A (640x480 59.940Hz) */
|
||||
};
|
||||
|
||||
void gs_init(enum gs_crt_type);
|
||||
#ifdef GSFB_DEBUG_MONITOR
|
||||
void __gsfb_print(int, const char *, ...);
|
||||
void __gsfb_print_hex(int, int, int, int);
|
||||
#endif
|
|
@ -0,0 +1,230 @@
|
|||
/* $NetBSD: intc.c,v 1.8 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: intc.c,v 1.8 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/intcvar.h>
|
||||
#include <playstation2/ee/intcreg.h>
|
||||
#include <playstation2/ee/gsvar.h> /* debug monitor */
|
||||
|
||||
#include <playstation2/playstation2/interrupt.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LEGAL_CHANNEL(x) ((x) >= 0 && (x) <= 15)
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
#define _INTC_NINTR 16
|
||||
|
||||
u_int32_t __intc_enabled_channel;
|
||||
|
||||
STATIC int __intc_initialized;
|
||||
STATIC struct _ipl_dispatcher __intc_dispatcher[_INTC_NINTR];
|
||||
STATIC struct _ipl_holder __intc_ipl_holder[_IPL_N];
|
||||
|
||||
STATIC SLIST_HEAD(, _ipl_dispatcher) __intc_dispatcher_head =
|
||||
SLIST_HEAD_INITIALIZER(__intc_dispatcher_head);
|
||||
|
||||
void
|
||||
intc_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (__intc_initialized++)
|
||||
return;
|
||||
|
||||
/* disable all channel */
|
||||
for (i = 0; i < _INTC_NINTR; i++)
|
||||
intc_intr_disable(i);
|
||||
|
||||
/* clear interrupts */
|
||||
_reg_write_4(I_STAT_REG, _reg_read_4(I_STAT_REG));
|
||||
|
||||
for (i = 0; i < _IPL_N; i++)
|
||||
__intc_ipl_holder[i].mask = 0xffffffff;
|
||||
}
|
||||
|
||||
int
|
||||
intc_intr(u_int32_t mask)
|
||||
{
|
||||
struct _ipl_dispatcher *dispatcher;
|
||||
u_int32_t r, dispatch, pending;
|
||||
|
||||
r = _reg_read_4(I_STAT_REG);
|
||||
dispatch = r & ~mask & __intc_enabled_channel;
|
||||
pending = r & mask & __intc_enabled_channel;
|
||||
|
||||
#if 0
|
||||
__gsfb_print(1,
|
||||
"INTC stat=%08x, mask=%08x, pend=%08x, disp=%08x enable=%08x\n",
|
||||
r, mask, pending, dispatch, __intc_enabled_channel);
|
||||
#endif
|
||||
if (dispatch == 0)
|
||||
return (pending == 0 ? 1 : 0);
|
||||
|
||||
/* clear interrupt */
|
||||
_reg_write_4(I_STAT_REG, dispatch);
|
||||
|
||||
/* dispatch interrupt handler */
|
||||
SLIST_FOREACH(dispatcher, &__intc_dispatcher_head, link) {
|
||||
if (dispatcher->bit & dispatch) {
|
||||
KDASSERT(dispatcher->func);
|
||||
(*dispatcher->func)(dispatcher->arg);
|
||||
dispatch &= ~dispatcher->bit;
|
||||
}
|
||||
}
|
||||
|
||||
/* disable spurious interrupt source */
|
||||
if (dispatch) {
|
||||
int i, bit;
|
||||
for (i = 0, bit = 1; i < _INTC_NINTR; i++, bit <<= 1) {
|
||||
if (bit & dispatch) {
|
||||
intc_intr_disable(i);
|
||||
printf("%s: spurious interrupt %d disabled.\n",
|
||||
__func__, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (pending == 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
void
|
||||
intc_intr_enable(enum intc_channel ch)
|
||||
{
|
||||
u_int32_t mask;
|
||||
|
||||
KDASSERT(LEGAL_CHANNEL(ch));
|
||||
mask = 1 << ch;
|
||||
_reg_write_4(I_MASK_REG, (_reg_read_4(I_MASK_REG) & mask) ^ mask);
|
||||
}
|
||||
|
||||
void
|
||||
intc_intr_disable(enum intc_channel ch)
|
||||
{
|
||||
|
||||
KDASSERT(LEGAL_CHANNEL(ch));
|
||||
_reg_write_4(I_MASK_REG, _reg_read_4(I_MASK_REG) & (1 << ch));
|
||||
}
|
||||
|
||||
void
|
||||
intc_update_mask(u_int32_t mask)
|
||||
{
|
||||
u_int32_t cur_mask;
|
||||
|
||||
cur_mask = _reg_read_4(I_MASK_REG);
|
||||
|
||||
_reg_write_4(I_MASK_REG, ((cur_mask ^ ~mask) | (cur_mask & mask)) &
|
||||
__intc_enabled_channel);
|
||||
}
|
||||
|
||||
void *
|
||||
intc_intr_establish(enum intc_channel ch, int ipl, int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct _ipl_dispatcher *dispatcher = &__intc_dispatcher[ch];
|
||||
struct _ipl_dispatcher *d;
|
||||
u_int32_t bit;
|
||||
int i, s;
|
||||
|
||||
KDASSERT(dispatcher->func == NULL);
|
||||
|
||||
s = _intr_suspend();
|
||||
dispatcher->func = func;
|
||||
dispatcher->arg = arg;
|
||||
dispatcher->ipl = ipl;
|
||||
dispatcher->channel = ch;
|
||||
dispatcher->bit = bit = (1 << ch);
|
||||
|
||||
for (i = 0; i < _IPL_N; i++)
|
||||
if (i < ipl)
|
||||
__intc_ipl_holder[i].mask &= ~bit;
|
||||
else
|
||||
__intc_ipl_holder[i].mask |= bit;
|
||||
|
||||
/* insert queue IPL order */
|
||||
if (SLIST_EMPTY(&__intc_dispatcher_head)) {
|
||||
SLIST_INSERT_HEAD(&__intc_dispatcher_head, dispatcher, link);
|
||||
} else {
|
||||
SLIST_FOREACH(d, &__intc_dispatcher_head, link) {
|
||||
if (SLIST_NEXT(d, link) == 0 ||
|
||||
SLIST_NEXT(d, link)->ipl < ipl) {
|
||||
SLIST_INSERT_AFTER(d, dispatcher, link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
md_ipl_register(IPL_INTC, __intc_ipl_holder);
|
||||
|
||||
intc_intr_enable(ch);
|
||||
__intc_enabled_channel |= bit;
|
||||
|
||||
_intr_resume(s);
|
||||
|
||||
return ((void *)ch);
|
||||
}
|
||||
|
||||
void
|
||||
intc_intr_disestablish(void *handle)
|
||||
{
|
||||
int ch = (int)(handle);
|
||||
struct _ipl_dispatcher *dispatcher = &__intc_dispatcher[ch];
|
||||
u_int32_t bit;
|
||||
int i, s;
|
||||
|
||||
s = _intr_suspend();
|
||||
|
||||
intc_intr_disable(ch);
|
||||
dispatcher->func = NULL;
|
||||
|
||||
SLIST_REMOVE(&__intc_dispatcher_head, dispatcher,
|
||||
_ipl_dispatcher, link);
|
||||
|
||||
bit = dispatcher->bit;
|
||||
for (i = 0; i < _IPL_N; i++)
|
||||
__intc_ipl_holder[i].mask |= bit;
|
||||
|
||||
md_ipl_register(IPL_INTC, __intc_ipl_holder);
|
||||
__intc_enabled_channel &= ~bit;
|
||||
|
||||
_intr_resume(s);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* $NetBSD: intcreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define I_STAT_REG MIPS_PHYS_TO_KSEG1(0x1000f000)
|
||||
#define I_MASK_REG MIPS_PHYS_TO_KSEG1(0x1000f010)
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/* $NetBSD: intcvar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* DO NOT REORDER */
|
||||
enum intc_channel {
|
||||
I_CH0_GS = 0,
|
||||
I_CH1_SBUS,
|
||||
I_CH2_VB_ON,
|
||||
I_CH3_VB_OFF,
|
||||
I_CH4_VIF0,
|
||||
I_CH5_VIF1,
|
||||
I_CH6_VU0,
|
||||
I_CH7_VU1,
|
||||
I_CH8_IPU,
|
||||
I_CH9_TIMER0,
|
||||
I_CH10_TIMER1,
|
||||
I_CH11_TIMER2,
|
||||
I_CH12_TIMER3,
|
||||
I_CH13_SFIFO,
|
||||
I_CH14_VU0WD,
|
||||
I_CH15_PGPU
|
||||
};
|
||||
|
||||
extern u_int32_t __intc_enabled_channel;
|
||||
|
||||
void intc_init(void);
|
||||
|
||||
int intc_intr(u_int32_t);
|
||||
|
||||
void *intc_intr_establish(enum intc_channel, int, int (*)(void *), void *);
|
||||
void intc_intr_disestablish(void *);
|
||||
|
||||
void intc_intr_disable(enum intc_channel);
|
||||
void intc_intr_enable(enum intc_channel);
|
||||
void intc_update_mask(u_int32_t);
|
|
@ -0,0 +1,142 @@
|
|||
/* $NetBSD: sif.c,v 1.10 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: sif.c,v 1.10 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <playstation2/playstation2/sifbios.h>
|
||||
#include <playstation2/ee/dmacvar.h>
|
||||
#include <playstation2/ee/sifvar.h>
|
||||
|
||||
#ifdef SIF_DEBUG
|
||||
int __spd_total_alloc;
|
||||
int sif_debug = 1;
|
||||
#define DPRINTF(fmt, args...) \
|
||||
if (sif_debug) \
|
||||
printf("%s: " fmt, __func__ , ##args)
|
||||
#define DPRINTFN(n, arg) \
|
||||
if (sif_debug > (n)) \
|
||||
n printf("%s: " fmt, __func__ , ##args)
|
||||
#else
|
||||
#define DPRINTF(arg...) ((void)0)
|
||||
#define DPRINTFN(n, arg...) ((void)0)
|
||||
#endif
|
||||
|
||||
#define ROUND64(x) ((((u_int32_t)(x)) + 63) & ~64)
|
||||
#define BCD_TO_DECIMAL(x) \
|
||||
({ \
|
||||
typeof(x) x_ = x; \
|
||||
(((x_) >> 4) * 10 + ((x_) & 0xf)); \
|
||||
})
|
||||
#define MAJOR(x) BCD_TO_DECIMAL(((x) >> 8) & 0xff)
|
||||
#define MINOR(x) BCD_TO_DECIMAL((x) & 0xff)
|
||||
|
||||
void
|
||||
sif_init(void)
|
||||
{
|
||||
u_int32_t vers;
|
||||
|
||||
vers = sifbios_getver();
|
||||
printf("PlayStation 2 SIF BIOS version %d.%d\n",
|
||||
MAJOR(vers), MINOR(vers));
|
||||
|
||||
/* Initialize SIF */
|
||||
if (sifdma_init() < 0)
|
||||
panic("SIFDMA");
|
||||
if (sifcmd_init() < 0)
|
||||
panic("SIFCMD");
|
||||
dmac_intr_establish(D_CH5_SIF0, IPL_TTY, sifcmd_intr, 0);
|
||||
if (sifrpc_init() < 0)
|
||||
panic("SIFRPC");
|
||||
if (iopmem_init() < 0)
|
||||
panic("IOP Memory");
|
||||
}
|
||||
|
||||
void
|
||||
sif_exit(void)
|
||||
{
|
||||
|
||||
sifrpc_exit();
|
||||
sifcmd_exit();
|
||||
dmac_intr_disestablish((void *)D_CH5_SIF0);
|
||||
sifdma_exit();
|
||||
}
|
||||
|
||||
int
|
||||
iopdma_allocate_buffer(struct iopdma_segment *seg, size_t size)
|
||||
{
|
||||
/*
|
||||
* To avoid cache inconsistecy as the result of DMA(to memory),
|
||||
* DMA buffer size is setted to multiple of CPU cache line size (64B)
|
||||
* and aligned to cache line.
|
||||
*/
|
||||
seg->size = ROUND64(size);
|
||||
|
||||
seg->iop_paddr = iopmem_alloc(seg->size);
|
||||
|
||||
if (seg->iop_paddr == 0) {
|
||||
printf("%s: can't allocate IOP memory.\n", __func__);
|
||||
DPRINTF("request = %d byte, current total = %#x\n",
|
||||
size, __spd_total_alloc);
|
||||
return (1);
|
||||
}
|
||||
|
||||
seg->ee_vaddr = IOPPHYS_TO_EEKV(seg->iop_paddr);
|
||||
|
||||
#ifdef SIF_DEBUG
|
||||
__spd_total_alloc += size;
|
||||
#endif
|
||||
DPRINTF("0x%08lx+%#x (total=%#x)\n", seg->iop_paddr, size,
|
||||
__spd_total_alloc);
|
||||
|
||||
KDASSERT((seg->ee_vaddr & 63) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
iopdma_free_buffer(struct iopdma_segment *seg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = iopmem_free(seg->iop_paddr);
|
||||
#ifdef SIF_DEBUG
|
||||
__spd_total_alloc -= seg->size;
|
||||
#endif
|
||||
DPRINTF("0x%08lx (total=%#x, result=%d)\n", seg->iop_paddr,
|
||||
__spd_total_alloc, ret);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* $NetBSD: sifvar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct iopdma_segment {
|
||||
size_t size;
|
||||
paddr_t iop_paddr;
|
||||
vaddr_t ee_vaddr;
|
||||
};
|
||||
|
||||
void sif_init(void);
|
||||
void sif_exit(void);
|
||||
|
||||
/* IOP DMA */
|
||||
int iopdma_allocate_buffer(struct iopdma_segment *, size_t size);
|
||||
void iopdma_free_buffer(struct iopdma_segment *);
|
|
@ -0,0 +1,149 @@
|
|||
/* $NetBSD: timer.c,v 1.8 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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: timer.c,v 1.8 2014/03/31 11:25:49 martin Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <playstation2/playstation2/interrupt.h>
|
||||
|
||||
#include <playstation2/ee/eevar.h>
|
||||
#include <playstation2/ee/intcvar.h>
|
||||
#include <playstation2/ee/timervar.h>
|
||||
#include <playstation2/ee/timerreg.h>
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define STATIC
|
||||
#else
|
||||
#define STATIC static
|
||||
#endif
|
||||
|
||||
STATIC int timer0_intr(void *);
|
||||
|
||||
/*
|
||||
* EE timer usage
|
||||
* 0 ... 100 Hz clock interrupt.
|
||||
* 1 ... one shot interrupt for software interrupt for IPL_SOFT
|
||||
* 2 ... for IPL_SOFTCLOCK
|
||||
* 3 ... for IPL_SOFTNET, IPL_SOFTSERIAL
|
||||
*/
|
||||
|
||||
void
|
||||
timer_init(void)
|
||||
{
|
||||
|
||||
_reg_write_4(T0_MODE_REG, (T_MODE_EQUF | T_MODE_OVFF));
|
||||
_reg_write_4(T1_MODE_REG, (T_MODE_EQUF | T_MODE_OVFF));
|
||||
_reg_write_4(T2_MODE_REG, (T_MODE_EQUF | T_MODE_OVFF));
|
||||
_reg_write_4(T3_MODE_REG, (T_MODE_EQUF | T_MODE_OVFF));
|
||||
}
|
||||
|
||||
void
|
||||
timer_clock_init(void)
|
||||
{
|
||||
/* clock interrupt (296.912MHz / 2 / 256) * 5760 = 100Hz */
|
||||
intc_intr_establish(I_CH9_TIMER0, IPL_CLOCK, timer0_intr, 0);
|
||||
_reg_write_4(T0_COUNT_REG, 0);
|
||||
_reg_write_4(T0_COMP_REG, 5760);
|
||||
_reg_write_4(T0_MODE_REG, T_MODE_CLKS_BUSCLK256 | T_MODE_ZRET |
|
||||
T_MODE_CUE | T_MODE_CMPE);
|
||||
}
|
||||
|
||||
void
|
||||
timer_one_shot(int timer)
|
||||
{
|
||||
KDASSERT(LEGAL_TIMER(timer) && timer != 0);
|
||||
|
||||
_reg_write_4(T_COUNT_REG(timer), 0);
|
||||
_reg_write_4(T_COMP_REG(timer), 1);
|
||||
_reg_write_4(T_MODE_REG(timer), T_MODE_CUE | T_MODE_CMPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* interrupt handler for clock interrupt (100Hz)
|
||||
*/
|
||||
int
|
||||
timer0_intr(void *arg)
|
||||
{
|
||||
|
||||
_reg_write_4(T0_MODE_REG, _reg_read_4(T0_MODE_REG) | T_MODE_EQUF);
|
||||
|
||||
_playstation2_evcnt.clock.ev_count++;
|
||||
|
||||
hardclock(&playstation2_clockframe);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* one shot timer interrupt for software interrupt */
|
||||
int
|
||||
timer1_intr(void *arg)
|
||||
{
|
||||
|
||||
_reg_write_4(T1_MODE_REG, T_MODE_EQUF | T_MODE_OVFF);
|
||||
|
||||
#ifdef __HAVE_FAST_SOFTINTS
|
||||
softintr_dispatch(0); /* IPL_SOFT */
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
timer2_intr(void *arg)
|
||||
{
|
||||
|
||||
_reg_write_4(T2_MODE_REG, T_MODE_EQUF | T_MODE_OVFF);
|
||||
|
||||
#ifdef __HAVE_FAST_SOFTINTS
|
||||
softintr_dispatch(1); /* IPL_SOFTCLOCK */
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
timer3_intr(void *arg)
|
||||
{
|
||||
|
||||
_reg_write_4(T3_MODE_REG, T_MODE_EQUF | T_MODE_OVFF);
|
||||
|
||||
#ifdef __HAVE_FAST_SOFTINTS
|
||||
softintr_dispatch(3); /* IPL_SOFTSERIAL */
|
||||
softintr_dispatch(2); /* IPL_SOFTNET */
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
/* $NetBSD: timerreg.h,v 1.8 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 16bit timer 0:3
|
||||
* source: BUSCLK, H-BLNK
|
||||
*/
|
||||
|
||||
#define EE_TIMER_MIN 0
|
||||
#define EE_TIMER_MAX 3
|
||||
#define LEGAL_TIMER(x) \
|
||||
(((x) >= EE_TIMER_MIN) && ((x) <= EE_TIMER_MAX))
|
||||
|
||||
/* Register address. all registers are 32bit wide */
|
||||
#define TIMER_REGBASE 0x10000000
|
||||
#define TIMER_REGSIZE 0x2000
|
||||
#define TIMER_OFS 0x800
|
||||
|
||||
#define T_COUNT_REG(x) MIPS_PHYS_TO_KSEG1((TIMER_REGBASE + TIMER_OFS * (x)))
|
||||
#define T_MODE_REG(x) MIPS_PHYS_TO_KSEG1((TIMER_REGBASE + \
|
||||
TIMER_OFS * (x) + 0x10))
|
||||
#define T_COMP_REG(x) MIPS_PHYS_TO_KSEG1((TIMER_REGBASE + \
|
||||
TIMER_OFS * (x) + 0x20))
|
||||
/*
|
||||
* timer0, timer1 have `hold register'.
|
||||
* (save T_COUNT when SBUS interrupt occurred)
|
||||
*/
|
||||
#define T_HOLD_REG(x) (TIMER_REGBASE + TIMER_OFS * (x) + 0x30)
|
||||
|
||||
#define T0_COUNT_REG MIPS_PHYS_TO_KSEG1(0x10000000)
|
||||
#define T0_MODE_REG MIPS_PHYS_TO_KSEG1(0x10000010)
|
||||
#define T0_COMP_REG MIPS_PHYS_TO_KSEG1(0x10000020)
|
||||
#define T0_HOLD_REG MIPS_PHYS_TO_KSEG1(0x10000030)
|
||||
#define T1_COUNT_REG MIPS_PHYS_TO_KSEG1(0x10000800)
|
||||
#define T1_MODE_REG MIPS_PHYS_TO_KSEG1(0x10000810)
|
||||
#define T1_COMP_REG MIPS_PHYS_TO_KSEG1(0x10000820)
|
||||
#define T1_HOLD_REG MIPS_PHYS_TO_KSEG1(0x10000830)
|
||||
#define T2_COUNT_REG MIPS_PHYS_TO_KSEG1(0x10001000)
|
||||
#define T2_MODE_REG MIPS_PHYS_TO_KSEG1(0x10001010)
|
||||
#define T2_COMP_REG MIPS_PHYS_TO_KSEG1(0x10001020)
|
||||
#define T3_COUNT_REG MIPS_PHYS_TO_KSEG1(0x10001800)
|
||||
#define T3_MODE_REG MIPS_PHYS_TO_KSEG1(0x10001810)
|
||||
#define T3_COMP_REG MIPS_PHYS_TO_KSEG1(0x10001820)
|
||||
|
||||
/*
|
||||
* Tn_MODE: mode, status register.
|
||||
*/
|
||||
#define T_MODE_CLKS_MASK 0x3
|
||||
#define T_MODE_CLKS(x) ((x) & T_MODE_CLKS_MASK)
|
||||
#define T_MODE_CLKS_CLR(x) ((x) & ~T_MODE_CLKS_MASK)
|
||||
|
||||
#define T_MODE_CLKS_BUSCLK1 0 /* 150 MHz */
|
||||
#define T_MODE_CLKS_BUSCLK16 1 /* 150 / 16 */
|
||||
#define T_MODE_CLKS_BUSCLK256 2 /* 150 / 256 */
|
||||
#define T_MODE_CLKS_HBLNK 3 /* H-Blank */
|
||||
|
||||
/* Gate Function Enabled */
|
||||
#define T_MODE_GATE 0x00000004
|
||||
/* Gate Selection */
|
||||
#define T_MODE_GATS_VBLNK 0x00000008
|
||||
/* Gate Mode */
|
||||
#define T_MODE_GATM_MASK 0x3
|
||||
#define T_MODE_GATM_SHIFT 4
|
||||
#define T_MODE_GATM(x) (((x) >> T_MODE_GATM_SHIFT) & T_MODE_GATM_MASK)
|
||||
#define T_MODE_GATM_CLR(x) \
|
||||
((x) & ~(T_MODE_GATM_MASK << T_MODE_GATM_SHIFT))
|
||||
#define T_MODE_GATM_SET(x, val) \
|
||||
((x) | (((val) << T_MODE_GATM_SHIFT) & \
|
||||
(T_MODE_GATM_MASK << T_MODE_GATM_SHIFT)))
|
||||
#define T_MODE_GATM_LOW 0x0
|
||||
#define T_MODE_GATM_POSEDGE 0x1
|
||||
#define T_MODE_GATM_NEGEDGE 0x2
|
||||
#define T_MODE_GATM_EDGE 0x3
|
||||
|
||||
/* Zero Return */
|
||||
#define T_MODE_ZRET 0x00000040
|
||||
/* Count Up Enable */
|
||||
#define T_MODE_CUE 0x00000080
|
||||
/* Compare-Interrupt Enable */
|
||||
#define T_MODE_CMPE 0x00000100
|
||||
/* Overflow-Interrupt Enable */
|
||||
#define T_MODE_OVFE 0x00000200
|
||||
/* Equal Flag (write clear) */
|
||||
#define T_MODE_EQUF 0x00000400
|
||||
/* Overflow Flag (write clear) */
|
||||
#define T_MODE_OVFF 0x00000800
|
||||
|
||||
/*
|
||||
* Tn_COUNT: counter register
|
||||
*/
|
||||
#define T_COUNT_MASK 0x0000ffff
|
||||
#define T_COUNT(x) ((x) & T_COUNT_MASK)
|
||||
|
||||
/*
|
||||
* Tn_COMP: compare register
|
||||
*/
|
||||
#define T_COMP_MASK 0x0000ffff
|
||||
#define T_COMP(x) ((x) & T_COMP_MASK)
|
||||
|
||||
/*
|
||||
* Tn_HOLD: hold register
|
||||
*/
|
||||
#define T_HOLD_MASK 0x0000ffff
|
||||
#define T_HOLD(x) ((x) & T_HOLD_MASK)
|
|
@ -0,0 +1,37 @@
|
|||
/* $NetBSD: timervar.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by UCHIYAMA Yasushi.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void timer_init(void);
|
||||
void timer_clock_init(void);
|
||||
int timer1_intr(void *);
|
||||
int timer2_intr(void *);
|
||||
int timer3_intr(void *);
|
||||
void timer_one_shot(int);
|
|
@ -0,0 +1,24 @@
|
|||
# $NetBSD: Makefile,v 1.11 2014/03/31 11:25:49 martin Exp $
|
||||
|
||||
INCSDIR= /usr/include/playstation2
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h \
|
||||
bswap.h \
|
||||
cdefs.h cpu.h \
|
||||
disklabel.h \
|
||||
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
|
||||
float.h \
|
||||
ieee.h ieeefp.h \
|
||||
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
|
||||
intr.h \
|
||||
kcore.h kdbparam.h \
|
||||
limits.h lock.h locore.h \
|
||||
math.h mcontext.h mips_opcode.h mutex.h \
|
||||
param.h pcb.h pmap.h pmc.h proc.h profile.h psl.h pte.h ptrace.h \
|
||||
reg.h regdef.h regnum.h reloc.h rwlock.h \
|
||||
setjmp.h signal.h stdarg.h \
|
||||
trap.h types.h \
|
||||
varargs.h vmparam.h \
|
||||
wchar_limits.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ansi.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/ansi.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: aout_machdep.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/aout_machdep.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: asm.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/asm.h>
|
|
@ -0,0 +1,31 @@
|
|||
/* $NetBSD: autoconf.h,v 1.4 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct mainbus_attach_args {
|
||||
const char *ma_name; /* device name */
|
||||
};
|
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: bootinfo.h,v 1.5 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define PS2_MEMORY_SIZE (32 * 1024 * 1024)
|
||||
|
||||
#define BOOTINFO_BLOCK_SIZE 0x1000
|
||||
#define BOOTINFO_BLOCK_BASE (PS2_MEMORY_SIZE - BOOTINFO_BLOCK_SIZE)
|
||||
|
||||
#define BOOTINFO_DEVCONF 0x00
|
||||
#define BOOTINFO_DEVCONF_SPD_PRESENT 0x100
|
||||
|
||||
#define BOOTINFO_OPTION_PTR 0x04
|
||||
#define BOOTINFO_RTC 0x10
|
||||
#define BOOTINFO_PCMCIA_TYPE 0x1c
|
||||
#define BOOTINFO_SYSCONF 0x20
|
||||
|
||||
#define BOOTINFO_REF(x) \
|
||||
(*(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(BOOTINFO_BLOCK_BASE + (x)))
|
||||
|
||||
struct bootinfo_rtc {
|
||||
u_int8_t __reserved1;
|
||||
u_int8_t sec;
|
||||
u_int8_t min;
|
||||
u_int8_t hour;
|
||||
u_int8_t __reserved2;
|
||||
u_int8_t day;
|
||||
u_int8_t mon;
|
||||
u_int8_t year;
|
||||
} __attribute__((__packed__));
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: bswap.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/bswap.h>
|
|
@ -0,0 +1,902 @@
|
|||
/* $NetBSD: bus.h,v 1.14 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYSTATION2_BUS_H_
|
||||
#define _PLAYSTATION2_BUS_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Turn on BUS_SPACE_DEBUG if the global DEBUG option is enabled.
|
||||
*/
|
||||
#if defined(DEBUG) && !defined(BUS_SPACE_DEBUG)
|
||||
#define BUS_SPACE_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef BUS_SPACE_DEBUG
|
||||
#include <sys/systm.h> /* for printf() prototype */
|
||||
/*
|
||||
* Macros for checking the aligned-ness of pointers passed to bus
|
||||
* space ops. Strict alignment is required by the MIPS architecture,
|
||||
* and a trap will occur if unaligned access is performed. These
|
||||
* may aid in the debugging of a broken device driver by displaying
|
||||
* useful information about the problem.
|
||||
*/
|
||||
#define __BUS_SPACE_ALIGNED_ADDRESS(p, t) \
|
||||
((((u_int32_t)(p)) & (sizeof(t)-1)) == 0)
|
||||
|
||||
#define __BUS_SPACE_ADDRESS_SANITY(p, t, d) \
|
||||
({ \
|
||||
if (__BUS_SPACE_ALIGNED_ADDRESS((p), t) == 0) { \
|
||||
printf("%s 0x%x not aligned to %u bytes %s:%d\n", \
|
||||
d, (u_int32_t)(p), (u_int32_t)sizeof(t), __FILE__, \
|
||||
__LINE__); \
|
||||
} \
|
||||
(void) 0; \
|
||||
})
|
||||
|
||||
#define BUS_SPACE_ALIGNED_POINTER(p, t) __BUS_SPACE_ALIGNED_ADDRESS(p, t)
|
||||
#else
|
||||
#define __BUS_SPACE_ADDRESS_SANITY(p, t, d) (void) 0
|
||||
#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
|
||||
#endif /* BUS_SPACE_DEBUG */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Addresses (in bus space).
|
||||
*/
|
||||
typedef long bus_addr_t;
|
||||
typedef long bus_size_t;
|
||||
|
||||
/*
|
||||
* Access methods for bus space.
|
||||
*/
|
||||
typedef const struct playstation2_bus_space *bus_space_tag_t;
|
||||
typedef bus_addr_t bus_space_handle_t;
|
||||
|
||||
struct extent; /* forward declaration */
|
||||
|
||||
struct playstation2_bus_space {
|
||||
struct extent *pbs_extent;
|
||||
bus_addr_t pbs_base_addr;
|
||||
|
||||
/* cookie */
|
||||
void *pbs_cookie;
|
||||
|
||||
/* mapping/unmapping */
|
||||
int (*pbs_map)(void *, bus_addr_t, bus_size_t,
|
||||
int, bus_space_handle_t *);
|
||||
void (*pbs_unmap)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
int (*pbs_subregion)(void *, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, bus_space_handle_t *);
|
||||
|
||||
/* allocation/deallocation */
|
||||
int (*pbs_alloc)(void *, bus_addr_t, bus_addr_t,
|
||||
bus_size_t, bus_size_t, bus_size_t, int,
|
||||
bus_addr_t *, bus_space_handle_t *);
|
||||
void (*pbs_free)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
|
||||
/* get kernel virtual address */
|
||||
void * (*pbs_vaddr)(void *, bus_space_handle_t);
|
||||
|
||||
/* read (single) */
|
||||
u_int8_t (*pbs_r_1)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
u_int16_t (*pbs_r_2)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
u_int32_t (*pbs_r_4)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
u_int64_t (*pbs_r_8)(void *, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
|
||||
/* read multiple */
|
||||
void (*pbs_rm_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t *, bus_size_t);
|
||||
void (*pbs_rm_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t *, bus_size_t);
|
||||
void (*pbs_rm_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*pbs_rm_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
|
||||
/* read region */
|
||||
void (*pbs_rr_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t *, bus_size_t);
|
||||
void (*pbs_rr_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t *, bus_size_t);
|
||||
void (*pbs_rr_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*pbs_rr_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
|
||||
/* write (single) */
|
||||
void (*pbs_w_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t);
|
||||
void (*pbs_w_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t);
|
||||
void (*pbs_w_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t);
|
||||
void (*pbs_w_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t);
|
||||
|
||||
/* write multiple */
|
||||
void (*pbs_wm_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*pbs_wm_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*pbs_wm_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*pbs_wm_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
|
||||
/* write region */
|
||||
void (*pbs_wr_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*pbs_wr_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*pbs_wr_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*pbs_wr_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
|
||||
/* set multiple */
|
||||
void (*pbs_sm_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t, bus_size_t);
|
||||
void (*pbs_sm_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t, bus_size_t);
|
||||
void (*pbs_sm_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t, bus_size_t);
|
||||
void (*pbs_sm_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t, bus_size_t);
|
||||
|
||||
/* set region */
|
||||
void (*pbs_sr_1)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t, bus_size_t);
|
||||
void (*pbs_sr_2)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t, bus_size_t);
|
||||
void (*pbs_sr_4)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t, bus_size_t);
|
||||
void (*pbs_sr_8)(void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t, bus_size_t);
|
||||
|
||||
/* copy */
|
||||
void (*pbs_c_1)(void *, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*pbs_c_2)(void *, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*pbs_c_4)(void *, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*pbs_c_8)(void *, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define _wbflush() __asm volatile("sync.l")
|
||||
#ifdef _PLAYSTATION2_BUS_SPACE_PRIVATE
|
||||
|
||||
#ifndef __read_1
|
||||
#define __read_1(a) (*(volatile u_int8_t *)(a))
|
||||
#endif
|
||||
#ifndef __read_2
|
||||
#define __read_2(a) (*(volatile u_int16_t *)(a))
|
||||
#endif
|
||||
#ifndef __read_4
|
||||
#define __read_4(a) (*(volatile u_int32_t *)(a))
|
||||
#endif
|
||||
#ifndef __read_8
|
||||
#define __read_8(a) \
|
||||
({ \
|
||||
u_int32_t lo, hi; \
|
||||
__asm volatile( \
|
||||
".set noreorder;" \
|
||||
".set push;" \
|
||||
".set mips3;" \
|
||||
"ld $8, (%2);" \
|
||||
"dsra %1, $8, 32;" \
|
||||
"dsll %0, $8, 32;" \
|
||||
"dsra %0, %0, 32;" \
|
||||
".set pop;" \
|
||||
".set reorder;" \
|
||||
: "=r"(lo), "=r"(hi) : "r"(a) : "$8"); \
|
||||
((u_int64_t)hi << 32) | lo; \
|
||||
})
|
||||
#endif
|
||||
#define __read_16(a) "error. not yet"
|
||||
|
||||
#ifndef __write_1
|
||||
#define __write_1(a, v) { \
|
||||
*(volatile u_int8_t *)(a) = (v); \
|
||||
_wbflush(); \
|
||||
}
|
||||
#endif
|
||||
#ifndef __write_2
|
||||
#define __write_2(a, v) { \
|
||||
*(volatile u_int16_t *)(a) = (v); \
|
||||
_wbflush(); \
|
||||
}
|
||||
#endif
|
||||
#ifndef __write_4
|
||||
#define __write_4(a, v) { \
|
||||
*(volatile u_int32_t *)(a) = (v); \
|
||||
_wbflush(); \
|
||||
}
|
||||
#endif
|
||||
#ifdef EE_GCC
|
||||
#ifndef __write_8
|
||||
#define __write_8(a, v) (*(volatile u_int64_t *)(a) = (v)) { \
|
||||
_wbflush(); \
|
||||
}
|
||||
#endif
|
||||
#ifndef __write_16
|
||||
#define __write_16(a, v) (*(volatile u_int128_t *)(a) = (v)) { \
|
||||
_wbflush(); \
|
||||
}
|
||||
#endif
|
||||
#else /* EE_GCC */
|
||||
#ifdef __write_8
|
||||
#error "can't override __write_8"
|
||||
#endif
|
||||
static __inline void
|
||||
__write_8(bus_addr_t a, u_int64_t v)
|
||||
{
|
||||
__asm volatile(
|
||||
".set noreorder;"
|
||||
".set push;"
|
||||
".set r5900;"
|
||||
"pextlw $8, %0, %1;"
|
||||
"sd $8, 0(%2);"
|
||||
"sync.l;"
|
||||
".set pop;"
|
||||
".set reorder;"
|
||||
: : "r"((u_int32_t)((u_int64_t)(v) >> 32)),
|
||||
"r"((u_int32_t)(v)), "r"((u_int32_t)(a)) : "$8");
|
||||
}
|
||||
#define _write_16(a) "error. not yet"
|
||||
#endif /* EE_GCC */
|
||||
|
||||
#define __TYPENAME(BITS) u_int##BITS##_t
|
||||
|
||||
#define _BUS_SPACE_READ(PREFIX, BYTES, BITS) \
|
||||
static __TYPENAME(BITS) \
|
||||
PREFIX##_read_##BYTES(void *, bus_space_handle_t, bus_size_t); \
|
||||
static __TYPENAME(BITS) \
|
||||
PREFIX##_read_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset) \
|
||||
{ \
|
||||
return __read_##BYTES(VADDR(bsh, offset)); \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_READ_MULTI(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_read_multi_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
__TYPENAME(BITS) *, bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_read_multi_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, __TYPENAME(BITS) *addr, bus_size_t count) \
|
||||
{ \
|
||||
bus_addr_t a = VADDR(bsh, offset); \
|
||||
while (count--) \
|
||||
*addr++ = __read_##BYTES(a); \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_READ_REGION(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_read_region_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
__TYPENAME(BITS) *, bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_read_region_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, __TYPENAME(BITS) *addr, bus_size_t count) \
|
||||
{ \
|
||||
while (count--) { \
|
||||
*addr++ = __read_##BYTES(VADDR(bsh, offset)); \
|
||||
offset += BYTES; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_WRITE(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_write_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
__TYPENAME(BITS)); \
|
||||
static void \
|
||||
PREFIX##_write_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, __TYPENAME(BITS) value) \
|
||||
{ \
|
||||
__write_##BYTES(VADDR(bsh, offset), value); \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_WRITE_MULTI(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_write_multi_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
const __TYPENAME(BITS) *, bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_write_multi_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const __TYPENAME(BITS) *addr, bus_size_t count) \
|
||||
{ \
|
||||
bus_addr_t a = VADDR(bsh, offset); \
|
||||
while (count--) { \
|
||||
__write_##BYTES(a, *addr++); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_WRITE_REGION(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_write_region_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
const __TYPENAME(BITS) *, bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_write_region_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const __TYPENAME(BITS) *addr, bus_size_t count) \
|
||||
{ \
|
||||
while (count--) { \
|
||||
__write_##BYTES(VADDR(bsh, offset), *addr++); \
|
||||
offset += BYTES; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_SET_MULTI(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_set_multi_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
__TYPENAME(BITS), bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_set_multi_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, __TYPENAME(BITS) value, bus_size_t count) \
|
||||
{ \
|
||||
bus_addr_t a = VADDR(bsh, offset); \
|
||||
while (count--) { \
|
||||
__write_##BYTES(a, value); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_SET_REGION(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_set_region_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
__TYPENAME(BITS), bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_set_region_##BYTES(void *tag, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, __TYPENAME(BITS) value, bus_size_t count) \
|
||||
{ \
|
||||
while (count--) { \
|
||||
__write_##BYTES(VADDR(bsh, offset), value); \
|
||||
offset += BYTES; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_COPY_REGION(PREFIX, BYTES, BITS) \
|
||||
static void \
|
||||
PREFIX##_copy_region_##BYTES(void *, bus_space_handle_t, bus_size_t, \
|
||||
bus_space_handle_t, bus_size_t, bus_size_t); \
|
||||
static void \
|
||||
PREFIX##_copy_region_##BYTES(void *t, bus_space_handle_t h1, \
|
||||
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) \
|
||||
{ \
|
||||
bus_size_t o; \
|
||||
if ((h1 + o1) >= (h2 + o2)) { \
|
||||
/* src after dest: copy forward */ \
|
||||
for (o = 0; c != 0; c--, o += BYTES) \
|
||||
__write_##BYTES(VADDR(h2, o2 + o), \
|
||||
__read_##BYTES(VADDR(h1, o1 + o))); \
|
||||
} else { \
|
||||
/* dest after src: copy backwards */ \
|
||||
for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES) \
|
||||
__write_##BYTES(VADDR(h2, o2 + o), \
|
||||
__read_##BYTES(VADDR(h1, o1 + o))); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _BUS_SPACE_NO_MAP \
|
||||
(int (*)(void *, bus_addr_t, bus_size_t, int, \
|
||||
bus_space_handle_t *))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_UNMAP \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t)) \
|
||||
_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_SUBREGION \
|
||||
(int (*)(void *, bus_space_handle_t, bus_size_t, bus_size_t, \
|
||||
bus_space_handle_t *))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_ALLOC \
|
||||
(int (*)(void *, bus_addr_t, bus_addr_t, bus_size_t, bus_size_t,\
|
||||
bus_size_t, int, bus_addr_t *, bus_space_handle_t *)) \
|
||||
_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_FREE \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t)) \
|
||||
_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_VADDR \
|
||||
(void *(*)(void *, bus_space_handle_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_READ(BYTES, BITS) \
|
||||
(u_int##BITS##_t (*)(void *, bus_space_handle_t, bus_size_t)) \
|
||||
_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_READ_MULTI(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
u_int##BITS##_t *, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_READ_REGION(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
u_int##BITS##_t *, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_WRITE(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
u_int##BITS##_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_WRITE_MULTI(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
const u_int##BITS##_t *, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_WRITE_REGION(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
const u_int##BITS##_t *, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_SET_MULTI(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
u_int##BITS##_t, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_SET_REGION(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
u_int##BITS##_t, bus_size_t))_bus_space_invalid_access
|
||||
#define _BUS_SPACE_NO_COPY_REGION(BYTES, BITS) \
|
||||
(void (*)(void *, bus_space_handle_t, bus_size_t, \
|
||||
bus_space_handle_t, bus_size_t, bus_size_t))_bus_space_invalid_access
|
||||
|
||||
void _bus_space_invalid_access(void);
|
||||
#endif /* _PLAYSTATION2_BUS_SPACE_PRIVATE */
|
||||
|
||||
#define __pbs_c(a,b) __CONCAT(a,b)
|
||||
#define __pbs_opname(op,size) __pbs_c(__pbs_c(__pbs_c(pbs_,op),_),size)
|
||||
|
||||
#define __pbs_rs(sz, tn, t, h, o) \
|
||||
(__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"), \
|
||||
(*(t)->__pbs_opname(r,sz))((t)->pbs_cookie, h, o))
|
||||
|
||||
#define __pbs_ws(sz, tn, t, h, o, v) \
|
||||
({ \
|
||||
__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
|
||||
(*(t)->__pbs_opname(w,sz))((t)->pbs_cookie, h, o, v); \
|
||||
})
|
||||
|
||||
#define __pbs_nonsingle(type, sz, tn, t, h, o, a, c) \
|
||||
({ \
|
||||
__BUS_SPACE_ADDRESS_SANITY((a), tn, "buffer"); \
|
||||
__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
|
||||
(*(t)->__pbs_opname(type,sz))((t)->pbs_cookie, h, o, a, c); \
|
||||
})
|
||||
|
||||
#define __pbs_set(type, sz, tn, t, h, o, v, c) \
|
||||
({ \
|
||||
__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
|
||||
(*(t)->__pbs_opname(type,sz))((t)->pbs_cookie, h, o, v, c); \
|
||||
})
|
||||
|
||||
#define __pbs_copy(sz, tn, t, h1, o1, h2, o2, cnt) \
|
||||
({ \
|
||||
__BUS_SPACE_ADDRESS_SANITY((h1) + (o1), tn, "bus addr 1"); \
|
||||
__BUS_SPACE_ADDRESS_SANITY((h2) + (o2), tn, "bus addr 2"); \
|
||||
(*(t)->__pbs_opname(c,sz))((t)->pbs_cookie, h1, o1, h2, o2, cnt); \
|
||||
})
|
||||
|
||||
/*
|
||||
* Create default bus_space tag.
|
||||
*/
|
||||
bus_space_tag_t bus_space_create(bus_space_tag_t, const char *, bus_addr_t,
|
||||
bus_size_t);
|
||||
void bus_space_destroy(bus_space_tag_t);
|
||||
|
||||
/*
|
||||
* Mapping and unmapping operations.
|
||||
*/
|
||||
#define bus_space_map(t, a, s, f, hp) \
|
||||
(*(t)->pbs_map)((t)->pbs_cookie, (a), (s), (f), (hp))
|
||||
#define bus_space_unmap(t, h, s) \
|
||||
(*(t)->pbs_unmap)((t)->pbs_cookie, (h), (s))
|
||||
#define bus_space_subregion(t, h, o, s, hp) \
|
||||
(*(t)->pbs_subregion)((t)->pbs_cookie, (h), (o), (s), (hp))
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#define BUS_SPACE_MAP_CACHEABLE 0x01
|
||||
#define BUS_SPACE_MAP_LINEAR 0x02
|
||||
#define BUS_SPACE_MAP_PREFETCHABLE 0x04
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Allocation and deallocation operations.
|
||||
*/
|
||||
#define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \
|
||||
(*(t)->pbs_alloc)((t)->pbs_cookie, (rs), (re), (s), (a), (b), \
|
||||
(f), (ap), (hp))
|
||||
#define bus_space_free(t, h, s) \
|
||||
(*(t)->pbs_free)((t)->pbs_cookie, (h), (s))
|
||||
|
||||
/*
|
||||
* Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR.
|
||||
*/
|
||||
#define bus_space_vaddr(t, h) \
|
||||
(*(t)->pbs_vaddr)((t)->pbs_cookie, (h))
|
||||
|
||||
/*
|
||||
* Bus barrier operations. The playstation2 does not currently require
|
||||
* barriers, but we must provide the flags to MI code.
|
||||
*/
|
||||
#define bus_space_barrier(t, h, o, l, f) \
|
||||
({ \
|
||||
_wbflush(); \
|
||||
})
|
||||
|
||||
|
||||
#define BUS_SPACE_BARRIER_READ 0x01
|
||||
#define BUS_SPACE_BARRIER_WRITE 0x02
|
||||
|
||||
|
||||
/*
|
||||
* Bus read (single) operations.
|
||||
*/
|
||||
#define bus_space_read_1(t, h, o) __pbs_rs(1,u_int8_t,(t),(h),(o))
|
||||
#define bus_space_read_2(t, h, o) __pbs_rs(2,u_int16_t,(t),(h),(o))
|
||||
#define bus_space_read_4(t, h, o) __pbs_rs(4,u_int32_t,(t),(h),(o))
|
||||
#define bus_space_read_8(t, h, o) __pbs_rs(8,u_int64_t,(t),(h),(o))
|
||||
|
||||
|
||||
/*
|
||||
* Bus read multiple operations.
|
||||
*/
|
||||
#define bus_space_read_multi_1(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rm,1,u_int8_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_multi_2(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rm,2,u_int16_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_multi_4(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rm,4,u_int32_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_multi_8(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rm,8,u_int64_t,(t),(h),(o),(a),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Bus read region operations.
|
||||
*/
|
||||
#define bus_space_read_region_1(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rr,1,u_int8_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_region_2(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rr,2,u_int16_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_region_4(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rr,4,u_int32_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_read_region_8(t, h, o, a, c) \
|
||||
__pbs_nonsingle(rr,8,u_int64_t,(t),(h),(o),(a),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Bus write (single) operations.
|
||||
*/
|
||||
#define bus_space_write_1(t, h, o, v) __pbs_ws(1,u_int8_t,(t),(h),(o),(v))
|
||||
#define bus_space_write_2(t, h, o, v) __pbs_ws(2,u_int16_t,(t),(h),(o),(v))
|
||||
#define bus_space_write_4(t, h, o, v) __pbs_ws(4,u_int32_t,(t),(h),(o),(v))
|
||||
#define bus_space_write_8(t, h, o, v) __pbs_ws(8,u_int64_t,(t),(h),(o),(v))
|
||||
|
||||
|
||||
/*
|
||||
* Bus write multiple operations.
|
||||
*/
|
||||
#define bus_space_write_multi_1(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wm,1,u_int8_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_multi_2(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wm,2,u_int16_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_multi_4(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wm,4,u_int32_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_multi_8(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wm,8,u_int64_t,(t),(h),(o),(a),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Bus write region operations.
|
||||
*/
|
||||
#define bus_space_write_region_1(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wr,1,u_int8_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_region_2(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wr,2,u_int16_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_region_4(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wr,4,u_int32_t,(t),(h),(o),(a),(c))
|
||||
#define bus_space_write_region_8(t, h, o, a, c) \
|
||||
__pbs_nonsingle(wr,8,u_int64_t,(t),(h),(o),(a),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Set multiple operations.
|
||||
*/
|
||||
#define bus_space_set_multi_1(t, h, o, v, c) \
|
||||
__pbs_set(sm,1,u_int8_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_multi_2(t, h, o, v, c) \
|
||||
__pbs_set(sm,2,u_int16_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_multi_4(t, h, o, v, c) \
|
||||
__pbs_set(sm,4,u_int32_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_multi_8(t, h, o, v, c) \
|
||||
__pbs_set(sm,8,u_int64_t,(t),(h),(o),(v),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Set region operations.
|
||||
*/
|
||||
#define bus_space_set_region_1(t, h, o, v, c) \
|
||||
__pbs_set(sr,1,u_int8_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_region_2(t, h, o, v, c) \
|
||||
__pbs_set(sr,2,u_int16_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_region_4(t, h, o, v, c) \
|
||||
__pbs_set(sr,4,u_int32_t,(t),(h),(o),(v),(c))
|
||||
#define bus_space_set_region_8(t, h, o, v, c) \
|
||||
__pbs_set(sr,8,u_int64_t,(t),(h),(o),(v),(c))
|
||||
|
||||
|
||||
/*
|
||||
* Copy region operations.
|
||||
*/
|
||||
#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \
|
||||
__pbs_copy(1, u_int8_t, (t), (h1), (o1), (h2), (o2), (c))
|
||||
#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \
|
||||
__pbs_copy(2, u_int16_t, (t), (h1), (o1), (h2), (o2), (c))
|
||||
#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \
|
||||
__pbs_copy(4, u_int32_t, (t), (h1), (o1), (h2), (o2), (c))
|
||||
#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \
|
||||
__pbs_copy(8, u_int64_t, (t), (h1), (o1), (h2), (o2), (c))
|
||||
|
||||
/*
|
||||
* Bus stream operations--defined in terms of non-stream counterparts
|
||||
*/
|
||||
#define __BUS_SPACE_HAS_STREAM_METHODS 1
|
||||
#define bus_space_read_stream_1 bus_space_read_1
|
||||
#define bus_space_read_stream_2 bus_space_read_2
|
||||
#define bus_space_read_stream_4 bus_space_read_4
|
||||
#define bus_space_read_stream_8 bus_space_read_8
|
||||
#define bus_space_read_multi_stream_1 bus_space_read_multi_1
|
||||
#define bus_space_read_multi_stream_2 bus_space_read_multi_2
|
||||
#define bus_space_read_multi_stream_4 bus_space_read_multi_4
|
||||
#define bus_space_read_multi_stream_8 bus_space_read_multi_8
|
||||
#define bus_space_read_region_stream_1 bus_space_read_region_1
|
||||
#define bus_space_read_region_stream_2 bus_space_read_region_2
|
||||
#define bus_space_read_region_stream_4 bus_space_read_region_4
|
||||
#define bus_space_read_region_stream_8 bus_space_read_region_8
|
||||
#define bus_space_write_stream_1 bus_space_write_1
|
||||
#define bus_space_write_stream_2 bus_space_write_2
|
||||
#define bus_space_write_stream_4 bus_space_write_4
|
||||
#define bus_space_write_stream_8 bus_space_write_8
|
||||
#define bus_space_write_multi_stream_1 bus_space_write_multi_1
|
||||
#define bus_space_write_multi_stream_2 bus_space_write_multi_2
|
||||
#define bus_space_write_multi_stream_4 bus_space_write_multi_4
|
||||
#define bus_space_write_multi_stream_8 bus_space_write_multi_8
|
||||
#define bus_space_write_region_stream_1 bus_space_write_region_1
|
||||
#define bus_space_write_region_stream_2 bus_space_write_region_2
|
||||
#define bus_space_write_region_stream_4 bus_space_write_region_4
|
||||
#define bus_space_write_region_stream_8 bus_space_write_region_8
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Flags used in various bus DMA methods.
|
||||
*/
|
||||
#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
|
||||
#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
|
||||
#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
|
||||
#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
|
||||
#define BUS_DMA_STREAMING 0x008 /* hint: sequential, unidirectional */
|
||||
#define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
|
||||
#define BUS_DMA_BUS2 0x020
|
||||
#define BUS_DMA_BUS3 0x040
|
||||
#define BUS_DMA_BUS4 0x080
|
||||
#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
|
||||
#define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
|
||||
#define BUS_DMA_NOCACHE 0x400 /* hint: map non-cached memory */
|
||||
|
||||
#define PLAYSTATION2_DMAMAP_COHERENT 0x10000 /* no cache flush necessary on sync */
|
||||
|
||||
/* Forwards needed by prototypes below. */
|
||||
struct mbuf;
|
||||
struct uio;
|
||||
|
||||
/*
|
||||
* Operations performed by bus_dmamap_sync().
|
||||
*/
|
||||
#define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */
|
||||
#define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */
|
||||
#define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */
|
||||
#define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */
|
||||
|
||||
typedef struct playstation2_bus_dma_tag *bus_dma_tag_t;
|
||||
typedef struct playstation2_bus_dmamap *bus_dmamap_t;
|
||||
|
||||
#define BUS_DMA_TAG_VALID(t) ((t) != (bus_dma_tag_t)0)
|
||||
|
||||
/*
|
||||
* bus_dma_segment_t
|
||||
*
|
||||
* Describes a single contiguous DMA transaction. Values
|
||||
* are suitable for programming into DMA registers.
|
||||
*/
|
||||
struct playstation2_bus_dma_segment {
|
||||
bus_addr_t ds_addr; /* DMA address */
|
||||
bus_size_t ds_len; /* length of transfer */
|
||||
bus_addr_t _ds_vaddr; /* virtual address, 0 if invalid */
|
||||
};
|
||||
typedef struct playstation2_bus_dma_segment bus_dma_segment_t;
|
||||
|
||||
/*
|
||||
* bus_dma_tag_t
|
||||
*
|
||||
* A machine-dependent opaque type describing the implementation of
|
||||
* DMA for a given bus.
|
||||
*/
|
||||
|
||||
struct playstation2_bus_dma_tag {
|
||||
/*
|
||||
* DMA mapping methods.
|
||||
*/
|
||||
int (*_dmamap_create)(bus_dma_tag_t, bus_size_t, int,
|
||||
bus_size_t, bus_size_t, int, bus_dmamap_t *);
|
||||
void (*_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
|
||||
int (*_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
|
||||
bus_size_t, struct proc *, int);
|
||||
int (*_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct mbuf *, int);
|
||||
int (*_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, int);
|
||||
int (*_dmamap_load_raw)(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int);
|
||||
void (*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
|
||||
void (*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_addr_t, bus_size_t, int);
|
||||
|
||||
/*
|
||||
* DMA memory utility functions.
|
||||
*/
|
||||
int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
|
||||
bus_size_t, bus_dma_segment_t *, int, int *, int);
|
||||
void (*_dmamem_free)(bus_dma_tag_t,
|
||||
bus_dma_segment_t *, int);
|
||||
int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, size_t, void **, int);
|
||||
void (*_dmamem_unmap)(bus_dma_tag_t, void *, size_t);
|
||||
paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, off_t, int, int);
|
||||
|
||||
/*
|
||||
* DMA controller private.
|
||||
*/
|
||||
void *_dmachip_cookie;
|
||||
};
|
||||
|
||||
#define bus_dmamap_create(t, s, n, m, b, f, p) \
|
||||
(*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
|
||||
#define bus_dmamap_destroy(t, p) \
|
||||
(*(t)->_dmamap_destroy)((t), (p))
|
||||
#define bus_dmamap_load(t, m, b, s, p, f) \
|
||||
(*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
|
||||
#define bus_dmamap_load_mbuf(t, m, b, f) \
|
||||
(*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
|
||||
#define bus_dmamap_load_uio(t, m, u, f) \
|
||||
(*(t)->_dmamap_load_uio)((t), (m), (u), (f))
|
||||
#define bus_dmamap_load_raw(t, m, sg, n, s, f) \
|
||||
(*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
|
||||
#define bus_dmamap_unload(t, p) \
|
||||
(*(t)->_dmamap_unload)((t), (p))
|
||||
#define bus_dmamap_sync(t, p, o, l, ops) \
|
||||
(*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
|
||||
|
||||
#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
|
||||
(*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
|
||||
#define bus_dmamem_free(t, sg, n) \
|
||||
(*(t)->_dmamem_free)((t), (sg), (n))
|
||||
#define bus_dmamem_map(t, sg, n, s, k, f) \
|
||||
(*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
|
||||
#define bus_dmamem_unmap(t, k, s) \
|
||||
(*(t)->_dmamem_unmap)((t), (k), (s))
|
||||
#define bus_dmamem_mmap(t, sg, n, o, p, f) \
|
||||
(*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
|
||||
|
||||
#define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
|
||||
#define bus_dmatag_destroy(t)
|
||||
|
||||
/*
|
||||
* bus_dmamap_t
|
||||
*
|
||||
* Describes a DMA mapping.
|
||||
*/
|
||||
struct playstation2_bus_dmamap {
|
||||
/*
|
||||
* PRIVATE MEMBERS: not for use my machine-independent code.
|
||||
*/
|
||||
bus_size_t _dm_size; /* largest DMA transfer mappable */
|
||||
int _dm_segcnt; /* number of segs this map can map */
|
||||
bus_size_t _dm_maxmaxsegsz; /* fixed largest possible segment */
|
||||
bus_size_t _dm_boundary; /* don't cross this */
|
||||
int _dm_flags; /* misc. flags */
|
||||
|
||||
/*
|
||||
* PUBLIC MEMBERS: these are used by machine-independent code.
|
||||
*/
|
||||
bus_size_t dm_maxsegsz; /* largest possible segment */
|
||||
bus_size_t dm_mapsize; /* size of the mapping */
|
||||
int dm_nsegs; /* # valid segments in mapping */
|
||||
bus_dma_segment_t dm_segs[1]; /* segments; variable length */
|
||||
};
|
||||
|
||||
#ifdef _PLAYSTATION2_BUS_DMA_PRIVATE
|
||||
int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
|
||||
bus_size_t, int, bus_dmamap_t *);
|
||||
void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
|
||||
int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
|
||||
bus_size_t, struct proc *, int);
|
||||
int _bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct mbuf *, int);
|
||||
int _bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, int);
|
||||
int _bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int);
|
||||
void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
|
||||
void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
|
||||
bus_size_t, int);
|
||||
|
||||
int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
|
||||
bus_size_t alignment, bus_size_t boundary,
|
||||
bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
|
||||
void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
|
||||
int nsegs);
|
||||
int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
|
||||
int nsegs, size_t size, void **kvap, int flags);
|
||||
void _bus_dmamem_unmap(bus_dma_tag_t tag, void *kva,
|
||||
size_t size);
|
||||
paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
|
||||
int nsegs, off_t off, int prot, int flags);
|
||||
|
||||
int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
|
||||
bus_size_t alignment, bus_size_t boundary,
|
||||
bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
|
||||
vaddr_t low, vaddr_t high);
|
||||
|
||||
extern struct playstation2_bus_dma_tag playstation2_default_bus_dma_tag;
|
||||
#endif /* _PLAYSTATION2_BUS_DMA_PRIVATE */
|
||||
|
||||
#endif /* _PLAYSTATION2_BUS_H_ */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: cdefs.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/cdefs.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: cpu.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/cpu.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: cpu_counter.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/cpu_counter.h>
|
|
@ -0,0 +1,6 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/db_machdep.h>
|
||||
|
||||
#define DB_ELF_SYMBOLS
|
||||
#define DB_ELFSIZE 32
|
|
@ -0,0 +1,61 @@
|
|||
/* $NetBSD: disklabel.h,v 1.9 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christopher G. Demetriou.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYSTATION2_DISKLABEL_H_
|
||||
#define _PLAYSTATION2_DISKLABEL_H_
|
||||
|
||||
#define LABELSECTOR 1 /* sector containing label */
|
||||
#define LABELOFFSET 0 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 16 /* number of partitions */
|
||||
#define RAW_PART 2
|
||||
|
||||
/* Pull in MBR partition definitions. */
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include <nbinclude/sys/bootblock.h>
|
||||
#else
|
||||
#include <sys/bootblock.h>
|
||||
#endif /* HAVE_NBTOOL_CONFIG_H */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include <nbinclude/sys/dkbad.h>
|
||||
#else
|
||||
#include <sys/dkbad.h>
|
||||
#endif /* HAVE_NBTOOL_CONFIG_H */
|
||||
struct cpu_disklabel {
|
||||
struct mbr_partition dosparts[MBR_PART_COUNT];
|
||||
#define __HAVE_DISKLABEL_DKBAD
|
||||
struct dkbad bad;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _PLAYSTATION2_DISKLABEL_H_ */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ecoff_machdep.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/ecoff_machdep.h>
|
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: elf_machdep.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/elf_machdep.h>
|
||||
|
||||
#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: endian_machdep.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||
#include <mips/endian_machdep.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: float.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/float.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ieee.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/ieee.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.3 2014/03/31 11:25:49 martin Exp $ */
|
||||
|
||||
#include <mips/ieeefp.h>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue