NetBSD, meet the SH-5 cpu.

SH-5, meet NetBSD.

Let's hope this is the start of a long and fruitful relationship. :-)

This code, funded by Wasabi Systems, adds initial support for the
Hitachi SuperH(tm) SH-5 cpu architecture to NetBSD.

At the present time, NetBSD/evbsh5 only runs on a SH-5 core simulator
which has no simulated devices other than a simple console. However, it
is good enough to get to the "root device: " prompt.

Device driver support for Real SH-5 Hardware is in place, particularly for
supporting the up-coming Cayman evaluation board, and should be quite
easy to get running when the hardware is available.

There is no in-tree toolchain for this port at this time. Gcc-current has
rudimentary SH-5 support but it is known to be buggy. A working toolchain
was obtained from SuperH to facilitate this port. Gcc-current will be
fixed in due course.

The SH-5 architecture is fully 64-bit capable, although NetBSD/evbsh5 has
currently only been tested in 32-bit mode. It is bi-endian, via a boot-
time option and it also has an "SHcompact" mode in which it will execute
SH-[34] user-land instructions.

For more information on the SH-5, see www.superh.com. Suffice to say it
is *not* just another respin of the SH-[34].
This commit is contained in:
scw 2002-07-05 13:31:28 +00:00
parent d38d8c6c75
commit 59474a8c82
190 changed files with 26305 additions and 2 deletions

6
lib/csu/sh5/Makefile Normal file
View File

@ -0,0 +1,6 @@
# $NetBSD: Makefile,v 1.1 2002/07/05 13:31:28 scw Exp $
#Uncomment the next line to enable the new .init fallthru
CPPFLAGS+= -I- -I${.CURDIR}
.include "${.CURDIR}/../common_elf/Makefile.inc"

90
lib/csu/sh5/crt0.c Normal file
View File

@ -0,0 +1,90 @@
/* $NetBSD: crt0.c,v 1.1 2002/07/05 13:31:28 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "common.h"
/*
* SH5 needs no assembler trampoline for _start as the kernel sets up
* all the necessary parameters.
*/
void _start(int argc, char **argv, char **envp, void (*cleanup)(void),
const Obj_Entry *obj, struct ps_strings *ps_strings);
void
_start(int argc, char **argv, char **envp, void (*cleanup)(void),
const Obj_Entry *obj, struct ps_strings *ps_strings)
{
char *pn;
environ = envp;
if ((pn = argv[0]) != NULL) {
if ((pn = _strrchr(argv[0], '/')) == NULL)
pn = argv[0];
else
pn++;
}
__progname = pn;
if (ps_strings)
__ps_strings = ps_strings;
#ifdef DYNAMIC
if (&_DYNAMIC != NULL)
_rtld_setup(cleanup, obj);
#endif
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
#endif
atexit(_fini);
_init();
exit(main(argc, argv, environ));
}
/*
* NOTE: Leave the RCS ID _after_ _start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: crt0.c,v 1.1 2002/07/05 13:31:28 scw Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"

108
lib/csu/sh5/dot_init.h Normal file
View File

@ -0,0 +1,108 @@
/* $NetBSD: dot_init.h,v 1.1 2002/07/05 13:31:28 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 2001 Ross Harvey
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
/*
* These must be extern to avoid warnings ("declared static but never defined")
* However, only the declaration is extern, the actually __asm() defines them
* as static.
*/
#define INIT_FALLTHRU_DECL void init_fallthru(void)
#define FINI_FALLTHRU_DECL void fini_fallthru(void)
#define INIT_FALLTHRU() init_fallthru()
#define FINI_FALLTHRU() fini_fallthru()
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
__asm ( \
".section "#sect",\"ax\",@progbits \n"\
#entry_pt": \n"\
" addi r15, -16, r15 \n"\
" st.q r15, 0, r14 \n"\
" st.q r15, 8, r18 \n"\
" add r15, r63, r14 \n"\
" /* fall thru */ \n"\
".previous")
#define MD_SECTION_EPILOGUE(sect) \
__asm ( \
".section "#sect",\"ax\",@progbits \n"\
" ld.q r15, 8, r18 \n"\
" ld.q r15, 0, r14 \n"\
" ptabs/l r18, tr0 \n"\
" addi r15, 16, r15 \n"\
" blink tr0, r63 \n"\
".previous")
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
#define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
#define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)

View File

@ -0,0 +1,9 @@
# $NetBSD: Makefile.inc,v 1.1 2002/07/05 13:31:29 scw Exp $
SRCS+= alloca.S \
byte_swap_2.S byte_swap_4.S byte_swap_8.S \
fabs.S \
sigsetjmp.S _setjmp.S
LSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
DPSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c

View File

@ -0,0 +1,141 @@
/* $NetBSD: _setjmp.S,v 1.1 2002/07/05 13:31:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#define _O(n) ((n)*8)
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* _setjmp(a)
* by restoring registers from the stack,
* The previous signal state is NOT restored.
*/
ENTRY_NOPROFILE(_setjmp)
st.q r2, _O(_JB_R10), r10
st.q r2, _O(_JB_R11), r11
st.q r2, _O(_JB_R12), r12
st.q r2, _O(_JB_R13), r13
st.q r2, _O(_JB_R14), r14
st.q r2, _O(_JB_R26), r26
st.q r2, _O(_JB_R27), r27
st.q r2, _O(_JB_R28), r28
st.q r2, _O(_JB_R29), r29
st.q r2, _O(_JB_R30), r30
st.q r2, _O(_JB_R31), r31
st.q r2, _O(_JB_R32), r32
st.q r2, _O(_JB_R33), r33
st.q r2, _O(_JB_R34), r34
st.q r2, _O(_JB_R35), r35
st.q r2, _O(_JB_R44), r44
st.q r2, _O(_JB_R45), r45
st.q r2, _O(_JB_R46), r46
st.q r2, _O(_JB_R47), r47
st.q r2, _O(_JB_R48), r48
st.q r2, _O(_JB_R49), r49
st.q r2, _O(_JB_R50), r50
st.q r2, _O(_JB_R51), r51
st.q r2, _O(_JB_R52), r52
st.q r2, _O(_JB_R53), r53
st.q r2, _O(_JB_R54), r54
st.q r2, _O(_JB_R55), r55
st.q r2, _O(_JB_R56), r56
st.q r2, _O(_JB_R57), r57
st.q r2, _O(_JB_R58), r58
st.q r2, _O(_JB_R59), r59
ptabs/l r18, tr0
gettr tr5, r0
st.q r2, _O(_JB_TR5), r0
gettr tr6, r0
st.q r2, _O(_JB_TR6), r0
gettr tr7, r0
st.q r2, _O(_JB_TR7), r0
st.q r2, _O(_JB_SP), r15
st.q r2, _O(_JB_PC), r18
movi 0, r2
blink tr0, r63
ENTRY_NOPROFILE(_longjmp)
ld.q r2, _O(_JB_R10), r10
ld.q r2, _O(_JB_R11), r11
ld.q r2, _O(_JB_R12), r12
ld.q r2, _O(_JB_R13), r13
ld.q r2, _O(_JB_R14), r14
ld.q r2, _O(_JB_R26), r26
ld.q r2, _O(_JB_R27), r27
ld.q r2, _O(_JB_R28), r28
ld.q r2, _O(_JB_R29), r29
ld.q r2, _O(_JB_R30), r30
ld.q r2, _O(_JB_R31), r31
ld.q r2, _O(_JB_R32), r32
ld.q r2, _O(_JB_R33), r33
ld.q r2, _O(_JB_R34), r34
ld.q r2, _O(_JB_R35), r35
ld.q r2, _O(_JB_R40), r44
ld.q r2, _O(_JB_R45), r45
ld.q r2, _O(_JB_R46), r46
ld.q r2, _O(_JB_R47), r47
ld.q r2, _O(_JB_R48), r48
ld.q r2, _O(_JB_R49), r49
ld.q r2, _O(_JB_R50), r50
ld.q r2, _O(_JB_R51), r51
ld.q r2, _O(_JB_R52), r52
ld.q r2, _O(_JB_R53), r53
ld.q r2, _O(_JB_R54), r54
ld.q r2, _O(_JB_R55), r55
ld.q r2, _O(_JB_R56), r56
ld.q r2, _O(_JB_R57), r57
ld.q r2, _O(_JB_R58), r58
ld.q r2, _O(_JB_R59), r59
ld.q r2, _O(_JB_TR5), r0
ptabs/u r0, tr5
ld.q r2, _O(_JB_TR6), r0
ptabs/u r0, tr6
ld.q r2, _O(_JB_TR7), r0
ptabs/u r0, tr7
ld.q r2, _O(_JB_PC), r18
ptabs/l r18, tr0
ld.q r2, _O(_JB_SP), r15
movi 1, r2
cmvne r3, r3, r2
blink tr0, r63

View File

@ -0,0 +1,45 @@
/* $NetBSD: alloca.S,v 1.1 2002/07/05 13:31:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
ENTRY_NOPROFILE(alloca)
ptabs/l r18, tr0
andi r2, -16, r2
sub r15, r2, r15
or r15, r63, r2
blink tr0, r63

View File

@ -0,0 +1,49 @@
/* $NetBSD: byte_swap_2.S,v 1.1 2002/07/05 13:31:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#include <machine/endian.h>
#if BTYE_ORDER == LITTLE_ENDIAN
ALTENTRY(htons)
ALTENTRY(ntohs)
#endif
ENTRY(__bswap16)
ptabs/l r18, tr0
byterev r2, r2
shlri r2, 48, r2
blink tr0, r63

View File

@ -0,0 +1,49 @@
/* $NetBSD: byte_swap_4.S,v 1.1 2002/07/05 13:31:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#include <machine/endian.h>
#if BTYE_ORDER == LITTLE_ENDIAN
ALTENTRY(htonl)
ALTENTRY(ntohl)
#endif
ENTRY(__bswap32)
ptabs/l r18, tr0
byterev r2, r2
shlri r2, 32, r2
blink tr0, r63

View File

@ -0,0 +1,44 @@
/* $NetBSD: byte_swap_8.S,v 1.1 2002/07/05 13:31:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#include <machine/endian.h>
ENTRY(__bswap64)
ptabs/l r18, tr0
byterev r2, r2
blink tr0, r63

View File

@ -0,0 +1,43 @@
/* $NetBSD: fabs.S,v 1.1 2002/07/05 13:31:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
ENTRY(fabs)
ptabs/l r18, tr0
fabs.d dr0, dr0
blink tr0, r63

View File

@ -0,0 +1,42 @@
/* $NetBSD: sigsetjmp.S,v 1.1 2002/07/05 13:31:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
ENTRY(sigsetjmp)

View File

@ -0,0 +1,7 @@
# $NetBSD: Makefile.inc,v 1.1 2002/07/05 13:31:31 scw Exp $
# hton* and nto* functions provided by ../gen/byte_swap_*.S
SRCS+=
LSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
DPSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c

View File

@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2002/07/05 13:31:31 scw Exp $
SRCS+= abs.S llabs.S div.c ldiv.c

View File

@ -0,0 +1,47 @@
/* $NetBSD: abs.S,v 1.1 2002/07/05 13:31:32 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#ifndef _LP64
ALTENTRY(labs)
#endif
ENTRY(abs)
ptabs/l r18, tr0
addz.l r2, r63, r2 /* Bits 32-63 to zero */
mabs.l r2, r2 /* r2 = abs(r2) */
blink tr0, r63

View File

@ -0,0 +1,47 @@
/* $NetBSD: llabs.S,v 1.1 2002/07/05 13:31:32 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <machine/asm.h>
#ifdef _LP64
ALTENTRY(labs)
#endif
ENTRY(llabs)
ptabs/l r18, tr0
bge/l r2, r63, tr0
sub r63, r2, r2
blink tr0, r63

View File

@ -0,0 +1,103 @@
/* $NetBSD: Ovfork.S,v 1.1 2002/07/05 13:31:32 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)Ovfork.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: Ovfork.S,v 1.1 2002/07/05 13:31:32 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* @(#)vfork.s 4.1 (Berkeley) 12/21/80
* C library -- vfork
*/
WARN_REFERENCES(vfork, \
"warning: reference to compatibility vfork(); include <unistd.h> for correct reference")
/*
* pid = vfork();
*
* r3 == 0 in parent process, r3 == 1 in child process.
* r2 == pid of child in parent, r2 == pid of parent in child.
*/
ENTRY(vfork)
SYSCALL(vfork)
ptabs/l r18, tr0
cmvne r3, r63, r2
blink tr0, r63

View File

@ -0,0 +1,68 @@
/* $NetBSD: __clone.S,v 1.1 2002/07/05 13:31:32 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include <sys/errno.h>
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
/*
* int clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
ENTRY(__clone)
pta/u 1f, tr0 /* Preload error path */
beq/u r2, r63, tr0 /* Bomb if fn is NULL */
beq/u r3, r63, tr0 /* Bomb if stack is NULL */
or r2, r63, r6 /* Preserve "fn" in r6 (syscall won't trash) */
or r3, r63, r2 /* Shuffle syscall args: stack */
or r4, r63, r3 /* Shuffle syscall args: flags */
SYSCALL(__clone)
ptabs/l r18, tr0
bne/l r2, r63, tr0 /* If parent, just return. */
ptabs/l r6, tr0 /* Clone's "fn" was safe in r6 */
or r5, r63, r2 /* Clone's "arg" was safe in r5 */
blink tr0, r18 /* Invoke the clone */
pt/l _C_LABEL(_exit), tr0
blink tr0, r63 /* If clone returns, invoke _exit(3) */
/*NOTREACHED*/
1: movi EINVAL, r2
pt/l _C_LABEL(__cerror), tr0
blink tr0, r63
/*NOTREACHED*/

View File

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

View File

@ -0,0 +1,44 @@
/* $NetBSD: __sigreturn14.S,v 1.1 2002/07/05 13:31:33 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
* Since system calls do this anyway on sh5.
*/
RSYSCALL(__sigreturn14)

View File

@ -0,0 +1,40 @@
/* $NetBSD: __syscall.S,v 1.1 2002/07/05 13:31:33 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "SYS.h"
RSYSCALL(__syscall)

View File

@ -0,0 +1,100 @@
/* $NetBSD: __vfork14.S,v 1.1 2002/07/05 13:31:33 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)Ovfork.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: __vfork14.S,v 1.1 2002/07/05 13:31:33 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* @(#)vfork.s 4.1 (Berkeley) 12/21/80
* C library -- vfork
*/
/*
* pid = vfork();
*
* r3 == 0 in parent process, r3 == 1 in child process.
* r2 == pid of child in parent, r2 == pid of parent in child.
*/
ENTRY(__vfork14)
SYSCALL(__vfork14)
ptabs/l r18, tr0
cmvne r3, r63, r2
blink tr0, r63

110
lib/libc/arch/sh5/sys/brk.S Normal file
View File

@ -0,0 +1,110 @@
/* $NetBSD: brk.S,v 1.1 2002/07/05 13:31:33 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)brk.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: brk.S,v 1.1 2002/07/05 13:31:33 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.data
.globl _end
GLOBAL(__minbrk)
#ifdef _ILP64
.quad datalabel _end
#else
.long datalabel _end
#endif
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
ENTRY(_brk)
LEA(_C_LABEL(__minbrk), r0)
LDPTR r0, 0, r0
cmpgtu r0, r2, r1 /* r1 == 1 if setting brk below _end */
cmvne r1, r0, r2 /* Clamp brk at _end if r1 == 1 */
or r2, r63, r3 /* Save new brk in r3 */
SYSCALL(break)
ptabs/l r18, tr0
LEA(_C_LABEL(__curbrk), r0)
STPTR r0, 0, r3 /* Otherwise, update __curbrk */
movi 0, r2
blink tr0, r63

View File

@ -0,0 +1,107 @@
/* $NetBSD: cerror.S,v 1.1 2002/07/05 13:31:33 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)cerror.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: cerror.S,v 1.1 2002/07/05 13:31:33 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
ENTRY_NOPROFILE(__cerror)
movi -1, r1
ENTRY_NOPROFILE(__cerror_rv)
#ifdef _REENTRANT
addi r15, -24, r15
st.q r15, 0, r1
st.q r15, 8, r2
pt/l _C_LABEL(__errno), tr0
st.q r15, 16, r18
blink tr0, r18
ld.q r15, 16, r18
or r2, r63, r0
ld.q r15, 8, r2
ld.q r15, 0, r1
addi r15, 24, r15
#else
LEA(_C_LABEL(errno), r0)
#endif
ptabs/l r18, tr0
st.l r0, 0, r2
or r1, r63, r2
blink tr0, r63

View File

@ -0,0 +1,89 @@
/* $NetBSD: exect.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)exect.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: exect.S,v 1.1 2002/07/05 13:31:34 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
ENTRY(exect)
SYSTRAP(execve)
pt/l _C_LABEL(__cerror), tr0
blink tr0, r63

View File

@ -0,0 +1,93 @@
/* $NetBSD: fork.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)fork.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: fork.S,v 1.1 2002/07/05 13:31:34 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
ENTRY(_fork)
SYSCALL(fork)
ptabs/l r18, tr0
cmvne r3, r63, r2
blink tr0, r63

View File

@ -0,0 +1,45 @@
/* $NetBSD: msgctl.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(msgctl, \
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
PSEUDO(msgctl,compat_14_msgctl)

View File

@ -0,0 +1,96 @@
/* $NetBSD: pipe.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)pipe.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: pipe.S,v 1.1 2002/07/05 13:31:34 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(pipe, _pipe)
#endif
ENTRY(_pipe)
or r2, r63, r3 /* Preserve arg across syscall */
SYSCALL(pipe)
ptabs/l r18, tr0
st.l r3, 0, r2 /* Store fd#1 */
movi 0, r2
st.l r3, 4, r3 /* Store fd#2 */
blink tr0, r63

View File

@ -0,0 +1,109 @@
/* $NetBSD: ptrace.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)ptrace.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: ptrace.S,v 1.1 2002/07/05 13:31:34 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
ENTRY(ptrace)
#ifdef _REENTRANT
addi r15, -40, r15
st.q r15, 0, r18
st.q r15, 8, r2
st.q r15, 16, r3
st.q r15, 24, r4
st.q r15, 32, r5
pt/l _C_LABEL(__errno), tr0
blink tr0, r18
or r2, r63, r0
ld.q r15, 0, r18
ld.q r15, 8, r2
ld.q r15, 16, r3
ld.q r15, 24, r4
ld.q r15, 32, r5
addi r15, 40, r15
#else
LEA(_C_LABEL(errno), r0)
#endif
st.l r0, 0, r63
SYSCALL(ptrace)
ptabs/l r18, tr0
blink tr0, r63

View File

@ -0,0 +1,108 @@
/* $NetBSD: sbrk.S,v 1.1 2002/07/05 13:31:34 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sbrk.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: sbrk.S,v 1.1 2002/07/05 13:31:34 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.data
.globl _end
GLOBAL(__curbrk)
#ifdef _LP64
.quad datalabel _end
#else
.long datalabel _end
#endif
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
#endif
ENTRY(_sbrk)
LEA(_C_LABEL(__curbrk), r3)
LDPTR r3, 0, r0
add r2, r0, r2
or r2, r63, r4
SYSCALL(break)
ptabs/l r18, tr0
LDPTR r3, 0, r2
STPTR r3, 0, r4
blink tr0, r63

View File

@ -0,0 +1,86 @@
/* $NetBSD: setlogin.S,v 1.1 2002/07/05 13:31:35 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)setlogin.s 5.1 (Berkeley) 5/6/91")
#else
RCSID("$NetBSD: setlogin.S,v 1.1 2002/07/05 13:31:35 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
ENTRY(setlogin)
SYSCALL(setlogin)
ptabs/l r18, tr0
LEA(_C_LABEL(__logname_valid), r0)
st.l r0, 0, r63
blink tr0, r63

View File

@ -0,0 +1,79 @@
/* $NetBSD: shmat.S,v 1.1 2002/07/05 13:31:35 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
ENTRY(shmat)
SYSTRAP(shmat)
ptabs/l r18, tr0
pt/u _C_LABEL(__cerror_rv), tr1
cmvne r0, r63, r1
bne/u r0, r63, tr1
blink tr0, r63

View File

@ -0,0 +1,45 @@
/* $NetBSD: shmctl.S,v 1.1 2002/07/05 13:31:35 scw Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)

View File

@ -0,0 +1,45 @@
/* $NetBSD: sigaction.S,v 1.1 2002/07/05 13:31:35 scw Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)

View File

@ -0,0 +1,94 @@
/* $NetBSD: sigpending.S,v 1.1 2002/07/05 13:31:35 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigpending.s 5.2 (Berkeley) 8/6/90")
#else
RCSID("$NetBSD: sigpending.S,v 1.1 2002/07/05 13:31:35 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
ENTRY(sigpending)
or r2, r63, r3
SYSTRAP(compat_13_sigpending13)
ptabs/l r18, tr0
st.l r3, 0, r2
movi 0, r2
blink r18, tr0

View File

@ -0,0 +1,104 @@
/* $NetBSD: sigprocmask.S,v 1.1 2002/07/05 13:31:36 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigprocmask.s 5.2 (Berkeley) 6/6/90")
#else
RCSID("$NetBSD: sigprocmask.S,v 1.1 2002/07/05 13:31:36 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigprocmask, \
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
ENTRY(sigprocmask)
ptb/u 1f, tr0 /* These six instructions */
gettr tr0, r0 /* work by magic. ;-) */
movi 1, r1 /* SIG_BLOCK */
cmveq r3, r1, r2 /* r2 = SIG_BLOCK; iff set == NULL */
cmveq r3, r0, r3 /* r3 = &0; iff set == NULL */
ld.l r3, 0, r3 /* r3 = *r3; */
SYSCALL(compat_13_sigprocmask13)
ptabs/l r18, tr0
or r2, r63, r0 /* Save old mask in r0 */
movi 0, r2 /* Return value is zero */
beq/l r4, r63, tr0 /* Just exit if they don't want omask */
st.l r4, 0, r0 /* Otherwise, store old mask */
blink tr0, r18
.align 3
1: .quad 0

View File

@ -0,0 +1,43 @@
/* $NetBSD: sigreturn.S,v 1.1 2002/07/05 13:31:36 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "SYS.h"
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn(); include <signal.h> for correct reference")
PSEUDO(sigreturn,compat_13_sigreturn13)

View File

@ -0,0 +1,92 @@
/* $NetBSD: sigsuspend.S,v 1.1 2002/07/05 13:31:36 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigsuspend.s 5.2 (Berkeley) 6/6/90")
#else
RCSID("$NetBSD: sigsuspend.S,v 1.1 2002/07/05 13:31:36 scw Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
ENTRY(sigsuspend)
ld.l r2, 0, r2
SYSCALL(compat_13_sigsuspend13)
ptabs/l r18, tr0
blink tr0, r63

View File

@ -0,0 +1,40 @@
/* $NetBSD: syscall.S,v 1.1 2002/07/05 13:31:36 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "SYS.h"
RSYSCALL(syscall)

View File

@ -1,4 +1,4 @@
$NetBSD: README,v 1.24 2002/06/10 14:25:41 fredette Exp $
$NetBSD: README,v 1.25 2002/07/05 13:31:37 scw Exp $
acorn26: Acorn ARM2- and ARM3-based machines (arm)
acorn32: Acorn computers Ltd. ARM 6/7/SA based machines (arm)
@ -16,6 +16,7 @@ dreamcast: SEGA Dreamcast (sh3)
evbarm: ARM-based eval boards (arm)
evbmips: MIPS-based eval boards (mips)
evbsh3: Hitachi SuperH(TM) sh3 and sh4 eval boards (sh3)
evbsh5: Hitachi SuperH(TM) sh5 eval boards (sh5)
hp300: Hewlett Packard 300- and 400-series machines (m68k)
hp700: Hewlett Packard 700-series machines (hppa)
hpcarm: ARM based handheld PCs (arm)
@ -63,5 +64,6 @@ m68k: Motorola 680x0 cpu based platform files
m88k: Motorola 88xxx cpu based platform files
mips: MIPS cpu based platform files
powerpc: PowerPC cpu based platform files
sh3: Hitachi SuperH cpu based platform files
sh3: Hitachi SuperH(TM) sh3 and sh4 cpu based platform files
sh5: Hitachi SuperH(TM) sh5 cpu based platform files
sun68k: Sun Motorola 680x0 cpu based platform files

View File

@ -0,0 +1 @@
This normally empty directory needs to be kept in the distribution.

118
sys/arch/evbsh5/conf/CAYMAN Normal file
View File

@ -0,0 +1,118 @@
# $NetBSD: CAYMAN,v 1.1 2002/07/05 13:31:37 scw Exp $
#
# Config file for SuperH "CAYMAN" SH-5 Evaluation board
#
include "arch/evbsh5/conf/std.evbsh5.el"
maxusers 2
options INCLUDE_CONFIG_FILE
#ident "CAYMAN-$Revision: 1.1 $"
options CPU_STB1
options DIAGNOSTIC
options DEBUG
#options DDB
options KTRACE
file-system FFS
file-system NFS
file-system KERNFS
file-system MFS
options SOFTDEP
options INET
options INET6
config netbsd root on ? type ?
options NFS_BOOT_DHCP
pseudo-device loop
pseudo-device bpfilter
pseudo-device pty
pseudo-device rnd
# The mainbus to which all devices attach
mainbus0 at root
#
# The SuperHyway bus is the main interconnect between the constituent
# "modules" which make up an SH-5 system
#
superhyway0 at mainbus0
#
# These are the "modules" present on the Cayman's SH-5
#
cpu0 at superhyway0 pport 0x0d # A single CPU
#emi0 at superhyway0 pport 0x80 # The memory controller module
pbridge0 at superhyway0 pport 0x09 # Peripheral Bridge
#dmac0 at superhyway0 pport 0x0e # DMA controller
femi0 at superhyway0 pport 0x08 # Flash/External memory
#pchb0 at superhyway0 pport 0x60 # PCI bus
#
# The Peripheral Bridge and all its sub-devices are actually on the same
# silicon as the CPU itself.
#
cprc0 at pbridge0 # Clock, Power & Reset Control
intc0 at pbridge0 # Interrupt controller
tmu0 at pbridge0 ipl 14 intevt 0x400 # Timer
#scif0 at pbridge0 ipl 12 intevt 0x700 # On-chip serial controller
rtc0 at pbridge0 # Battery-backed Date/Time chip
#
# The Clock, Power and Reset controller has a number of sub-devices, only one
# of which is currently used.
#
clock0 at cprc0 # Primary clock generator
#watchdog0 at cprc0 # Watchdog
#power0 at cprc0 # Power Management
#reset0 at cprc0 # Reset controller
#
# The FEMI module (which hangs off the SuperHyway) is actually more than
# just an interface to Flash memory. It's pretty much a complete expansion
# bus in its own right.
#
sysfpga0 at femi0 offset 0x4000000 # The main System FPGA chip
#
# The Super I/O chip is straight out of the x86 PeeCee world in that
# it implements a bunch if "standard" PeeCee type devices (although
# a few of those are not connected on Cayman).
#
# We make it look like a PeeCee isa bus so that we can re-use all the
# pre-existing NetBSD drivers for the devices implemented in the Super IO.
#
superio0 at sysfpga0 # SMC Super I/O Device
isa0 at superio0 # The ISAbus attachment.
#
# These are the devices Cayman uses
#
# Note that the addresses and irqs are hard-coded and should really be
# moved into a `knowndevs' structure ...
#
#pckbc0 at isa0 # Keyboard Controller
#pms0 at pckbc0 # Mouse
com0 at isa0 port 0x3f8 irq 4 # PC-style serial ports
com1 at isa0 port 0x2f8 irq 3
lpt0 at isa0 port 0x378 irq 7 # Parallel printer port
sm0 at isa0 port 0x1000 irq 10 # SMC91C100 LAN controller
wdc0 at isa0 port 0x1f0 irq 14 flags 0x0 # IDE-style disk controller
# Support for IDE/ATAPI device
wd* at wdc0 channel ? drive ? flags 0x0000
atapibus* at wdc0 channel ?
cd* at atapibus? drive ? flags 0x0000
# The MII device on the LAN controller
ukphy* at mii? phy ?

View File

@ -0,0 +1,61 @@
# $NetBSD: SIMULATOR,v 1.1 2002/07/05 13:31:37 scw Exp $
# NetBSD/sh5 on the simple `chess' based simulator.
#
# This won't get to single-user, but it serves as a useful way to debug
# startup code.
include "arch/evbsh5/conf/std.evbsh5.el"
maxusers 2
options INCLUDE_CONFIG_FILE
#ident "SIMULATOR-$Revision: 1.1 $"
options CPU_STB1
options SIMULATED_CLOCK
options DIAGNOSTIC
options DEBUG
#options DDB
options KTRACE
file-system FFS
file-system NFS
file-system KERNFS
file-system MFS
options SOFTDEP
options INET
options INET6
config netbsd root on ? type ?
options NFS_BOOT_DHCP
pseudo-device loop
pseudo-device bpfilter
pseudo-device pty
pseudo-device rnd
# The mainbus to which all devices attach
mainbus0 at root
#
# The SuperHyway bus is the main interconnect between the constituent
# "modules" which make up an SH-5 system
#
superhyway0 at mainbus0
#
# Only the CPU module exists on the simulator.
#
cpu0 at superhyway0 pport 0x0d # A single CPU
#
# The DTF debug interface.
#
dtfcons0 at mainbus0

View File

@ -0,0 +1,21 @@
# $NetBSD: files.evbsh5,v 1.1 2002/07/05 13:31:38 scw Exp $
# Config file for SuperH CAYMAN SH5 Evaluation Board
maxpartitions 16
maxusers 2 16 64
include "dev/isa/files.isa"
file arch/evbsh5/evbsh5/machdep.c
file arch/evbsh5/evbsh5/cons_machdep.c
file arch/evbsh5/evbsh5/mainbus.c mainbus
device sysfpga { }
attach sysfpga at femi
file arch/evbsh5/dev/sysfpga.c sysfpga
device superio: isabus
attach superio at sysfpga
file arch/evbsh5/dev/superio.c superio

View File

@ -0,0 +1,10 @@
# $NetBSD: std.evbsh5.el,v 1.1 2002/07/05 13:31:38 scw Exp $
#
# Options/devices that all Little Endian evbsh5s should have
#
machine evbsh5 sh5
options EXEC_ELF32
options EXEC_SCRIPT

View File

@ -0,0 +1,708 @@
/* $NetBSD: superio.c,v 1.1 2002/07/05 13:31:38 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*
* Cayman's "Super IO" device, which looks like an ISA bus once
* we're finished with it.
*/
#include "com.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/extent.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/isa/isavar.h>
#include <dev/ic/smc91cxxreg.h>
#if NCOM > 0
#include <evbsh5/dev/sysfpgareg.h>
#endif
#include <evbsh5/dev/sysfpgavar.h>
#include <evbsh5/dev/superioreg.h>
#include <evbsh5/dev/superiovar.h>
struct superio_softc {
struct device sc_dev;
bus_space_tag_t sc_bust;
bus_space_handle_t sc_bush;
struct extent *sc_isaext;
};
static int superiomatch(struct device *, struct cfdata *, void *);
static void superioattach(struct device *, struct device *, void *);
static int superioprint(void *, const char *);
struct cfattach superio_ca = {
sizeof(struct superio_softc), superiomatch, superioattach
};
extern struct cfdriver superio_cd;
#define superio_reg_read(s,r) \
((u_int8_t)bus_space_read_4((s)->sc_bust,(s)->sc_bush,(r)))
#define superio_reg_write(s,r,v) \
bus_space_write_4((s)->sc_bust,(s)->sc_bush,(r),(u_int32_t)(v)&0xff)
static int superio_bs_map(void *, bus_addr_t, bus_size_t,
int, bus_space_handle_t *);
static void superio_bs_unmap(void *, bus_space_handle_t, bus_size_t);
static int superio_bs_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 *);
static void superio_bs_free(void *, bus_space_handle_t, bus_size_t);
static u_int8_t superio_bs_read_1(void *, bus_space_handle_t, bus_size_t);
static u_int16_t superio_bs_read_2(void *, bus_space_handle_t, bus_size_t);
static void superio_bs_write_1(void *, bus_space_handle_t,
bus_size_t, u_int8_t);
static void superio_bs_write_2(void *, bus_space_handle_t,
bus_size_t, u_int16_t);
static u_int16_t superio_bs_read_stream_2(void *, bus_space_handle_t,
bus_size_t);
static void superio_bs_write_stream_2(void *, bus_space_handle_t,
bus_size_t, u_int16_t);
static struct sh5_bus_space_tag superio_bus_space_tag = {
NULL,
superio_bs_map,
superio_bs_unmap,
superio_bs_alloc,
superio_bs_free,
NULL,
NULL,
superio_bs_read_1,
superio_bs_read_2,
NULL,
NULL,
superio_bs_write_1,
superio_bs_write_2,
NULL,
NULL,
superio_bs_read_stream_2,
NULL,
NULL,
superio_bs_write_stream_2,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
static int superio_isa_irq_to_inum(int, int *);
static void superio_cfgmode_enable(struct superio_softc *);
static void superio_cfgmode_disable(struct superio_softc *);
static u_int8_t superio_cfgreg_read(struct superio_softc *, int);
static void superio_cfgreg_write(struct superio_softc *, int, u_int8_t);
static struct superio_softc *superio_sc;
struct superio_devs {
u_int8_t sd_irq0;
u_int8_t sd_irq1;
u_int16_t sd_bar0;
u_int16_t sd_bar1;
};
#define SUPERIO_BAR_COM0 0x3f8
#define SUPERIO_BAR_COM1 0x2f8
static struct superio_devs superio_devs[] = {
/* Logical Device 0: FDD */
{0, 0, 0, 0},
/* Logical Device 1: IDE1 */
{14, 0, 0x1f0, 0x3f6},
/* Logical Device 2: IDE2 */
{0, 0, 0, 0},
/* Logical Device 3: LPT */
{7, 0, 0x378, 0},
/* Logical Device 4: UART1 */
{4, 0, SUPERIO_BAR_COM0, 0},
/* Logical Device 5: UART2 */
{3, 0, SUPERIO_BAR_COM1, 0},
/* Logical Device 6: RTC */
{0, 0, 0, 0},
/* Logical Device 7: Keyboard */
{0, 0, 0, 0},
/* Logical Device 8: Aux I/O */
{0, 0, 0, 0}
};
#define SUPERIO_NDEVS (sizeof(superio_devs) / sizeof(struct superio_devs))
#define BH_IS_LAN_DEV(bh) (((bus_addr_t)bh) >= SYSFPGA_OFFSET_LAN)
/*ARGSUSED*/
static int
superiomatch(struct device *parent, struct cfdata *cf, void *args)
{
struct sysfpga_attach_args *sa = args;
if (superio_sc)
return (0);
return (strcmp(sa->sa_name, superio_cd.cd_name) == 0);
}
/*ARGSUSED*/
static void
superioattach(struct device *parent, struct device *self, void *args)
{
struct superio_softc *sc = (struct superio_softc *)self;
struct sysfpga_attach_args *sa = args;
struct isabus_attach_args iba;
int i;
superio_bus_space_tag.bs_cookie = sc;
sc->sc_bust = sa->sa_bust;
bus_space_map(sc->sc_bust, sa->sa_offset,
SUPERIO_REG_SZ, 0, &sc->sc_bush);
superio_cfgmode_enable(sc);
printf(": FDC37C935 Super IO Controller, Id 0x%02x, Revision %d\n",
superio_cfgreg_read(sc, SUPERIO_GLBL_REG_DEVID),
superio_cfgreg_read(sc, SUPERIO_GLBL_REG_DEVREV));
/*
* Power up the relevant devices for Cayman
*/
superio_cfgreg_write(sc, SUPERIO_GLBL_REG_POWER_CTRL, 0x3a);
delay(1000);
/*
* Activate/Deactivate devices as appropriate for Cayman
*/
for (i = 0; i < SUPERIO_NDEVS; i++) {
superio_cfgreg_write(sc, SUPERIO_GLBL_REG_LDN, i);
if (superio_devs[i].sd_irq0 == 0 &&
superio_devs[i].sd_irq1 == 0 &&
superio_devs[i].sd_bar0 == 0 &&
superio_devs[i].sd_bar1 == 0) {
superio_cfgreg_write(sc, SUPERIO_DEV_REG_ACTIVATE, 0);
continue;
}
superio_cfgreg_write(sc, SUPERIO_DEV_REG_BAR0_HI,
(superio_devs[i].sd_bar0 >> 8) & 0xff);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_BAR0_LO,
superio_devs[i].sd_bar0 & 0xff);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_BAR1_HI,
(superio_devs[i].sd_bar1 >> 8) & 0xff);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_BAR1_LO,
superio_devs[i].sd_bar1 & 0xff);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_INT0_SEL,
superio_devs[i].sd_irq0);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_INT1_SEL,
superio_devs[i].sd_irq1);
superio_cfgreg_write(sc, SUPERIO_DEV_REG_ACTIVATE, 1);
}
superio_cfgmode_disable(sc);
sc->sc_isaext = extent_create("isaio", 0, 0xfff, M_DEVBUF, 0, 0, 0);
if (sc->sc_isaext == NULL) {
bus_space_unmap(sc->sc_bust, sc->sc_bush, SUPERIO_REG_SZ);
printf("%s: Failed to create isaio extent\n",
sc->sc_dev.dv_xname);
return;
}
iba.iba_busname = "isa";
iba.iba_iot = &superio_bus_space_tag;
iba.iba_memt = NULL;
iba.iba_dmat = NULL; /* XXX: Should be able to do DMA thru dmac */
iba.iba_ic = (void *)sc;
config_found(self, &iba, superioprint);
}
static int
superioprint(void *arg, const char *cp)
{
if (cp)
printf("isa at %s", cp);
return (UNCONF);
}
static void
superio_cfgmode_enable(struct superio_softc *sc)
{
superio_reg_write(sc, SUPERIO_REG_INDEX, 0x55);
bus_space_barrier(sc->sc_bust, sc->sc_bush,
SUPERIO_REG_INDEX, 4, BUS_SPACE_BARRIER_WRITE);
superio_reg_write(sc, SUPERIO_REG_INDEX, 0x55);
bus_space_barrier(sc->sc_bust, sc->sc_bush,
SUPERIO_REG_INDEX, 4, BUS_SPACE_BARRIER_WRITE);
}
static void
superio_cfgmode_disable(struct superio_softc *sc)
{
superio_reg_write(sc, SUPERIO_REG_INDEX, 0x55);
bus_space_barrier(sc->sc_bust, sc->sc_bush,
SUPERIO_REG_INDEX, 4, BUS_SPACE_BARRIER_WRITE);
}
static u_int8_t
superio_cfgreg_read(struct superio_softc *sc, int reg)
{
superio_reg_write(sc, SUPERIO_REG_INDEX, reg);
bus_space_barrier(sc->sc_bust, sc->sc_bush, SUPERIO_REG_INDEX, 4,
BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
return (superio_reg_read(sc, SUPERIO_REG_DATA));
}
static void
superio_cfgreg_write(struct superio_softc *sc, int reg, u_int8_t val)
{
superio_reg_write(sc, SUPERIO_REG_INDEX, reg);
bus_space_barrier(sc->sc_bust, sc->sc_bush, SUPERIO_REG_INDEX, 4,
BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
superio_reg_write(sc, SUPERIO_REG_DATA, val);
}
/*
* The SuperIO's data bus is only 8-bits wide, but it is connected to
* a 32-bit wide data bus in the FEMI area. Software must access the
* SuperIO using 32-bit operations, where only the lowest 8 bits are
* valid.
*
* This implies that any `address', `size' or `offset' value we get
* passed here needs to be scaled appropriately.
*/
static int
superio_bs_map(void *arg, bus_addr_t addr, bus_size_t size,
int flags, bus_space_handle_t *hp)
{
struct superio_softc *sc = arg;
int rv;
if (addr < SYSFPGA_OFFSET_LAN) {
addr *= 4;
size *= 4;
if (sc->sc_isaext)
rv = extent_alloc_region(sc->sc_isaext,
addr, size, EX_NOWAIT);
if (rv != 0)
return (rv);
}
else
if (addr > (SYSFPGA_OFFSET_LAN + SMC_IOSIZE))
return (EINVAL);
*hp = (bus_space_handle_t) addr;
return (rv);
}
/*ARGSUSED*/
static void
superio_bs_unmap(void *arg, bus_space_handle_t bh, bus_size_t size)
{
struct superio_softc *sc = arg;
bus_addr_t addr = (bus_addr_t)bh;
if (sc->sc_isaext && addr < SYSFPGA_OFFSET_LAN)
extent_free(sc->sc_isaext, (u_long)bh / 4, size * 4, EX_NOWAIT);
}
/*ARGSUSED*/
static int
superio_bs_alloc(void *arg, bus_addr_t rstart, bus_addr_t rend,
bus_size_t size, bus_size_t align, bus_size_t boundary, int flags,
bus_addr_t *addrp, bus_space_handle_t *hp)
{
return (ENOMEM);
}
/*ARGSUSED*/
static void
superio_bs_free(void *arg, bus_space_handle_t bh, bus_size_t size)
{
}
static u_int8_t
superio_bs_read_1(void *arg, bus_space_handle_t bh, bus_size_t off)
{
struct superio_softc *sc = arg;
u_int8_t rv;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
rv = (u_int8_t)bus_space_read_4(sc->sc_bust, sc->sc_bush, off);
} else {
off = (bus_size_t)bh + (off ^ 0x3);
rv = bus_space_read_1(sc->sc_bust, sc->sc_bush, off);
}
return (rv);
}
static u_int16_t
superio_bs_read_2(void *arg, bus_space_handle_t bh, bus_size_t off)
{
struct superio_softc *sc = arg;
u_int32_t reg;
u_int16_t rv;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
reg = bus_space_read_4(sc->sc_bust, sc->sc_bush, off);
rv = reg & 0xff;
reg = bus_space_read_4(sc->sc_bust, sc->sc_bush, off + 4);
rv |= (reg & 0xff) << 8;
} else {
off = (bus_size_t)bh + (off ^ 0x2);
rv = bus_space_read_2(sc->sc_bust, sc->sc_bush, off);
}
return (rv);
}
static void
superio_bs_write_1(void *arg, bus_space_handle_t bh, bus_size_t off,
u_int8_t val)
{
struct superio_softc *sc = arg;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
bus_space_write_4(sc->sc_bust, sc->sc_bush, off,
(u_int32_t)val & 0xff);
} else {
off = (bus_size_t)bh + (off ^ 0x3);
bus_space_write_1(sc->sc_bust, sc->sc_bush, off, val);
}
}
static void
superio_bs_write_2(void *arg, bus_space_handle_t bh, bus_size_t off,
u_int16_t val)
{
struct superio_softc *sc = arg;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
bus_space_write_4(sc->sc_bust, sc->sc_bush, off,
(u_int32_t)val & 0xff);
bus_space_write_4(sc->sc_bust, sc->sc_bush, off + 4,
(u_int32_t)(val >> 8) & 0xff);
} else {
off = (bus_size_t)bh + (off ^ 0x2);
bus_space_write_2(sc->sc_bust, sc->sc_bush, off, val);
}
}
static u_int16_t
superio_bs_read_stream_2(void *arg, bus_space_handle_t bh, bus_size_t off)
{
struct superio_softc *sc = arg;
u_int32_t reg;
u_int16_t rv;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
reg = bus_space_read_4(sc->sc_bust, sc->sc_bush, off);
rv = reg & 0xff;
reg = bus_space_read_4(sc->sc_bust, sc->sc_bush, off + 4);
rv = (rv << 8) | (reg & 0xff);
} else {
off = (bus_size_t)bh + (off ^ 0x2);
rv = bus_space_read_stream_2(sc->sc_bust, sc->sc_bush, off);
}
return (rv);
}
static void
superio_bs_write_stream_2(void *arg, bus_space_handle_t bh, bus_size_t off,
u_int16_t val)
{
struct superio_softc *sc = arg;
if (!BH_IS_LAN_DEV(bh)) {
off = (bus_size_t)bh + (off * 4);
bus_space_write_4(sc->sc_bust, sc->sc_bush, off,
(u_int32_t)(val >> 8) & 0xff);
bus_space_write_4(sc->sc_bust, sc->sc_bush, off + 4,
(u_int32_t)val & 0xff);
} else {
off = (bus_size_t)bh + (off ^ 0x2);
bus_space_write_stream_4(sc->sc_bust, sc->sc_bush, off, val);
}
}
static int
superio_isa_irq_to_inum(int irq, int *level)
{
int inum;
switch (irq) {
case 1:
inum = SYSFPGA_SUPERIO_INUM_KBD;
*level = IPL_TTY;
break;
case 3:
inum = SYSFPGA_SUPERIO_INUM_UART2;
*level = IPL_SERIAL;
break;
case 4:
inum = SYSFPGA_SUPERIO_INUM_UART1;
*level = IPL_SERIAL;
break;
case 7:
inum = SYSFPGA_SUPERIO_INUM_LPT;
*level = IPL_TTY;
break;
case 10:
inum = SYSFPGA_SUPERIO_INUM_LAN;
*level = IPL_NET;
break;
case 12:
inum = SYSFPGA_SUPERIO_INUM_MOUSE;
*level = IPL_TTY;
break;
case 14:
inum = SYSFPGA_SUPERIO_INUM_IDE;
*level = IPL_BIO;
break;
default:
inum = -1;
break;
}
return (inum);
}
/*ARGSUSED*/
void
isa_attach_hook(struct device *parent, struct device *self,
struct isabus_attach_args *iba)
{
iba->iba_ic = superio_sc;
}
/*ARGSUSED*/
const struct evcnt *
isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
{
return (sysfpga_intr_evcnt(SYSFPGA_IGROUP_SUPERIO));
}
int
isa_intr_alloc(isa_chipset_tag_t ic, int mask, int type, int *irq)
{
return (EINVAL);
}
/*ARGSUSED*/
void *
isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level,
int (*handler)(void *), void *arg)
{
void *ih;
int inum;
int shlev;
if (type != IST_EDGE)
return (NULL);
if ((inum = superio_isa_irq_to_inum(irq, &shlev)) < 0)
return (NULL);
KDASSERT(level == shlev);
ih = sysfpga_intr_establish(SYSFPGA_IGROUP_SUPERIO, shlev, inum,
handler, arg);
return (ih);
}
void
isa_intr_disestablish(isa_chipset_tag_t ic, void *cookie)
{
sysfpga_intr_disestablish(cookie);
}
/*
* Dummy ISA DMA routines
*/
/*ARGSUSED*/
void
isa_dmainit(struct isa_dma_state *ids, bus_space_tag_t bt,
bus_dma_tag_t dt, struct device *dev)
{
}
/*ARGSUSED*/
bus_size_t
isa_dmamaxsize(struct isa_dma_state *ids, int chan)
{
return (0);
}
/*ARGSUSED*/
int
isa_dmamap_create(struct isa_dma_state *ids, int chan,
bus_size_t size, int flags)
{
return (EINVAL);
}
/*ARGSUSED*/
int
isa_dmastart(struct isa_dma_state *ids, int chan, void *addr,
bus_size_t nbytes, struct proc *p, int flags, int busdmaflags)
{
return (EINVAL);
}
/*ARGSUSED*/
int
isa_dmadone(struct isa_dma_state *ids, int chan)
{
return (EINVAL);
}
#if NCOM > 0
/*
* Helper function for using one of the Super IO's com ports as console
*/
int
superio_console_tag(bus_space_tag_t bt, int port,
bus_space_tag_t *tp, bus_addr_t *ap)
{
static struct superio_softc sc;
bus_addr_t base;
u_int8_t reg;
if (bus_space_map(bt, SYSFPGA_OFFSET_SUPERIO, SUPERIO_REG_SZ, 0,
&sc.sc_bush))
return (-1);
sc.sc_bust = bt;
switch (port) {
case 0:
base = SUPERIO_BAR_COM0;
break;
case 1:
base = SUPERIO_BAR_COM1;
break;
default:
return (-1);
}
*tp = &superio_bus_space_tag;
*ap = base;
/*
* Ensure the relevant com port is enabled
*/
superio_cfgmode_enable(&sc);
reg = superio_cfgreg_read(&sc, SUPERIO_GLBL_REG_POWER_CTRL);
reg |= (1 << (4 + port));
superio_cfgreg_write(&sc, SUPERIO_GLBL_REG_POWER_CTRL, reg);
superio_cfgmode_disable(&sc);
return (0);
}
#endif

View File

@ -0,0 +1,107 @@
/* $NetBSD: superioreg.h,v 1.1 2002/07/05 13:31:38 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_SUPERIOREG_H
#define _EVBSH5_SUPERIOREG_H
#define SUPERIO_REG_SZ 0x1000
#define SUPERIO_REG_INDEX 0xfc0
#define SUPERIO_REG_DATA 0xfc4
/*
* Global Configuration Registers
*/
#define SUPERIO_GLBL_REG_CONFIG 0x02
#define SUPERIO_GLBL_REG_INDEX 0x03
#define SUPERIO_GLBL_REG_LDN 0x07
#define SUPERIO_GLBL_REG_DEVID 0x20
#define SUPERIO_GLBL_REG_DEVREV 0x21
#define SUPERIO_GLBL_REG_POWER_CTRL 0x22
#define SUPERIO_GLBL_POWER_CTRL_FDC (1<<0) /* FDC Power Enable */
#define SUPERIO_GLBL_POWER_CTRL_IDE1 (1<<1) /* IDE1 Power Enable */
#define SUPERIO_GLBL_POWER_CTRL_IDE2 (1<<2) /* IDE2 Power Enable */
#define SUPERIO_GLBL_POWER_CTRL_LPT (1<<3) /* Printer Power Enable */
#define SUPERIO_GLBL_POWER_CTRL_UART1 (1<<4) /* UART1 Power Enable */
#define SUPERIO_GLBL_POWER_CTRL_UART2 (1<<5) /* UART2 Power Enable */
#define SUPERIO_GLBL_REG_POWER_MGMT 0x23
#define SUPERIO_GLBL_POWER_MGMT_FDC (1<<0) /* FDC Power Management */
#define SUPERIO_GLBL_POWER_MGMT_IDE1 (1<<1) /* IDE1 Power Management */
#define SUPERIO_GLBL_POWER_MGMT_IDE2 (1<<2) /* IDE2 Power Management */
#define SUPERIO_GLBL_POWER_MGMT_LPT (1<<3) /* Printer Power Management */
#define SUPERIO_GLBL_POWER_MGMT_UART1 (1<<4) /* UART1 Power Management */
#define SUPERIO_GLBL_POWER_MGMT_UART2 (1<<5) /* UART2 Power Management */
#define SUPERIO_GLBL_REG_OSC 0x24
#define SUPERIO_GLBL_REG_TEST1 0x2d
#define SUPERIO_GLBL_REG_TEST2 0x2e
#define SUPERIO_GLBL_REG_TEST3 0x2f
/*
* Generic Device Configuration Registers
*/
#define SUPERIO_DEV_REG_ACTIVATE 0x30
#define SUPERIO_DEV_REG_BAR0_HI 0x60
#define SUPERIO_DEV_REG_BAR0_LO 0x61
#define SUPERIO_DEV_REG_BAR1_HI 0x62
#define SUPERIO_DEV_REG_BAR1_LO 0x63
#define SUPERIO_DEV_REG_INT0_SEL 0x70
#define SUPERIO_DEV_REG_INT1_SEL 0x71
#define SUPERIO_DEV_REG_DMA_SEL 0x74
#define SUPERIO_DEV_REG_MODE 0xf0
#define SUPERIO_DEV_REG_OPTION 0xf1
/*
* FDD-Specific Configuration Registers
*/
#define SUPERIO_FDD_REG_TYPE 0xf2
#define SUPERIO_FDD_REG_FDD0 0xf4
#define SUPERIO_FDD_REG_FDD1 0xf5
/*
* Logical Device Numbers
*/
#define SUPERIO_LDN_FDD 0
#define SUPERIO_LDN_IDE1 1
#define SUPERIO_LDN_IDE2 2
#define SUPERIO_LDN_LPT 3
#define SUPERIO_LDN_UART1 4
#define SUPERIO_LDN_UART2 5
#define SUPERIO_LDN_RTC 6
#define SUPERIO_LDN_KEYBOARD 7
#define SUPERIO_LDN_AUXIO 8
#endif /* _EVBSH5_SUPERIOREG_H */

View File

@ -0,0 +1,54 @@
/* $NetBSD: superiovar.h,v 1.1 2002/07/05 13:31:39 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_SUPERIOVAR_H
#define _EVBSH5_SUPERIOVAR_H
/*
* This is only compiled in when the com(4) is specified in the kernel
* config file where there is a chance that com0 will be used as the
* system console.
*
* It is passed a tag which can be used to access the Super IO's
* registers at their standard system FPGA offset, the com port to be
* used as console, and pointers to a tag and an offset suitable for
* passing directly to comcnattach().
*/
extern int superio_console_tag(bus_space_tag_t, int,
bus_space_tag_t *, bus_addr_t *);
#endif /* _EVBSH5_SUPERIOVAR_H */

View File

@ -0,0 +1,329 @@
/* $NetBSD: sysfpga.c,v 1.1 2002/07/05 13:31:39 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/* Cayman's System FPGA Chip */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <sh5/dev/femivar.h>
#include <sh5/dev/intcreg.h>
#include <evbsh5/dev/sysfpgareg.h>
#include <evbsh5/dev/sysfpgavar.h>
struct sysfpga_ihandler {
int (*ih_func)(void *);
void *ih_arg;
int ih_level;
int ih_group;
int ih_inum;
};
struct sysfpga_softc {
struct device sc_dev;
bus_space_tag_t sc_bust;
bus_space_handle_t sc_bush;
void *sc_ih[SYSFPGA_NGROUPS];
struct sysfpga_ihandler sc_ih_superio[SYSFPGA_SUPERIO_NINTR];
u_int8_t sc_intmr[SYSFPGA_NGROUPS];
};
static int sysfpgamatch(struct device *, struct cfdata *, void *);
static void sysfpgaattach(struct device *, struct device *, void *);
static int sysfpgaprint(void *, const char *);
struct cfattach sysfpga_ca = {
sizeof(struct sysfpga_softc), sysfpgamatch, sysfpgaattach
};
extern struct cfdriver sysfpga_cd;
/*
* Devices which hang off the System FPGA
*/
struct sysfpga_device {
const char *sd_name;
bus_addr_t sd_offset;
};
static struct sysfpga_device sysfpga_devices[] = {
{"superio", SYSFPGA_OFFSET_SUPERIO},
{NULL, 0}
};
#define sysfpga_reg_read(s,r) \
bus_space_read_4((s)->sc_bust, (s)->sc_bush, (r))
#define sysfpga_reg_write(s,r,v) \
bus_space_write_4((s)->sc_bust, (s)->sc_bush, (r), (v))
static int sysfpga_intr_handler_irl1(void *);
static int sysfpga_intr_dispatch(struct sysfpga_softc *,
struct sysfpga_ihandler *, int);
static const char *sysfpga_cpuclksel[] = {
"400/200/100MHz", "400/200/66MHz", "400/200/50MHz", "<invalid>"
};
static struct sysfpga_softc *sysfpga_sc;
/*ARGSUSED*/
static int
sysfpgamatch(struct device *parent, struct cfdata *cf, void *args)
{
if (sysfpga_sc)
return (0);
return (cf->cf_driver == &sysfpga_cd);
}
/*ARGSUSED*/
static void
sysfpgaattach(struct device *parent, struct device *self, void *args)
{
struct sysfpga_softc *sc = (struct sysfpga_softc *)self;
struct femi_attach_args *fa = args;
struct sysfpga_attach_args sa;
u_int32_t reg;
int i;
sysfpga_sc = sc;
sc->sc_bust = fa->fa_bust;
bus_space_map(sc->sc_bust, fa->fa_offset + SYSFPGA_OFFSET_REGS,
SYSFPGA_REG_SZ, 0, &sc->sc_bush);
reg = sysfpga_reg_read(sc, SYSFPGA_REG_DATE);
printf(
": Cayman System FPGA, Revision: %d - %02x/%02x/%02x (yy/mm/dd)\n",
SYSFPGA_DATE_REV(reg), SYSFPGA_DATE_YEAR(reg),
SYSFPGA_DATE_MONTH(reg), SYSFPGA_DATE_DATE(reg));
reg = sysfpga_reg_read(sc, SYSFPGA_REG_BDMR);
printf("%s: CPUCLKSEL: %s, CPU Clock Mode: %d\n", sc->sc_dev.dv_xname,
sysfpga_cpuclksel[SYSFPGA_BDMR_CPUCLKSEL(reg)],
SYSFPGA_CPUMR_CLKMODE(sysfpga_reg_read(sc, SYSFPGA_REG_CPUMR)));
memset(sc->sc_ih_superio, 0, sizeof(sc->sc_ih_superio));
for (i = 0; i < SYSFPGA_NGROUPS; i++) {
sysfpga_reg_write(sc, SYSFPGA_REG_INTMR(i), 0);
sc->sc_intmr[i] = 0;
}
/*
* Hook interrupts from the Super IO device
*/
sc->sc_ih[SYSFPGA_IGROUP_SUPERIO] =
sh5_intr_establish(INTC_INTEVT_IRL1, IST_LEVEL, IPL_SUPERIO,
sysfpga_intr_handler_irl1, sc);
if (sc->sc_ih[SYSFPGA_IGROUP_SUPERIO] == NULL)
panic("sysfpga: failed to register superio isr");
/*
* Attach configured children
*/
sa._sa_base = fa->fa_offset;
for (i = 0; sysfpga_devices[i].sd_name != NULL; i++) {
sa.sa_name = sysfpga_devices[i].sd_name;
sa.sa_bust = fa->fa_bust;
sa.sa_dmat = fa->fa_dmat;
sa.sa_offset = sysfpga_devices[i].sd_offset + sa._sa_base;
(void) config_found(self, &sa, sysfpgaprint);
}
}
static int
sysfpgaprint(void *arg, const char *cp)
{
struct sysfpga_attach_args *sa = arg;
if (cp)
printf("%s at %s", sa->sa_name, cp);
printf(" offset 0x%lx", sa->sa_offset - sa->_sa_base);
return (UNCONF);
}
static int
sysfpga_intr_handler_irl1(void *arg)
{
struct sysfpga_softc *sc = arg;
struct sysfpga_ihandler *ih;
u_int8_t intsr0;
int h = 0;
ih = sc->sc_ih_superio;
for (intsr0 = sysfpga_reg_read(sc, 0);
(intsr0 & sc->sc_intmr[0]) != 0;
intsr0 = sysfpga_reg_read(sc, 0)) {
intsr0 &= sc->sc_intmr[0];
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_UART1))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_UART1);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_UART2))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_UART2);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_MOUSE))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_MOUSE);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_KBD))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_KBD);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_LAN))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_LAN);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_IDE))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_IDE);
if (intsr0 & (1 << SYSFPGA_SUPERIO_INUM_LPT))
h |= sysfpga_intr_dispatch(sc, ih,
SYSFPGA_SUPERIO_INUM_LPT);
if (h == 0)
panic("sysfpga: unclaimed IRL1 interrupt: 0x%02x",
intsr0);
}
return (h);
}
static int
sysfpga_intr_dispatch(struct sysfpga_softc *sc, struct sysfpga_ihandler *ih,
int hnum)
{
int h, s;
ih += hnum;
#ifdef DEBUG
if (ih->ih_func == NULL)
panic("sysfpga_intr_dispatch: NULL handler for isr %d", hnum);
#endif
/*
* This splraise() is fine since sysfpga's interrupt handler
* runs at a lower ipl than anything the child drivers could request.
*/
s = splraise(ih->ih_level);
h = (*ih->ih_func)(ih->ih_arg);
splx(s);
return (h);
}
struct evcnt *
sysfpga_intr_evcnt(int group)
{
struct sysfpga_softc *sc = sysfpga_sc;
KDASSERT(group < SYSFPGA_NGROUPS);
KDASSERT(sc->sc_ih[group] != NULL);
return (sh5_intr_evcnt(sc->sc_ih[group]));
}
void *
sysfpga_intr_establish(int group, int level, int inum,
int (*func)(void *), void *arg)
{
struct sysfpga_softc *sc = sysfpga_sc;
struct sysfpga_ihandler *ih;
int s;
switch (group) {
case SYSFPGA_IGROUP_SUPERIO:
KDASSERT(inum < SYSFPGA_SUPERIO_NINTR);
KDASSERT(level >= IPL_SUPERIO);
ih = sc->sc_ih_superio;
break;
default:
return (NULL);
}
KDASSERT(ih->ih_func == NULL);
ih += inum;
ih->ih_level = level;
ih->ih_group = group;
ih->ih_inum = inum;
ih->ih_arg = arg;
ih->ih_func = func;
s = splhigh();
sc->sc_intmr[group] |= 1 << inum;
sysfpga_reg_write(sc, SYSFPGA_REG_INTMR(group), sc->sc_intmr[group]);
splx(s);
return ((void *)ih);
}
void
sysfpga_intr_disestablish(void *cookie)
{
struct sysfpga_softc *sc = sysfpga_sc;
struct sysfpga_ihandler *ih = cookie;
int s;
s = splhigh();
sc->sc_intmr[ih->ih_group] &= ~(1 << ih->ih_inum);
sysfpga_reg_write(sc, SYSFPGA_REG_INTMR(ih->ih_group),
sc->sc_intmr[ih->ih_group]);
splx(s);
ih->ih_func = NULL;
}

View File

@ -0,0 +1,107 @@
/* $NetBSD: sysfpgareg.h,v 1.1 2002/07/05 13:31:39 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _SH5_SYSFPGAREG_H
#define _SH5_SYSFPGAREG_H
/*
* Offsets of the devices in the System FPGA area (Actually FEMI Area 1)
*/
#define SYSFPGA_OFFSET_SUPERIO 0x0000
#define SYSFPGA_OFFSET_LAN 0x1000
#define SYSFPGA_OFFSET_REGS 0x2000
/*
* The System FPGA's registers
*/
#define SYSFPGA_REG_BDMR 0x00 /* Board operating mode register */
#define SYSFPGA_REG_CPUMR 0x04 /* CPU mode register */
#define SYSFPGA_REG_LEDCR 0x08 /* Discrete LED control register */
#define SYSFPGA_REG_INTSR(n) (0x10+((n)*4)) /* Interrupt source registers */
#define SYSFPGA_REG_INTMR(n) (0x20+((n)*4)) /* Interrupt mask registers */
#define SYSFPGA_REG_NMISR 0x30 /* NMI source register */
#define SYSFPGA_REG_NMIMR 0x34 /* NMI mask register */
#define SYSFPGA_REG_LANWAIT 0x40 /* LAN controller wait register */
#define SYSFPGA_REG_IOWAIT 0x44 /* Super IO wait register */
#define SYSFPGA_REG_DATE 0x60 /* FPGA data code register */
#define SYSFPGA_REG_SOFT_RESET 0x80 /* Software reset register */
#define SYSFPGA_REG_SZ 0x200
/*
* Bit definitions for the System FPGA's register
*/
#define SYSFPGA_BDMR_FLBANK (1<<15)
#define SYSFPGA_BDMR_RDYCTRL (1<<12)
#define SYSFPGA_BDMR_PCICLKSEL (1<<11)
#define SYSFPGA_BDMR_BAUDSEL_MASK (3<<9)
#define SYSFPGA_BDMR_BAUDSEL_115200 (0<<9)
#define SYSFPGA_BDMR_BAUDSEL_57600 (1<<9)
#define SYSFPGA_BDMR_BAUDSEL_38400 (2<<9)
#define SYSFPGA_BDMR_CPUCLKSEL(r) (((r)>>7)&3)
#define SYSFPGA_BDMR_SOFTWP (1<<6)
#define SYSFPGA_BDMR_FLWP_BIT (1<<5)
#define SYSFPGA_BDMR_MAPSEL (1<<4)
#define SYSFPGA_BDMR_SOFTMAP_MASK (3<<2)
#define SYSFPGA_BDMR_SOFTMAP_NORMAL (0<<2)
#define SYSFPGA_BDMR_SOFTMAP_EXTERNAL (1<<2)
#define SYSFPGA_BDMR_SOFTMAP_BOOT1 (2<<2)
#define SYSFPGA_BDMR_SOFTMAP_BOOT2 (3<<2)
#define SYSFPGA_BDMR_CS0MAP_MASK (3<<0)
#define SYSFPGA_BDMR_CS0MAP_NORMAL (0<<0)
#define SYSFPGA_BDMR_CS0MAP_EXTERNAL (1<<0)
#define SYSFPGA_BDMR_CS0MAP_BOOT1 (2<<0)
#define SYSFPGA_BDMR_CS0MAP_BOOT2 (3<<0)
#define SYSFPGA_CPUMR_CS0BUSWIDTH(r) (((r)>>7)&3)
#define SYSFPGA_CPUMR_CS0BUSWIDTH_8BIT 0
#define SYSFPGA_CPUMR_CS0BUSWIDTH_16BIT 1
#define SYSFPGA_CPUMR_CS0BUSWIDTH_32BIT 2
#define SYSFPGA_CPUMR_CS0MEMTYPE(r) (((r)>>6)&1)
#define SYSFPGA_CPUMR_CS0MEMTYPE_SRAM 0
#define SYSFPGA_CPUMR_CS0MEMTYPE_MPX 1
#define SYSFPGA_CPUMR_CLKMODE(r) ((r)&7)
#define SYSFPGA_LEDCR_SLED_MASK 1
#define SYSFPGA_LEDCR_SLED_ON 0
#define SYSFPGA_LEDCR_SLED_OFF 1
#define SYSFPGA_DATE_REV(r) ((r) & 0xff)
#define SYSFPGA_DATE_DATE(r) (((r) >> 8) & 0xff)
#define SYSFPGA_DATE_MONTH(r) (((r) >> 16) & 0xff)
#define SYSFPGA_DATE_YEAR(r) (((r) >> 24) & 0xff)
#endif /* _SH5_SYSFPGAREG_H */

View File

@ -0,0 +1,77 @@
/* $NetBSD: sysfpgavar.h,v 1.1 2002/07/05 13:31:39 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _SH5_SYSFPGAVAR_H
#define _SH5_SYSFPGAVAR_H
struct sysfpga_attach_args {
const char *sa_name;
bus_space_tag_t sa_bust;
bus_dma_tag_t sa_dmat;
bus_addr_t sa_offset;
bus_addr_t _sa_base;
};
/*
* Interrupt groups managed by the System FPGA
*/
#define SYSFPGA_IGROUP_FEMI 0
#define SYSFPGA_IGROUP_SUPERIO 1
#define SYSFPGA_IGROUP_PCI1 2
#define SYSFPGA_IGROUP_PCI2 3
#define SYSFPGA_NGROUPS 4
/*
* Super IO generates the following interrupts
*/
#define SYSFPGA_SUPERIO_INUM_DCD 0 /* XXX: Not strictly SuperIO! */
#define SYSFPGA_SUPERIO_INUM_LAN 1 /* XXX: Not strictly SuperIO! */
#define SYSFPGA_SUPERIO_INUM_KBD 2
#define SYSFPGA_SUPERIO_INUM_UART2 3
#define SYSFPGA_SUPERIO_INUM_UART1 4
#define SYSFPGA_SUPERIO_INUM_LPT 5
#define SYSFPGA_SUPERIO_INUM_MOUSE 6
#define SYSFPGA_SUPERIO_INUM_IDE 7
#define SYSFPGA_SUPERIO_NINTR 8
struct evcnt;
extern struct evcnt *sysfpga_intr_evcnt(int);
extern void *sysfpga_intr_establish(int, int, int, int (*)(void *), void *);
extern void sysfpga_intr_disestablish(void *);
#endif /* _SH5_SYSFPGAVAR_H */

View File

@ -0,0 +1,184 @@
/* $NetBSD: cons_machdep.c,v 1.1 2002/07/05 13:31:40 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*
* Machine-dependent Console Initialisation
*
* XXX: Needs a rototil.
*/
#include "com.h"
#include "scif.h"
#include "dtfcons.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/termios.h>
#include <sys/ttydefaults.h>
#include <machine/bus.h>
#include <evbsh5/evbsh5/machdep.h>
#include <evbsh5/dev/superiovar.h>
#include <dev/cons.h>
#if NCOM > 0
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
dev_type_cnprobe(comcnprobe);
dev_type_cninit(comcninit);
cdev_decl(com);
static bus_space_tag_t comtag;
static bus_addr_t comaddr;
#endif
#if NSCIF > 0
#include <sh5/dev/scifreg.h>
#include <sh5/dev/scifvar.h>
/* XXX: Gross hack until scif is re-written */
bus_space_tag_t _sh5_scif_bt;
bus_space_handle_t _sh5_scif_bh;
#endif
#if NDTFCONS > 0
#include <sh5/dev/dtfconsvar.h>
cdev_decl(dtfcons);
dev_type_cnprobe(dtfconscnprobe);
dev_type_cninit(dtfconscninit);
#endif
/*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
* to choose and initialize a console.
*/
void
consinit(void)
{
#if NSCIF > 0
_sh5_scif_bt = &_sh5_bus_space_tag;
bus_space_subregion(_sh5_scif_bt, _evbsh5_bh_pbridge,
PBRIDGE_OFFSET_SCIF, SCIF_REG_SZ, &_sh5_scif_bh);
#endif
/*
* Initialize the console before we print anything out.
*/
cninit();
#ifdef DDB
{
extern int end;
extern int *esym;
ddb_init((int)esym - (int)&end - sizeof(Elf32_Ehdr),
(void *)&end, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif
}
#if NCOM > 0
void
comcnprobe(struct consdev *cn)
{
bus_space_handle_t bh;
int i, pri = CN_DEAD;
i = superio_console_tag(&_sh5_bus_space_tag, 0, &comtag, &comaddr);
if (i < 0)
goto done;
i = bus_space_map(comtag, comaddr, COM_NPORTS, 0, &bh);
if (i)
goto done;
i = comprobe1(comtag, bh);
bus_space_unmap(comtag, bh, COM_NPORTS);
if (i == 0)
goto done;
for (i = 0; i < nchrdev; i++)
if (cdevsw[i].d_open == comopen)
break;
cn->cn_dev = makedev(i, 0);
pri = CN_NORMAL;
done:
cn->cn_pri = pri;
}
void
comcninit(struct consdev *cn)
{
comcnattach(comtag, comaddr, TTYDEF_SPEED, COM_FREQ, TTYDEF_CFLAG);
}
#endif /* NCOM > 0 */
#if NDTFCONS > 0
void
dtfconscnprobe(struct consdev *cn)
{
int i;
for (i = 0; i < nchrdev; i++)
if (cdevsw[i].d_open == dtfconsopen)
break;
cn->cn_dev = makedev(i, 0);
cn->cn_pri = CN_NORMAL;
}
void
dtfconscninit(struct consdev *cn)
{
dtfcons_cnattach();
}
#endif /* NDTFCONS > 0 */

View File

@ -0,0 +1,192 @@
/* $NetBSD: locore.S,v 1.1 2002/07/05 13:31:40 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "assym.h"
#include <machine/asm.h>
.section .text
.align 3
/*
* The main entry point.
*
* The bootloader (to be written) will have stashed the boot parameters
* in r56 - r62
*/
GLOBAL(text)
.globl start
start:
LDC32(SH5_CONREG_SR_IMASK_ALL|SH5_CONREG_SR_BL|SH5_CONREG_SR_MD, r0)
putcon r0, ssr
pta/u 1f, tr0 /* PC-Relative */
pta/u 1f, tr1
pta/u 1f, tr2
pta/u 1f, tr3
pta/u 1f, tr4
pta/u 1f, tr5
pta/u 1f, tr6
pta/u 1f, tr7
gettr tr0, r0
putcon r0, spc
synco
rte
nop
nop
nop
nop
nop
/*
* The SR is sane. Go initialise the TLB, Cache and MMU.
*/
1: LEAF(Lmapped_start, r18)
LDUC32(0x80000000, r2)
pta/l Lsh5_stb1_init, tr0
blink tr0, r63
/*
* We are now running mapped in KSEG0, with the MMU enabled.
*/
Lmapped_start:
LDC32(0x02000000, r56)
LEA(_C_LABEL(edata), r0)
LEA(_C_LABEL(end), r1)
pta/u 1f, tr0
1: st.q r0, 0, r63 /* Clear BSS */
addi r0, 8, r0
bgtu/l r1, r0, tr0
LEA(_C_LABEL(evbsh5_bootparams), r0)
st.q r0, 0, r56 /* Save boot parameters */
st.q r0, 8, r57
st.q r0, 16, r58
st.q r0, 24, r59
st.q r0, 32, r60
st.q r0, 40, r61
st.q r0, 48, r62
/*
* Do generic runtime environment initialisation
*/
LEAF(Lsh5_init_env, r0)
ptabs/l r0, tr0
blink tr0, r18
/* Now safe to call C code */
/*
* Do basic pre-pmap initialisation. This is mostly to do with
* sizing physical memory.
*
* vaddr_t evbsh5_memory_init(vaddr_t endkernel, struct mem_region *mr);
*/
LEA(_C_LABEL(end), r2)
LEA(Lmem_regions, r3)
LEAF(_C_LABEL(evbsh5_memory_init), r0)
ptabs/l r0, tr0
blink tr0, r18
/*
* Bootstrap the pmap:
*
* void pmap_bootstrap(vaddr_t avail, struct mem_region *mr);
*/
LEA(Lmem_regions, r3)
LEAF(_C_LABEL(pmap_bootstrap), r0)
ptabs/l r0, tr0
blink tr0, r18
/*
* We can now deal with exceptions, particularly TLB misses
*/
getcon sr, r1
movi 1, r0
shlli r0, SH5_CONREG_SR_BL_SHIFT, r0
andc r1, r0, r1
putcon r1, sr
/*
* Secondary initialisation. The pmap has been set up enough
* to map device register into kernel virtual address space.
*/
LEAF(_C_LABEL(evbsh5_init), r0)
ptabs/l r0, tr0
blink tr0, r18
/*
* Just about set to call main(). All that's left is to
* enable interrupts.
*/
getcon sr, r1
movi SH5_CONREG_SR_IMASK_ALL, r0
andc r1, r0, r1
putcon r1, sr
LEAF(_C_LABEL(main), r0) /* Call main(), never to return */
ptabs/l r0, tr0
blink tr0, r18
/*NOTREACHED*/
pta/l 1f, tr0 /* But just in case ... */
1: nop
blink tr0, r63
.comm Lmem_regions,SIZEOF_MEM_REGION*2,8
/*
* Pull in the common SH5 locore code
*/
#include <sh5/sh5/exception.S>
#include <sh5/sh5/locore_subr.S>
#include <sh5/sh5/cpu_switch.S>
#include <sh5/sh5/stb1_locore.S>
#include <sh5/sh5/sigcode.S>
#include <sh5/sh5/bus_subr.S>
#include "dtfcons.h"
#if NDTFCONS > 0
.section .data
.balign 64
GLOBAL(_evbsh5_dtf_buffer)
.space 4096,0
#endif

View File

@ -0,0 +1,339 @@
/* $NetBSD: machdep.c,v 1.1 2002/07/05 13:31:40 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#include "dtfcons.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/param.h>
#include <machine/memregion.h>
#include <machine/bootparams.h>
#include <machine/cacheops.h>
#include <uvm/uvm_extern.h>
#include <sh5/pmap.h>
#include <sh5/sh5/stb1var.h>
#include <sh5/sh5/dtf_comms.h>
#include <sh5/dev/superhywayvar.h>
#include <sh5/dev/pbridgereg.h>
#include <sh5/dev/rtcreg.h>
#include <sh5/dev/rtcvar.h>
#include <evbsh5/evbsh5/machdep.h>
static void compute_ctc_tick_per_us(void);
struct boot_params evbsh5_bootparams;
struct vm_map *exec_map;
struct vm_map *mb_map;
struct vm_map *phys_map;
char machine[] = MACHINE;
char cpu_model[128];
/*
* Physical addresses of important devices on the Cayman board
* which need to be mapped early on during bootstrap to gain
* access to configuration information.
*/
#define EVBSH5_SYSFPGA_PHYS_ADDR 0x04000000
#define EVBSH5_SYSFPGA_LEN 0x00004000
#define EVBSH5_PBRIDGE_PHYS_ADDR \
(SUPERHYWAY_PPORT_TO_BUSADDR(0x09) + PBRIDGE_OFFSET_BASE)
#define EVBSH5_PBRIDGE_LEN PBRIDGE_REG_SZ
/*
* Handles through which the above device regions can be accessed.
*/
bus_space_handle_t _evbsh5_bh_pbridge;
bus_space_handle_t _evbsh5_bh_sysfpga;
vaddr_t
evbsh5_memory_init(vaddr_t endkernel, struct mem_region *mr)
{
u_long ksize;
endkernel = sh5_round_page(endkernel);
ksize = endkernel - SH5_KSEG0_BASE;
mr[0].mr_start = 0x80000000 + ksize;
mr[0].mr_kvastart = SH5_KSEG0_BASE + ksize;
mr[0].mr_size = sh5_trunc_page(evbsh5_bootparams.bp_physramsize)- ksize;
mr[1].mr_start = 0;
mr[1].mr_size = 0;
return (endkernel);
}
void
evbsh5_init(void)
{
#if NDTFCONS > 0
extern char *_dtf_buffer;
extern void _dtf_trap_frob(void);
vaddr_t dtfbuf;
paddr_t frob_p;
#endif
/*
* Fix up the cpu-specific TLB/cache manipulation functions
*/
__cpu_tlbinv = _sh5_stb1_tlbinv;
__cpu_tlbinv_cookie = _sh5_stb1_tlbinv_cookie;
__cpu_tlbinv_all = _sh5_stb1_tlbinv_all;
__cpu_tlbload = _sh5_stb1_tlbload;
__cpu_cache_purge = _sh5_stb1_cache_purge;
__cpu_cache_invalidate = _sh5_stb1_cache_invalidate;
#if NDTFCONS > 0
dtfbuf = (vaddr_t) &_dtf_buffer;
frob_p = (paddr_t) (uintptr_t) _dtf_trap_frob;
frob_p = 0x80000000 + (frob_p - SH5_KSEG0_BASE);
dtf_init(0xc100018, frob_p,
(paddr_t)(0x80000000 + (dtfbuf - SH5_KSEG0_BASE)), dtfbuf);
#endif
/*
* Map the on-chip devices behind the peripheral bridge
*/
bus_space_map(&_sh5_bus_space_tag, EVBSH5_PBRIDGE_PHYS_ADDR,
EVBSH5_PBRIDGE_LEN, 0, &_evbsh5_bh_pbridge);
/*
* Map the system FPGA/Super IO area
*/
bus_space_map(&_sh5_bus_space_tag, EVBSH5_SYSFPGA_PHYS_ADDR,
EVBSH5_SYSFPGA_LEN, 0, &_evbsh5_bh_sysfpga);
/*
* Figure out how fast the CPU is
*
* XXX: Should just read the relevant system FPGA bits ...
*/
compute_ctc_tick_per_us();
}
static void
compute_ctc_tick_per_us(void)
{
#ifndef SIMULATED_CLOCK
bus_space_tag_t bt;
bus_space_handle_t bh;
register_t ctcstart, ctcstop;
u_int8_t r64cnt;
bt = &_sh5_bus_space_tag;
/*
* Map the RTC's registers
*/
bus_space_subregion(bt, _evbsh5_bh_pbridge, PBRIDGE_OFFSET_RTC,
RTC_REG_SIZE, &bh);
bus_space_write_1(bt, bh, RTC_REG_RCR1, 0);
bus_space_write_1(bt, bh, RTC_REG_RCR2, RTC_RCR2_START|RTC_RCR2_RTCEN);
/*
* Set the cpu cycle counter to a reasonably high value such that
* it won't wrap around in the loop
*/
ctcstart = 0xffffffff;
/*
* Fetch the current value of the 128Hz RTC counter and
* add 16 so we can time the loop to pretty much exactly 125mS
*/
r64cnt = (rtc_read_r64cnt(bt, bh) + 16) & RTC_R64CNT_MASK;
__asm __volatile("putcon %0, ctc" :: "r"(ctcstart));
/*
* Wait 125mS
*/
while (rtc_read_r64cnt(bt, bh) != r64cnt)
;
__asm __volatile("getcon ctc, %0" : "=r"(ctcstop));
/*
* Compute the number of CTC ticks per micro-second, for use
* in the delay() loop.
*/
_sh5_ctc_ticks_per_us = (ctcstart - ctcstop) / 125000;
bus_space_unmap(bt, bh, RTC_REG_SIZE);
#else
_sh5_ctc_ticks_per_us = 300;
#endif
}
void
cpu_startup(void)
{
unsigned i;
caddr_t v;
int base, residual;
vaddr_t minaddr, maxaddr;
vsize_t size;
char pbuf[16];
strcpy(cpu_model, "SuperH SH-5 STB1");
/*
* Find out how much space we need, allocate it,
* and then give everything true virtual addresses.
*/
size = (vsize_t)allocsys(NULL, NULL);
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
panic("startup: no room for tables");
if ((allocsys(v, NULL) - v) != size)
panic("startup: table size inconsistency");
/*
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
size = MAXBSIZE * nbuf;
if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
UVM_ADV_NORMAL, 0)) != 0)
panic("startup: cannot allocate VM for buffers");
minaddr = (vaddr_t)buffers;
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
vsize_t curbufsize;
vaddr_t curbuf;
struct vm_page *pg;
/*
* Each buffer has MAXBSIZE bytes of VM space allocated. Of
* that MAXBSIZE space, we allocate and map (base+1) pages
* for the first "residual" buffers, and then we allocate
* "base" pages for the rest.
*/
curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
curbufsize = NBPG * ((i < residual) ? (base+1) : base);
while (curbufsize) {
pg = uvm_pagealloc(NULL, 0, NULL, 0);
if (pg == NULL)
panic("cpu_startup: not enough memory for "
"buffer cache");
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ|VM_PROT_WRITE);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
}
pmap_update(pmap_kernel());
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
/*
* Allocate a submap for physio
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
/*
* Finally, allocate mbuf cluster submap.
*/
mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
nmbclusters * mclbytes, VM_MAP_INTRSAFE,
FALSE, NULL);
printf("%s%s\n", version, cpu_model);
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
printf("total memory = %s\n", pbuf);
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
printf("using %d buffers containing %s bytes of memory\n", nbuf, pbuf);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
int
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen, struct proc *p)
{
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
return (EOPNOTSUPP);
}
void
cpu_reboot(int how, char *bootstr)
{
for (;;)
;
}
void
device_register(struct device *dev, void *arg)
{
}

View File

@ -0,0 +1,49 @@
/* $NetBSD: machdep.h,v 1.1 2002/07/05 13:31:40 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_MACHDEP_H
#define _EVBSH5_MACHDEP_H
extern bus_space_handle_t _evbsh5_bh_pbridge;
extern bus_space_handle_t _evbsh5_bh_sysfpga;
struct mem_region;
extern vaddr_t evbsh5_memory_init(vaddr_t, struct mem_region *);
extern void evbsh5_init(void);
#endif /* _EVBSH5_MACHDEP_H */

View File

@ -0,0 +1,109 @@
/* $NetBSD: mainbus.c,v 1.1 2002/07/05 13:31:41 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/* SH5 Evaluation Board Mainbus */
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <sh5/sh5/mainbus.h>
static int mainbusmatch(struct device *, struct cfdata *, void *);
static void mainbusattach(struct device *, struct device *, void *);
static int mainbusprint(void *, const char *);
struct cfattach mainbus_ca = {
sizeof(struct device), mainbusmatch, mainbusattach
};
extern struct cfdriver mainbus_cd;
/*
* Devices which hang off the Peripheral Bridge
*/
static const char *mainbus_devs[] = {"superhyway", NULL};
/*ARGSUSED*/
static int
mainbusmatch(struct device *parent, struct cfdata *cf, void *args)
{
static int mainbus_matched;
if (mainbus_matched)
return (0);
mainbus_matched = 1;
return (1);
}
/*ARGSUSED*/
static void
mainbusattach(struct device *parent, struct device *self, void *args)
{
struct mainbus_attach_args ma;
int i;
printf("\n");
/*
* Attach configured children
*/
for (i = 0; mainbus_devs[i] != NULL; i++) {
ma.ma_bust = &_sh5_bus_space_tag;
ma.ma_dmat = &_sh5_bus_dma_tag;
ma.ma_name = mainbus_devs[i];
(void) config_found(self, &ma, mainbusprint);
}
}
static int
mainbusprint(void *arg, const char *cp)
{
struct mainbus_attach_args *ma = arg;
if (cp)
printf("%s at %s", ma->ma_name, cp);
return (UNCONF);
}

View File

@ -0,0 +1,3 @@
/* $NetBSD: ansi.h,v 1.1 2002/07/05 13:31:41 scw Exp $ */
#include <sh5/ansi.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: aout_machdep.h,v 1.1 2002/07/05 13:31:41 scw Exp $ */
#include <sh5/aout_machdep.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: asm.h,v 1.1 2002/07/05 13:31:41 scw Exp $ */
#include <sh5/asm.h>

View File

@ -0,0 +1,46 @@
/* $NetBSD: bootparams.h,v 1.1 2002/07/05 13:31:42 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_BOOTPARAMS_H
#define _EVBSH5_BOOTPARAMS_H
struct boot_params {
u_int64_t bp_physramsize;
u_int64_t bp_resvd[6];
};
#endif /* _EVBSH5_BOOTPARAMS_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: bswap.h,v 1.1 2002/07/05 13:31:42 scw Exp $ */
#include <sh5/bswap.h>

View File

@ -0,0 +1,45 @@
/* $NetBSD: bus.h,v 1.1 2002/07/05 13:31:42 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_BUS_H
#define _EVBSH5_BUS_H
#include <sh5/bus.h>
#define _BUS_SPACE_NUM_BOOT_MAPPINGS 4
#endif /* _EVBSH5_BUS_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: cacheops.h,v 1.1 2002/07/05 13:31:42 scw Exp $ */
#include <sh5/cacheops.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: cdefs.h,v 1.1 2002/07/05 13:31:43 scw Exp $ */
#include <sh5/cdefs.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: conreg.h,v 1.1 2002/07/05 13:31:43 scw Exp $ */
#include <sh5/conreg.h>

View File

@ -0,0 +1,6 @@
/* $NetBSD: cpu.h,v 1.1 2002/07/05 13:31:43 scw Exp $ */
#define SH5_NEFF_BITS 32
#define SG5_ASID_BITS 8
#include <sh5/cpu.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: disklabel.h,v 1.1 2002/07/05 13:31:43 scw Exp $ */
#include <sh5/disklabel.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: elf_machdep.h,v 1.1 2002/07/05 13:31:44 scw Exp $ */
#include <sh5/elf_machdep.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: endian.h,v 1.1 2002/07/05 13:31:44 scw Exp $ */
#include <sh5/endian.h>

View File

@ -0,0 +1,10 @@
/* $NetBSD: endian_machdep.h,v 1.1 2002/07/05 13:31:44 scw Exp $ */
#ifndef _EVBSH5_ENDIAN_MACHDEP_H
#define _EVBSH5_ENDIAN_MACHDEP_H
#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sh5/endian_machdep.h>
#endif /* _EVBSH5_ENDIAN_MACHDEP_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: frame.h,v 1.1 2002/07/05 13:31:44 scw Exp $ */
#include <sh5/frame.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_const.h,v 1.1 2002/07/05 13:31:44 scw Exp $ */
#include <sh5/int_const.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_fmtio.h,v 1.1 2002/07/05 13:31:45 scw Exp $ */
#include <sh5/int_fmtio.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_limits.h,v 1.1 2002/07/05 13:31:45 scw Exp $ */
#include <sh5/int_limits.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_mwgwtypes.h,v 1.1 2002/07/05 13:31:45 scw Exp $ */
#include <sh5/int_mwgwtypes.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: int_types.h,v 1.1 2002/07/05 13:31:45 scw Exp $ */
#include <sh5/int_types.h>

View File

@ -0,0 +1,48 @@
/* $NetBSD: intr.h,v 1.1 2002/07/05 13:31:46 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_INTR_H
#define _EVBSH5_INTR_H
#include <sh5/intr.h>
#define IPL_SUPERIO 5 /* SuperIO interrupts at this level */
#define splsuperio() splraise(IPL_SUPERIO)
#define spllpt() splsuperio()
#endif /* _EVBSH5_INTR_H */

View File

@ -0,0 +1,72 @@
/* $NetBSD: isa_machdep.h,v 1.1 2002/07/05 13:31:46 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _EVBSH5_ISA_MACHDEP_H
#define _EVBSH5_ISA_MACHDEP_H
/*
* Types provided to machine-independent ISA code
*/
typedef void *isa_chipset_tag_t;
/*
* Functions provided to machine-independent ISA code.
*/
struct device;
struct isabus_attach_args;
extern void isa_attach_hook(struct device *, struct device *,
struct isabus_attach_args *);
extern int isa_intr_alloc(isa_chipset_tag_t, int, int, int *);
extern const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t, int);
extern void *isa_intr_establish(isa_chipset_tag_t, int, int,
int, int (*)(void *), void *);
extern void isa_intr_disestablish(isa_chipset_tag_t, void *);
/*
* We don't support ISA dma, so these are just dummy stubs.
*/
struct isa_dma_state;
extern void isa_dmainit(struct isa_dma_state *, bus_space_tag_t,
bus_dma_tag_t, struct device *);
extern bus_size_t isa_dmamaxsize(struct isa_dma_state *, int);
extern int isa_dmamap_create(struct isa_dma_state *, int, bus_size_t, int);
extern int isa_dmastart(struct isa_dma_state *, int, void *,
bus_size_t, struct proc *, int, int);
extern int isa_dmadone(struct isa_dma_state *, int);
#endif /* _EVBSH5_ISA_MACHDEP_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: limits.h,v 1.1 2002/07/05 13:31:46 scw Exp $ */
#include <sh5/limits.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: lock.h,v 1.1 2002/07/05 13:31:46 scw Exp $ */
#include <sh5/lock.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: memregion.h,v 1.1 2002/07/05 13:31:47 scw Exp $ */
#include <sh5/memregion.h>

View File

@ -0,0 +1,25 @@
/* $NetBSD: param.h,v 1.1 2002/07/05 13:31:47 scw Exp $ */
/*
* XXX: Not sure if these are actually correct for SH-5
*/
#ifndef _EVBSH5_PARAM_H
#define _EVBSH5_PARAM_H
#include <sh5/param.h>
#ifdef __LITTLE_ENDIAN__
#define _MACHINE_ARCH sh5le
#define MACHINE_ARCH "sh5le"
#else
#define _MACHINE_ARCH sh5
#define MACHINE_ARCH "sh5"
#endif
#define _MACHINE evbsh5
#define MACHINE "evbsh5"
#define MID_MACHINE MID_SH5
#endif /* _EVBSH5_PARAM_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: pcb.h,v 1.1 2002/07/05 13:31:47 scw Exp $ */
#include <sh5/pcb.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: pmap.h,v 1.1 2002/07/05 13:31:47 scw Exp $ */
#include <sh5/pmap.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: proc.h,v 1.1 2002/07/05 13:31:48 scw Exp $ */
#include <sh5/proc.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: ptrace.h,v 1.1 2002/07/05 13:31:48 scw Exp $ */
#include <sh5/ptrace.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: reg.h,v 1.1 2002/07/05 13:31:48 scw Exp $ */
#include <sh5/reg.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: setjmp.h,v 1.1 2002/07/05 13:31:48 scw Exp $ */
#include <sh5/setjmp.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: signal.h,v 1.1 2002/07/05 13:31:49 scw Exp $ */
#include <sh5/signal.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: stdarg.h,v 1.1 2002/07/05 13:31:49 scw Exp $ */
#include <sh5/stdarg.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: trap.h,v 1.1 2002/07/05 13:31:49 scw Exp $ */
#include <sh5/trap.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: types.h,v 1.1 2002/07/05 13:31:50 scw Exp $ */
#include <sh5/types.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: varargs.h,v 1.1 2002/07/05 13:31:50 scw Exp $ */
#include <sh5/varargs.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: vmparam.h,v 1.1 2002/07/05 13:31:50 scw Exp $ */
#include <sh5/vmparam.h>

View File

@ -0,0 +1,102 @@
# $NetBSD: Makefile.sh5,v 1.1 2002/07/05 13:31:50 scw Exp $
# Makefile for NetBSD/sh5
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/arch/<machine>/conf/``machineid''
# after which you should do
# config machineid
# CPU generic makefile changes should be made in
# /sys/arch/sh5/conf/Makefile.sh5
# after which config should be rerun for all machines of that type.
#
# To specify debugging, add the config line: makeoptions DEBUG="-g"
# A better way is to specify -g only for a few files.
#
# makeoptions DEBUGLIST="uvm* trap if_*"
MACHINE_ARCH=sh5
USETOOLS?= no
NEED_OWN_INSTALL_TARGET?=no
.include <bsd.own.mk>
##
## (1) port identification
##
THISSH5= $S/arch/${MACHINE}
SH5= $S/arch/sh5
GENASSYM= ${SH5}/sh5/genassym.cf
.-include "${THISSH5}/conf/Makefile.${MACHINE}.inc"
##
## (2) compile settings
##
## The kernel must be compiled to *not* use FPU registers.
##
CC= sh5gcc -D__NetBSD__ -ml -m5-32media-nofpu
AS= sh5gcc -D__NetBSD__ -ml -m5-32media-nofpu
LD= sh5ld -m shlelf32
AR= sh5ar
RANLIB= sh5ranlib
SIZE= sh5size
CPPFLAGS+= -D${MACHINE}
CWARNFLAGS+= -Wno-parentheses
AFLAGS+= -x assembler-with-cpp -traditional-cpp
COPTS?= -O2
##
## (3) libkern and compat
##
##
## (4) local objects, compile rules, and dependencies
##
## locore.S must be assembled with the -no-expand option to prevent
## the assembler from synthesising instructions which use r25.
## Otherwise, interrupt/tlb handlers will lose.
##
MD_OBJS= locore.o
MD_CFILES=
MD_SFILES= ${THISSH5}/${MACHINE}/locore.S
locore.o: ${THISSH5}/${MACHINE}/locore.S assym.h
${NORMAL_S} -Wa,-no-expand
##
## (5) link settings
##
# LINKTEXT possibly set by individual sh5 port
LINKTEXT?= -Ttext 0xc0000000
##
## (6) port specific target dependencies
##
# depend on CPU configuration
locore.o machdep.o: Makefile
##
## (7) misc settings
##
##
## (8) config(8) generated machinery
##
%INCLUDES
%OBJS
%CFILES
%SFILES
%LOAD
%RULES
##
## (9) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"

127
sys/arch/sh5/conf/files.sh5 Normal file
View File

@ -0,0 +1,127 @@
# $NetBSD: files.sh5,v 1.1 2002/07/05 13:31:51 scw Exp $
#
# System bus types
#
define mainbus { }
device mainbus: mainbus
attach mainbus at root
# The SuperHighway Bus
device superhyway { pport }
attach superhyway at mainbus
file arch/sh5/dev/superhyway.c superhyway
# CPUs have a set of control registers on the SuperHighway bus
device cpu
attach cpu at superhyway with cpu_sh
file arch/sh5/dev/cpu_sh.c cpu_sh
# The External Memory Interface
device emi
attach emi at superhyway
file arch/sh5/dev/emi.c emi
# The Peripheral Controller Interface
device pbridge { [ipl = -1], [intevt = -1] }
attach pbridge at superhyway
file arch/sh5/dev/pbridge.c pbridge
# The Flash/External Memory Interface
device femi { offset }
attach femi at superhyway
file arch/sh5/dev/femi.c femi
# The PCI Interface
device pchb
attach pchb at superhyway
file arch/sh5/dev/pchb.c pchb
# XXX: This should really attach under a SuperHyway Debug Link Module
# XXX: It's all a bit of a hack anyway and should ideally go away...
device dtfcons
attach dtfcons at mainbus
file arch/sh5/dev/dtfcons.c dtfcons needs-flag
# Clock, Power and Reset Controller
device cprc { }
attach cprc at pbridge
device clock
attach clock at cprc
device watchdog
attach watchdog at cprc
device power
attach power at cprc
device reset
attach reset at cprc
file arch/sh5/dev/cprc.c cprc & (clock | watchdog | power | reset)
# Interrupt Controller
device intc
attach intc at pbridge
file arch/sh5/dev/intc.c intc
# Timer Unit
device tmu
attach tmu at pbridge
file arch/sh5/dev/tmu.c tmu
# Real-time Clock
device rtc
attach rtc at pbridge
file arch/sh5/dev/rtc.c rtc
# Serial Interface with FIFO
# XXX: Not likely to work at this time.
device scif
attach scif at pbridge
file arch/sh5/dev/scif.c scif needs-flag
#
# Machine-independent SCSI drivers
#
include "dev/scsipi/files.scsipi"
major {sd = 4}
major {st = 5}
major {cd = 6}
#
# Machine-independent ATA drivers
#
include "dev/ata/files.ata"
major {wd = 0}
# Memory Disk for install floppy
file dev/md_root.c memory_disk_hooks
major {md = 17}
# Source files
file arch/sh5/sh5/autoconf.c
file arch/sh5/sh5/bus_dma.c
file arch/sh5/sh5/bus_space.c
file arch/sh5/sh5/conf.c
file arch/sh5/sh5/disksubr.c
file arch/sh5/sh5/dtf_comms.c dtfcons
file arch/sh5/sh5/interrupt.c
file arch/sh5/sh5/mem.c
file arch/sh5/sh5/pmap.c
file arch/sh5/sh5/process_machdep.c
file arch/sh5/sh5/sh5_clock.c
file arch/sh5/sh5/sh5_machdep.c
file arch/sh5/sh5/sig_machdep.c
file arch/sh5/sh5/softintr.c
file arch/sh5/sh5/syscall.c
file arch/sh5/sh5/trap.c
file arch/sh5/sh5/vm_machdep.c
file dev/clock_subr.c
file dev/cons.c
file dev/cninit.c
file arch/sh5/sh5/in_cksum.c inet
file netinet/in4_cksum.c inet
file netns/ns_cksum.c ns

349
sys/arch/sh5/dev/cprc.c Normal file
View File

@ -0,0 +1,349 @@
/* $NetBSD: cprc.c,v 1.1 2002/07/05 13:31:51 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*
* SH-5 Clock, Power and Reset Controller
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <sh5/dev/pbridgevar.h>
#include <sh5/dev/cprcreg.h>
#include <sh5/dev/cprcvar.h>
#include "locators.h"
struct cprc_softc {
struct device sc_dev;
bus_space_tag_t sc_bust;
bus_space_handle_t sc_bush;
};
static int cprcmatch(struct device *, struct cfdata *, void *);
static void cprcattach(struct device *, struct device *, void *);
static int cprcprint(void *, const char *);
struct cfattach cprc_ca = {
sizeof(struct cprc_softc), cprcmatch, cprcattach
};
static u_int32_t cprc_reg_read(u_int);
#ifdef notyet
static void cprc_reg_write(u_int, u_int32_t);
#endif
extern struct cfdriver cprc_cd;
static const char *cprc_subdevs[] =
{"clock", "watchdog", "power", "reset", NULL};
static struct cprc_softc *cprc_sc;
#ifdef notyet
static int watchdog_ipl;
static int watchdog_intevt;
#endif
/*ARGSUSED*/
static int
cprcmatch(struct device *parent, struct cfdata *cf, void *args)
{
struct pbridge_attach_args *pa = args;
if (strcmp(pa->pa_name, cprc_cd.cd_name))
return (0);
KDASSERT(cprc_sc == NULL);
pa->pa_ipl = cf->cf_loc[PBRIDGECF_IPL];
pa->pa_intevt = cf->cf_loc[PBRIDGECF_INTEVT];
return (1);
}
/*ARGSUSED*/
static void
cprcattach(struct device *parent, struct device *self, void *args)
{
struct pbridge_attach_args *pa = args;
struct cprc_softc *sc = (struct cprc_softc *)self;
int i;
#ifdef notyet
watchdog_ipl = pa->pa_ipl;
watchdog_intevt = pa->pa_intevt;
#endif
sc->sc_bust = pa->pa_bust;
bus_space_map(sc->sc_bust, pa->pa_offset, CPRC_REG_SIZE,0,&sc->sc_bush);
cprc_sc = sc;
printf(": Clock, Power and Watchdog/Reset Controller\n");
for (i = 0; cprc_subdevs[i] != NULL; i++) {
if (i == 0 &&
config_found(self, (void *)cprc_subdevs[i], cprcprint) ==
NULL)
panic("%s: no clock driver configured!",self->dv_xname);
}
}
static int
cprcprint(void *arg, const char *cp)
{
if (cp)
printf("%s at %s", (const char *)arg, cp);
return (UNCONF);
}
static u_int32_t
cprc_reg_read(u_int off)
{
return (bus_space_read_4(cprc_sc->sc_bust, cprc_sc->sc_bush, off));
}
#ifdef notyet
static void
cprc_reg_write(u_int off, u_int32_t value)
{
bus_space_write_4(cprc_sc->sc_bust, cprc_sc->sc_bush, off, value);
}
#endif
/******************************************************************************
*
* The clock controller
*/
static int clockmatch(struct device *, struct cfdata *, void *);
static void clockattach(struct device *, struct device *, void *);
struct cfattach clock_ca = {
sizeof(struct device), clockmatch, clockattach
};
extern struct cfdriver clock_cd;
struct cprc_clocks cprc_clocks;
/*ARGSUSED*/
static int
clockmatch(struct device *parent, struct cfdata *cf, void *args)
{
const char *name = args;
return (strcmp(name, clock_cd.cd_name) == 0);
}
/*ARGSUSED*/
static void
clockattach(struct device *parent, struct device *self, void *args)
{
u_int64_t pllfreq;
u_int32_t reg;
reg = cprc_reg_read(CPRC_REG_FRQ);
/*
* First, since we know the CPU clock, and its divider ratio,
* we can easilly figure out the PLL output clock rate from
* which all other clocks are derived.
*/
pllfreq = _sh5_ctc_ticks_per_us *
CPRC_FRQ2DIV((reg >> CPRC_FRQ_IFC_SHIFT) & CPRC_FRQ_MASK);
pllfreq *= 1000000;
cprc_clocks.cc_cpu = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_IFC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_emi = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_EMC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_superhyway = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_BMC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_peripheral = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_PBC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_pci = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_PCC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_femi = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_FMC_SHIFT) & CPRC_FRQ_MASK);
cprc_clocks.cc_stbus = pllfreq /
CPRC_FRQ2DIV((reg >> CPRC_FRQ_SBC_SHIFT) & CPRC_FRQ_MASK);
printf(": PLL frequency - %dMHz\n", (int)(pllfreq/1000000));
printf("%s: External Memory Clock: %dMHz, SuperHyway Clock: %dMHz\n",
self->dv_xname,
cprc_clocks.cc_emi / 1000000, cprc_clocks.cc_superhyway / 1000000);
printf("%s: Peripheral Bus Clock: %dMHz, PCIbus Clock: %dMHz\n",
self->dv_xname,
cprc_clocks.cc_peripheral / 1000000, cprc_clocks.cc_pci / 1000000);
printf("%s: FEMI Bus Clock: %dMHz, ST Legacy Clock: %dMHz\n",
self->dv_xname,
cprc_clocks.cc_femi / 1000000, cprc_clocks.cc_stbus / 1000000);
}
#ifdef notyet
/******************************************************************************
*
* The watchdog controller
*/
struct watchdog_softc {
struct device sc_dev;
void *sc_ih;
};
static int watchdogmatch(struct device *, struct cfdata *, void *);
static void watchdogattach(struct device *, struct device *, void *);
static int watchdogint(void *);
struct cfattach watchdog_ca = {
sizeof(struct watchdog_softc), watchdogmatch, watchdogattach
};
extern struct cfdriver watchdog_cd;
/*ARGSUSED*/
static int
watchdogmatch(struct device *parent, struct cfdata *cf, void *args)
{
const char *name = args;
return (strcmp(name, watchdog_cd.cd_name) == 0);
}
/*ARGSUSED*/
static void
watchdogattach(struct device *parent, struct device *self, void *args)
{
struct watchdog_softc *sc = (struct watchdog_sc *)self;
if (watchdog_ipl == PBRIDGECF_IPL_DEFAULT ||
watchdog_intevt == PBRIDGECF_INTEVT_DEFAULT) {
printf(": Watchdog disabled - ipl/intevt not specified\n");
return;
}
/* TBD: Set up watchdog timer */
printf(": Watchdog enabled\n");
sc->sc_ih = sh5_intr_establish(watchdog_intevt, IST_LEVEL,
watchdog_ipl, watchdogint, sc);
}
/*ARGSUSED*/
static int
watchdogint(void *arg)
{
/* TBD */
}
#endif /* notyet */
#ifdef notyet
/******************************************************************************
*
* The power controller
*/
static int powermatch(struct device *, struct cfdata *, void *);
static void powerattach(struct device *, struct device *, void *);
struct cfattach power_ca = {
sizeof(struct device), powermatch, powerattach
};
extern struct cfdriver power_cd;
/*ARGSUSED*/
static int
powermatch(struct device *parent, struct cfdata *cf, void *args)
{
const char *name = args;
return (strcmp(name, power_cd.cd_name) == 0);
}
/*ARGSUSED*/
static void
powerattach(struct device *parent, struct device *self, void *args)
{
printf(": Power Controller\n");
}
#endif /* notyet */
#ifdef notyet
/******************************************************************************
*
* The reset controller
*/
static int resetmatch(struct device *, struct cfdata *, void *);
static void resetattach(struct device *, struct device *, void *);
struct cfattach reset_ca = {
sizeof(struct device), resetmatch, resetattach
};
extern struct cfdriver reset_cd;
/*ARGSUSED*/
static int
resetmatch(struct device *parent, struct cfdata *cf, void *args)
{
const char *name = args;
return (strcmp(name, reset_cd.cd_name) == 0);
}
/*ARGSUSED*/
static void
resetattach(struct device *parent, struct device *self, void *args)
{
printf(": Reset Controller\n");
/*
* XXX: Need to hook into a generic SH-5 reset front-end
*/
}
#endif /* notyet */

View File

@ -0,0 +1,95 @@
/* $NetBSD: cprcreg.h,v 1.1 2002/07/05 13:31:51 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _SH5_CPRCREG_H
#define _SH5_CPRCREG_H
/*
* Register Offsets for the Clock, Power, Watchdog and Reset Controller Module
*/
#define CPRC_REG_FRQ 0x00 /* Clock: Frequency Control Register */
#define CPRC_REG_PLL 0x08 /* Clock: PLL1 Control Register */
#define CPRC_REG_WTCNT 0x10 /* Watchdog: Count Register */
#define CPRC_REG_WTCS 0x18 /* Watchdog: Control/Status Register */
#define CPRC_REG_MSTP 0x20 /* Power: Module Stop Register */
#define CPRC_REG_MSTPACK 0x28 /* Power: Module Stop Ack Register */
#define CPRC_REG_STBCR 0x30 /* Power: Control Register */
#define CPRC_REG_RST 0x38 /* Reset: Control Register */
#define CPRC_REG_SIZE 0x40
/*
* Bit definitions for CPRC_REG_FRQ
*/
#define CPRC_FRQ_MASK 0x07 /* Mask for clock divider fields */
#define CPRC_FRQ_EMC_SHIFT 0 /* External Memory Clk Divider Ratio */
#define CPRC_FRQ_BMC_SHIFT 3 /* SuperHyway Clock Divider Ratio */
#define CPRC_FRQ_IFC_SHIFT 6 /* CPU Clock Divider Ratio */
#define CPRC_FRQ_PBC_SHIFT 12 /* Peripheral Clock Divider Ratio */
#define CPRC_FRQ_PCC_SHIFT 15 /* PCIbus Clock Divider Ratio */
#define CPRC_FRQ_FMC_SHIFT 18 /* Flash Memory I/F Clk Divider Ratio */
#define CPRC_FRQ_SBC_SHIFT 21 /* ST Legacy Bus Clock Divider Ratio */
#define CPRC_FRQ_PLL2EN 0x0200 /* PLL2 Enable (PLL2 not in eval) */
#define CPRC_FRQ_PLL1EN 0x0400 /* PLL1 Enable */
#define CPRC_FRQ_CKOEN 0x0800 /* Clock output enable (Not in eval) */
/*
* Given an encoded divider ratio from the CPRC_REG_FRQ register, this
* macro evaluates to "1/actual ratio" it represents.
*
* So, the encoding "0" represents the ratio 1/2. In this case,
* the macro evaluates to "2".
*/
#define CPRC_FRQ2DIV(f) (((f)<6)?(((f)+1)*2):(((f)==6)?16:24))
/*
* Bit definitions for CPRC_REG_PLL
*/
#define CPRC_PLL_MDIV_MASK 0xff /* PLL1 Pre-divider */
#define CPRC_PLL_MDIV_SHIFT 0
#define CPRC_PLL_NDIV_MASK 0xff /* PLL1 Feedback divider */
#define CPRC_PLL_NDIV_SHIFT 8
#define CPRC_PLL_PDIV_MASK 0x07 /* PLL1 Post divider */
#define CPRC_PLL_PDIV_SHIFT 16
#define CPRC_PLL_SETUP_MASK 0x1ff /* PLL1 Loop characteristics */
#define CPRC_PLL_SETUP_SHIFT 19
#define CPRC_PLL_ENABLE_MASK 0x03 /* PLL1 Enabling Truth Table */
#define CPRC_PLL_ENABLE_SHIFT 28
#define CPRC_PLL_LOCKED (1<<30) /* PLL1 Locked */
#define CPRC_PLL_POWER (1<<31) /* PLL1 Power Control */
#endif /* _SH5_CPRCREG_H */

View File

@ -0,0 +1,64 @@
/* $NetBSD: cprcvar.h,v 1.1 2002/07/05 13:31:51 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
#ifndef _SH5_CPRCVAR_H
#define _SH5_CPRCVAR_H
/*
* The following structure describes the clock rates of the
* various clock domains provided by the CPRC module. Clock
* rates are expressed in Hz values.
*
* Other drivers in the system can refer to this to determine
* their own clock rates as appropriate.
*
* XXX: Will need to change the "u_int" to "u_long" should
* technology improve to the point where we have > 4GHz cpus :)
*/
struct cprc_clocks {
u_int cc_cpu; /* CPU Clock */
u_int cc_emi; /* External Memory Interface Clock */
u_int cc_superhyway; /* SuperHyway Clock */
u_int cc_peripheral; /* Peripheral Bus Clock */
u_int cc_pci; /* PCI Bus Clock */
u_int cc_femi; /* Flash External Memory Interface Clock */
u_int cc_stbus; /* ST Legacy Bus Clock */
};
extern struct cprc_clocks cprc_clocks;
#endif /* _SH5_CPRCVAR_H */

107
sys/arch/sh5/dev/cpu_sh.c Normal file
View File

@ -0,0 +1,107 @@
/* $NetBSD: cpu_sh.c,v 1.1 2002/07/05 13:31:52 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*
* SH-5 CPU Module
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <sh5/dev/superhywayvar.h>
#include "locators.h"
static int cpu_shmatch(struct device *, struct cfdata *, void *);
static void cpu_shattach(struct device *, struct device *, void *);
struct cfattach cpu_sh_ca = {
sizeof(struct device), cpu_shmatch, cpu_shattach
};
extern struct cfdriver cpu_cd;
#define CPU_SH_MODULE_ID 0x51e2
/*ARGSUSED*/
static int
cpu_shmatch(struct device *parent, struct cfdata *cf, void *args)
{
struct superhyway_attach_args *sa = args;
bus_space_handle_t bh;
u_int64_t vcr;
if (strcmp(sa->sa_name, cpu_cd.cd_name))
return (0);
sa->sa_pport = 0;
bus_space_map(sa->sa_bust,
SUPERHYWAY_PPORT_TO_BUSADDR(cf->cf_loc[SUPERHYWAYCF_PPORT]),
SUPERHYWAY_REG_SZ, 0, &bh);
vcr = bus_space_read_8(sa->sa_bust, bh, SUPERHYWAY_REG_VCR);
bus_space_unmap(sa->sa_bust, bh, SUPERHYWAY_REG_SZ);
if (SUPERHYWAY_VCR_MOD_ID(vcr) != CPU_SH_MODULE_ID)
return (0);
sa->sa_pport = cf->cf_loc[SUPERHYWAYCF_PPORT];
return (1);
}
/*ARGSUSED*/
static void
cpu_shattach(struct device *parent, struct device *self, void *args)
{
struct superhyway_attach_args *sa = args;
bus_space_handle_t bh;
u_int64_t vcr;
bus_space_map(sa->sa_bust, SUPERHYWAY_PPORT_TO_BUSADDR(sa->sa_pport),
SUPERHYWAY_REG_SZ, 0, &bh);
vcr = bus_space_read_8(sa->sa_bust, bh, SUPERHYWAY_REG_VCR);
bus_space_unmap(sa->sa_bust, bh, SUPERHYWAY_REG_SZ);
printf(": SH-5 CPU, Version 0x%x\n",
(int) SUPERHYWAY_VCR_MOD_VERS(vcr));
}

207
sys/arch/sh5/dev/dtfcons.c Normal file
View File

@ -0,0 +1,207 @@
/* $NetBSD: dtfcons.c,v 1.1 2002/07/05 13:31:52 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford 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.
*/
/*
* TTY-like device for use under SH5 simulator/debugger such that
* console I/O is directed to the host.
*
* Well, that's the theory anyway. The "Posix" interface is isn't up
* to the job and I can't find documentation for any other interface
* hiding behind the host's DTF code.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
#include <sys/select.h>
#include <sys/tty.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <sh5/dev/dtfconsvar.h>
#include <sh5/sh5/dtf_comms.h>
#include <sh5/sh5/mainbus.h>
#include <dev/cons.h>
cdev_decl(dtfcons);
cons_decl(dtfcons);
static int dtfconsmatch(struct device *, struct cfdata *, void *);
static void dtfconsattach(struct device *, struct device *, void *);
struct cfattach dtfcons_ca = {
sizeof(struct device), dtfconsmatch, dtfconsattach
};
extern struct cfdriver dtfcons_cd;
static int dtf_is_console;
static int
dtfconsmatch(struct device *parent, struct cfdata *cf, void *args)
{
struct mainbus_attach_args *ma = args;
if (dtf_is_console == 0)
return (0);
return (strcmp(ma->ma_name, dtfcons_cd.cd_name) == 0);
}
static void
dtfconsattach(struct device *parent, struct device *self, void *args)
{
#if 0
struct mainbus_attach_args *ma = args;
#endif
printf(": DTF Console\n");
}
int
dtfconsopen(dev_t dev, int flag, int mode, struct proc *p)
{
return (0);
}
int
dtfconsclose(dev_t dev, int flag, int mode, struct proc *p)
{
return (0);
}
int
dtfconsread(dev_t dev, struct uio *uio, int flag)
{
return (EIO);
}
int
dtfconswrite(dev_t dev, struct uio *uio, int flag)
{
return (EIO);
}
int
dtfconspoll(dev_t dev, int events, struct proc *p)
{
return (EIO);
}
struct tty *
dtfconstty(dev_t dev)
{
return (NULL);
}
int
dtfconsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
return (ENOTTY);
}
void
dtfcons_cnattach(void)
{
dtf_is_console = 1;
}
int
dtfconscngetc(dev_t dev)
{
u_int32_t status;
u_int8_t buff[16];
u_int8_t *p = buff;
int len;
int s;
s = splhigh();
do {
p = buff;
*p++ = DTF_POSIX_POLLKEY;
len = (int)(p - buff);
if (dtf_transaction(buff, &len) < 0 || len != 8)
if (panicstr == NULL)
panic("dtfconscngetc: lost link to DTF host");
p = dtf_unpackdword(buff, &status);
} while (status == 0);
p = dtf_unpackdword(p, &status);
splx(s);
return ((int)status);
}
void
dtfconscnputc(dev_t dev, int ch)
{
u_int8_t buff[16];
u_int8_t *p = buff;
int len;
int s;
s = splhigh();
p = buff;
*p++ = DTF_POSIX_WRITE;
p = dtf_packdword(p, 1);
*p++ = (u_int8_t)ch;
len = (int)(p - buff);
if (dtf_transaction(buff, &len) < 0 || len != 4)
if (panicstr == NULL)
panic("dtfconscnputc: lost link to DTF host");
splx(s);
}
/*ARGSUSED*/
void
dtfconscnpollc(dev_t dev, int on)
{
}

Some files were not shown because too many files have changed in this diff Show More