Sync: merge r215944 through r216132 from ^/head.
This commit is contained in:
commit
2006fbc8fe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/binutils-2.17/; revision=216133
@ -1158,12 +1158,6 @@ OLD_FILES+=usr/include/machine/i4b_rbch_ioctl.h
|
||||
OLD_FILES+=usr/include/machine/i4b_tel_ioctl.h
|
||||
OLD_FILES+=usr/include/machine/i4b_trace.h
|
||||
.endif
|
||||
# 20070704: I4B 'modules' temporary disconnected (removed 20080525)
|
||||
.if ${TARGET_ARCH} == "i386"
|
||||
OLD_FILES+=usr/share/man/man4/i4bing.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i4bipr.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz
|
||||
.endif
|
||||
# 20070703: pf 4.1 import
|
||||
OLD_FILES+=usr/libexec/ftp-proxy
|
||||
# 20070701: KAME IPSec removal
|
||||
@ -1342,12 +1336,8 @@ OLD_LIBS+=usr/lib/libusbhid.so.2
|
||||
OLD_LIBS+=usr/lib/libvgl.so.4
|
||||
OLD_LIBS+=usr/lib/libwrap.so.4
|
||||
OLD_LIBS+=usr/lib/libypclnt.so.2
|
||||
OLD_LIBS+=usr/lib/snmp_atm.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_bridge.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_hostres.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_mibII.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_netgraph.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_pf.so.3
|
||||
.if ${TARGET_ARCH} == "amd64"
|
||||
OLD_LIBS+=usr/lib32/libatm.so.4
|
||||
OLD_LIBS+=usr/lib32/libbegemot.so.2
|
||||
@ -4551,7 +4541,6 @@ OLD_FILES+=usr/games/worm
|
||||
OLD_FILES+=usr/games/worms
|
||||
OLD_FILES+=usr/games/wump
|
||||
OLD_FILES+=sbin/mount_reiserfs
|
||||
OLD_FILES+=usr/include/c++/3.4/ext/demangle.h
|
||||
OLD_FILES+=usr/include/cam/cam_extend.h
|
||||
OLD_FILES+=usr/include/dev/wi/wi_hostap.h
|
||||
OLD_FILES+=usr/include/disktab.h
|
||||
@ -4814,7 +4803,6 @@ OLD_FILES+=usr/include/posix4/posix4.h
|
||||
OLD_FILES+=usr/include/posix4/sched.h
|
||||
OLD_FILES+=usr/include/posix4/semaphore.h
|
||||
OLD_DIRS+=usr/include/posix4
|
||||
OLD_FILES+=usr/include/rune.h
|
||||
OLD_FILES+=usr/include/security/_pam_compat.h
|
||||
OLD_FILES+=usr/include/security/_pam_macros.h
|
||||
OLD_FILES+=usr/include/security/_pam_types.h
|
||||
@ -4960,37 +4948,14 @@ OLD_FILES+=usr/share/doc/ntp/release.htm
|
||||
OLD_FILES+=usr/share/doc/ntp/tickadj.htm
|
||||
OLD_FILES+=usr/share/doc/papers/nqnfs.ascii.gz
|
||||
OLD_FILES+=usr/share/doc/papers/px.ascii.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/rune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/exp10f.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/exp10.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbrrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbmb.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/sputrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/sgetrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/setrunelocale.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/setinvalidrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/rune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/exp10f.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/exp10.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbrrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/mbmb.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/sputrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/sgetrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/setrunelocale.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/setinvalidrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fungetrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fputrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/fgetrune.3.gz
|
||||
OLD_FILES+=usr/share/man/man5/usbd.conf.5.gz
|
||||
.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
|
||||
OLD_FILES+=usr/share/man/man8/boot_i386.8.gz
|
||||
@ -5088,11 +5053,7 @@ OLD_LIBS+=lib/libgpib.so.1
|
||||
# 20060413: libpcap.so.4 moved to /lib/
|
||||
OLD_LIBS+=usr/lib/libpcap.so.4
|
||||
# 20060412: libpthread.so.2 moved to /lib/
|
||||
.if ${TARGET_ARCH} != "sparc64"
|
||||
OLD_LIBS+=usr/lib/libpthread.so.2
|
||||
.else
|
||||
OLD_LIBS+=usr/lib/libthr.so.2
|
||||
.endif
|
||||
# 20060127: revert libdisk to static-only
|
||||
OLD_LIBS+=usr/lib/libdisk.so.3
|
||||
# 20051027: libc_r discontinued (removed 20101113)
|
||||
@ -5211,8 +5172,6 @@ OLD_LIBS+=usr/lib/snmp_atm.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_mibII.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_netgraph.so.3
|
||||
OLD_LIBS+=usr/lib/snmp_pf.so.3
|
||||
# 20050603: network related ABI change on 64bit systems
|
||||
OLD_LIBS+=usr/lib/libpcap.so.3
|
||||
# 200505XX: ?
|
||||
OLD_LIBS+=usr/lib/snmp_atm.so.2
|
||||
OLD_LIBS+=usr/lib/snmp_mibII.so.2
|
||||
@ -5233,10 +5192,6 @@ OLD_LIBS+=usr/lib/libpcap.so.2
|
||||
OLD_LIBS+=usr/lib/libisc.so.1
|
||||
# 200408XX
|
||||
OLD_LIBS+=usr/lib/snmp_netgraph.so.1
|
||||
.if ${TARGET_ARCH} != "sparc64"
|
||||
# 20040130: libkse renamed to libpthread
|
||||
OLD_LIBS+=usr/lib/libkse.so.1
|
||||
.endif
|
||||
# 200404XX
|
||||
OLD_LIBS+=usr/lib/libsnmp.so.1
|
||||
OLD_LIBS+=usr/lib/snmp_mibII.so.1
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 19, 2010
|
||||
.Dd December 1, 2010
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -1712,7 +1712,8 @@ A synonym for the
|
||||
.Ic cd
|
||||
built-in command.
|
||||
.It Ic command Oo Fl p Oc Op Ar utility Op Ar argument ...
|
||||
.It Ic command Oo Fl v | V Oc Op Ar utility
|
||||
.It Ic command Oo Fl p Oc Fl v Ar utility
|
||||
.It Ic command Oo Fl p Oc Fl V Ar utility
|
||||
The first form of invocation executes the specified
|
||||
.Ar utility ,
|
||||
ignoring shell functions in the search.
|
||||
|
@ -1,129 +0,0 @@
|
||||
# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# 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: (1) source code distributions
|
||||
# retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
# distributions including binary code include the above copyright notice and
|
||||
# this paragraph in its entirety in the documentation or other materials
|
||||
# provided with the distribution, and (3) all advertising materials mentioning
|
||||
# features or use of this software display the following acknowledgement:
|
||||
# ``This product includes software developed by the University of California,
|
||||
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
# the University nor the names of its contributors may be used to endorse
|
||||
# or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#) $Id: Makefile.in,v 1.28 2000/11/23 20:05:14 leres Exp $ (LBL)
|
||||
|
||||
#
|
||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||
#
|
||||
|
||||
# Top level hierarchy
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
# Pathname of directory to install the binary
|
||||
BINDEST = @sbindir@
|
||||
# Pathname of directory to install the man page
|
||||
MANDEST = @mandir@
|
||||
|
||||
# VPATH
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
#
|
||||
# You shouldn't need to edit anything below here.
|
||||
#
|
||||
|
||||
CC = @CC@
|
||||
CCOPT = @V_CCOPT@
|
||||
INCLS = -I. @V_INCLS@
|
||||
DEFS = @DEFS@
|
||||
|
||||
# Standard CFLAGS
|
||||
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
|
||||
|
||||
# Standard LIBS
|
||||
LIBS = @LIBS@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
|
||||
# Also, gcc does not remove the .o before forking 'as', which can be a
|
||||
# problem if you don't own the file but can write to the directory.
|
||||
.c.o:
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
|
||||
|
||||
CSRC = traceroute.c ifaddrlist.c @V_FINDSADDR@
|
||||
GENSRC = version.c
|
||||
|
||||
SRC = $(CSRC) $(GENSRC)
|
||||
HDR = findsaddr.h ifaddrlist.h
|
||||
|
||||
TAGHDR = \
|
||||
/usr/include/netinet/in.h \
|
||||
/usr/include/netinet/ip_icmp.h \
|
||||
/usr/include/netinet/udp.h
|
||||
|
||||
TAGFILES = $(SRC) $(HDR) $(TAGHDR)
|
||||
|
||||
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
||||
# hack the extra indirection
|
||||
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
|
||||
|
||||
CLEANFILES = $(OBJ) traceroute $(GENSRC)
|
||||
|
||||
all: traceroute
|
||||
|
||||
traceroute: $(OBJ)
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
|
||||
version.o: version.c
|
||||
version.c: $(srcdir)/VERSION
|
||||
@rm -f $@
|
||||
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
|
||||
|
||||
install: force
|
||||
$(INSTALL) -m 4555 -o root -g bin traceroute $(DESTDIR)$(BINDEST)
|
||||
|
||||
install-man: force
|
||||
$(INSTALL) -m 444 -o bin -g bin traceroute.8 $(DESTDIR)$(MANDEST)/man8
|
||||
|
||||
lint: $(GENSRC) force
|
||||
lint -hbxn $(SRC) | \
|
||||
grep -v 'struct/union .* never defined' | \
|
||||
grep -v 'possible pointer alignment problem'
|
||||
|
||||
clean: force
|
||||
rm -f $(CLEANFILES)
|
||||
|
||||
distclean: force
|
||||
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
|
||||
gnuc.h os-proto.h
|
||||
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
tar: force
|
||||
@cwd=`pwd` ; name=traceroute-`cat VERSION` ; \
|
||||
list="" ; tar="tar chf" ; temp="$$name.tar.gz" ; \
|
||||
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
|
||||
echo \
|
||||
"rm -f $$name; ln -s . $$name" ; \
|
||||
rm -f $$name; ln -s . $$name ; \
|
||||
echo \
|
||||
"$$tar - [lots of files] | gzip > $$temp" ; \
|
||||
$$tar - $$list | gzip > $$temp ; \
|
||||
echo \
|
||||
"rm -f $$name" ; \
|
||||
rm -f $$name
|
||||
|
||||
force: /tmp
|
||||
depend: $(GENSRC) force
|
||||
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
765
contrib/traceroute/aclocal.m4
vendored
765
contrib/traceroute/aclocal.m4
vendored
@ -1,765 +0,0 @@
|
||||
dnl @(#) $Header: aclocal.m4,v 1.73 99/08/14 16:50:02 leres Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996, 1997, 1998, 1999
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that: (1) source code distributions
|
||||
dnl retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
dnl distributions including binary code include the above copyright notice and
|
||||
dnl this paragraph in its entirety in the documentation or other materials
|
||||
dnl provided with the distribution, and (3) all advertising materials mentioning
|
||||
dnl features or use of this software display the following acknowledgement:
|
||||
dnl ``This product includes software developed by the University of California,
|
||||
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
dnl the University nor the names of its contributors may be used to endorse
|
||||
dnl or promote products derived from this software without specific prior
|
||||
dnl written permission.
|
||||
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
dnl
|
||||
dnl LBL autoconf macros
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl Determine which compiler we're using (cc or gcc)
|
||||
dnl If using gcc, determine the version number
|
||||
dnl If using cc, require that it support ansi prototypes
|
||||
dnl If using gcc, use -O2 (otherwise use -O)
|
||||
dnl If using cc, explicitly specify /usr/local/include
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_C_INIT(copt, incls)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt set)
|
||||
dnl $2 (incls set)
|
||||
dnl CC
|
||||
dnl LDFLAGS
|
||||
dnl LBL_CFLAGS
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_C_INIT,
|
||||
[AC_PREREQ(2.12)
|
||||
AC_BEFORE([$0], [AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
|
||||
AC_BEFORE([$0], [AC_LBL_DEVEL])
|
||||
AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
|
||||
$1="-O"
|
||||
$2=""
|
||||
if test "${srcdir}" != "." ; then
|
||||
$2="-I\$\(srcdir\)"
|
||||
fi
|
||||
if test "${CFLAGS+set}" = set; then
|
||||
LBL_CFLAGS="$CFLAGS"
|
||||
fi
|
||||
if test -z "$CC" ; then
|
||||
case "$target_os" in
|
||||
|
||||
bsdi*)
|
||||
AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
|
||||
if test $SHLICC2 = yes ; then
|
||||
CC=shlicc2
|
||||
export CC
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test -z "$CC" -a "$with_gcc" = no ; then
|
||||
CC=cc
|
||||
export CC
|
||||
fi
|
||||
AC_PROG_CC
|
||||
if test "$GCC" != yes ; then
|
||||
AC_MSG_CHECKING(that $CC handles ansi prototypes)
|
||||
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[int frob(int, char *)],
|
||||
ac_cv_lbl_cc_ansi_prototypes=yes,
|
||||
ac_cv_lbl_cc_ansi_prototypes=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
|
||||
if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
|
||||
case "$target_os" in
|
||||
|
||||
hpux*)
|
||||
AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
|
||||
savedcflags="$CFLAGS"
|
||||
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
|
||||
AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[int frob(int, char *)],
|
||||
ac_cv_lbl_cc_hpux_cc_aa=yes,
|
||||
ac_cv_lbl_cc_hpux_cc_aa=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
|
||||
if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
CFLAGS="$savedcflags"
|
||||
$1="-Aa $$1"
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
$2="$$2 -I/usr/local/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
|
||||
case "$target_os" in
|
||||
|
||||
irix*)
|
||||
$1="$$1 -xansi -signed -g3"
|
||||
;;
|
||||
|
||||
osf*)
|
||||
$1="$$1 -std1 -g3"
|
||||
;;
|
||||
|
||||
ultrix*)
|
||||
AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
|
||||
AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[struct a { int b; };
|
||||
void c(const struct a *)],
|
||||
ac_cv_lbl_cc_const_proto=yes,
|
||||
ac_cv_lbl_cc_const_proto=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
|
||||
if test $ac_cv_lbl_cc_const_proto = no ; then
|
||||
AC_DEFINE(const,)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Use pfopen.c if available and pfopen() not in standard libraries
|
||||
dnl Require libpcap
|
||||
dnl Look for libpcap in ..
|
||||
dnl Use the installed libpcap if there is no local version
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_LIBPCAP(pcapdep, incls)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (pcapdep set)
|
||||
dnl $2 (incls appended)
|
||||
dnl LIBS
|
||||
dnl LDFLAGS
|
||||
dnl LBL_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
[AC_REQUIRE([AC_LBL_LIBRARY_NET])
|
||||
dnl
|
||||
dnl save a copy before locating libpcap.a
|
||||
dnl
|
||||
LBL_LIBS="$LIBS"
|
||||
pfopen=/usr/examples/packetfilter/pfopen.c
|
||||
if test -f $pfopen ; then
|
||||
AC_CHECK_FUNCS(pfopen)
|
||||
if test $ac_cv_func_pfopen = "no" ; then
|
||||
AC_MSG_RESULT(Using $pfopen)
|
||||
LIBS="$LIBS $pfopen"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING(for local pcap library)
|
||||
libpcap=FAIL
|
||||
lastdir=FAIL
|
||||
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
|
||||
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
|
||||
for dir in $places ../libpcap libpcap ; do
|
||||
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
|
||||
if test $lastdir = $basedir ; then
|
||||
dnl skip alphas when an actual release is present
|
||||
continue;
|
||||
fi
|
||||
lastdir=$dir
|
||||
if test -r $dir/pcap.c ; then
|
||||
libpcap=$dir/libpcap.a
|
||||
d=$dir
|
||||
dnl continue and select the last one that exists
|
||||
fi
|
||||
done
|
||||
if test "x$libpcap" = xFAIL ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
unset ac_cv_lbl_lib_pcap_pcap_open_live_
|
||||
AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
|
||||
if test "x$libpcap" = xFAIL ; then
|
||||
unset ac_cv_lbl_lib_pcap_pcap_open_live_
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
LIBS="$LIBS -L/usr/local/lib"
|
||||
AC_LBL_CHECK_LIB(pcap, pcap_open_live, libpcap="-lpcap")
|
||||
if test "x$libpcap" = xFAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
$2="$$2 -I/usr/local/include"
|
||||
fi
|
||||
LIBS="$LIBS -lpcap"
|
||||
else
|
||||
$1=$libpcap
|
||||
$2="-I$d $$2"
|
||||
AC_MSG_RESULT($libpcap)
|
||||
fi
|
||||
if test "x$libpcap" != "x-lpcap" ; then
|
||||
LIBS="$libpcap $LIBS"
|
||||
fi
|
||||
case "$target_os" in
|
||||
|
||||
aix*)
|
||||
pseexe="/lib/pse.exp"
|
||||
AC_MSG_CHECKING(for $pseexe)
|
||||
if test -f $pseexe ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
LIBS="$LIBS -I:$pseexe"
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
|
||||
dnl
|
||||
dnl Define RETSIGTYPE and RETSIGVAL
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_TYPE_SIGNAL
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl RETSIGTYPE (defined)
|
||||
dnl RETSIGVAL (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_TYPE_SIGNAL,
|
||||
[AC_BEFORE([$0], [AC_LBL_LIBPCAP])
|
||||
AC_TYPE_SIGNAL
|
||||
if test "$ac_cv_type_signal" = void ; then
|
||||
AC_DEFINE(RETSIGVAL,)
|
||||
else
|
||||
AC_DEFINE(RETSIGVAL,(0))
|
||||
fi
|
||||
case "$target_os" in
|
||||
|
||||
irix*)
|
||||
AC_DEFINE(_BSD_SIGNALS)
|
||||
;;
|
||||
|
||||
*)
|
||||
dnl prefer sigset() to sigaction()
|
||||
AC_CHECK_FUNCS(sigset)
|
||||
if test $ac_cv_func_sigset = yes ; then
|
||||
AC_DEFINE(signal,sigset)
|
||||
else
|
||||
AC_CHECK_FUNCS(sigaction)
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
|
||||
dnl
|
||||
dnl If using gcc, make sure we have ANSI ioctl definitions
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_FIXINCLUDES
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_FIXINCLUDES,
|
||||
[if test "$GCC" = yes ; then
|
||||
AC_MSG_CHECKING(for ANSI ioctl definitions)
|
||||
AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
|
||||
AC_TRY_COMPILE(
|
||||
[/*
|
||||
* This generates a "duplicate case value" when fixincludes
|
||||
* has not be run.
|
||||
*/
|
||||
# include <sys/types.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef HAVE_SYS_IOCCOM_H
|
||||
# include <sys/ioccom.h>
|
||||
# endif],
|
||||
[switch (0) {
|
||||
case _IO('A', 1):;
|
||||
case _IO('B', 1):;
|
||||
}],
|
||||
ac_cv_lbl_gcc_fixincludes=yes,
|
||||
ac_cv_lbl_gcc_fixincludes=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
|
||||
if test $ac_cv_lbl_gcc_fixincludes = no ; then
|
||||
# Don't cache failure
|
||||
unset ac_cv_lbl_gcc_fixincludes
|
||||
AC_MSG_ERROR(see the INSTALL for more info)
|
||||
fi
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Check for flex, default to lex
|
||||
dnl Require flex 2.4 or higher
|
||||
dnl Check for bison, default to yacc
|
||||
dnl Default to lex/yacc if both flex and bison are not available
|
||||
dnl Define the yy prefix string if using flex and bison
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (lex set)
|
||||
dnl $2 (yacc appended)
|
||||
dnl $3 (optional flex and bison -P prefix)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LEX_AND_YACC,
|
||||
[AC_ARG_WITH(flex, [ --without-flex don't use flex])
|
||||
AC_ARG_WITH(bison, [ --without-bison don't use bison])
|
||||
if test "$with_flex" = no ; then
|
||||
$1=lex
|
||||
else
|
||||
AC_CHECK_PROGS($1, flex, lex)
|
||||
fi
|
||||
if test "$$1" = flex ; then
|
||||
# The -V flag was added in 2.4
|
||||
AC_MSG_CHECKING(for flex 2.4 or higher)
|
||||
AC_CACHE_VAL(ac_cv_lbl_flex_v24,
|
||||
if flex -V >/dev/null 2>&1; then
|
||||
ac_cv_lbl_flex_v24=yes
|
||||
else
|
||||
ac_cv_lbl_flex_v24=no
|
||||
fi)
|
||||
AC_MSG_RESULT($ac_cv_lbl_flex_v24)
|
||||
if test $ac_cv_lbl_flex_v24 = no ; then
|
||||
s="2.4 or higher required"
|
||||
AC_MSG_WARN(ignoring obsolete flex executable ($s))
|
||||
$1=lex
|
||||
fi
|
||||
fi
|
||||
if test "$with_bison" = no ; then
|
||||
$2=yacc
|
||||
else
|
||||
AC_CHECK_PROGS($2, bison, yacc)
|
||||
fi
|
||||
if test "$$2" = bison ; then
|
||||
$2="$$2 -y"
|
||||
fi
|
||||
if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
|
||||
AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
|
||||
$1=lex
|
||||
$2=yacc
|
||||
fi
|
||||
if test "$$1" = flex -a -n "$3" ; then
|
||||
$1="$$1 -P$3"
|
||||
$2="$$2 -p $3"
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if union wait is used with WEXITSTATUS()
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_UNION_WAIT
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl DECLWAITSTATUS (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_UNION_WAIT,
|
||||
[AC_MSG_CHECKING(if union wait is used)
|
||||
AC_CACHE_VAL(ac_cv_lbl_union_wait,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>],
|
||||
[int status;
|
||||
u_int i = WEXITSTATUS(status);
|
||||
u_int j = waitpid(0, &status, 0);],
|
||||
ac_cv_lbl_union_wait=no,
|
||||
ac_cv_lbl_union_wait=yes))
|
||||
AC_MSG_RESULT($ac_cv_lbl_union_wait)
|
||||
if test $ac_cv_lbl_union_wait = yes ; then
|
||||
AC_DEFINE(DECLWAITSTATUS,union wait)
|
||||
else
|
||||
AC_DEFINE(DECLWAITSTATUS,int)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_SOCKADDR_SA_LEN
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl HAVE_SOCKADDR_SA_LEN (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
|
||||
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
|
||||
AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>],
|
||||
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
|
||||
ac_cv_lbl_sockaddr_has_sa_len=yes,
|
||||
ac_cv_lbl_sockaddr_has_sa_len=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
|
||||
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
|
||||
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if the IFF_LOOPBACK exists as a define or enum
|
||||
dnl
|
||||
dnl (stupidly some versions of linux use an enum...)
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_IFF_LOOPBACK
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl HAVE_IFF_LOOPBACK (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_IFF_LOOPBACK,
|
||||
[AC_MSG_CHECKING(for IFF_LOOPBACK define/enum)
|
||||
AC_CACHE_VAL(ac_cv_lbl_have_iff_loopback,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/param.h>
|
||||
# include <sys/file.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/socket.h>
|
||||
# ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
# endif
|
||||
# include <sys/time.h>
|
||||
# include <net/if.h>
|
||||
# include <netinet/in.h>],
|
||||
[int i = IFF_LOOPBACK],
|
||||
ac_cv_lbl_have_iff_loopback=yes,
|
||||
ac_cv_lbl_have_iff_loopback=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_iff_loopback)
|
||||
if test $ac_cv_lbl_have_iff_loopback = yes ; then
|
||||
AC_DEFINE(HAVE_IFF_LOOPBACK)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if -R is used
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_HAVE_RUN_PATH
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl ac_cv_lbl_have_run_path (yes or no)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
|
||||
[AC_MSG_CHECKING(for ${CC-cc} -R)
|
||||
AC_CACHE_VAL(ac_cv_lbl_have_run_path,
|
||||
[echo 'main(){}' > conftest.c
|
||||
${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
|
||||
if test ! -s conftest.out ; then
|
||||
ac_cv_lbl_have_run_path=yes
|
||||
else
|
||||
ac_cv_lbl_have_run_path=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_CHECK_TYPE
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl int32_t (defined)
|
||||
dnl u_int32_t (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_CHECK_TYPE,
|
||||
[AC_MSG_CHECKING(for $1 using $CC)
|
||||
AC_CACHE_VAL(ac_cv_lbl_have_$1,
|
||||
AC_TRY_COMPILE([
|
||||
# include "confdefs.h"
|
||||
# include <sys/types.h>
|
||||
# if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# endif],
|
||||
[$1 i],
|
||||
ac_cv_lbl_have_$1=yes,
|
||||
ac_cv_lbl_have_$1=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_$1)
|
||||
if test $ac_cv_lbl_have_$1 = no ; then
|
||||
AC_DEFINE($1, $2)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if unaligned memory accesses fail
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_UNALIGNED_ACCESS
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl LBL_ALIGN (DEFINED)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
|
||||
[AC_MSG_CHECKING(if unaligned accesses fail)
|
||||
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
|
||||
[case "$target_cpu" in
|
||||
|
||||
alpha|hp*|mips|sparc)
|
||||
ac_cv_lbl_unaligned_fail=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
cat >conftest.c <<EOF
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include <stdio.h>
|
||||
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
|
||||
main() {
|
||||
unsigned int i;
|
||||
pid_t pid;
|
||||
int status;
|
||||
/* avoid "core dumped" message */
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
exit(2);
|
||||
if (pid > 0) {
|
||||
/* parent */
|
||||
pid = waitpid(pid, &status, 0);
|
||||
if (pid < 0)
|
||||
exit(3);
|
||||
exit(!WIFEXITED(status));
|
||||
}
|
||||
/* child */
|
||||
i = *(unsigned int *)&a[[1]];
|
||||
printf("%d\n", i);
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
|
||||
conftest.c $LIBS >/dev/null 2>&1
|
||||
if test ! -x conftest ; then
|
||||
dnl failed to compile for some reason
|
||||
ac_cv_lbl_unaligned_fail=yes
|
||||
else
|
||||
./conftest >conftest.out
|
||||
if test ! -s conftest.out ; then
|
||||
ac_cv_lbl_unaligned_fail=yes
|
||||
else
|
||||
ac_cv_lbl_unaligned_fail=no
|
||||
fi
|
||||
fi
|
||||
rm -f conftest* core core.conftest
|
||||
;;
|
||||
esac])
|
||||
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
|
||||
if test $ac_cv_lbl_unaligned_fail = yes ; then
|
||||
AC_DEFINE(LBL_ALIGN)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl add all warning option to CFLAGS
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_CHECK_WALL(copt)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt appended)
|
||||
dnl ac_cv_lbl_gcc_vers
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_CHECK_WALL,
|
||||
[ if test "$GCC" = yes ; then
|
||||
if test "$SHLICC2" = yes ; then
|
||||
ac_cv_lbl_gcc_vers=2
|
||||
$1="`echo $$1 | sed -e 's/-O/-O2/'`"
|
||||
else
|
||||
AC_MSG_CHECKING(gcc version)
|
||||
AC_CACHE_VAL(ac_cv_lbl_gcc_vers,
|
||||
ac_cv_lbl_gcc_vers=`$CC --version 2>&1 | \
|
||||
sed -e 's/\..*//'`)
|
||||
AC_MSG_RESULT($ac_cv_lbl_gcc_vers)
|
||||
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
|
||||
$1="`echo $$1 | sed -e 's/-O/-O2/'`"
|
||||
fi
|
||||
fi
|
||||
if test "${LBL_CFLAGS+set}" != set; then
|
||||
if test "$ac_cv_prog_cc_g" = yes ; then
|
||||
$1="-g $$1"
|
||||
fi
|
||||
$1="$$1 -Wall"
|
||||
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
|
||||
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
case "$target_os" in
|
||||
|
||||
irix6*)
|
||||
$1="$$1 -fullwarn -n32"
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl If using gcc and the file .devel exists:
|
||||
dnl Compile with -g (if supported) and -Wall
|
||||
dnl If using gcc 2, do extra prototype checking
|
||||
dnl If an os prototype include exists, symlink os-proto.h to it
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_DEVEL(copt)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt appended)
|
||||
dnl HAVE_OS_PROTO_H (defined)
|
||||
dnl os-proto.h (symlinked)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_DEVEL,
|
||||
[rm -f os-proto.h
|
||||
if test "${LBL_CFLAGS+set}" = set; then
|
||||
$1="$$1 ${LBL_CFLAGS}"
|
||||
fi
|
||||
if test -f .devel ; then
|
||||
AC_LBL_CHECK_WALL($1)
|
||||
os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
|
||||
name="lbl/os-$os.h"
|
||||
if test -f $name ; then
|
||||
ln -s $name os-proto.h
|
||||
AC_DEFINE(HAVE_OS_PROTO_H)
|
||||
else
|
||||
AC_MSG_WARN(can't find $name)
|
||||
fi
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Improved version of AC_CHECK_LIB
|
||||
dnl
|
||||
dnl Thanks to John Hawkinson (jhawk@mit.edu)
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
|
||||
dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl LIBS
|
||||
dnl
|
||||
|
||||
define(AC_LBL_CHECK_LIB,
|
||||
[AC_MSG_CHECKING([for $2 in -l$1])
|
||||
dnl Use a cache variable name containing both the library and function name,
|
||||
dnl because the test really is for library $1 defining function $2, not
|
||||
dnl just for library $1. Separate tests with the same $1 and different $2's
|
||||
dnl may have different results.
|
||||
ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
|
||||
AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
|
||||
[ac_save_LIBS="$LIBS"
|
||||
LIBS="-l$1 $5 $LIBS"
|
||||
AC_TRY_LINK(dnl
|
||||
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
|
||||
[/* Override any gcc2 internal prototype to avoid an error. */
|
||||
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
])dnl
|
||||
[/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char $2();
|
||||
]),
|
||||
[$2()],
|
||||
eval "ac_cv_lbl_lib_$ac_lib_var=yes",
|
||||
eval "ac_cv_lbl_lib_$ac_lib_var=no")
|
||||
LIBS="$ac_save_LIBS"
|
||||
])dnl
|
||||
if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$3], ,
|
||||
[changequote(, )dnl
|
||||
ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
|
||||
changequote([, ])dnl
|
||||
AC_DEFINE_UNQUOTED($ac_tr_lib)
|
||||
LIBS="-l$1 $LIBS"
|
||||
], [$3])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$4], , , [$4
|
||||
])dnl
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_LBL_LIBRARY_NET
|
||||
dnl
|
||||
dnl This test is for network applications that need socket() and
|
||||
dnl gethostbyname() -ish functions. Under Solaris, those applications
|
||||
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
|
||||
dnl with "-lnsl" but should *not* link with "-lsocket" because
|
||||
dnl libsocket.a breaks a number of things (for instance:
|
||||
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
|
||||
dnl versions of IRIX).
|
||||
dnl
|
||||
dnl Unfortunately, many application developers are not aware of this,
|
||||
dnl and mistakenly write tests that cause -lsocket to be used under
|
||||
dnl IRIX. It is also easy to write tests that cause -lnsl to be used
|
||||
dnl under operating systems where neither are necessary (or useful),
|
||||
dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
|
||||
dnl
|
||||
dnl This test exists so that every application developer does not test
|
||||
dnl this in a different, and subtly broken fashion.
|
||||
|
||||
dnl It has been argued that this test should be broken up into two
|
||||
dnl seperate tests, one for the resolver libraries, and one for the
|
||||
dnl libraries necessary for using Sockets API. Unfortunately, the two
|
||||
dnl are carefully intertwined and allowing the autoconf user to use
|
||||
dnl them independantly potentially results in unfortunate ordering
|
||||
dnl dependancies -- as such, such component macros would have to
|
||||
dnl carefully use indirection and be aware if the other components were
|
||||
dnl executed. Since other autoconf macros do not go to this trouble,
|
||||
dnl and almost no applications use sockets without the resolver, this
|
||||
dnl complexity has not been implemented.
|
||||
dnl
|
||||
dnl The check for libresolv is in case you are attempting to link
|
||||
dnl statically and happen to have a libresolv.a lying around (and no
|
||||
dnl libnsl.a).
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LIBRARY_NET, [
|
||||
# Most operating systems have gethostbyname() in the default searched
|
||||
# libraries (i.e. libc):
|
||||
AC_CHECK_FUNC(gethostbyname, ,
|
||||
# Some OSes (eg. Solaris) place it in libnsl:
|
||||
AC_LBL_CHECK_LIB(nsl, gethostbyname, ,
|
||||
# Some strange OSes (SINIX) have it in libsocket:
|
||||
AC_LBL_CHECK_LIB(socket, gethostbyname, ,
|
||||
# Unfortunately libsocket sometimes depends on libnsl.
|
||||
# AC_CHECK_LIB's API is essentially broken so the
|
||||
# following ugliness is necessary:
|
||||
AC_LBL_CHECK_LIB(socket, gethostbyname,
|
||||
LIBS="-lsocket -lnsl $LIBS",
|
||||
AC_CHECK_LIB(resolv, gethostbyname),
|
||||
-lnsl))))
|
||||
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
|
||||
AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
|
||||
-lnsl)))
|
||||
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
|
||||
AC_CHECK_LIB(str, putmsg)
|
||||
])
|
@ -1,494 +0,0 @@
|
||||
dnl @(#) $Header: acsite.m4,v 1.38 96/09/26 21:18:41 leres Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that: (1) source code distributions
|
||||
dnl retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
dnl distributions including binary code include the above copyright notice and
|
||||
dnl this paragraph in its entirety in the documentation or other materials
|
||||
dnl provided with the distribution, and (3) all advertising materials mentioning
|
||||
dnl features or use of this software display the following acknowledgement:
|
||||
dnl ``This product includes software developed by the University of California,
|
||||
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
dnl the University nor the names of its contributors may be used to endorse
|
||||
dnl or promote products derived from this software without specific prior
|
||||
dnl written permission.
|
||||
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
dnl
|
||||
dnl LBL autoconf macros
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl Determine which compiler we're using (cc or gcc)
|
||||
dnl If using gcc, determine the version number
|
||||
dnl If using cc, require that it support ansi prototypes
|
||||
dnl If using gcc, use -O2 (otherwise use -O)
|
||||
dnl If using cc, explicitly specify /usr/local/include
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_C_INIT(copt, incls)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt set)
|
||||
dnl $2 (incls set)
|
||||
dnl CC
|
||||
dnl ac_cv_gcc_vers
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_C_INIT,
|
||||
[$1=-O
|
||||
$2=""
|
||||
if test -z "$CC" ; then
|
||||
case "$target_os" in
|
||||
|
||||
bsdi*)
|
||||
AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
|
||||
if test $SHLICC2 = yes ; then
|
||||
CC=shlicc2
|
||||
export CC
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_PROG_CC
|
||||
if test $ac_cv_prog_gcc = yes ; then
|
||||
if test "$SHLICC2" = yes ; then
|
||||
ac_cv_gcc_vers=2
|
||||
$1=-O2
|
||||
else
|
||||
AC_MSG_CHECKING(gcc version)
|
||||
AC_CACHE_VAL(ac_cv_gcc_vers,
|
||||
ac_cv_gcc_vers=`$CC -v 2>&1 | \
|
||||
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
|
||||
AC_MSG_RESULT($ac_cv_gcc_vers)
|
||||
if test $ac_cv_gcc_vers -gt 1 ; then
|
||||
$1=-O2
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING(that $CC handles ansi prototypes)
|
||||
AC_CACHE_VAL(ac_cv_cc_ansi_prototypes,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[int frob(int, char *)],
|
||||
ac_cv_cc_ansi_prototypes=yes,
|
||||
ac_cv_cc_ansi_prototypes=no))
|
||||
AC_MSG_RESULT($ac_cv_cc_ansi_prototypes)
|
||||
if test $ac_cv_cc_ansi_prototypes = no ; then
|
||||
case "$target_os" in
|
||||
|
||||
hpux*)
|
||||
AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
|
||||
savedcflags="$CFLAGS"
|
||||
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
|
||||
AC_CACHE_VAL(ac_cv_cc_hpux_cc_aa,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[int frob(int, char *)],
|
||||
ac_cv_cc_hpux_cc_aa=yes,
|
||||
ac_cv_cc_hpux_cc_aa=no))
|
||||
AC_MSG_RESULT($ac_cv_cc_hpux_cc_aa)
|
||||
if test $ac_cv_cc_hpux_cc_aa = no ; then
|
||||
AC_MSG_ERROR(see the INSTALL for more info)
|
||||
fi
|
||||
CFLAGS="$savedcflags"
|
||||
V_CCOPT="-Aa $V_CCOPT"
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR(see the INSTALL for more info)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
$2=-I/usr/local/include
|
||||
|
||||
case "$target_os" in
|
||||
|
||||
irix*)
|
||||
V_CCOPT="$V_CCOPT -xansi -signed -g3"
|
||||
;;
|
||||
|
||||
osf*)
|
||||
V_CCOPT="$V_CCOPT -g3"
|
||||
;;
|
||||
|
||||
ultrix*)
|
||||
AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
|
||||
AC_CACHE_VAL(ac_cv_cc_const_proto,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[struct a { int b; };
|
||||
void c(const struct a *)],
|
||||
ac_cv_cc_const_proto=yes,
|
||||
ac_cv_cc_const_proto=no))
|
||||
AC_MSG_RESULT($ac_cv_cc_const_proto)
|
||||
if test $ac_cv_cc_const_proto = no ; then
|
||||
AC_DEFINE(const,)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Use pfopen.c if available and pfopen() not in standard libraries
|
||||
dnl Require libpcap
|
||||
dnl Look for libpcap in ..
|
||||
dnl Use the installed libpcap if there is no local version
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_LIBPCAP(pcapdep, incls)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (pcapdep set)
|
||||
dnl $2 (incls appended)
|
||||
dnl LIBS
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
[pfopen=/usr/examples/packetfilter/pfopen.c
|
||||
if test -f $pfopen ; then
|
||||
AC_CHECK_FUNCS(pfopen)
|
||||
if test $ac_cv_func_pfopen = "no" ; then
|
||||
AC_MSG_RESULT(Using $pfopen)
|
||||
LIBS="$LIBS $pfopen"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING(for local pcap library)
|
||||
libpcap=FAIL
|
||||
lastdir=FAIL
|
||||
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
|
||||
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
|
||||
for dir in $places ../libpcap libpcap ; do
|
||||
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
|
||||
if test $lastdir = $basedir ; then
|
||||
dnl skip alphas when an actual release is present
|
||||
continue;
|
||||
fi
|
||||
lastdir=$dir
|
||||
if test -r $dir/pcap.c ; then
|
||||
libpcap=$dir/libpcap.a
|
||||
d=$dir
|
||||
dnl continue and select the last one that exists
|
||||
fi
|
||||
done
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
else
|
||||
$1=$libpcap
|
||||
$2="-I$d $$2"
|
||||
AC_MSG_RESULT($libpcap)
|
||||
fi
|
||||
LIBS="$libpcap $LIBS"])
|
||||
|
||||
dnl
|
||||
dnl Define RETSIGTYPE and RETSIGVAL
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_TYPE_SIGNAL
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl RETSIGTYPE (defined)
|
||||
dnl RETSIGVAL (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_TYPE_SIGNAL,
|
||||
[AC_TYPE_SIGNAL
|
||||
if test "$ac_cv_type_signal" = void ; then
|
||||
AC_DEFINE(RETSIGVAL,)
|
||||
else
|
||||
AC_DEFINE(RETSIGVAL,(0))
|
||||
fi
|
||||
case "$target_os" in
|
||||
|
||||
irix*)
|
||||
AC_DEFINE(_BSD_SIGNALS)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_CHECK_FUNCS(sigset)
|
||||
if test $ac_cv_func_sigset = yes ; then
|
||||
AC_DEFINE(signal, sigset)
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
|
||||
dnl
|
||||
dnl If using gcc, see if fixincludes should be run
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_FIXINCLUDES
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_FIXINCLUDES,
|
||||
[if test $ac_cv_prog_gcc = yes ; then
|
||||
AC_MSG_CHECKING(if fixincludes is needed)
|
||||
AC_CACHE_VAL(ac_cv_gcc_fixincludes,
|
||||
AC_TRY_COMPILE(
|
||||
[/*
|
||||
* This generates a "duplicate case value" when fixincludes
|
||||
* has not be run.
|
||||
*/
|
||||
# include <sys/types.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef HAVE_SYS_IOCCOM_H
|
||||
# include <sys/ioccom.h>
|
||||
# endif],
|
||||
[switch (0) {
|
||||
case _IO('A', 1):;
|
||||
case _IO('B', 1):;
|
||||
}],
|
||||
ac_cv_gcc_fixincludes=yes,
|
||||
ac_cv_gcc_fixincludes=no))
|
||||
AC_MSG_RESULT($ac_cv_gcc_fixincludes)
|
||||
if test $ac_cv_gcc_fixincludes = no ; then
|
||||
# Don't cache failure
|
||||
unset ac_cv_gcc_fixincludes
|
||||
AC_MSG_ERROR(see the INSTALL for more info)
|
||||
fi
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Check for flex, default to lex
|
||||
dnl Require flex 2.4 or higher
|
||||
dnl Check for bison, default to yacc
|
||||
dnl Default to lex/yacc if both flex and bison are not available
|
||||
dnl Define the yy prefix string if using flex and bison
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (lex set)
|
||||
dnl $2 (yacc appended)
|
||||
dnl $3 (optional flex and bison -P prefix)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LEX_AND_YACC,
|
||||
[AC_CHECK_PROGS($1, flex, lex)
|
||||
if test "$$1" = flex ; then
|
||||
# The -V flag was added in 2.4
|
||||
AC_MSG_CHECKING(for flex 2.4 or higher)
|
||||
AC_CACHE_VAL(ac_cv_flex_v24,
|
||||
if flex -V >/dev/null 2>&1; then
|
||||
ac_cv_flex_v24=yes
|
||||
else
|
||||
ac_cv_flex_v24=no
|
||||
fi)
|
||||
AC_MSG_RESULT($ac_cv_flex_v24)
|
||||
if test $ac_cv_flex_v24 = no ; then
|
||||
s="2.4 or higher required"
|
||||
AC_MSG_WARN(ignoring obsolete flex executable ($s))
|
||||
$1=lex
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_PROGS($2, bison, yacc)
|
||||
if test "$$2" = bison ; then
|
||||
$2="$$2 -y"
|
||||
fi
|
||||
if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
|
||||
AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
|
||||
$1=lex
|
||||
$2=yacc
|
||||
fi
|
||||
if test "$$1" = flex -a -n "$3" ; then
|
||||
$1="$$1 -P$3"
|
||||
$2="$$2 -p $3"
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if union wait is used with WEXITSTATUS()
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_UNION_WAIT
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl DECLWAITSTATUS (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_UNION_WAIT,
|
||||
[AC_MSG_CHECKING(if union wait is used)
|
||||
AC_CACHE_VAL(ac_cv_union_wait,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>],
|
||||
[int status;
|
||||
u_int i = WEXITSTATUS(status);
|
||||
u_int j = waitpid(0, &status, 0);],
|
||||
ac_cv_union_wait=no,
|
||||
ac_cv_union_wait=yes))
|
||||
AC_MSG_RESULT($ac_cv_union_wait)
|
||||
if test $ac_cv_union_wait = yes ; then
|
||||
AC_DEFINE(DECLWAITSTATUS,union wait)
|
||||
else
|
||||
AC_DEFINE(DECLWAITSTATUS,int)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_SOCKADDR_SA_LEN
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl HAVE_SOCKADDR_SA_LEN (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
|
||||
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
|
||||
AC_CACHE_VAL(ac_cv_sockaddr_has_sa_len,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>],
|
||||
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
|
||||
ac_cv_sockaddr_has_sa_len=yes,
|
||||
ac_cv_sockaddr_has_sa_len=no))
|
||||
AC_MSG_RESULT($ac_cv_sockaddr_has_sa_len)
|
||||
if test $ac_cv_sockaddr_has_sa_len = yes ; then
|
||||
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if -R is used
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_HAVE_RUN_PATH
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl ac_cv_have_run_path (yes or no)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
|
||||
[AC_MSG_CHECKING(for ${CC-cc} -R)
|
||||
AC_CACHE_VAL(ac_cv_have_run_path,
|
||||
[echo 'main(){}' > conftest.c
|
||||
${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
|
||||
if test ! -s conftest.out ; then
|
||||
ac_cv_have_run_path=yes
|
||||
else
|
||||
ac_cv_have_run_path=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
AC_MSG_RESULT($ac_cv_have_run_path)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if unaligned memory accesses fail
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_UNALIGNED_ACCESS
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl LBL_ALIGN (DEFINED)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
|
||||
[AC_MSG_CHECKING(if unaligned accesses fail)
|
||||
AC_CACHE_VAL(ac_cv_unaligned_fail,
|
||||
[case "$target_cpu" in
|
||||
|
||||
alpha|hp*|mips|sparc)
|
||||
ac_cv_unaligned_fail=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
cat >conftest.c <<EOF
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include <stdio.h>
|
||||
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
|
||||
main() {
|
||||
unsigned int i;
|
||||
pid_t pid;
|
||||
int status;
|
||||
/* avoid "core dumped" message */
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
exit(2);
|
||||
if (pid > 0) {
|
||||
/* parent */
|
||||
pid = waitpid(pid, &status, 0);
|
||||
if (pid < 0)
|
||||
exit(3);
|
||||
exit(!WIFEXITED(status));
|
||||
}
|
||||
/* child */
|
||||
i = *(unsigned int *)&a[[1]];
|
||||
printf("%d\n", i);
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
|
||||
conftest.c $LIBS >/dev/null 2>&1
|
||||
if test ! -x conftest ; then
|
||||
dnl failed to compile for some reason
|
||||
ac_cv_unaligned_fail=yes
|
||||
else
|
||||
./conftest >conftest.out
|
||||
if test ! -s conftest.out ; then
|
||||
ac_cv_unaligned_fail=yes
|
||||
else
|
||||
ac_cv_unaligned_fail=no
|
||||
fi
|
||||
fi
|
||||
rm -f conftest* core core.conftest
|
||||
;;
|
||||
esac])
|
||||
AC_MSG_RESULT($ac_cv_unaligned_fail)
|
||||
if test $ac_cv_unaligned_fail = yes ; then
|
||||
AC_DEFINE(LBL_ALIGN)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl If using gcc and the file .devel exists:
|
||||
dnl Compile with -g (if supported) and -Wall
|
||||
dnl If using gcc 2, do extra prototype checking
|
||||
dnl If an os prototype include exists, symlink os-proto.h to it
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_DEVEL(copt)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt appended)
|
||||
dnl HAVE_OS_PROTO_H (defined)
|
||||
dnl os-proto.h (symlinked)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_DEVEL,
|
||||
[rm -f os-proto.h
|
||||
if test $ac_cv_prog_gcc = yes -a -f .devel ; then
|
||||
if test $ac_cv_prog_gcc_g = yes ; then
|
||||
$1="-g $$1"
|
||||
fi
|
||||
$1="$$1 -Wall"
|
||||
if test $ac_cv_gcc_vers -gt 1 ; then
|
||||
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
|
||||
fi
|
||||
os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
|
||||
name="lbl/os-$os.h"
|
||||
if test -f $name ; then
|
||||
ln -s $name os-proto.h
|
||||
AC_DEFINE(HAVE_OS_PROTO_H)
|
||||
else
|
||||
AC_MSG_WARN(can't find $name)
|
||||
fi
|
||||
fi])
|
@ -16,13 +16,6 @@
|
||||
* 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
|
||||
|
@ -16,13 +16,6 @@
|
||||
* 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
|
||||
|
693
contrib/traceroute/config.guess
vendored
693
contrib/traceroute/config.guess
vendored
@ -1,693 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:*:*)
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-cbm-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-atari-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-sun-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-apple-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:OpenBSD:*:*)
|
||||
echo m68k-hp-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
|
||||
echo "powerpc-unknown-linux-gnu" ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
echo alpha-unknown-linux-gnu ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "sparc" ; then
|
||||
echo sparc-unknown-linux-gnu ; exit 0
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
|
||||
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
test ! -d /usr/lib/ldscripts/. \
|
||||
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
printf ("%s-pc-linux-gnu\n", argv[1]);
|
||||
#else
|
||||
printf ("%s-pc-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
927
contrib/traceroute/config.sub
vendored
927
contrib/traceroute/config.sub
vendored
@ -1,927 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigados
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
basic_machine=mips-mips
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-unixware* | svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigados
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
2425
contrib/traceroute/configure
vendored
2425
contrib/traceroute/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,140 +0,0 @@
|
||||
dnl @(#) $Id: configure.in,v 1.33 2000/12/18 09:38:26 leres Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996, 1997, 1999, 2000
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_INIT(traceroute.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
umask 002
|
||||
|
||||
if test -z "$PWD" ; then
|
||||
PWD=`pwd`
|
||||
fi
|
||||
|
||||
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
|
||||
AC_CHECK_HEADERS(malloc.h sys/select.h sys/sockio.h net/route.h \
|
||||
net/if_dl.h inet/mib2.h)
|
||||
|
||||
AC_REPLACE_FUNCS(strerror usleep)
|
||||
AC_CHECK_FUNCS(setlinebuf)
|
||||
if test $ac_cv_func_usleep = "no" ; then
|
||||
AC_CHECK_FUNCS(nanosleep)
|
||||
fi
|
||||
|
||||
AC_LBL_LIBRARY_NET
|
||||
|
||||
case "$target_os" in
|
||||
|
||||
bsd4*)
|
||||
AC_DEFINE(HAVE_RAW_OPTIONS)
|
||||
;;
|
||||
|
||||
bsdi*)
|
||||
AC_DEFINE(HAVE_RAW_OPTIONS)
|
||||
;;
|
||||
|
||||
freebsd*)
|
||||
AC_DEFINE(HAVE_RAW_OPTIONS)
|
||||
;;
|
||||
|
||||
linux*)
|
||||
V_INCLS="$V_INCLS -Ilinux-include"
|
||||
AC_DEFINE(BYTESWAP_IP_HDR)
|
||||
;;
|
||||
|
||||
osf3*)
|
||||
dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
|
||||
AC_DEFINE(__STDC__,2)
|
||||
;;
|
||||
|
||||
solaris2.[[012345]]*)
|
||||
AC_DEFINE(BYTESWAP_IP_HDR)
|
||||
AC_DEFINE(CANT_HACK_IPCKSUM)
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
AC_DEFINE(BYTESWAP_IP_HDR)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl What kind of routing table lookup do we have?
|
||||
dnl
|
||||
AC_MSG_CHECKING(routing table type)
|
||||
t="generic"
|
||||
if test $ac_cv_header_inet_mib2_h = yes ; then
|
||||
t="mib"
|
||||
elif test $ac_cv_header_net_route_h = yes -a \
|
||||
$ac_cv_header_net_if_dl_h = yes ; then
|
||||
t="socket"
|
||||
elif test -f /proc/net/route ; then
|
||||
t="linux"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT(${t})
|
||||
V_FINDSADDR="findsaddr-${t}.c"
|
||||
|
||||
|
||||
AC_LBL_CHECK_TYPE(int32_t, int)
|
||||
AC_LBL_CHECK_TYPE(u_int32_t, u_int)
|
||||
|
||||
AC_LBL_DEVEL(V_CCOPT)
|
||||
|
||||
AC_LBL_SOCKADDR_SA_LEN
|
||||
|
||||
AC_MSG_CHECKING(if struct icmp has icmp_nextmtu)
|
||||
AC_CACHE_VAL(ac_cv_struct_icmp_has_icmp_nextmtu,
|
||||
LBL_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $V_INCLS"
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/param.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in_systm.h>
|
||||
# if __STDC__
|
||||
/* osf3 has REALLY good prototyes */
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# include <netinet/ip.h>
|
||||
# include <netinet/ip_icmp.h>
|
||||
# include <netinet/if_ether.h>],
|
||||
[u_int i = sizeof(((struct icmp *)0)->icmp_nextmtu)],
|
||||
ac_cv_struct_icmp_has_icmp_nextmtu=yes,
|
||||
ac_cv_struct_icmp_has_icmp_nextmtu=no)
|
||||
CFLAGS="$LBL_SAVE_CFLAGS")
|
||||
AC_MSG_RESULT($ac_cv_struct_icmp_has_icmp_nextmtu)
|
||||
if test $ac_cv_struct_icmp_has_icmp_nextmtu = yes ; then
|
||||
AC_DEFINE(HAVE_ICMP_NEXTMTU)
|
||||
fi
|
||||
|
||||
if test "${srcdir}" = "." ; then
|
||||
srcdirprefix=""
|
||||
else
|
||||
srcdirprefix="./"
|
||||
fi
|
||||
|
||||
if test -r ${srcdirprefix}lbl/gnuc.h ; then
|
||||
rm -f gnuc.h
|
||||
ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
|
||||
fi
|
||||
|
||||
AC_SUBST(V_CCOPT)
|
||||
AC_SUBST(V_INCLS)
|
||||
AC_SUBST(V_FINDSADDR)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
if test -f .devel ; then
|
||||
make depend
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000
|
||||
* 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 Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: findsaddr-generic.c,v 1.1 2000/11/23 20:17:12 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#include <sys/time.h> /* concession to AIX */
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "findsaddr.h"
|
||||
#include "ifaddrlist.h"
|
||||
#include "traceroute.h"
|
||||
|
||||
/*
|
||||
* Return the source address for the given destination address
|
||||
*/
|
||||
const char *
|
||||
findsaddr(register const struct sockaddr_in *to,
|
||||
register struct sockaddr_in *from)
|
||||
{
|
||||
register int n;
|
||||
struct ifaddrlist *al;
|
||||
static char errbuf[132];
|
||||
|
||||
/* Get the interface address list */
|
||||
if ((n = ifaddrlist(&al, errbuf)) < 0)
|
||||
return (errbuf);
|
||||
|
||||
if (n == 0)
|
||||
return ("Can't find any network interfaces");
|
||||
|
||||
setsin(from, al->addr);
|
||||
if (n > 1)
|
||||
fprintf(stderr,
|
||||
"%s: Warning: Multiple interfaces found; using %s @ %s\n",
|
||||
prog, inet_ntoa(from->sin_addr), al->device);
|
||||
return (NULL);
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000
|
||||
* 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 Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: findsaddr-linux.c,v 1.1 2000/11/23 20:17:12 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/* XXX linux is different (as usual) */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#include <sys/time.h> /* concession to AIX */
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "findsaddr.h"
|
||||
#include "ifaddrlist.h"
|
||||
#include "traceroute.h"
|
||||
|
||||
static const char route[] = "/proc/net/route";
|
||||
|
||||
/*
|
||||
* Return the source address for the given destination address
|
||||
*/
|
||||
const char *
|
||||
findsaddr(register const struct sockaddr_in *to,
|
||||
register struct sockaddr_in *from)
|
||||
{
|
||||
register int i, n;
|
||||
register FILE *f;
|
||||
register u_int32_t mask;
|
||||
u_int32_t dest, tmask;
|
||||
struct ifaddrlist *al;
|
||||
char buf[256], tdevice[256], device[256];
|
||||
static char errbuf[132];
|
||||
|
||||
if ((f = fopen(route, "r")) == NULL) {
|
||||
sprintf(errbuf, "open %s: %.128s", route, strerror(errno));
|
||||
return (errbuf);
|
||||
}
|
||||
|
||||
/* Find the appropriate interface */
|
||||
n = 0;
|
||||
mask = 0;
|
||||
device[0] = '\0';
|
||||
while (fgets(buf, sizeof(buf), f) != NULL) {
|
||||
++n;
|
||||
if (n == 1 && strncmp(buf, "Iface", 5) == 0)
|
||||
continue;
|
||||
if ((i = sscanf(buf, "%s %x %*s %*s %*s %*s %*s %x",
|
||||
tdevice, &dest, &tmask)) != 3)
|
||||
return ("junk in buffer");
|
||||
if ((to->sin_addr.s_addr & tmask) == dest &&
|
||||
(tmask > mask || mask == 0)) {
|
||||
mask = tmask;
|
||||
strcpy(device, tdevice);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
if (device[0] == '\0')
|
||||
return ("Can't find interface");
|
||||
|
||||
/* Get the interface address list */
|
||||
if ((n = ifaddrlist(&al, errbuf)) < 0)
|
||||
return (errbuf);
|
||||
|
||||
if (n == 0)
|
||||
return ("Can't find any network interfaces");
|
||||
|
||||
/* Find our appropriate source address */
|
||||
for (i = n; i > 0; --i, ++al)
|
||||
if (strcmp(device, al->device) == 0)
|
||||
break;
|
||||
if (i <= 0) {
|
||||
sprintf(errbuf, "Can't find interface \"%.32s\"", device);
|
||||
return (errbuf);
|
||||
}
|
||||
|
||||
setsin(from, al->addr);
|
||||
return (NULL);
|
||||
}
|
@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000
|
||||
* 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 Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory 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.
|
||||
*/
|
||||
|
||||
/* Seriously complex Solaris mib2 code */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: findsaddr-mib.c,v 1.2 2000/12/13 21:31:49 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#include <sys/time.h> /* concession to AIX */
|
||||
#include <sys/stream.h>
|
||||
#include <sys/tihdr.h>
|
||||
#include <sys/tiuser.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <inet/common.h>
|
||||
#include <inet/mib2.h>
|
||||
#include <inet/ip.h>
|
||||
#include <inet/arp.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stropts.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "findsaddr.h"
|
||||
|
||||
/* Compatibility with older versions of Solaris */
|
||||
#ifndef IRE_CACHE
|
||||
#define IRE_CACHE IRE_ROUTE
|
||||
#endif
|
||||
|
||||
#ifndef T_CURRENT
|
||||
#define T_CURRENT MI_T_CURRENT
|
||||
#endif
|
||||
|
||||
struct routelist {
|
||||
struct routelist *next;
|
||||
u_int32_t dest;
|
||||
u_int32_t mask;
|
||||
u_int32_t gate;
|
||||
char ifname[64];
|
||||
};
|
||||
|
||||
/* Forwards */
|
||||
static struct routelist *getroutelist(char *);
|
||||
static void freeroutelist(struct routelist *);
|
||||
|
||||
/*
|
||||
* Return the source address for the given destination address
|
||||
*
|
||||
* Since solaris doesn't report the interface associated with every
|
||||
* route, we have to make two passes over the routing table. The
|
||||
* first pass should yield a host, net, default or interface route.
|
||||
* If we find an interface route we're done. If not, we need to
|
||||
* make a second pass to find the interface route for the gateway
|
||||
* in the host, net, default route we found in the first pass.
|
||||
*
|
||||
* So instead of making a single pass through the tables as they
|
||||
* are retrieved from the kernel, we must build a linked list...
|
||||
*/
|
||||
const char *
|
||||
findsaddr(register const struct sockaddr_in *to,
|
||||
register struct sockaddr_in *from)
|
||||
{
|
||||
register struct routelist *rl, *rl2, *routelist;
|
||||
static char errbuf[512];
|
||||
u_int32_t mask, gate;
|
||||
|
||||
/* Get the routing table */
|
||||
routelist = getroutelist(errbuf);
|
||||
if (routelist == NULL)
|
||||
return (errbuf);
|
||||
|
||||
/* First pass; look for a route that matches */
|
||||
mask = 0;
|
||||
rl2 = NULL;
|
||||
for (rl = routelist; rl != NULL; rl = rl->next) {
|
||||
if ((to->sin_addr.s_addr & rl->mask) == rl->dest &&
|
||||
(rl->mask > mask || mask == 0) &&
|
||||
rl->gate != 0) {
|
||||
mask = rl->mask;
|
||||
rl2 = rl;
|
||||
}
|
||||
}
|
||||
if (rl2 == NULL) {
|
||||
freeroutelist(routelist);
|
||||
sprintf(errbuf, "%s: %.128s",
|
||||
inet_ntoa(to->sin_addr), strerror(EHOSTUNREACH));
|
||||
return (errbuf);
|
||||
}
|
||||
|
||||
/* We're done if we got one with an interface */
|
||||
if (rl2->ifname[0] != '\0') {
|
||||
freeroutelist(routelist);
|
||||
from->sin_addr.s_addr = rl2->gate;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* First pass; look for a route that matches the gateway we found */
|
||||
mask = 0;
|
||||
gate = rl2->gate;
|
||||
rl2 = NULL;
|
||||
for (rl = routelist; rl != NULL; rl = rl->next) {
|
||||
if ((gate & rl->mask) == rl->dest &&
|
||||
(rl->mask > mask || mask == 0) &&
|
||||
rl->gate != 0 &&
|
||||
rl->ifname[0] != '\0') {
|
||||
mask = rl->mask;
|
||||
rl2 = rl;
|
||||
}
|
||||
}
|
||||
if (rl2 == NULL) {
|
||||
freeroutelist(routelist);
|
||||
sprintf(errbuf, "%s: %.128s (second pass)",
|
||||
inet_ntoa(to->sin_addr), strerror(EHOSTUNREACH));
|
||||
return (errbuf);
|
||||
}
|
||||
|
||||
from->sin_addr.s_addr = rl2->gate;
|
||||
freeroutelist(routelist);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Request mib */
|
||||
struct mibrq {
|
||||
struct T_optmgmt_req req;
|
||||
struct opthdr hdr;
|
||||
};
|
||||
|
||||
/* Reply mib */
|
||||
struct mibrep {
|
||||
struct T_optmgmt_ack ack;
|
||||
struct opthdr hdr;
|
||||
char buf[512];
|
||||
};
|
||||
|
||||
static struct mibrq mibrq = {
|
||||
{ T_OPTMGMT_REQ, sizeof(mibrq.hdr), sizeof(mibrq.req), T_CURRENT },
|
||||
{ MIB2_IP }
|
||||
};
|
||||
|
||||
static struct mibrep mibrep = {
|
||||
{ 0, 0, 0 },
|
||||
{ 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static struct strbuf rqbuf = {
|
||||
0, sizeof(mibrq), (char *)&mibrq
|
||||
};
|
||||
|
||||
static struct strbuf repbuf = {
|
||||
sizeof(mibrep.buf), sizeof(mibrep.ack) + sizeof(mibrep.hdr),
|
||||
(char *)&mibrep
|
||||
};
|
||||
|
||||
static const char devip[] = "/dev/ip";
|
||||
|
||||
/*
|
||||
* Construct the list of routes
|
||||
*/
|
||||
static struct routelist *
|
||||
getroutelist(char *errbuf)
|
||||
{
|
||||
register int s, stat, i;
|
||||
register char *cp;
|
||||
register struct T_optmgmt_ack *ackp;
|
||||
register struct T_error_ack *eackp;
|
||||
register struct opthdr *hp;
|
||||
register mib2_ipRouteEntry_t *rp, *rp2;
|
||||
register struct routelist *rl, *rl2, *routelist;
|
||||
int flags;
|
||||
struct strbuf repbuf2;
|
||||
|
||||
s = open(devip, O_RDWR, 0);
|
||||
if (s < 0) {
|
||||
sprintf(errbuf, "open %s: %.128s", devip, strerror(errno));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((cp = "arp", ioctl(s, I_PUSH, cp) < 0) ||
|
||||
(cp = "tcp", ioctl(s, I_PUSH, cp) < 0) ||
|
||||
(cp = "udp", ioctl(s, I_PUSH, cp) < 0)) {
|
||||
sprintf(errbuf, "I_PUSH %s: %.128s", cp, strerror(errno));
|
||||
close(s);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
if (putmsg(s, &rqbuf, NULL, flags) < 0) {
|
||||
sprintf(errbuf, "putmsg: %.128s", strerror(errno));
|
||||
close(s);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
routelist= NULL;
|
||||
rl2 = NULL;
|
||||
|
||||
rp = NULL;
|
||||
|
||||
ackp = &mibrep.ack;
|
||||
hp = &mibrep.hdr;
|
||||
eackp = (struct T_error_ack *)ackp;
|
||||
for (;;) {
|
||||
flags = 0;
|
||||
memset(repbuf.buf, 0, repbuf.len);
|
||||
stat = getmsg(s, &repbuf, NULL, &flags);
|
||||
if (stat < 0) {
|
||||
sprintf(errbuf, "getmsg: %.128s", strerror(errno));
|
||||
goto bail;
|
||||
}
|
||||
if (stat == 0 && repbuf.len >= sizeof(*ackp) &&
|
||||
ackp->PRIM_type == T_OPTMGMT_ACK &&
|
||||
ackp->MGMT_flags == T_SUCCESS &&
|
||||
hp->len == 0) {
|
||||
/* All done! */
|
||||
goto done;
|
||||
}
|
||||
if (repbuf.len >= sizeof(*eackp) &&
|
||||
eackp->PRIM_type == T_ERROR_ACK) {
|
||||
sprintf(errbuf, "getmsg err: %.128s",
|
||||
strerror((eackp->TLI_error == TSYSERR) ?
|
||||
eackp->UNIX_error : EPROTO));
|
||||
goto bail;
|
||||
}
|
||||
if (stat != MOREDATA ||
|
||||
repbuf.len < sizeof(*ackp) ||
|
||||
ackp->PRIM_type != T_OPTMGMT_ACK ||
|
||||
ackp->MGMT_flags != T_SUCCESS) {
|
||||
strcpy(errbuf, "unknown getmsg err");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
memset(&repbuf2, 0, sizeof(repbuf2));
|
||||
repbuf2.maxlen = hp->len;
|
||||
rp = malloc(hp->len);
|
||||
if (rp == NULL) {
|
||||
sprintf(errbuf, "malloc: %.128s", strerror(errno));
|
||||
goto bail;
|
||||
}
|
||||
repbuf2.buf = (char *)rp;
|
||||
|
||||
flags = 0;
|
||||
memset(repbuf2.buf, 0, repbuf2.len);
|
||||
stat = getmsg(s, NULL, &repbuf2, &flags);
|
||||
if (stat < 0) {
|
||||
sprintf(errbuf, "getmsg2: %.128s", strerror(errno));
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Spin through the routes */
|
||||
rp2 = rp;
|
||||
for (rp2 = rp; (char *)rp2 < (char *)rp + repbuf2.len; ++rp2) {
|
||||
if (hp->level != MIB2_IP || hp->name != MIB2_IP_21)
|
||||
continue;
|
||||
|
||||
if (rp2->ipRouteInfo.re_ire_type == IRE_CACHE ||
|
||||
rp2->ipRouteInfo.re_ire_type == IRE_BROADCAST)
|
||||
continue;
|
||||
|
||||
/* Got one we want to keep */
|
||||
rl = malloc(sizeof(*rl));
|
||||
if (rl == NULL) {
|
||||
sprintf(errbuf,
|
||||
"malloc 2: %.128s", strerror(errno));
|
||||
goto bail;
|
||||
}
|
||||
memset(rl, 0, sizeof(*rl));
|
||||
|
||||
rl->mask = rp2->ipRouteMask;
|
||||
rl->dest = rp2->ipRouteDest;
|
||||
rl->gate = rp2->ipRouteNextHop;
|
||||
if (rp2->ipRouteIfIndex.o_length > 0) {
|
||||
i = rp2->ipRouteIfIndex.o_length;
|
||||
if (i > sizeof(rl->ifname) - 1)
|
||||
i = sizeof(rl->ifname) - 1;
|
||||
strncpy(rl->ifname,
|
||||
rp2->ipRouteIfIndex.o_bytes, i);
|
||||
rl->ifname[i] = '\0';
|
||||
}
|
||||
|
||||
/* Keep in order (just for fun) */
|
||||
if (routelist == NULL)
|
||||
routelist = rl;
|
||||
if (rl2 != NULL)
|
||||
rl2->next = rl;
|
||||
rl2 = rl;
|
||||
}
|
||||
free(rp);
|
||||
rp = NULL;
|
||||
}
|
||||
|
||||
strcpy(errbuf, "failed!");
|
||||
|
||||
bail:
|
||||
if (routelist != NULL) {
|
||||
freeroutelist(routelist);
|
||||
routelist = NULL;
|
||||
}
|
||||
done:
|
||||
if (rp != NULL)
|
||||
free(rp);
|
||||
close(s);
|
||||
return (routelist);
|
||||
}
|
||||
|
||||
static void
|
||||
freeroutelist(register struct routelist *rl)
|
||||
{
|
||||
register struct routelist *rl2;
|
||||
|
||||
while (rl != NULL) {
|
||||
rl2 = rl->next;
|
||||
free(rl);
|
||||
rl = rl2;
|
||||
}
|
||||
}
|
@ -61,11 +61,6 @@ struct rtentry;
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "ifaddrlist.h"
|
||||
|
||||
/*
|
||||
|
@ -1,250 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
@ -1,43 +0,0 @@
|
||||
/* @(#) $Header: gnuc.h,v 1.3 95/10/09 02:47:01 leres Exp $ (LBL) */
|
||||
|
||||
/* Define __P() macro, if necessary */
|
||||
#ifndef __P
|
||||
#if __STDC__
|
||||
#define __P(protos) protos
|
||||
#else
|
||||
#define __P(protos) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* inline foo */
|
||||
#ifdef __GNUC__
|
||||
#define inline __inline
|
||||
#else
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle new and old "dead" routine prototypes
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* __dead void foo(void) __attribute__((volatile));
|
||||
*
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifndef __dead
|
||||
#define __dead volatile
|
||||
#endif
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(args)
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifndef __dead
|
||||
#define __dead
|
||||
#endif
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(args)
|
||||
#endif
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 2000
|
||||
* 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: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Id: os-solaris2.h,v 1.18 1997/10/01 01:10:22 leres Exp leres $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in SunOS 5 */
|
||||
int daemon(int, int);
|
||||
int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
|
||||
int dn_skipname(const u_char *, const u_char *);
|
||||
int flock(int, int);
|
||||
int getdtablesize(void);
|
||||
int gethostname(char *, int);
|
||||
int getpagesize(void);
|
||||
char *getusershell(void);
|
||||
char *getwd(char *);
|
||||
int iruserok(u_int, int, char *, char *);
|
||||
#ifdef __STDC__
|
||||
struct utmp;
|
||||
void login(struct utmp *);
|
||||
#endif
|
||||
int logout(const char *);
|
||||
int res_query(const char *, int, int, u_char *, int);
|
||||
int setenv(const char *, const char *, int);
|
||||
#if defined(_STDIO_H) && defined(HAVE_SETLINEBUF)
|
||||
int setlinebuf(FILE *);
|
||||
#endif
|
||||
int sigblock(int);
|
||||
int sigsetmask(int);
|
||||
char *strerror(int);
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
int strcasecmp(const char *, const char *);
|
||||
void unsetenv(const char *);
|
@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1990, 1993, 1994, 1995, 1996
|
||||
* 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: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: os-sunos4.h,v 1.32 96/11/29 15:18:18 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in SunOS 4 */
|
||||
#ifdef FILE
|
||||
int _filbuf(FILE *);
|
||||
int _flsbuf(u_char, FILE *);
|
||||
int fclose(FILE *);
|
||||
int fflush(FILE *);
|
||||
int fgetc(FILE *);
|
||||
int fprintf(FILE *, const char *, ...);
|
||||
int fputc(int, FILE *);
|
||||
int fputs(const char *, FILE *);
|
||||
u_int fread(void *, u_int, u_int, FILE *);
|
||||
int fseek(FILE *, long, int);
|
||||
u_int fwrite(const void *, u_int, u_int, FILE *);
|
||||
int pclose(FILE *);
|
||||
void rewind(FILE *);
|
||||
void setbuf(FILE *, char *);
|
||||
int setlinebuf(FILE *);
|
||||
int ungetc(int, FILE *);
|
||||
int vfprintf(FILE *, const char *, ...);
|
||||
int vprintf(const char *, ...);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ <= 1
|
||||
int read(int, char *, u_int);
|
||||
int write(int, char *, u_int);
|
||||
#endif
|
||||
|
||||
long a64l(const char *);
|
||||
#ifdef __STDC__
|
||||
struct sockaddr;
|
||||
#endif
|
||||
int accept(int, struct sockaddr *, int *);
|
||||
int bind(int, struct sockaddr *, int);
|
||||
int bcmp(const void *, const void *, u_int);
|
||||
void bcopy(const void *, void *, u_int);
|
||||
void bzero(void *, int);
|
||||
int chroot(const char *);
|
||||
int close(int);
|
||||
void closelog(void);
|
||||
int connect(int, struct sockaddr *, int);
|
||||
char *crypt(const char *, const char *);
|
||||
int daemon(int, int);
|
||||
int fchmod(int, int);
|
||||
int fchown(int, int, int);
|
||||
void endgrent(void);
|
||||
void endpwent(void);
|
||||
void endservent(void);
|
||||
#ifdef __STDC__
|
||||
struct ether_addr;
|
||||
#endif
|
||||
struct ether_addr *ether_aton(const char *);
|
||||
int flock(int, int);
|
||||
#ifdef __STDC__
|
||||
struct stat;
|
||||
#endif
|
||||
int fstat(int, struct stat *);
|
||||
#ifdef __STDC__
|
||||
struct statfs;
|
||||
#endif
|
||||
int fstatfs(int, struct statfs *);
|
||||
int fsync(int);
|
||||
#ifdef __STDC__
|
||||
struct timeb;
|
||||
#endif
|
||||
int ftime(struct timeb *);
|
||||
int ftruncate(int, off_t);
|
||||
int getdtablesize(void);
|
||||
long gethostid(void);
|
||||
int gethostname(char *, int);
|
||||
int getopt(int, char * const *, const char *);
|
||||
int getpagesize(void);
|
||||
char *getpass(char *);
|
||||
int getpeername(int, struct sockaddr *, int *);
|
||||
int getpriority(int, int);
|
||||
#ifdef __STDC__
|
||||
struct rlimit;
|
||||
#endif
|
||||
int getrlimit(int, struct rlimit *);
|
||||
int getsockname(int, struct sockaddr *, int *);
|
||||
int getsockopt(int, int, int, char *, int *);
|
||||
#ifdef __STDC__
|
||||
struct timeval;
|
||||
struct timezone;
|
||||
#endif
|
||||
int gettimeofday(struct timeval *, struct timezone *);
|
||||
char *getusershell(void);
|
||||
char *getwd(char *);
|
||||
int initgroups(const char *, int);
|
||||
int ioctl(int, int, caddr_t);
|
||||
int iruserok(u_long, int, char *, char *);
|
||||
int isatty(int);
|
||||
int killpg(int, int);
|
||||
int listen(int, int);
|
||||
#ifdef __STDC__
|
||||
struct utmp;
|
||||
#endif
|
||||
void login(struct utmp *);
|
||||
int logout(const char *);
|
||||
off_t lseek(int, off_t, int);
|
||||
int lstat(const char *, struct stat *);
|
||||
int mkstemp(char *);
|
||||
char *mktemp(char *);
|
||||
int munmap(caddr_t, int);
|
||||
void openlog(const char *, int, int);
|
||||
void perror(const char *);
|
||||
int printf(const char *, ...);
|
||||
int puts(const char *);
|
||||
long random(void);
|
||||
int readlink(const char *, char *, int);
|
||||
#ifdef __STDC__
|
||||
struct iovec;
|
||||
#endif
|
||||
int readv(int, struct iovec *, int);
|
||||
int recv(int, char *, u_int, int);
|
||||
int recvfrom(int, char *, u_int, int, struct sockaddr *, int *);
|
||||
int rename(const char *, const char *);
|
||||
int rcmd(char **, u_short, char *, char *, char *, int *);
|
||||
int rresvport(int *);
|
||||
int send(int, char *, u_int, int);
|
||||
int sendto(int, char *, u_int, int, struct sockaddr *, int);
|
||||
int setenv(const char *, const char *, int);
|
||||
int seteuid(int);
|
||||
int setpriority(int, int, int);
|
||||
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
int setpgrp(int, int);
|
||||
void setpwent(void);
|
||||
int setrlimit(int, struct rlimit *);
|
||||
void setservent(int);
|
||||
int setsockopt(int, int, int, char *, int);
|
||||
int shutdown(int, int);
|
||||
int sigblock(int);
|
||||
void (*signal (int, void (*) (int))) (int);
|
||||
int sigpause(int);
|
||||
int sigsetmask(int);
|
||||
#ifdef __STDC__
|
||||
struct sigvec;
|
||||
#endif
|
||||
int sigvec(int, struct sigvec *, struct sigvec*);
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
int socket(int, int, int);
|
||||
int socketpair(int, int, int, int *);
|
||||
int symlink(const char *, const char *);
|
||||
void srandom(int);
|
||||
int sscanf(char *, const char *, ...);
|
||||
int stat(const char *, struct stat *);
|
||||
int statfs(char *, struct statfs *);
|
||||
char *strerror(int);
|
||||
int strcasecmp(const char *, const char *);
|
||||
#ifdef __STDC__
|
||||
struct tm;
|
||||
#endif
|
||||
int strftime(char *, int, char *, struct tm *);
|
||||
int strncasecmp(const char *, const char *, int);
|
||||
long strtol(const char *, char **, int);
|
||||
void sync(void);
|
||||
void syslog(int, const char *, ...);
|
||||
int system(const char *);
|
||||
long tell(int);
|
||||
time_t time(time_t *);
|
||||
char *timezone(int, int);
|
||||
int tolower(int);
|
||||
int toupper(int);
|
||||
int truncate(char *, off_t);
|
||||
void unsetenv(const char *);
|
||||
int vfork(void);
|
||||
int vsprintf(char *, const char *, ...);
|
||||
int writev(int, struct iovec *, int);
|
||||
#ifdef __STDC__
|
||||
struct rusage;
|
||||
#endif
|
||||
int utimes(const char *, struct timeval *);
|
||||
#if __GNUC__ <= 1
|
||||
int wait(int *);
|
||||
pid_t wait3(int *, int, struct rusage *);
|
||||
#endif
|
||||
|
||||
/* Ugly signal hacking */
|
||||
#ifdef SIG_ERR
|
||||
#undef SIG_ERR
|
||||
#define SIG_ERR (void (*)(int))-1
|
||||
#undef SIG_DFL
|
||||
#define SIG_DFL (void (*)(int))0
|
||||
#undef SIG_IGN
|
||||
#define SIG_IGN (void (*)(int))1
|
||||
|
||||
#ifdef KERNEL
|
||||
#undef SIG_CATCH
|
||||
#define SIG_CATCH (void (*)(int))2
|
||||
#endif
|
||||
#undef SIG_HOLD
|
||||
#define SIG_HOLD (void (*)(int))3
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# Copyright (c) 1994, 1996
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of California at Berkeley. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
|
||||
#
|
||||
|
||||
PATH=/bin:/usr/bin:/usr/ucb:/usr/local:/usr/local/bin
|
||||
export PATH
|
||||
|
||||
MAKE=Makefile # default makefile name is "Makefile"
|
||||
CC=cc # default C compiler is "cc"
|
||||
|
||||
while :
|
||||
do case "$1" in
|
||||
# -c allows you to specify the C compiler
|
||||
-c)
|
||||
CC=$2
|
||||
shift; shift ;;
|
||||
|
||||
# -f allows you to select a makefile name
|
||||
-f)
|
||||
MAKE=$2
|
||||
shift; shift ;;
|
||||
|
||||
# the -p flag produces "program: program.c" style dependencies
|
||||
# so .o's don't get produced
|
||||
-p)
|
||||
SED='s;\.o;;'
|
||||
shift ;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
echo 'usage: mkdep [-p] [-c cc] [-f makefile] [flags] file ...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w $MAKE ]; then
|
||||
echo "mkdep: no writeable file \"$MAKE\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMP=/tmp/mkdep$$
|
||||
|
||||
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
|
||||
|
||||
cp $MAKE ${MAKE}.bak
|
||||
|
||||
sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
|
||||
|
||||
cat << _EOF_ >> $TMP
|
||||
# DO NOT DELETE THIS LINE -- mkdep uses it.
|
||||
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
|
||||
|
||||
_EOF_
|
||||
|
||||
# If your compiler doesn't have -M, add it. If you can't, the next two
|
||||
# lines will try and replace the "cc -M". The real problem is that this
|
||||
# hack can't deal with anything that requires a search path, and doesn't
|
||||
# even try for anything using bracket (<>) syntax.
|
||||
#
|
||||
# egrep '^#include[ ]*".*"' /dev/null $* |
|
||||
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
|
||||
|
||||
# XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
|
||||
$CC -M $* |
|
||||
sed "
|
||||
s; \./; ;g
|
||||
$SED" |
|
||||
awk '{
|
||||
if ($1 != prev) {
|
||||
if (rec != "")
|
||||
print rec;
|
||||
rec = $0;
|
||||
prev = $1;
|
||||
}
|
||||
else {
|
||||
if (length(rec $2) > 78) {
|
||||
print rec;
|
||||
rec = $0;
|
||||
}
|
||||
else
|
||||
rec = rec " " $2
|
||||
}
|
||||
}
|
||||
END {
|
||||
print rec
|
||||
}' >> $TMP
|
||||
|
||||
cat << _EOF_ >> $TMP
|
||||
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
_EOF_
|
||||
|
||||
# copy to preserve permissions
|
||||
cp $TMP $MAKE
|
||||
rm -f ${MAKE}.bak $TMP
|
||||
exit 0
|
@ -245,11 +245,6 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
/* rfc1716 */
|
||||
#ifndef ICMP_UNREACH_FILTER_PROHIB
|
||||
#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */
|
||||
|
@ -1,32 +0,0 @@
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: usleep.c,v 1.1 2000/09/16 05:31:06 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
usleep(register u_int useconds)
|
||||
{
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
struct timespec ts;
|
||||
|
||||
ts.tv_sec = useconds / 1000000;
|
||||
ts.tv_nsec = (useconds % 1000000) * 1000;
|
||||
return (nanosleep(&ts, NULL));
|
||||
#else
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = useconds / 1000000;
|
||||
tv.tv_usec = useconds % 1000000;
|
||||
return (select(0, NULL, NULL, NULL, &tv));
|
||||
#endif
|
||||
}
|
@ -19,7 +19,9 @@ CFLAGS+= ${DRIVER_DEFINES}
|
||||
|
||||
SRCS= gcc.c opts-common.c options.c intl.c prefix.c version.c
|
||||
|
||||
.if exists(${GCCDIR}/config/${GCC_CPU}/driver-${GCC_CPU}.c)
|
||||
# Include -march=native support for native-ish compilers only
|
||||
.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64") && \
|
||||
${GCC_CPU} == "i386"
|
||||
SRCS+= driver-${GCC_CPU}.c
|
||||
.endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 29, 2009
|
||||
.Dd November 30, 2010
|
||||
.Dt GETLINE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -54,23 +54,23 @@ function is equivalent to
|
||||
with the newline character as the delimiter.
|
||||
The delimiter character is included as part of the line, unless
|
||||
the end of the file is reached.
|
||||
The caller may provide a pointer to a malloc buffer for the line in
|
||||
.Pp
|
||||
The caller may provide a pointer to a malloced buffer for the line in
|
||||
.Fa *linep ,
|
||||
and the capacity of that buffer in
|
||||
.Fa *linecapp ;
|
||||
if
|
||||
.Fa *linecapp
|
||||
is 0, then
|
||||
.Fa *linep
|
||||
is treated as
|
||||
.Dv NULL .
|
||||
These functions may expand the buffer as needed, as if via
|
||||
.Fn realloc ,
|
||||
and update
|
||||
.Fa *linecapp .
|
||||
These functions expand the buffer as needed, as if via
|
||||
.Fn realloc .
|
||||
If
|
||||
.Fa linep
|
||||
points to a
|
||||
.Dv NULL
|
||||
pointer, a new buffer will be allocated.
|
||||
In either case,
|
||||
.Fa *linep
|
||||
and
|
||||
.Fa *linecapp
|
||||
accordingly.
|
||||
will be updated accordingly.
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn getdelim
|
||||
@ -140,7 +140,7 @@ No delimiter was found in the first
|
||||
characters.
|
||||
.El
|
||||
.Pp
|
||||
These functions may also fail for any of the errors specified for
|
||||
These functions may also fail due to any of the errors specified for
|
||||
.Fn fgets
|
||||
and
|
||||
.Fn malloc .
|
||||
|
@ -248,7 +248,6 @@ __find_arguments (const char *fmt0, va_list ap, union arg **argtable)
|
||||
int n; /* handy integer (short term usage) */
|
||||
int error;
|
||||
int flags; /* flags as above */
|
||||
int width; /* width from format (%8d), or 0 */
|
||||
struct typetable types; /* table of types */
|
||||
|
||||
fmt = (char *)fmt0;
|
||||
@ -266,7 +265,6 @@ __find_arguments (const char *fmt0, va_list ap, union arg **argtable)
|
||||
fmt++; /* skip over '%' */
|
||||
|
||||
flags = 0;
|
||||
width = 0;
|
||||
|
||||
rflag: ch = *fmt++;
|
||||
reswitch: switch (ch) {
|
||||
@ -304,7 +302,6 @@ reswitch: switch (ch) {
|
||||
types.nextarg = n;
|
||||
goto rflag;
|
||||
}
|
||||
width = n;
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
@ -439,7 +436,6 @@ __find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
|
||||
int n; /* handy integer (short term usage) */
|
||||
int error;
|
||||
int flags; /* flags as above */
|
||||
int width; /* width from format (%8d), or 0 */
|
||||
struct typetable types; /* table of types */
|
||||
|
||||
fmt = (wchar_t *)fmt0;
|
||||
@ -457,7 +453,6 @@ __find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
|
||||
fmt++; /* skip over '%' */
|
||||
|
||||
flags = 0;
|
||||
width = 0;
|
||||
|
||||
rflag: ch = *fmt++;
|
||||
reswitch: switch (ch) {
|
||||
@ -495,7 +490,6 @@ reswitch: switch (ch) {
|
||||
types.nextarg = n;
|
||||
goto rflag;
|
||||
}
|
||||
width = n;
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
|
@ -3,7 +3,7 @@
|
||||
LIB= cam
|
||||
SHLIBDIR?= /lib
|
||||
SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c \
|
||||
ata_all.c
|
||||
ata_all.c smp_all.c
|
||||
INCS= camlib.h
|
||||
|
||||
DPADD= ${LIBSBUF}
|
||||
|
@ -370,10 +370,12 @@ readboot(void)
|
||||
p[60] = (st.st_size + secsize - 1) / secsize;
|
||||
p[61] = 1;
|
||||
p[62] = 0;
|
||||
close(fd);
|
||||
return;
|
||||
} else if ((!alphacksum) && st.st_size <= BBSIZE) {
|
||||
if (read(fd, bootarea, st.st_size) != st.st_size)
|
||||
err(1, "read error %s", xxboot);
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
errx(1, "boot code %s is wrong size", xxboot);
|
||||
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 1, 2010
|
||||
.Dd November 30, 2010
|
||||
.Dt CAMCONTROL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -131,6 +131,43 @@
|
||||
.Op Fl r Ar fmt
|
||||
.Ek
|
||||
.Nm
|
||||
.Ic smpcmd
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Aq Fl r Ar len Ar fmt Op args
|
||||
.Aq Fl R Ar len Ar fmt Op args
|
||||
.Nm
|
||||
.Ic smprg
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Op Fl l
|
||||
.Nm
|
||||
.Ic smppc
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Aq Fl p Ar phy
|
||||
.Op Fl l
|
||||
.Op Fl o Ar operation
|
||||
.Op Fl d Ar name
|
||||
.Op Fl m Ar rate
|
||||
.Op Fl M Ar rate
|
||||
.Op Fl T Ar pp_timeout
|
||||
.Op Fl a Ar enable|disable
|
||||
.Op Fl A Ar enable|disable
|
||||
.Op Fl s Ar enable|disable
|
||||
.Op Fl S Ar enable|disable
|
||||
.Nm
|
||||
.Ic smpphylist
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Op Fl l
|
||||
.Op Fl q
|
||||
.Nm
|
||||
.Ic smpmaninfo
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Op Fl l
|
||||
.Nm
|
||||
.Ic debug
|
||||
.Op Fl I
|
||||
.Op Fl P
|
||||
@ -554,6 +591,177 @@ If the format is
|
||||
.Sq - ,
|
||||
11 result registers will be written to standard output in hex.
|
||||
.El
|
||||
.It Ic smpcmd
|
||||
Allows the user to send an arbitrary Serial
|
||||
Management Protocol (SMP) command to a device.
|
||||
The
|
||||
.Ic smpcmd
|
||||
function requires the
|
||||
.Fl r
|
||||
argument to specify the SMP request to be sent, and the
|
||||
.Fl R
|
||||
argument to specify the format of the SMP response.
|
||||
The syntax for the SMP request and response arguments is documented in
|
||||
.Xr cam_cdbparse 3 .
|
||||
.Pp
|
||||
Note that SAS adapters that support SMP passthrough (at least the currently
|
||||
known adapters) do not accept CRC bytes from the user in the request and do
|
||||
not pass CRC bytes back to the user in the response.
|
||||
Therefore users should not include the CRC bytes in the length of the
|
||||
request and not expect CRC bytes to be returned in the response.
|
||||
.Bl -tag -width 17n
|
||||
.It Fl r Ar len Ar fmt Op args
|
||||
This specifies the size of the SMP request, without the CRC bytes, and the
|
||||
SMP request format. If the format is
|
||||
.Sq - ,
|
||||
.Ar len
|
||||
bytes of data will be read from standard input and written as the SMP
|
||||
request.
|
||||
.It Fl R Ar len Ar fmt Op args
|
||||
This specifies the size of the buffer allocated for the SMP response, and
|
||||
the SMP response format.
|
||||
If the format is
|
||||
.Sq - ,
|
||||
.Ar len
|
||||
bytes of data will be allocated for the response and the response will be
|
||||
written to standard output.
|
||||
.El
|
||||
.It Ic smprg
|
||||
Allows the user to send the Serial Management Protocol (SMP) Report General
|
||||
command to a device.
|
||||
.Nm
|
||||
will display the data returned by the Report General command.
|
||||
If the SMP target supports the long response format, the additional data
|
||||
will be requested and displayed automatically.
|
||||
.Bl -tag -width 8n
|
||||
.It Fl l
|
||||
Request the long response format only.
|
||||
Not all SMP targets support the long response format.
|
||||
This option causes
|
||||
.Nm
|
||||
to skip sending the initial report general request without the long bit set
|
||||
and only issue a report general request with the long bit set.
|
||||
.El
|
||||
.It Ic smppc
|
||||
Allows the user to issue the Serial Management Protocol (SMP) PHY Control
|
||||
command to a device.
|
||||
This function should be used with some caution, as it can render devices
|
||||
inaccessible, and could potentially cause data corruption as well.
|
||||
The
|
||||
.Fl p
|
||||
argument is required to specify the PHY to operate on.
|
||||
.Bl -tag -width 17n
|
||||
.It Fl p Ar phy
|
||||
Specify the PHY to operate on.
|
||||
This argument is required.
|
||||
.It Fl l
|
||||
Request the long request/response format.
|
||||
Not all SMP targets support the long response format.
|
||||
For the PHY Control command, this currently only affects whether the
|
||||
request length is set to a value other than 0.
|
||||
.It Fl o Ar operation
|
||||
Specify a PHY control operation.
|
||||
Only one
|
||||
.Fl o
|
||||
operation may be specified.
|
||||
The operation may be specified numerically (in decimal, hexadecimal, or octal)
|
||||
or one of the following operation names may be specified:
|
||||
.Bl -tag -width 16n
|
||||
.It nop
|
||||
No operation.
|
||||
It is not necessary to specify this argument.
|
||||
.It linkreset
|
||||
Send the LINK RESET command to the phy.
|
||||
.It hardreset
|
||||
Send the HARD RESET command to the phy.
|
||||
.It disable
|
||||
Send the DISABLE command to the phy.
|
||||
Note that the LINK RESET or HARD RESET commands should re-enable the phy.
|
||||
.It clearerrorlog
|
||||
Send the CLEAR ERROR LOG command.
|
||||
This clears the error log counters for the specified phy.
|
||||
.It clearaffiliation
|
||||
Send the CLEAR AFFILIATION command.
|
||||
This clears the affiliation from the STP initiator port with the same SAS
|
||||
address as the SMP initiator that requests the clear operation.
|
||||
.It sataportsel
|
||||
Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
|
||||
This will cause a SATA port selector to use the given phy as its active phy
|
||||
and make the other phy inactive.
|
||||
.It clearitnl
|
||||
Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
|
||||
.It setdevname
|
||||
Send the SET ATTACHED DEVICE NAME command to the PHY.
|
||||
This requires the
|
||||
.Fl d
|
||||
argument to specify the device name.
|
||||
.El
|
||||
.It Fl d Ar name
|
||||
Specify the attached device name.
|
||||
This option is needed with the
|
||||
.Fl o Ar setdevname
|
||||
phy operation.
|
||||
The name is a 64-bit number, and can be specified in decimal, hexadecimal
|
||||
or octal format.
|
||||
.It Fl m Ar rate
|
||||
Set the minimum physical link rate for the phy.
|
||||
This is a numeric argument.
|
||||
Currently known link rates are:
|
||||
.Bl -tag -width 5n
|
||||
.It 0x0
|
||||
Do not change current value.
|
||||
.It 0x8
|
||||
1.5 Gbps
|
||||
.It 0x9
|
||||
3 Gbps
|
||||
.It 0xa
|
||||
6 Gbps
|
||||
.El
|
||||
.Pp
|
||||
Other values may be specified for newer physical link rates.
|
||||
.It Fl M Ar rate
|
||||
Set the maximum physical link rate for the phy.
|
||||
This is a numeric argument.
|
||||
See the
|
||||
.Fl m
|
||||
argument description for known link rate arguments.
|
||||
.It Fl T Ar pp_timeout
|
||||
Set the partial pathway timeout value, in microseconds.
|
||||
See the
|
||||
.Tn ANSI
|
||||
.Tn SAS
|
||||
Protcol Layer (SPL)
|
||||
specification for more information on this field.
|
||||
.It Fl a Ar enable|disable
|
||||
Enable or disable SATA slumber phy power conditions.
|
||||
.It Fl A Ar enable|disable
|
||||
Enable or disable SATA partial power conditions.
|
||||
.It Fl s Ar enable|disable
|
||||
Enable or disable SAS slumber phy power conditions.
|
||||
.It Fl S Ar enable|disable
|
||||
Enable or disable SAS partial phy power conditions.
|
||||
.El
|
||||
.It Ic smpphylist
|
||||
List phys attached to a SAS expander, the address of the end device
|
||||
attached to the phy, and the inquiry data for that device and peripheral
|
||||
devices attached to that device.
|
||||
The inquiry data and peripheral devices are displayed if available.
|
||||
.Bl -tag -width 5n
|
||||
.It Fl l
|
||||
Turn on the long response format for the underlying SMP commands used for
|
||||
this command.
|
||||
.It Fl q
|
||||
Only print out phys that are attached to a device in the CAM EDT (Existing
|
||||
Device Table).
|
||||
.El
|
||||
.It Ic smpmaninfo
|
||||
Send the SMP Report Manufacturer Information command to the device and
|
||||
display the response.
|
||||
.Bl -tag -width 5n
|
||||
.It Fl l
|
||||
Turn on the long response format for the underlying SMP commands used for
|
||||
this command.
|
||||
.El
|
||||
.It Ic debug
|
||||
Turn on CAM debugging printfs in the kernel.
|
||||
This requires options CAMDEBUG
|
||||
@ -965,6 +1173,14 @@ camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
|
||||
Negotiate a sync rate of 20MHz and an offset of 15 with da3.
|
||||
Then send a
|
||||
Test Unit Ready command to make the settings take effect.
|
||||
.Pp
|
||||
.Bd -literal -offset indent
|
||||
camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
|
||||
.Ed
|
||||
.Pp
|
||||
Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
|
||||
it contains.
|
||||
Display SMP errors if the command fails.
|
||||
.Sh SEE ALSO
|
||||
.Xr cam 3 ,
|
||||
.Xr cam_cdbparse 3 ,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -295,6 +295,8 @@ main(int argc, char *argv[])
|
||||
sdl = (const struct sockaddr_dl *) ifa->ifa_addr;
|
||||
else
|
||||
sdl = NULL;
|
||||
if (sdl != NULL && sdl->sdl_type == IFT_USB)
|
||||
continue;
|
||||
if (cp != NULL && strcmp(cp, ifa->ifa_name) == 0 && !namesonly)
|
||||
continue;
|
||||
iflen = strlcpy(name, ifa->ifa_name, sizeof(name));
|
||||
|
@ -24,12 +24,12 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 28, 2008
|
||||
.Dd November 25, 2010
|
||||
.Dt ARCMSR 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm arcmsr
|
||||
.Nd Areca SATA II RAID Controller driver
|
||||
.Nd Areca RAID Controller driver
|
||||
.Sh SYNOPSIS
|
||||
To compile this driver into the kernel,
|
||||
place the following lines in your
|
||||
@ -50,11 +50,11 @@ arcmsr_load="YES"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the Areca ARC-11xx and ARC-12xx series of SATA II
|
||||
RAID controllers.
|
||||
driver provides support for the Areca ARC-11xx, ARC-12xx, ARC-13xx,
|
||||
ARC-16xx and ARC-18xx series of SAS and SATA RAID controllers.
|
||||
These controllers feature RAID-0, 1, 3, 5, 6, and 10 and
|
||||
JBOD acceleration for up to 16 SATA drives.
|
||||
Raid level and stripe level
|
||||
RAID level and stripe level
|
||||
migration, online capacity expansion, hot insertion/removal, automatic failover
|
||||
and rebuild, and SMART are also supported.
|
||||
Access to the arrays is provided
|
||||
@ -82,8 +82,6 @@ ARC-1160
|
||||
.It
|
||||
ARC-1170
|
||||
.It
|
||||
ARC-1180
|
||||
.It
|
||||
ARC-1110ML
|
||||
.It
|
||||
ARC-1120ML
|
||||
@ -92,14 +90,28 @@ ARC-1130ML
|
||||
.It
|
||||
ARC-1160ML
|
||||
.It
|
||||
ARC-1200
|
||||
.It
|
||||
ARC-1201
|
||||
.It
|
||||
ARC-1210
|
||||
.It
|
||||
ARC-1212
|
||||
.It
|
||||
ARC-1220
|
||||
.It
|
||||
ARC-1222
|
||||
.It
|
||||
ARC-1230
|
||||
.It
|
||||
ARC-1231
|
||||
.It
|
||||
ARC-1260
|
||||
.It
|
||||
ARC-1261
|
||||
.It
|
||||
ARC-1270
|
||||
.It
|
||||
ARC-1280
|
||||
.It
|
||||
ARC-1210ML
|
||||
@ -111,6 +123,16 @@ ARC-1231ML
|
||||
ARC-1261ML
|
||||
.It
|
||||
ARC-1280ML
|
||||
.It
|
||||
ARC-1380
|
||||
.It
|
||||
ARC-1381
|
||||
.It
|
||||
ARC-1680
|
||||
.It
|
||||
ARC-1681
|
||||
.It
|
||||
ARC-1880
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width ".Pa /dev/arcmsr?" -compact
|
||||
|
@ -228,6 +228,13 @@ but be aware that your hardware might
|
||||
support it and can potentially
|
||||
.Em hang
|
||||
the entire system causing data loss.
|
||||
.Pp
|
||||
The
|
||||
.Nm acd
|
||||
driver implements most of the
|
||||
.Fn ioctl
|
||||
requests documented by
|
||||
.Xr cd 4 .
|
||||
.Sh FILES
|
||||
.Bl -tag -width ".Pa /sys/i386/conf/GENERIC" -compact
|
||||
.It Pa /dev/ad*
|
||||
@ -271,6 +278,7 @@ Native Command Queuing (NCQ) on SATA drives is not yet supported.
|
||||
.Xr ataraid 4 ,
|
||||
.Xr atacontrol 8 ,
|
||||
.Xr burncd 8 ,
|
||||
.Xr cd 4 ,
|
||||
.Xr siis 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 14, 2008
|
||||
.Dd November 25, 2010
|
||||
.Dt ET 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -122,6 +122,11 @@ Note that the 1000baseT media type is only available
|
||||
if it is supported by the adapter.
|
||||
For more information on configuring this device, see
|
||||
.Xr ifconfig 8 .
|
||||
.Sh HARDWARE
|
||||
The
|
||||
.Nm
|
||||
driver supports Agere ET1310 10/100/Gigabit
|
||||
Ethernet adapters.
|
||||
.Sh TUNABLES
|
||||
.Bl -tag -width ".Va hw.et.rx_intr_npkts"
|
||||
.It Va hw.et.rx_intr_npkts
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 12, 2010
|
||||
.Dd November 26, 2010
|
||||
.Dt FXP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -166,9 +166,6 @@ Number of packets that will be bundled, before an interrupt is
|
||||
generated.
|
||||
This is only effective if the Intel microcode is loaded.
|
||||
The accepted range is 1 to 65535, the default is 6.
|
||||
.It Va dev.fxp.%d.noflow
|
||||
Controls whether flow control should be used or not.
|
||||
The default is 1 (no flow control).
|
||||
.El
|
||||
.Sh SYSCTL VARIABLES
|
||||
The following variables are available as
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 27, 2010
|
||||
.Dd December 2, 2010
|
||||
.Dt RE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -178,6 +178,11 @@ prompt before booting the kernel or stored in
|
||||
.It Va hw.re.msi_disable
|
||||
This tunable disables MSI support on the Ethernet hardware.
|
||||
The default value is 0.
|
||||
.It Va hw.re.prefer_iomap
|
||||
This tunable controls which register mapping should be used on the
|
||||
specified device.
|
||||
A non-zero value enables I/O space register mapping.
|
||||
The default value is 0 to use memory space register mapping.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Bl -diag
|
||||
|
@ -93,6 +93,7 @@ including:
|
||||
.It "Buffalo WLI-U2-SG54HP" Ta USB
|
||||
.It "Buffalo WLI-U2-SG54HG" Ta USB
|
||||
.It "Buffalo WLI-U2-G54HP" Ta USB
|
||||
.It "Buffalo WLI-UC-G" Ta USB
|
||||
.It "CNet CWD-854 ver F" Ta USB
|
||||
.It "Conceptronic C54RU ver 2" Ta USB
|
||||
.It "Corega CG-WLUSB2GO" Ta USB
|
||||
|
@ -26,7 +26,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 7, 2010
|
||||
.Dd November 29, 2010
|
||||
.Dt SPLASH 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -114,7 +114,10 @@ The screen will gradually fade away.
|
||||
.It Pa fire_saver.ko
|
||||
A fire which becomes higher as load increases.
|
||||
.It Pa green_saver.ko
|
||||
If the monitor supports power saving mode, it will be turned off.
|
||||
The screen will be blanked, similar to
|
||||
.Pa blank_saver.ko .
|
||||
If the monitor and the video card's BIOS support it
|
||||
the screen will also be powered off.
|
||||
.It Pa logo_saver.ko
|
||||
Animated graphical
|
||||
.Fx
|
||||
|
@ -27,7 +27,7 @@ To compile this module into the kernel,
|
||||
place the following line in your
|
||||
kernel configuration file:
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "device ucom"
|
||||
.Cd "device usb"
|
||||
.Ed
|
||||
.Pp
|
||||
Alternatively, to load the module at boot
|
||||
@ -183,7 +183,6 @@ device which appears as a USB device on
|
||||
usbconfig -d ugen0.3 add_quirk UQ_MSC_EJECT_WAIT
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr usb_quirk 4 ,
|
||||
.Xr usbconfig 5
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -49,7 +49,7 @@
|
||||
# Language support: MENU, FONT
|
||||
#
|
||||
MENU:en:Choose your keyboard font
|
||||
MENU:de:Wähle Deine Schrift
|
||||
MENU:de:Wählen Sie Ihre Schrift
|
||||
MENU:fr:Choisissez votre fonte écran
|
||||
MENU:pl:Wybierz czcionkê ekranow±
|
||||
MENU:es:Escoja el juego de caracteres
|
||||
|
@ -26,7 +26,7 @@ FILES= armscii8-8x8.fnt armscii8-8x14.fnt armscii8-8x16.fnt \
|
||||
koi8-r-8x8.fnt koi8-r-8x14.fnt koi8-r-8x16.fnt \
|
||||
koi8-rb-8x16.fnt koi8-rc-8x16.fnt \
|
||||
koi8-u-8x8.fnt koi8-u-8x14.fnt koi8-u-8x16.fnt \
|
||||
swiss-8x16.fnt swiss-8x8.fnt \
|
||||
swiss-8x16.fnt swiss-8x14.fnt swiss-8x8.fnt \
|
||||
swiss-1251-8x16.fnt swiss-1131-8x16.fnt \
|
||||
INDEX.fonts
|
||||
|
||||
|
84
share/syscons/fonts/swiss-8x14.fnt
Normal file
84
share/syscons/fonts/swiss-8x14.fnt
Normal file
@ -0,0 +1,84 @@
|
||||
# $FreeBSD$
|
||||
begin 644 swiss-8x14
|
||||
M````````$```````````/$*!YZ69@9E"/``````\?O^9V^?_YWX\``````!L
|
||||
M_O[^_OY\.!`````````0.'S^?#@0```````X.!#6_M80.'Q\`````!`X?/[^
|
||||
M5!`X?'P``````````!@\/!@``````/______Y\/#Y_______`````#QF0D)F
|
||||
M/`````#_____PYF]O9G#_____P`>#AHP>,S,S,QX`````#QF9F8\&'X8&!@`
|
||||
M```@,#@\-C8P</#P8``````^(CXB(B(B)F[D0``````0DE0HQBA4DA``````
|
||||
M0&!P>'Q^?'AP8$`````"!@X>/GX^'@X&`@`````8/'X8&!@8?CP8````9F9F
|
||||
M9F9F9@!F9@````!^]/3T=!04%!04````'C!XW,[G<SL>#'@`````````````
|
||||
M_O[^_@`````8/'X8&!@8&'X\&`#_`!@\?A@8&!@8&!@8````&!@8&!@8&!A^
|
||||
M/!@````````,!O\&#````````````#!@_V`P````````,V;N````````````
|
||||
M```````D9O]F)```````````&#P\?G[__P````````#__WY^/#P8````````
|
||||
M`````````````````!@8&!@8&!@``!@8````=V;,``````````````!L;&S^
|
||||
M;&QL_FQL;```$'S6T-!P.!P6%M9\$```QL8,#!@P,&!@QL8````X;&PX<-;<
|
||||
MS,S,=@```!P8,``````````````,&!@P,#`P,#`P&!@,`#`8&`P,#`P,#`P8
|
||||
M&#```````!@8_SP\9@``````````&!A^&!@````````````````````<&#``
|
||||
M````````?@``````````````````````&!@```,#!@8,#!@8,#!@8,#``'S&
|
||||
MQL;6UM;&QL9\````&!@X>!@8&!@8&'X```!\Q@8&#!@P8,#`_@```'S&!@8\
|
||||
M!@8&!L9\````#`S,S,S,_@P,#`P```#^P,#`_`8&!@;&?````#Q@P,#\QL;&
|
||||
MQL9\````_@8&#`P8&#`P,#````!\QL;&?,;&QL;&?````'S&QL;&?@8&#!AP
|
||||
M```````8&``````8&````````!@8`````!P8,`````8,&#!@P&`P&`P&````
|
||||
M`````'X``'X```````#`8#`8#`8,&#!@P````'S&!@8,&#`P`#`P````?,;&
|
||||
MQM[>WM[<P'P````X.#AL;&Q\QL;&Q@```/S&QL;\QL;&QL;\````/&;`P,#`
|
||||
MP,#`9CP```#XS,;&QL;&QL;,^````/[`P,#\P,#`P,#^````_L#`P/S`P,#`
|
||||
MP,`````\9L#`P,[&QL9F/````,;&QL;&_L;&QL;&````/!@8&!@8&!@8&#P`
|
||||
M```>!@8&!@8&QL;&?````,;&S-CPX/#8S,;&````P,#`P,#`P,#`P/X```#&
|
||||
M[O[^UM;&QL;&Q@```,;F]O[>SL;&QL;&````?,;&QL;&QL;&QGP```#\QL;&
|
||||
MQOS`P,#`P````'S&QL;&QL;&]MY\#`8`_,;&QL;\V,S,QL8```!\QL#`8#@,
|
||||
M!@;&?````/\8&!@8&!@8&!@8````QL;&QL;&QL;&QGP```#&QL;&QFQL;#@X
|
||||
M$````,;&QL;&UM;^[L;&````QL9L;#@X.&QLQL8```##PV9F/#P8&!@8&```
|
||||
M`/X&#`P8&#!@8,#^````/#`P,#`P,#`P,#P``,#`8&`P,!@8#`P&!@,#`#P,
|
||||
M#`P,#`P,#`P\```0.&S&`````````````````````````````/\``'`P&```
|
||||
M`````````````````'P&?L;&QGX```#`P,#`_,;&QL;&_`````````!\QL#`
|
||||
MP,9\````!@8&!G[&QL;&QGX`````````?,;^P,#&?````#QF8&#P8&!@8&!@
|
||||
M````````?L;&QL;&?@;&?`#`P,#`_,;&QL;&Q@```!@8```8&!@8&!@8````
|
||||
M!@8```8&!@8&!L;&?```P,#`QLS8\-C,Q@```#@8&!@8&!@8&!@\````````
|
||||
M`.S^_M;&QL8`````````_,;&QL;&Q@````````!\QL;&QL9\````````_,;&
|
||||
MQL;&_,#`P`````!^QL;&QL9^!@8&``````#\QL#`P,#``````````'S`<!P&
|
||||
M!GP`````$#`P_#`P,#`P'`````````#&QL;&QL9\`````````,;&;&PX.!``
|
||||
M````````QL;&UM;^Q@````````#&;#@X.&S&````````QL;&QL;&?@;&?```
|
||||
M````_@8,&#!@_@````X8&!@P8#`8&!@.```8&!@8&!@8&!@8&!@```!P&!@8
|
||||
M#`8,&!@8<````';<```````````````````0.&S&QL;^```````\9L#`P,#`
|
||||
MP&8\&)AP`&QL`,;&QL;&QGP````&#!@`?,;^P,#&?````!@\9@!\!G[&QL9^
|
||||
M`````&QL`'P&?L;&QGX```!@,!@`?`9^QL;&?@```#AL;#@`?`9^QL;&?@``
|
||||
M`````'S&P,#`QGPXF'`8/&8`?,;^P,#&?`````!L;`!\QO[`P,9\````8#`8
|
||||
M`'S&_L#`QGP`````9F8`&!@8&!@8&````!@\9@`8&!@8&!@8````8#`8`!@8
|
||||
M&!@8&!@```!L;!`X;,;&_L;&QL8``#AL;#ALQL;^QL;&Q@``&##^P,#`_,#`
|
||||
MP,#^````````?)(2?I"0;@````!^D)"0_)"0D)">````&#QF`'S&QL;&QGP`
|
||||
M````;&P`?,;&QL;&?````&`P&`!\QL;&QL9\````&#QF`,;&QL;&QGP```!@
|
||||
M,!@`QL;&QL;&?`````!L;`#&QL;&QL9^!@9\;`!\QL;&QL;&QL9\``!L;`#&
|
||||
MQL;&QL;&QGP`````&!A^P\#`P,-^&!@``#AL8/!@\&!@9OP`````9F9F/!A^
|
||||
M&'X8&`````#\QL;&QOS&S\;&!P````X;&!@8/!@8&!C8<``&#!@`?`9^QL;&
|
||||
M?@````8,&``8&!@8&!@8````!@P8`'S&QL;&QGP````,&#``QL;&QL;&?```
|
||||
M``!VW`#\QL;&QL;&````=MP`QN;V_M[.QL;&````?`9^QL;&?@``_@````!\
|
||||
MQL;&QL9\``#^`````!@``!@8&`P&QGP``````````/[`P,``````````````
|
||||
M_@8&!@``````&#@8&!@`_P`8+!@P/``8.!@8&`#_`!@X:'P8```8```8&!@8
|
||||
M&!@8`````````#9LV-AL-@``````````V&PV-FS8`````$011!%$$4011!%$
|
||||
M$401JE6J5:I5JE6J5:I5JE5WW7?==]UWW7?==]UWW1@8&!@8&!@8&!@8&!@8
|
||||
M&!@8&!@8&/@8&!@8&!@8&!@8&/@8^!@8&!@8V-C8V-C;V-C8V-C8V````
|
||||
M`````/XV-C8V-C8``````/@8^!@8&!@8V-C8V]@;V-C8V-C8V-C8V-C8V
|
||||
M-C8V-C8V-C8``````/X&]C8V-C8V-C8V-C8V]@;^````````-C8V-C8V-OX`
|
||||
M```````8&!@8&/@8^`````````````````#X&!@8&!@8&!@8&!@8&!\`````
|
||||
M```8&!@8&!@8_P````````````````#_&!@8&!@8&!@8&!@8&!\8&!@8&!@`
|
||||
M````````_P```````!@8&!@8&!C_&!@8&!@8&!@8&!@?&!\8&!@8&!@V-C8V
|
||||
M-C8V-S8V-C8V-C8V-C8V-S`_```````````````_,#<V-C8V-C8V-C8V-O<`
|
||||
M_P``````````````_P#W-C8V-C8V-C8V-C8W,#<V-C8V-C8``````/\`_P``
|
||||
M`````#8V-C8V]P#W-C8V-C8V&!@8&!C_`/\````````V-C8V-C8V_P``````
|
||||
M````````_P#_&!@8&!@8`````````/\V-C8V-C8V-C8V-C8V/P```````!@8
|
||||
M&!@8'Q@?```````````````?&!\8&!@8&!@`````````/S8V-C8V-C8V-C8V
|
||||
M-C;_-C8V-C8V&!@8&!C_`/\8&!@8&!@8&!@8&!@8^``````````````````?
|
||||
M&!@8&!@8__________________\`````````__________#P\/#P\/#P\/#P
|
||||
M\/#P#P\/#P\/#P\/#P\/#P__________````````````````=]S,S-YS````
|
||||
M`'S&QLS8S,;&QMS`P```_L;&P,#`P,#`P`````````-^[&QL;&QH`````/[&
|
||||
M8#`8,&#`QOX`````````?_#8V-C8<`````````!F9F9F9F9\8&#`````=MP8
|
||||
M&!@8&!@`````&!A^V]O;VWX8&``````X;,;&_L;&QFPX`````#QFP\/#PV9F
|
||||
MY^<`````'C`8##YF9F9F/`````````!^V]O;?@`````````#!G[/V_-^8,``
|
||||
M````'#!@8'Q@8&`P'```````?,;&QL;&QL;&````````_@``_@``_@``````
|
||||
M```8&'X8&```_P``````,!@,!@P8,`!^```````,&#!@,!@,`'X````````.
|
||||
M&QL8&!@8&!@8&!@8&!@8&!C8V'``````````&!@`?@`8&```````````=MP`
|
||||
M=MP````````X;&PX````````````````````&!@`````````````````&```
|
||||
M```````#`P8&#`S8>#`0`````-AL;&QL;```````````>,P8,&#\````````
|
||||
=`````'Q\?'Q\?'P````````````0"```````````
|
||||
`
|
||||
end
|
@ -426,9 +426,7 @@ fpudna(void)
|
||||
fxrstor(&fpu_initialstate);
|
||||
if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
|
||||
fldcw(pcb->pcb_initial_fpucw);
|
||||
pcb->pcb_flags |= PCB_FPUINITDONE;
|
||||
if (PCB_USER_FPU(pcb))
|
||||
pcb->pcb_flags |= PCB_USERFPUINITDONE;
|
||||
fpuuserinited(curthread);
|
||||
} else
|
||||
fxrstor(pcb->pcb_save);
|
||||
critical_exit();
|
||||
@ -448,60 +446,50 @@ fpudrop()
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the state of the FPU without dropping ownership (if possible).
|
||||
* It returns the FPU ownership status.
|
||||
* Get the user state of the FPU into pcb->pcb_user_save without
|
||||
* dropping ownership (if possible). It returns the FPU ownership
|
||||
* status.
|
||||
*/
|
||||
int
|
||||
fpugetuserregs(struct thread *td, struct savefpu *addr)
|
||||
fpugetregs(struct thread *td)
|
||||
{
|
||||
struct pcb *pcb;
|
||||
|
||||
pcb = td->td_pcb;
|
||||
if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) {
|
||||
bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate));
|
||||
addr->sv_env.en_cw = pcb->pcb_initial_fpucw;
|
||||
return (_MC_FPOWNED_NONE);
|
||||
bcopy(&fpu_initialstate, &pcb->pcb_user_save,
|
||||
sizeof(fpu_initialstate));
|
||||
pcb->pcb_user_save.sv_env.en_cw = pcb->pcb_initial_fpucw;
|
||||
fpuuserinited(td);
|
||||
return (_MC_FPOWNED_PCB);
|
||||
}
|
||||
critical_enter();
|
||||
if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) {
|
||||
fxsave(addr);
|
||||
fxsave(&pcb->pcb_user_save);
|
||||
critical_exit();
|
||||
return (_MC_FPOWNED_FPU);
|
||||
} else {
|
||||
critical_exit();
|
||||
bcopy(&pcb->pcb_user_save, addr, sizeof(*addr));
|
||||
return (_MC_FPOWNED_PCB);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
fpugetregs(struct thread *td, struct savefpu *addr)
|
||||
void
|
||||
fpuuserinited(struct thread *td)
|
||||
{
|
||||
struct pcb *pcb;
|
||||
|
||||
pcb = td->td_pcb;
|
||||
if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
|
||||
bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate));
|
||||
addr->sv_env.en_cw = pcb->pcb_initial_fpucw;
|
||||
return (_MC_FPOWNED_NONE);
|
||||
}
|
||||
critical_enter();
|
||||
if (td == PCPU_GET(fpcurthread)) {
|
||||
fxsave(addr);
|
||||
critical_exit();
|
||||
return (_MC_FPOWNED_FPU);
|
||||
} else {
|
||||
critical_exit();
|
||||
bcopy(pcb->pcb_save, addr, sizeof(*addr));
|
||||
return (_MC_FPOWNED_PCB);
|
||||
}
|
||||
if (PCB_USER_FPU(pcb))
|
||||
pcb->pcb_flags |= PCB_FPUINITDONE;
|
||||
pcb->pcb_flags |= PCB_USERFPUINITDONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the state of the FPU.
|
||||
*/
|
||||
void
|
||||
fpusetuserregs(struct thread *td, struct savefpu *addr)
|
||||
fpusetregs(struct thread *td, struct savefpu *addr)
|
||||
{
|
||||
struct pcb *pcb;
|
||||
|
||||
@ -514,31 +502,10 @@ fpusetuserregs(struct thread *td, struct savefpu *addr)
|
||||
} else {
|
||||
critical_exit();
|
||||
bcopy(addr, &td->td_pcb->pcb_user_save, sizeof(*addr));
|
||||
if (PCB_USER_FPU(pcb))
|
||||
pcb->pcb_flags |= PCB_FPUINITDONE;
|
||||
pcb->pcb_flags |= PCB_USERFPUINITDONE;
|
||||
fpuuserinited(td);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fpusetregs(struct thread *td, struct savefpu *addr)
|
||||
{
|
||||
struct pcb *pcb;
|
||||
|
||||
pcb = td->td_pcb;
|
||||
critical_enter();
|
||||
if (td == PCPU_GET(fpcurthread)) {
|
||||
fxrstor(addr);
|
||||
critical_exit();
|
||||
} else {
|
||||
critical_exit();
|
||||
bcopy(addr, td->td_pcb->pcb_save, sizeof(*addr));
|
||||
}
|
||||
if (PCB_USER_FPU(pcb))
|
||||
pcb->pcb_flags |= PCB_USERFPUINITDONE;
|
||||
pcb->pcb_flags |= PCB_FPUINITDONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* On AuthenticAMD processors, the fxrstor instruction does not restore
|
||||
* the x87's stored last instruction pointer, last data pointer, and last
|
||||
@ -567,7 +534,7 @@ fpu_clean_state(void)
|
||||
* the x87 stack, but we don't care since we're about to call
|
||||
* fxrstor() anyway.
|
||||
*/
|
||||
__asm __volatile("ffree %%st(7); fld %0" : : "m" (dummy_variable));
|
||||
__asm __volatile("ffree %%st(7); flds %0" : : "m" (dummy_variable));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1975,6 +1975,9 @@ int
|
||||
fill_fpregs(struct thread *td, struct fpreg *fpregs)
|
||||
{
|
||||
|
||||
KASSERT(td == curthread || TD_IS_SUSPENDED(td),
|
||||
("not suspended thread %p", td));
|
||||
fpugetregs(td);
|
||||
fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs);
|
||||
return (0);
|
||||
}
|
||||
@ -1985,6 +1988,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs)
|
||||
{
|
||||
|
||||
set_fpregs_xmm(fpregs, &td->td_pcb->pcb_user_save);
|
||||
fpuuserinited(td);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2099,8 +2103,9 @@ static void
|
||||
get_fpcontext(struct thread *td, mcontext_t *mcp)
|
||||
{
|
||||
|
||||
mcp->mc_ownedfp = fpugetuserregs(td,
|
||||
(struct savefpu *)&mcp->mc_fpstate);
|
||||
mcp->mc_ownedfp = fpugetregs(td);
|
||||
bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate,
|
||||
sizeof(mcp->mc_fpstate));
|
||||
mcp->mc_fpformat = fpuformat();
|
||||
}
|
||||
|
||||
@ -2120,7 +2125,7 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp)
|
||||
mcp->mc_ownedfp == _MC_FPOWNED_PCB) {
|
||||
fpstate = (struct savefpu *)&mcp->mc_fpstate;
|
||||
fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask;
|
||||
fpusetuserregs(td, fpstate);
|
||||
fpusetregs(td, fpstate);
|
||||
} else
|
||||
return (EINVAL);
|
||||
return (0);
|
||||
|
@ -452,6 +452,8 @@ allocpages(vm_paddr_t *firstaddr, int n)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
CTASSERT(powerof2(NDMPML4E));
|
||||
|
||||
static void
|
||||
create_pagetables(vm_paddr_t *firstaddr)
|
||||
{
|
||||
@ -532,9 +534,12 @@ create_pagetables(vm_paddr_t *firstaddr)
|
||||
((pdp_entry_t *)KPML4phys)[PML4PML4I] = KPML4phys;
|
||||
((pdp_entry_t *)KPML4phys)[PML4PML4I] |= PG_RW | PG_V | PG_U;
|
||||
|
||||
/* Connect the Direct Map slot up to the PML4 */
|
||||
((pdp_entry_t *)KPML4phys)[DMPML4I] = DMPDPphys;
|
||||
((pdp_entry_t *)KPML4phys)[DMPML4I] |= PG_RW | PG_V | PG_U;
|
||||
/* Connect the Direct Map slot(s) up to the PML4. */
|
||||
for (i = 0; i < NDMPML4E; i++) {
|
||||
((pdp_entry_t *)KPML4phys)[DMPML4I + i] = DMPDPphys +
|
||||
(i << PAGE_SHIFT);
|
||||
((pdp_entry_t *)KPML4phys)[DMPML4I + i] |= PG_RW | PG_V | PG_U;
|
||||
}
|
||||
|
||||
/* Connect the KVA slot up to the PML4 */
|
||||
((pdp_entry_t *)KPML4phys)[KPML4I] = KPDPphys;
|
||||
@ -1589,6 +1594,7 @@ pmap_pinit(pmap_t pmap)
|
||||
{
|
||||
vm_page_t pml4pg;
|
||||
static vm_pindex_t color;
|
||||
int i;
|
||||
|
||||
PMAP_LOCK_INIT(pmap);
|
||||
|
||||
@ -1606,7 +1612,10 @@ pmap_pinit(pmap_t pmap)
|
||||
|
||||
/* Wire in kernel global address entries. */
|
||||
pmap->pm_pml4[KPML4I] = KPDPphys | PG_RW | PG_V | PG_U;
|
||||
pmap->pm_pml4[DMPML4I] = DMPDPphys | PG_RW | PG_V | PG_U;
|
||||
for (i = 0; i < NDMPML4E; i++) {
|
||||
pmap->pm_pml4[DMPML4I + i] = (DMPDPphys + (i << PAGE_SHIFT)) |
|
||||
PG_RW | PG_V | PG_U;
|
||||
}
|
||||
|
||||
/* install self-referential address mapping entry(s) */
|
||||
pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M;
|
||||
@ -1855,6 +1864,7 @@ void
|
||||
pmap_release(pmap_t pmap)
|
||||
{
|
||||
vm_page_t m;
|
||||
int i;
|
||||
|
||||
KASSERT(pmap->pm_stats.resident_count == 0,
|
||||
("pmap_release: pmap resident count %ld != 0",
|
||||
@ -1865,7 +1875,8 @@ pmap_release(pmap_t pmap)
|
||||
m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME);
|
||||
|
||||
pmap->pm_pml4[KPML4I] = 0; /* KVA */
|
||||
pmap->pm_pml4[DMPML4I] = 0; /* Direct Map */
|
||||
for (i = 0; i < NDMPML4E; i++) /* Direct Map */
|
||||
pmap->pm_pml4[DMPML4I + i] = 0;
|
||||
pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */
|
||||
|
||||
m->wire_count--;
|
||||
|
@ -699,25 +699,6 @@ ENTRY(longjmp)
|
||||
ret
|
||||
END(longjmp)
|
||||
|
||||
/*
|
||||
* Support for BB-profiling (gcc -a). The kernbb program will extract
|
||||
* the data from the kernel.
|
||||
*/
|
||||
|
||||
.data
|
||||
ALIGN_DATA
|
||||
.globl bbhead
|
||||
bbhead:
|
||||
.quad 0
|
||||
|
||||
.text
|
||||
NON_GPROF_ENTRY(__bb_init_func)
|
||||
movq $1,(%rdi)
|
||||
movq bbhead,%rax
|
||||
movq %rax,32(%rdi)
|
||||
movq %rdi,bbhead
|
||||
NON_GPROF_RET
|
||||
|
||||
/*
|
||||
* Support for reading MSRs in the safe manner.
|
||||
*/
|
||||
|
@ -145,13 +145,18 @@ set_regs32(struct thread *td, struct reg32 *regs)
|
||||
int
|
||||
fill_fpregs32(struct thread *td, struct fpreg32 *regs)
|
||||
{
|
||||
struct save87 *sv_87 = (struct save87 *)regs;
|
||||
struct env87 *penv_87 = &sv_87->sv_env;
|
||||
struct savefpu *sv_fpu = &td->td_pcb->pcb_user_save;
|
||||
struct envxmm *penv_xmm = &sv_fpu->sv_env;
|
||||
struct savefpu *sv_fpu;
|
||||
struct save87 *sv_87;
|
||||
struct env87 *penv_87;
|
||||
struct envxmm *penv_xmm;
|
||||
int i;
|
||||
|
||||
bzero(regs, sizeof(*regs));
|
||||
sv_87 = (struct save87 *)regs;
|
||||
penv_87 = &sv_87->sv_env;
|
||||
fpugetregs(td);
|
||||
sv_fpu = &td->td_pcb->pcb_user_save;
|
||||
penv_xmm = &sv_fpu->sv_env;
|
||||
|
||||
/* FPU control/status */
|
||||
penv_87->en_cw = penv_xmm->en_cw;
|
||||
@ -200,6 +205,7 @@ set_fpregs32(struct thread *td, struct fpreg32 *regs)
|
||||
sv_fpu->sv_fp[i].fp_acc = sv_87->sv_ac[i];
|
||||
for (i = 8; i < 16; ++i)
|
||||
bzero(&sv_fpu->sv_fp[i].fp_acc, sizeof(sv_fpu->sv_fp[i].fp_acc));
|
||||
fpuuserinited(td);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -99,8 +99,9 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp)
|
||||
* 64bit instruction and data pointers. Ignore the difference
|
||||
* for now, it should be irrelevant for most applications.
|
||||
*/
|
||||
mcp->mc_ownedfp = fpugetuserregs(td,
|
||||
(struct savefpu *)&mcp->mc_fpstate);
|
||||
mcp->mc_ownedfp = fpugetregs(td);
|
||||
bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate,
|
||||
sizeof(mcp->mc_fpstate));
|
||||
mcp->mc_fpformat = fpuformat();
|
||||
}
|
||||
|
||||
@ -117,7 +118,7 @@ ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp)
|
||||
fpstate_drop(td);
|
||||
else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU ||
|
||||
mcp->mc_ownedfp == _MC_FPOWNED_PCB) {
|
||||
fpusetuserregs(td, (struct savefpu *)&mcp->mc_fpstate);
|
||||
fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate);
|
||||
} else
|
||||
return (EINVAL);
|
||||
return (0);
|
||||
|
@ -1,53 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)param.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _AMD64_INCLUDE__ALIGN_H_
|
||||
#define _AMD64_INCLUDE__ALIGN_H_
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value
|
||||
* for all data types (int, long, ...). The result is u_long and
|
||||
* must be cast to any desired pointer type.
|
||||
*/
|
||||
#define _ALIGNBYTES (sizeof(long) - 1)
|
||||
#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
|
||||
|
||||
#endif /* !_AMD64_INCLUDE__ALIGN_H_ */
|
||||
#include <x86/_align.h>
|
||||
|
@ -112,12 +112,11 @@ void fpudna(void);
|
||||
void fpudrop(void);
|
||||
void fpuexit(struct thread *td);
|
||||
int fpuformat(void);
|
||||
int fpugetregs(struct thread *td, struct savefpu *addr);
|
||||
int fpugetuserregs(struct thread *td, struct savefpu *addr);
|
||||
int fpugetregs(struct thread *td);
|
||||
void fpuinit(void);
|
||||
void fpusetregs(struct thread *td, struct savefpu *addr);
|
||||
void fpusetuserregs(struct thread *td, struct savefpu *addr);
|
||||
int fputrap(void);
|
||||
void fpuuserinited(struct thread *td);
|
||||
int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
|
||||
u_int flags);
|
||||
int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);
|
||||
|
@ -125,15 +125,21 @@
|
||||
#define NUPDPE (NUPML4E*NPDPEPG)/* number of userland PDP pages */
|
||||
#define NUPDE (NUPDPE*NPDEPG) /* number of userland PD entries */
|
||||
|
||||
#define NDMPML4E 1 /* number of dmap PML4 slots */
|
||||
/*
|
||||
* NDMPML4E is the number of PML4 entries that are used to implement the
|
||||
* direct map. It must be a power of two.
|
||||
*/
|
||||
#define NDMPML4E 2
|
||||
|
||||
/*
|
||||
* The *PDI values control the layout of virtual memory
|
||||
* The *PDI values control the layout of virtual memory. The starting address
|
||||
* of the direct map, which is controlled by DMPML4I, must be a multiple of
|
||||
* its size. (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.)
|
||||
*/
|
||||
#define PML4PML4I (NPML4EPG/2) /* Index of recursive pml4 mapping */
|
||||
|
||||
#define KPML4I (NPML4EPG-1) /* Top 512GB for KVM */
|
||||
#define DMPML4I (KPML4I-1) /* Next 512GB down for direct map */
|
||||
#define DMPML4I rounddown(KPML4I - NDMPML4E, NDMPML4E) /* Below KVM */
|
||||
|
||||
#define KPDPI (NPDPEPG-2) /* kernbase at -2GB */
|
||||
|
||||
|
@ -163,8 +163,9 @@
|
||||
* 0x0000000000000000 - 0x00007fffffffffff user map
|
||||
* 0x0000800000000000 - 0xffff7fffffffffff does not exist (hole)
|
||||
* 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot)
|
||||
* 0xffff804020101000 - 0xfffffeffffffffff unused
|
||||
* 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings
|
||||
* 0xffff804020101000 - 0xfffffdffffffffff unused
|
||||
* 0xfffffe0000000000 - 0xfffffeffffffffff 1TB direct map
|
||||
* 0xffffff0000000000 - 0xffffff7fffffffff unused
|
||||
* 0xffffff8000000000 - 0xffffffffffffffff 512GB kernel map
|
||||
*
|
||||
* Within the kernel map:
|
||||
@ -176,7 +177,7 @@
|
||||
#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-512, 0, 0)
|
||||
|
||||
#define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0)
|
||||
#define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0)
|
||||
#define DMAP_MAX_ADDRESS KVADDR(DMPML4I + NDMPML4E, 0, 0, 0)
|
||||
|
||||
#define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0)
|
||||
|
||||
|
@ -37,12 +37,14 @@ __FBSDID("$FreeBSD$");
|
||||
#else /* _KERNEL */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <camlib.h>
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_ccb.h>
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
#include <cam/scsi/smp_all.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
@ -83,6 +85,8 @@ const struct cam_status_entry cam_status_table[] = {
|
||||
{ CAM_REQ_TOO_BIG, "The request was too large for this host" },
|
||||
{ CAM_REQUEUE_REQ, "Unconditionally Re-queue Request", },
|
||||
{ CAM_ATA_STATUS_ERROR, "ATA Status Error" },
|
||||
{ CAM_SCSI_IT_NEXUS_LOST,"Initiator/Target Nexus Lost" },
|
||||
{ CAM_SMP_STATUS_ERROR, "SMP Status Error" },
|
||||
{ CAM_IDE, "Initiator Detected Error Message Received" },
|
||||
{ CAM_RESRC_UNAVAIL, "Resource Unavailable" },
|
||||
{ CAM_UNACKED_EVENT, "Unacknowledged Event by Host" },
|
||||
@ -263,6 +267,21 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case XPT_SMP_IO:
|
||||
switch (proto_flags & CAM_EPF_LEVEL_MASK) {
|
||||
case CAM_EPF_NONE:
|
||||
break;
|
||||
case CAM_EPF_ALL:
|
||||
proto_flags |= CAM_ESMF_PRINT_FULL_CMD;
|
||||
/* FALLTHROUGH */
|
||||
case CAM_EPF_NORMAL:
|
||||
case CAM_EPF_MINIMAL:
|
||||
proto_flags |= CAM_ESMF_PRINT_STATUS;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -289,6 +308,12 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
|
||||
#endif /* _KERNEL/!_KERNEL */
|
||||
sbuf_printf(&sb, "\n");
|
||||
break;
|
||||
case XPT_SMP_IO:
|
||||
smp_command_sbuf(&ccb->smpio, &sb, path_str, 79 -
|
||||
strlen(path_str), (proto_flags &
|
||||
CAM_ESMF_PRINT_FULL_CMD) ? 79 : 0);
|
||||
sbuf_printf(&sb, "\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -355,6 +380,19 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
|
||||
#endif /* _KERNEL/!_KERNEL */
|
||||
}
|
||||
break;
|
||||
case XPT_SMP_IO:
|
||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
|
||||
CAM_SMP_STATUS_ERROR)
|
||||
break;
|
||||
|
||||
if (proto_flags & CAM_ESF_PRINT_STATUS) {
|
||||
sbuf_cat(&sb, path_str);
|
||||
sbuf_printf(&sb, "SMP status: %s (%#x)\n",
|
||||
smp_error_desc(ccb->smpio.smp_response[2]),
|
||||
ccb->smpio.smp_response[2]);
|
||||
}
|
||||
/* There is no SMP equivalent to SCSI sense. */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -147,6 +147,7 @@ typedef enum {
|
||||
*/
|
||||
CAM_ATA_STATUS_ERROR, /* ATA error, look at error code in CCB */
|
||||
CAM_SCSI_IT_NEXUS_LOST, /* Initiator/Target Nexus lost. */
|
||||
CAM_SMP_STATUS_ERROR, /* SMP error, look at error code in CCB */
|
||||
CAM_IDE = 0x33, /* Initiator Detected Error */
|
||||
CAM_RESRC_UNAVAIL, /* Resource Unavailable */
|
||||
CAM_UNACKED_EVENT, /* Unacknowledged Event by Host */
|
||||
@ -197,6 +198,12 @@ typedef enum {
|
||||
CAM_ESF_PRINT_SENSE = 0x20
|
||||
} cam_error_scsi_flags;
|
||||
|
||||
typedef enum {
|
||||
CAM_ESMF_PRINT_NONE = 0x00,
|
||||
CAM_ESMF_PRINT_STATUS = 0x10,
|
||||
CAM_ESMF_PRINT_FULL_CMD = 0x20,
|
||||
} cam_error_smp_flags;
|
||||
|
||||
typedef enum {
|
||||
CAM_EAF_PRINT_NONE = 0x00,
|
||||
CAM_EAF_PRINT_STATUS = 0x10,
|
||||
|
@ -66,7 +66,7 @@ typedef enum {
|
||||
*/
|
||||
CAM_SCATTER_VALID = 0x00000010,/* Scatter/gather list is valid */
|
||||
CAM_DIS_AUTOSENSE = 0x00000020,/* Disable autosense feature */
|
||||
CAM_DIR_RESV = 0x00000000,/* Data direction (00:reserved) */
|
||||
CAM_DIR_BOTH = 0x00000000,/* Data direction (00:IN/OUT) */
|
||||
CAM_DIR_IN = 0x00000040,/* Data direction (01:DATA IN) */
|
||||
CAM_DIR_OUT = 0x00000080,/* Data direction (10:DATA OUT) */
|
||||
CAM_DIR_NONE = 0x000000C0,/* Data direction (11:no data) */
|
||||
@ -144,6 +144,8 @@ typedef enum {
|
||||
/* Device statistics (error counts, etc.) */
|
||||
XPT_FREEZE_QUEUE = 0x0d,
|
||||
/* Freeze device queue */
|
||||
XPT_GDEV_ADVINFO = 0x0e,
|
||||
/* Advanced device information */
|
||||
/* SCSI Control Functions: 0x10->0x1F */
|
||||
XPT_ABORT = 0x10,
|
||||
/* Abort the specified CCB */
|
||||
@ -185,6 +187,9 @@ typedef enum {
|
||||
* Set SIM specific knob values.
|
||||
*/
|
||||
|
||||
XPT_SMP_IO = 0x1b | XPT_FC_DEV_QUEUED,
|
||||
/* Serial Management Protocol */
|
||||
|
||||
XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB
|
||||
| XPT_FC_XPT_ONLY,
|
||||
/* Scan Target */
|
||||
@ -608,6 +613,32 @@ struct ccb_pathstats {
|
||||
struct timeval last_reset; /* Time of last bus reset/loop init */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
SMP_FLAG_NONE = 0x00,
|
||||
SMP_FLAG_REQ_SG = 0x01,
|
||||
SMP_FLAG_RSP_SG = 0x02
|
||||
} ccb_smp_pass_flags;
|
||||
|
||||
/*
|
||||
* Serial Management Protocol CCB
|
||||
* XXX Currently the semantics for this CCB are that it is executed either
|
||||
* by the addressed device, or that device's parent (i.e. an expander for
|
||||
* any device on an expander) if the addressed device doesn't support SMP.
|
||||
* Later, once we have the ability to probe SMP-only devices and put them
|
||||
* in CAM's topology, the CCB will only be executed by the addressed device
|
||||
* if possible.
|
||||
*/
|
||||
struct ccb_smpio {
|
||||
struct ccb_hdr ccb_h;
|
||||
uint8_t *smp_request;
|
||||
int smp_request_len;
|
||||
uint16_t smp_request_sglist_cnt;
|
||||
uint8_t *smp_response;
|
||||
int smp_response_len;
|
||||
uint16_t smp_response_sglist_cnt;
|
||||
ccb_smp_pass_flags flags;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
u_int8_t *sense_ptr; /*
|
||||
* Pointer to storage
|
||||
@ -1053,6 +1084,26 @@ struct ccb_eng_exec { /* This structure must match SCSIIO size */
|
||||
|
||||
#define XPT_CCB_INVALID -1 /* for signaling a bad CCB to free */
|
||||
|
||||
/*
|
||||
* CCB for getting advanced device information. This operates in a fashion
|
||||
* similar to XPT_GDEV_TYPE. Specify the target in ccb_h, the buffer
|
||||
* type requested, and provide a buffer size/buffer to write to. If the
|
||||
* buffer is too small, the handler will set GDEVAI_FLAG_MORE.
|
||||
*/
|
||||
struct ccb_getdev_advinfo {
|
||||
struct ccb_hdr ccb_h;
|
||||
uint32_t flags;
|
||||
#define CGDAI_FLAG_TRANSPORT 0x1
|
||||
#define CGDAI_FLAG_PROTO 0x2
|
||||
uint32_t buftype; /* IN: Type of data being requested */
|
||||
/* NB: buftype is interpreted on a per-transport basis */
|
||||
#define CGDAI_TYPE_SCSI_DEVID 1
|
||||
off_t bufsiz; /* IN: Size of external buffer */
|
||||
#define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */
|
||||
off_t provsiz; /* OUT: Size required/used */
|
||||
uint8_t *buf; /* IN/OUT: Buffer for requested data */
|
||||
};
|
||||
|
||||
/*
|
||||
* Union of all CCB types for kernel space allocation. This union should
|
||||
* never be used for manipulating CCBs - its only use is for the allocation
|
||||
@ -1087,9 +1138,11 @@ union ccb {
|
||||
struct ccb_notify_acknowledge cna2;
|
||||
struct ccb_eng_inq cei;
|
||||
struct ccb_eng_exec cee;
|
||||
struct ccb_smpio smpio;
|
||||
struct ccb_rescan crcn;
|
||||
struct ccb_debug cdbg;
|
||||
struct ccb_ataio ataio;
|
||||
struct ccb_getdev_advinfo cgdai;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
@ -1115,6 +1168,13 @@ cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries,
|
||||
u_int8_t *data_ptr, u_int32_t dxfer_len,
|
||||
u_int32_t timeout);
|
||||
|
||||
static __inline void
|
||||
cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags,
|
||||
uint8_t *smp_request, int smp_request_len,
|
||||
uint8_t *smp_response, int smp_response_len,
|
||||
uint32_t timeout);
|
||||
|
||||
static __inline void
|
||||
cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
@ -1172,6 +1232,32 @@ cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries,
|
||||
ataio->tag_action = tag_action;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags,
|
||||
uint8_t *smp_request, int smp_request_len,
|
||||
uint8_t *smp_response, int smp_response_len,
|
||||
uint32_t timeout)
|
||||
{
|
||||
#ifdef _KERNEL
|
||||
KASSERT((flags & CAM_DIR_MASK) == CAM_DIR_BOTH,
|
||||
("direction != CAM_DIR_BOTH"));
|
||||
KASSERT((smp_request != NULL) && (smp_response != NULL),
|
||||
("need valid request and response buffers"));
|
||||
KASSERT((smp_request_len != 0) && (smp_response_len != 0),
|
||||
("need non-zero request and response lengths"));
|
||||
#endif /*_KERNEL*/
|
||||
smpio->ccb_h.func_code = XPT_SMP_IO;
|
||||
smpio->ccb_h.flags = flags;
|
||||
smpio->ccb_h.retry_count = retries;
|
||||
smpio->ccb_h.cbfcnp = cbfcnp;
|
||||
smpio->ccb_h.timeout = timeout;
|
||||
smpio->smp_request = smp_request;
|
||||
smpio->smp_request_len = smp_request_len;
|
||||
smpio->smp_response = smp_response;
|
||||
smpio->smp_response_len = smp_response_len;
|
||||
}
|
||||
|
||||
void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);
|
||||
|
||||
__END_DECLS
|
||||
|
@ -648,6 +648,21 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo)
|
||||
dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
|
||||
numbufs = 1;
|
||||
break;
|
||||
case XPT_SMP_IO:
|
||||
data_ptrs[0] = &ccb->smpio.smp_request;
|
||||
lengths[0] = ccb->smpio.smp_request_len;
|
||||
dirs[0] = CAM_DIR_OUT;
|
||||
data_ptrs[1] = &ccb->smpio.smp_response;
|
||||
lengths[1] = ccb->smpio.smp_response_len;
|
||||
dirs[1] = CAM_DIR_IN;
|
||||
numbufs = 2;
|
||||
break;
|
||||
case XPT_GDEV_ADVINFO:
|
||||
data_ptrs[0] = (uint8_t **)&ccb->cgdai.buf;
|
||||
lengths[0] = ccb->cgdai.bufsiz;
|
||||
dirs[0] = CAM_DIR_IN;
|
||||
numbufs = 1;
|
||||
break;
|
||||
default:
|
||||
return(EINVAL);
|
||||
break; /* NOTREACHED */
|
||||
@ -787,6 +802,15 @@ cam_periph_unmapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo)
|
||||
data_ptrs[0] = &ccb->ataio.data_ptr;
|
||||
numbufs = min(mapinfo->num_bufs_used, 1);
|
||||
break;
|
||||
case XPT_SMP_IO:
|
||||
numbufs = min(mapinfo->num_bufs_used, 2);
|
||||
data_ptrs[0] = &ccb->smpio.smp_request;
|
||||
data_ptrs[1] = &ccb->smpio.smp_response;
|
||||
break;
|
||||
case XPT_GDEV_ADVINFO:
|
||||
numbufs = min(mapinfo->num_bufs_used, 1);
|
||||
data_ptrs[0] = (uint8_t **)&ccb->cgdai.buf;
|
||||
break;
|
||||
default:
|
||||
/* allow ourselves to be swapped once again */
|
||||
PRELE(curproc);
|
||||
|
@ -2386,6 +2386,7 @@ xpt_action_default(union ccb *start_ccb)
|
||||
/* FALLTHROUGH */
|
||||
case XPT_RESET_DEV:
|
||||
case XPT_ENG_EXEC:
|
||||
case XPT_SMP_IO:
|
||||
{
|
||||
struct cam_path *path = start_ccb->ccb_h.path;
|
||||
int frozen;
|
||||
|
@ -93,6 +93,10 @@ struct cam_ed {
|
||||
cam_xport transport;
|
||||
u_int transport_version;
|
||||
struct scsi_inquiry_data inq_data;
|
||||
uint8_t *supported_vpds;
|
||||
uint8_t supported_vpds_len;
|
||||
uint32_t device_id_len;
|
||||
uint8_t *device_id;
|
||||
struct ata_params ident_data;
|
||||
u_int8_t inq_flags; /*
|
||||
* Current settings for inquiry flags.
|
||||
|
@ -3552,6 +3552,34 @@ scsi_calc_syncparam(u_int period)
|
||||
return (period/400);
|
||||
}
|
||||
|
||||
uint8_t *
|
||||
scsi_get_sas_addr(struct scsi_vpd_device_id *id, uint32_t len)
|
||||
{
|
||||
uint8_t *bufp, *buf_end;
|
||||
struct scsi_vpd_id_descriptor *descr;
|
||||
struct scsi_vpd_id_naa_basic *naa;
|
||||
|
||||
bufp = buf_end = (uint8_t *)id;
|
||||
bufp += SVPD_DEVICE_ID_HDR_LEN;
|
||||
buf_end += len;
|
||||
while (bufp < buf_end) {
|
||||
descr = (struct scsi_vpd_id_descriptor *)bufp;
|
||||
bufp += SVPD_DEVICE_ID_DESC_HDR_LEN;
|
||||
/* Right now, we only care about SAS NAA IEEE Reg addrs */
|
||||
if (((descr->id_type & SVPD_ID_PIV) != 0)
|
||||
&& (descr->proto_codeset >> SVPD_ID_PROTO_SHIFT) ==
|
||||
SCSI_PROTO_SAS
|
||||
&& (descr->id_type & SVPD_ID_TYPE_MASK) == SVPD_ID_TYPE_NAA){
|
||||
naa = (struct scsi_vpd_id_naa_basic *)bufp;
|
||||
if ((naa->naa >> 4) == SVPD_ID_NAA_IEEE_REG)
|
||||
return bufp;
|
||||
}
|
||||
bufp += descr->length;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
scsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
|
@ -796,13 +796,29 @@ struct scsi_vpd_supported_page_list
|
||||
{
|
||||
u_int8_t device;
|
||||
u_int8_t page_code;
|
||||
#define SVPD_SUPPORTED_PAGE_LIST 0x00
|
||||
#define SVPD_SUPPORTED_PAGE_LIST 0x00
|
||||
#define SVPD_SUPPORTED_PAGES_HDR_LEN 4
|
||||
u_int8_t reserved;
|
||||
u_int8_t length; /* number of VPD entries */
|
||||
#define SVPD_SUPPORTED_PAGES_SIZE 251
|
||||
u_int8_t list[SVPD_SUPPORTED_PAGES_SIZE];
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure is more suited to target operation, because the
|
||||
* number of supported pages is left to the user to allocate.
|
||||
*/
|
||||
struct scsi_vpd_supported_pages
|
||||
{
|
||||
u_int8_t device;
|
||||
u_int8_t page_code;
|
||||
u_int8_t reserved;
|
||||
#define SVPD_SUPPORTED_PAGES 0x00
|
||||
u_int8_t length;
|
||||
u_int8_t page_list[0];
|
||||
};
|
||||
|
||||
|
||||
struct scsi_vpd_unit_serial_number
|
||||
{
|
||||
u_int8_t device;
|
||||
@ -814,6 +830,148 @@ struct scsi_vpd_unit_serial_number
|
||||
u_int8_t serial_num[SVPD_SERIAL_NUM_SIZE];
|
||||
};
|
||||
|
||||
struct scsi_vpd_device_id
|
||||
{
|
||||
u_int8_t device;
|
||||
u_int8_t page_code;
|
||||
#define SVPD_DEVICE_ID 0x83
|
||||
#define SVPD_DEVICE_ID_MAX_SIZE 0xffff
|
||||
#define SVPD_DEVICE_ID_HDR_LEN 4
|
||||
#define SVPD_DEVICE_ID_DESC_HDR_LEN 4
|
||||
u_int8_t length[2];
|
||||
u_int8_t desc_list[0];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_descriptor
|
||||
{
|
||||
u_int8_t proto_codeset;
|
||||
#define SCSI_PROTO_FC 0x00
|
||||
#define SCSI_PROTO_SPI 0x01
|
||||
#define SCSI_PROTO_SSA 0x02
|
||||
#define SCSI_PROTO_1394 0x03
|
||||
#define SCSI_PROTO_RDMA 0x04
|
||||
#define SCSI_PROTO_iSCSI 0x05
|
||||
#define SCSI_PROTO_SAS 0x06
|
||||
#define SVPD_ID_PROTO_SHIFT 4
|
||||
#define SVPD_ID_CODESET_BINARY 0x01
|
||||
#define SVPD_ID_CODESET_ASCII 0x02
|
||||
u_int8_t id_type;
|
||||
#define SVPD_ID_PIV 0x80
|
||||
#define SVPD_ID_ASSOC_LUN 0x00
|
||||
#define SVPD_ID_ASSOC_PORT 0x10
|
||||
#define SVPD_ID_ASSOC_TARGET 0x20
|
||||
#define SVPD_ID_TYPE_VENDOR 0x00
|
||||
#define SVPD_ID_TYPE_T10 0x01
|
||||
#define SVPD_ID_TYPE_EUI64 0x02
|
||||
#define SVPD_ID_TYPE_NAA 0x03
|
||||
#define SVPD_ID_TYPE_RELTARG 0x04
|
||||
#define SVPD_ID_TYPE_TPORTGRP 0x05
|
||||
#define SVPD_ID_TYPE_LUNGRP 0x06
|
||||
#define SVPD_ID_TYPE_MD5_LUN_ID 0x07
|
||||
#define SVPD_ID_TYPE_SCSI_NAME 0x08
|
||||
#define SVPD_ID_TYPE_MASK 0x0f
|
||||
u_int8_t reserved;
|
||||
u_int8_t length;
|
||||
u_int8_t identifier[0];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_t10
|
||||
{
|
||||
u_int8_t vendor[8];
|
||||
u_int8_t vendor_spec_id[0];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_eui64
|
||||
{
|
||||
u_int8_t ieee_company_id[3];
|
||||
u_int8_t extension_id[5];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_naa_basic
|
||||
{
|
||||
uint8_t naa;
|
||||
/* big endian, packed:
|
||||
uint8_t naa : 4;
|
||||
uint8_t naa_desig : 4;
|
||||
*/
|
||||
#define SVPD_ID_NAA_IEEE_EXT 0x02
|
||||
#define SVPD_ID_NAA_LOCAL_REG 0x03
|
||||
#define SVPD_ID_NAA_IEEE_REG 0x05
|
||||
#define SVPD_ID_NAA_IEEE_REG_EXT 0x06
|
||||
uint8_t naa_data[0];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_naa_ieee_extended_id
|
||||
{
|
||||
uint8_t naa;
|
||||
uint8_t vendor_specific_id_a;
|
||||
uint8_t ieee_company_id[3];
|
||||
uint8_t vendor_specific_id_b[4];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_naa_local_reg
|
||||
{
|
||||
uint8_t naa;
|
||||
uint8_t local_value[7];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_naa_ieee_reg
|
||||
{
|
||||
uint8_t naa;
|
||||
uint8_t reg_value[7];
|
||||
/* big endian, packed:
|
||||
uint8_t naa_basic : 4;
|
||||
uint8_t ieee_company_id_0 : 4;
|
||||
uint8_t ieee_company_id_1[2];
|
||||
uint8_t ieee_company_id_2 : 4;
|
||||
uint8_t vendor_specific_id_0 : 4;
|
||||
uint8_t vendor_specific_id_1[4];
|
||||
*/
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_naa_ieee_reg_extended
|
||||
{
|
||||
uint8_t naa;
|
||||
uint8_t reg_value[15];
|
||||
/* big endian, packed:
|
||||
uint8_t naa_basic : 4;
|
||||
uint8_t ieee_company_id_0 : 4;
|
||||
uint8_t ieee_company_id_1[2];
|
||||
uint8_t ieee_company_id_2 : 4;
|
||||
uint8_t vendor_specific_id_0 : 4;
|
||||
uint8_t vendor_specific_id_1[4];
|
||||
uint8_t vendor_specific_id_ext[8];
|
||||
*/
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_rel_trgt_port_id
|
||||
{
|
||||
uint8_t obsolete[2];
|
||||
uint8_t rel_trgt_port_id[2];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_trgt_port_grp_id
|
||||
{
|
||||
uint8_t reserved[2];
|
||||
uint8_t trgt_port_grp[2];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_lun_grp_id
|
||||
{
|
||||
uint8_t reserved[2];
|
||||
uint8_t log_unit_grp[2];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_md5_lun_id
|
||||
{
|
||||
uint8_t lun_id[16];
|
||||
};
|
||||
|
||||
struct scsi_vpd_id_scsi_name
|
||||
{
|
||||
uint8_t name_string[256];
|
||||
};
|
||||
|
||||
struct scsi_read_capacity
|
||||
{
|
||||
u_int8_t opcode;
|
||||
@ -1164,7 +1322,8 @@ void scsi_print_inquiry(struct scsi_inquiry_data *inq_data);
|
||||
|
||||
u_int scsi_calc_syncsrate(u_int period_factor);
|
||||
u_int scsi_calc_syncparam(u_int period);
|
||||
|
||||
uint8_t * scsi_get_sas_addr(struct scsi_vpd_device_id *id, uint32_t len);
|
||||
|
||||
void scsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *,
|
||||
union ccb *),
|
||||
|
@ -524,8 +524,8 @@ passsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb)
|
||||
* We only attempt to map the user memory into kernel space
|
||||
* if they haven't passed in a physical memory pointer,
|
||||
* and if there is actually an I/O operation to perform.
|
||||
* Right now cam_periph_mapmem() only supports SCSI and device
|
||||
* match CCBs. For the SCSI CCBs, we only pass the CCB in if
|
||||
* cam_periph_mapmem() supports SCSI, ATA, SMP, ADVINFO and device
|
||||
* match CCBs. For the SCSI and ATA CCBs, we only pass the CCB in if
|
||||
* there's actually data to map. cam_periph_mapmem() will do the
|
||||
* right thing, even if there isn't data to map, but since CCBs
|
||||
* without data are a reasonably common occurance (e.g. test unit
|
||||
@ -535,7 +535,9 @@ passsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb)
|
||||
&& (((ccb->ccb_h.func_code == XPT_SCSI_IO ||
|
||||
ccb->ccb_h.func_code == XPT_ATA_IO)
|
||||
&& ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE))
|
||||
|| (ccb->ccb_h.func_code == XPT_DEV_MATCH))) {
|
||||
|| (ccb->ccb_h.func_code == XPT_DEV_MATCH)
|
||||
|| (ccb->ccb_h.func_code == XPT_SMP_IO)
|
||||
|| (ccb->ccb_h.func_code == XPT_GDEV_ADVINFO))) {
|
||||
|
||||
bzero(&mapinfo, sizeof(mapinfo));
|
||||
|
||||
|
@ -68,7 +68,7 @@ struct scsi_quirk_entry {
|
||||
struct scsi_inquiry_pattern inq_pat;
|
||||
u_int8_t quirks;
|
||||
#define CAM_QUIRK_NOLUNS 0x01
|
||||
#define CAM_QUIRK_NOSERIAL 0x02
|
||||
#define CAM_QUIRK_NOVPDS 0x02
|
||||
#define CAM_QUIRK_HILUNS 0x04
|
||||
#define CAM_QUIRK_NOHILUNS 0x08
|
||||
#define CAM_QUIRK_NORPTLUNS 0x10
|
||||
@ -134,8 +134,9 @@ typedef enum {
|
||||
PROBE_FULL_INQUIRY,
|
||||
PROBE_REPORT_LUNS,
|
||||
PROBE_MODE_SENSE,
|
||||
PROBE_SERIAL_NUM_0,
|
||||
PROBE_SERIAL_NUM_1,
|
||||
PROBE_SUPPORTED_VPD_LIST,
|
||||
PROBE_DEVICE_ID,
|
||||
PROBE_SERIAL_NUM,
|
||||
PROBE_TUR_FOR_NEGOTIATION,
|
||||
PROBE_INQUIRY_BASIC_DV1,
|
||||
PROBE_INQUIRY_BASIC_DV2,
|
||||
@ -149,8 +150,9 @@ static char *probe_action_text[] = {
|
||||
"PROBE_FULL_INQUIRY",
|
||||
"PROBE_REPORT_LUNS",
|
||||
"PROBE_MODE_SENSE",
|
||||
"PROBE_SERIAL_NUM_0",
|
||||
"PROBE_SERIAL_NUM_1",
|
||||
"PROBE_SUPPORTED_VPD_LIST",
|
||||
"PROBE_DEVICE_ID",
|
||||
"PROBE_SERIAL_NUM",
|
||||
"PROBE_TUR_FOR_NEGOTIATION",
|
||||
"PROBE_INQUIRY_BASIC_DV1",
|
||||
"PROBE_INQUIRY_BASIC_DV2",
|
||||
@ -463,7 +465,7 @@ static struct scsi_quirk_entry scsi_quirk_table[] =
|
||||
T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "TANDBERG",
|
||||
" TDC 3600", "U07:"
|
||||
},
|
||||
CAM_QUIRK_NOSERIAL, /*mintags*/0, /*maxtags*/0
|
||||
CAM_QUIRK_NOVPDS, /*mintags*/0, /*maxtags*/0
|
||||
},
|
||||
{
|
||||
/*
|
||||
@ -696,6 +698,21 @@ probeschedule(struct cam_periph *periph)
|
||||
xpt_schedule(periph, CAM_PRIORITY_XPT);
|
||||
}
|
||||
|
||||
static int
|
||||
device_has_vpd(struct cam_ed *device, uint8_t page_id)
|
||||
{
|
||||
int i, num_pages;
|
||||
struct scsi_vpd_supported_pages *vpds;
|
||||
|
||||
vpds = (struct scsi_vpd_supported_pages *)device->supported_vpds;
|
||||
num_pages = device->supported_vpds_len - SVPD_SUPPORTED_PAGES_HDR_LEN;
|
||||
for (i = 0;i < num_pages;i++)
|
||||
if (vpds->page_list[i] == page_id)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
{
|
||||
@ -810,7 +827,8 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
if (INQ_DATA_TQ_ENABLED(inq_buf))
|
||||
PROBE_SET_ACTION(softc, PROBE_MODE_SENSE);
|
||||
else
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0);
|
||||
PROBE_SET_ACTION(softc,
|
||||
PROBE_SUPPORTED_VPD_LIST);
|
||||
goto again;
|
||||
}
|
||||
scsi_report_luns(csio, 5, probedone, MSG_SIMPLE_Q_TAG,
|
||||
@ -843,19 +861,20 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
}
|
||||
xpt_print(periph->path, "Unable to mode sense control page - "
|
||||
"malloc failure\n");
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0);
|
||||
PROBE_SET_ACTION(softc, PROBE_SUPPORTED_VPD_LIST);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case PROBE_SERIAL_NUM_0:
|
||||
case PROBE_SUPPORTED_VPD_LIST:
|
||||
{
|
||||
struct scsi_vpd_supported_page_list *vpd_list = NULL;
|
||||
struct scsi_vpd_supported_page_list *vpd_list;
|
||||
struct cam_ed *device;
|
||||
|
||||
vpd_list = NULL;
|
||||
device = periph->path->device;
|
||||
if ((SCSI_QUIRK(device)->quirks & CAM_QUIRK_NOSERIAL) == 0) {
|
||||
|
||||
if ((SCSI_QUIRK(device)->quirks & CAM_QUIRK_NOVPDS) == 0)
|
||||
vpd_list = malloc(sizeof(*vpd_list), M_CAMXPT,
|
||||
M_NOWAIT | M_ZERO);
|
||||
}
|
||||
|
||||
if (vpd_list != NULL) {
|
||||
scsi_inquiry(csio,
|
||||
@ -878,7 +897,39 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
probedone(periph, start_ccb);
|
||||
return;
|
||||
}
|
||||
case PROBE_SERIAL_NUM_1:
|
||||
case PROBE_DEVICE_ID:
|
||||
{
|
||||
struct scsi_vpd_device_id *devid;
|
||||
struct cam_ed *device;
|
||||
|
||||
devid = NULL;
|
||||
device = periph->path->device;
|
||||
if (device_has_vpd(device, SVPD_DEVICE_ID))
|
||||
devid = malloc(SVPD_DEVICE_ID_MAX_SIZE, M_CAMXPT,
|
||||
M_NOWAIT | M_ZERO);
|
||||
|
||||
if (devid != NULL) {
|
||||
scsi_inquiry(csio,
|
||||
/*retries*/4,
|
||||
probedone,
|
||||
MSG_SIMPLE_Q_TAG,
|
||||
(uint8_t *)devid,
|
||||
SVPD_DEVICE_ID_MAX_SIZE,
|
||||
/*evpd*/TRUE,
|
||||
SVPD_DEVICE_ID,
|
||||
SSD_MIN_SIZE,
|
||||
/*timeout*/60 * 1000);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* We'll have to do without, let our probedone
|
||||
* routine finish up for us.
|
||||
*/
|
||||
start_ccb->csio.data_ptr = NULL;
|
||||
probedone(periph, start_ccb);
|
||||
return;
|
||||
}
|
||||
case PROBE_SERIAL_NUM:
|
||||
{
|
||||
struct scsi_vpd_unit_serial_number *serial_buf;
|
||||
struct cam_ed* device;
|
||||
@ -891,8 +942,10 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
device->serial_num_len = 0;
|
||||
}
|
||||
|
||||
serial_buf = (struct scsi_vpd_unit_serial_number *)
|
||||
malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO);
|
||||
if (device_has_vpd(device, SVPD_UNIT_SERIAL_NUMBER))
|
||||
serial_buf = (struct scsi_vpd_unit_serial_number *)
|
||||
malloc(sizeof(*serial_buf), M_CAMXPT,
|
||||
M_NOWAIT|M_ZERO);
|
||||
|
||||
if (serial_buf != NULL) {
|
||||
scsi_inquiry(csio,
|
||||
@ -1046,6 +1099,8 @@ proberequestbackoff(struct cam_periph *periph, struct cam_ed *device)
|
||||
return (1);
|
||||
}
|
||||
|
||||
#define CCB_COMPLETED_OK(ccb) (((ccb).status & CAM_STATUS_MASK) == CAM_REQ_CMP)
|
||||
|
||||
static void
|
||||
probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
{
|
||||
@ -1133,7 +1188,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
PROBE_MODE_SENSE);
|
||||
else
|
||||
PROBE_SET_ACTION(softc,
|
||||
PROBE_SERIAL_NUM_0);
|
||||
PROBE_SUPPORTED_VPD_LIST);
|
||||
|
||||
if (path->device->flags & CAM_DEV_UNCONFIGURED) {
|
||||
path->device->flags &= ~CAM_DEV_UNCONFIGURED;
|
||||
@ -1290,7 +1345,8 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
if (INQ_DATA_TQ_ENABLED(inq_buf))
|
||||
PROBE_SET_ACTION(softc, PROBE_MODE_SENSE);
|
||||
else
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0);
|
||||
PROBE_SET_ACTION(softc,
|
||||
PROBE_SUPPORTED_VPD_LIST);
|
||||
xpt_release_ccb(done_ccb);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
@ -1326,35 +1382,82 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
}
|
||||
xpt_release_ccb(done_ccb);
|
||||
free(mode_hdr, M_CAMXPT);
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0);
|
||||
PROBE_SET_ACTION(softc, PROBE_SUPPORTED_VPD_LIST);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
case PROBE_SERIAL_NUM_0:
|
||||
case PROBE_SUPPORTED_VPD_LIST:
|
||||
{
|
||||
struct ccb_scsiio *csio;
|
||||
struct scsi_vpd_supported_page_list *page_list;
|
||||
int length, serialnum_supported, i;
|
||||
|
||||
serialnum_supported = 0;
|
||||
csio = &done_ccb->csio;
|
||||
page_list =
|
||||
(struct scsi_vpd_supported_page_list *)csio->data_ptr;
|
||||
|
||||
if (path->device->supported_vpds != NULL) {
|
||||
free(path->device->supported_vpds, M_CAMXPT);
|
||||
path->device->supported_vpds = NULL;
|
||||
path->device->supported_vpds_len = 0;
|
||||
}
|
||||
|
||||
if (page_list == NULL) {
|
||||
/*
|
||||
* Don't process the command as it was never sent
|
||||
*/
|
||||
} else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP
|
||||
&& (page_list->length > 0)) {
|
||||
length = min(page_list->length,
|
||||
SVPD_SUPPORTED_PAGES_SIZE);
|
||||
for (i = 0; i < length; i++) {
|
||||
if (page_list->list[i] ==
|
||||
SVPD_UNIT_SERIAL_NUMBER) {
|
||||
serialnum_supported = 1;
|
||||
break;
|
||||
}
|
||||
} else if (CCB_COMPLETED_OK(csio->ccb_h)) {
|
||||
/* Got vpd list */
|
||||
path->device->supported_vpds_len = page_list->length +
|
||||
SVPD_SUPPORTED_PAGES_HDR_LEN;
|
||||
path->device->supported_vpds = (uint8_t *)page_list;
|
||||
xpt_release_ccb(done_ccb);
|
||||
PROBE_SET_ACTION(softc, PROBE_DEVICE_ID);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
} else if (cam_periph_error(done_ccb, 0,
|
||||
SF_RETRY_UA|SF_NO_PRINT,
|
||||
&softc->saved_ccb) == ERESTART) {
|
||||
return;
|
||||
} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
|
||||
/* Don't wedge the queue */
|
||||
xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,
|
||||
/*run_queue*/TRUE);
|
||||
}
|
||||
|
||||
if (page_list)
|
||||
free(page_list, M_CAMXPT);
|
||||
/* No VPDs available, skip to device check. */
|
||||
csio->data_ptr = NULL;
|
||||
goto probe_device_check;
|
||||
}
|
||||
case PROBE_DEVICE_ID:
|
||||
{
|
||||
struct scsi_vpd_device_id *devid;
|
||||
struct ccb_scsiio *csio;
|
||||
uint32_t length = 0;
|
||||
|
||||
csio = &done_ccb->csio;
|
||||
devid = (struct scsi_vpd_device_id *)csio->data_ptr;
|
||||
|
||||
/* Clean up from previous instance of this device */
|
||||
if (path->device->device_id != NULL) {
|
||||
path->device->device_id_len = 0;
|
||||
free(path->device->device_id, M_CAMXPT);
|
||||
path->device->device_id = NULL;
|
||||
}
|
||||
|
||||
if (devid == NULL) {
|
||||
/* Don't process the command as it was never sent */
|
||||
} else if (CCB_COMPLETED_OK(csio->ccb_h)) {
|
||||
length = scsi_2btoul(devid->length);
|
||||
if (length != 0) {
|
||||
/*
|
||||
* NB: device_id_len is actual response
|
||||
* size, not buffer size.
|
||||
*/
|
||||
path->device->device_id_len = length +
|
||||
SVPD_DEVICE_ID_HDR_LEN;
|
||||
path->device->device_id = (uint8_t *)devid;
|
||||
}
|
||||
} else if (cam_periph_error(done_ccb, 0,
|
||||
SF_RETRY_UA|SF_NO_PRINT,
|
||||
@ -1366,21 +1469,17 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
/*run_queue*/TRUE);
|
||||
}
|
||||
|
||||
if (page_list != NULL)
|
||||
free(page_list, M_CAMXPT);
|
||||
|
||||
if (serialnum_supported) {
|
||||
xpt_release_ccb(done_ccb);
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_1);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
|
||||
csio->data_ptr = NULL;
|
||||
/* FALLTHROUGH */
|
||||
/* Free the device id space if we don't use it */
|
||||
if (devid && length == 0)
|
||||
free(devid, M_CAMXPT);
|
||||
xpt_release_ccb(done_ccb);
|
||||
PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
|
||||
case PROBE_SERIAL_NUM_1:
|
||||
probe_device_check:
|
||||
case PROBE_SERIAL_NUM:
|
||||
{
|
||||
struct ccb_scsiio *csio;
|
||||
struct scsi_vpd_unit_serial_number *serial_buf;
|
||||
@ -1395,13 +1494,6 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
serial_buf =
|
||||
(struct scsi_vpd_unit_serial_number *)csio->data_ptr;
|
||||
|
||||
/* Clean up from previous instance of this device */
|
||||
if (path->device->serial_num != NULL) {
|
||||
free(path->device->serial_num, M_CAMXPT);
|
||||
path->device->serial_num = NULL;
|
||||
path->device->serial_num_len = 0;
|
||||
}
|
||||
|
||||
if (serial_buf == NULL) {
|
||||
/*
|
||||
* Don't process the command as it was never sent
|
||||
@ -2227,6 +2319,10 @@ scsi_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
|
||||
device->queue_flags = 0;
|
||||
device->serial_num = NULL;
|
||||
device->serial_num_len = 0;
|
||||
device->device_id = NULL;
|
||||
device->device_id_len = 0;
|
||||
device->supported_vpds = NULL;
|
||||
device->supported_vpds_len = 0;
|
||||
|
||||
/*
|
||||
* XXX should be limited by number of CCBs this bus can
|
||||
@ -2336,6 +2432,31 @@ scsi_devise_transport(struct cam_path *path)
|
||||
xpt_action((union ccb *)&cts);
|
||||
}
|
||||
|
||||
static void
|
||||
scsi_getdev_advinfo(union ccb *start_ccb)
|
||||
{
|
||||
struct cam_ed *device;
|
||||
struct ccb_getdev_advinfo *cgdai;
|
||||
off_t amt;
|
||||
|
||||
device = start_ccb->ccb_h.path->device;
|
||||
cgdai = &start_ccb->cgdai;
|
||||
switch(cgdai->buftype) {
|
||||
case CGDAI_TYPE_SCSI_DEVID:
|
||||
cgdai->provsiz = device->device_id_len;
|
||||
if (device->device_id_len == 0)
|
||||
break;
|
||||
amt = device->device_id_len;
|
||||
if (cgdai->provsiz > cgdai->bufsiz)
|
||||
amt = cgdai->bufsiz;
|
||||
bcopy(device->device_id, cgdai->buf, amt);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
start_ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
}
|
||||
|
||||
static void
|
||||
scsi_action(union ccb *start_ccb)
|
||||
{
|
||||
@ -2365,6 +2486,11 @@ scsi_action(union ccb *start_ccb)
|
||||
(*(sim->sim_action))(sim, start_ccb);
|
||||
break;
|
||||
}
|
||||
case XPT_GDEV_ADVINFO:
|
||||
{
|
||||
scsi_getdev_advinfo(start_ccb);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
xpt_action_default(start_ccb);
|
||||
break;
|
||||
|
620
sys/cam/scsi/smp_all.c
Normal file
620
sys/cam/scsi/smp_all.c
Normal file
@ -0,0 +1,620 @@
|
||||
/*-
|
||||
* Copyright (c) 2010 Spectra Logic Corporation
|
||||
* 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,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* substantially similar to the "NO WARRANTY" disclaimer below
|
||||
* ("Disclaimer") and any redistribution must be conditioned upon
|
||||
* including a substantially similar Disclaimer requirement for further
|
||||
* binary redistribution.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
|
||||
*
|
||||
* $Id: //depot/users/kenm/FreeBSD-test/sys/cam/scsi/smp_all.c#4 $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Serial Management Protocol helper functions.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef _KERNEL
|
||||
#include <sys/systm.h>
|
||||
#include <sys/libkern.h>
|
||||
#include <sys/kernel.h>
|
||||
#else /* _KERNEL */
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_ccb.h>
|
||||
#include <cam/cam_xpt.h>
|
||||
#include <cam/scsi/smp_all.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
#include <camlib.h>
|
||||
#endif
|
||||
|
||||
static char *smp_yesno(int val);
|
||||
|
||||
static char *
|
||||
smp_yesno(int val)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (val)
|
||||
str = "Yes";
|
||||
else
|
||||
str = "No";
|
||||
|
||||
return (str);
|
||||
}
|
||||
|
||||
struct smp_error_table_entry {
|
||||
uint8_t function_result;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
/* List current as of SPL Revision 7 */
|
||||
static struct smp_error_table_entry smp_error_table[] = {
|
||||
{SMP_FR_ACCEPTED, "SMP Function Accepted"},
|
||||
{SMP_FR_UNKNOWN_FUNC, "Unknown SMP Function"},
|
||||
{SMP_FR_FUNCTION_FAILED, "SMP Function Failed"},
|
||||
{SMP_FR_INVALID_REQ_FRAME_LEN, "Invalid Request Frame Length"},
|
||||
{SMP_FR_INVALID_EXP_CHG_CNT, "Invalid Expander Change Count"},
|
||||
{SMP_FR_BUSY, "Busy"},
|
||||
{SMP_FR_INCOMPLETE_DESC_LIST, "Incomplete Descriptor List"},
|
||||
{SMP_FR_PHY_DOES_NOT_EXIST, "Phy Does Not Exist"},
|
||||
{SMP_FR_INDEX_DOES_NOT_EXIST, "Index Does Not Exist"},
|
||||
{SMP_FR_PHY_DOES_NOT_SUP_SATA, "Phy Does Not Support SATA"},
|
||||
{SMP_FR_UNKNOWN_PHY_OP, "Unknown Phy Operation"},
|
||||
{SMP_FR_UNKNOWN_PHY_TEST_FUNC, "Unknown Phy Test Function"},
|
||||
{SMP_FR_PHY_TEST_FUNC_INPROG, "Phy Test Function In Progress"},
|
||||
{SMP_FR_PHY_VACANT, "Phy Vacant"},
|
||||
{SMP_FR_UNKNOWN_PHY_EVENT_SRC, "Unknown Phy Event Source"},
|
||||
{SMP_FR_UNKNOWN_DESC_TYPE, "Unknown Descriptor Type"},
|
||||
{SMP_FR_UNKNOWN_PHY_FILTER, "Unknown Phy Filter"},
|
||||
{SMP_FR_AFFILIATION_VIOLATION, "Affiliation Violation"},
|
||||
{SMP_FR_SMP_ZONE_VIOLATION, "SMP Zone Violation"},
|
||||
{SMP_FR_NO_MGMT_ACCESS_RIGHTS, "No Management Access Rights"},
|
||||
{SMP_FR_UNKNOWN_ED_ZONING_VAL, "Unknown Enable Disable Zoning Value"},
|
||||
{SMP_FR_ZONE_LOCK_VIOLATION, "Zone Lock Violation"},
|
||||
{SMP_FR_NOT_ACTIVATED, "Not Activated"},
|
||||
{SMP_FR_ZG_OUT_OF_RANGE, "Zone Group Out of Range"},
|
||||
{SMP_FR_NO_PHYS_PRESENCE, "No Physical Presence"},
|
||||
{SMP_FR_SAVING_NOT_SUP, "Saving Not Supported"},
|
||||
{SMP_FR_SRC_ZONE_DNE, "Source Zone Group Does Not Exist"},
|
||||
{SMP_FR_DISABLED_PWD_NOT_SUP, "Disabled Password Not Supported"}
|
||||
};
|
||||
|
||||
const char *
|
||||
smp_error_desc(int function_result)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(smp_error_table)/sizeof(smp_error_table[0]));
|
||||
i++){
|
||||
if (function_result == smp_error_table[i].function_result)
|
||||
return (smp_error_table[i].desc);
|
||||
}
|
||||
return ("Reserved Function Result");
|
||||
}
|
||||
|
||||
/* List current as of SPL Revision 7 */
|
||||
struct smp_cmd_table_entry {
|
||||
uint8_t cmd_num;
|
||||
const char *desc;
|
||||
} smp_cmd_table[] = {
|
||||
{SMP_FUNC_REPORT_GENERAL, "REPORT GENERAL"},
|
||||
{SMP_FUNC_REPORT_MANUF_INFO, "REPORT MANUFACTURER INFORMATION"},
|
||||
{SMP_FUNC_REPORT_SC_STATUS, "REPORT SELF-CONFIGURATION STATUS"},
|
||||
{SMP_FUNC_REPORT_ZONE_PERM_TBL, "REPORT ZONE PERMISSION TABLE"},
|
||||
{SMP_FUNC_REPORT_BROADCAST, "REPORT BROADCAST"},
|
||||
{SMP_FUNC_DISCOVER, "DISCOVER"},
|
||||
{SMP_FUNC_REPORT_PHY_ERR_LOG, "REPORT PHY ERROR LOG"},
|
||||
{SMP_FUNC_REPORT_PHY_SATA, "REPORT PHY SATA"},
|
||||
{SMP_FUNC_REPORT_ROUTE_INFO, "REPORT ROUTE INFORMATION"},
|
||||
{SMP_FUNC_REPORT_PHY_EVENT, "REPORT PHY EVENT"},
|
||||
{SMP_FUNC_DISCOVER_LIST, "DISCOVER LIST"},
|
||||
{SMP_FUNC_REPORT_PHY_EVENT_LIST, "REPORT PHY EVENT LIST"},
|
||||
{SMP_FUNC_REPORT_EXP_RTL, "REPORT EXPANDER ROUTE TABLE LIST"},
|
||||
{SMP_FUNC_CONFIG_GENERAL, "CONFIGURE GENERAL"},
|
||||
{SMP_FUNC_ENABLE_DISABLE_ZONING, "ENABLE DISABLE ZONING"},
|
||||
{SMP_FUNC_ZONED_BROADCAST, "ZONED BROADCAST"},
|
||||
{SMP_FUNC_ZONE_LOCK, "ZONE LOCK"},
|
||||
{SMP_FUNC_ZONE_ACTIVATE, "ZONE ACTIVATE"},
|
||||
{SMP_FUNC_ZONE_UNLOCK, "ZONE UNLOCK"},
|
||||
{SMP_FUNC_CONFIG_ZM_PWD, "CONFIGURE ZONE MANAGER PASSWORD"},
|
||||
{SMP_FUNC_CONFIG_ZONE_PHY_INFO, "CONFIGURE ZONE PHY INFORMATION"},
|
||||
{SMP_FUNC_CONFIG_ZONE_PERM_TBL, "CONFIGURE ZONE PERMISSION TABLE"},
|
||||
{SMP_FUNC_CONFIG_ROUTE_INFO, "CONFIGURE ROUTE INFORMATION"},
|
||||
{SMP_FUNC_PHY_CONTROL, "PHY CONTROL"},
|
||||
{SMP_FUNC_PHY_TEST_FUNC, "PHY TEST FUNCTION"},
|
||||
{SMP_FUNC_CONFIG_PHY_EVENT, "CONFIGURE PHY EVENT"}
|
||||
};
|
||||
|
||||
const char *
|
||||
smp_command_desc(uint8_t cmd_num)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(smp_cmd_table)/sizeof(smp_cmd_table[0])) &&
|
||||
smp_cmd_table[i].cmd_num <= cmd_num; i++) {
|
||||
if (cmd_num == smp_cmd_table[i].cmd_num)
|
||||
return (smp_cmd_table[i].desc);
|
||||
}
|
||||
|
||||
/*
|
||||
* 0x40 to 0x7f and 0xc0 to 0xff are the vendor specific SMP
|
||||
* command ranges.
|
||||
*/
|
||||
if (((cmd_num >= 0x40) && (cmd_num <= 0x7f))
|
||||
|| (cmd_num >= 0xc0)) {
|
||||
return ("Vendor Specific SMP Command");
|
||||
} else {
|
||||
return ("Unknown SMP Command");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode a SMP request buffer into a string of hexadecimal numbers.
|
||||
*
|
||||
* smp_request: SMP request
|
||||
* request_len: length of the SMP request buffer, may be reduced if the
|
||||
* caller only wants part of the buffer printed
|
||||
* sb: sbuf(9) buffer
|
||||
* line_prefix: prefix for new lines, or an empty string ("")
|
||||
* first_line_len: length left on first line
|
||||
* line_len: total length of subsequent lines, 0 for no additional lines
|
||||
* if there are no additional lines, first line will get ...
|
||||
* at the end if there is additional data
|
||||
*/
|
||||
void
|
||||
smp_command_decode(uint8_t *smp_request, int request_len, struct sbuf *sb,
|
||||
char *line_prefix, int first_line_len, int line_len)
|
||||
{
|
||||
int i, cur_len;
|
||||
|
||||
for (i = 0, cur_len = first_line_len; i < request_len; i++) {
|
||||
/*
|
||||
* Each byte takes 3 characters. As soon as we go less
|
||||
* than 6 (meaning we have at least 3 and at most 5
|
||||
* characters left), check to see whether the subsequent
|
||||
* line length (line_len) is long enough to bother with.
|
||||
* If the user set it to 0, or some other length that isn't
|
||||
* enough to hold at least the prefix and one byte, put ...
|
||||
* on the first line to indicate that there is more data
|
||||
* and bail out.
|
||||
*/
|
||||
if ((cur_len < 6)
|
||||
&& (line_len < (strlen(line_prefix) + 3))) {
|
||||
sbuf_printf(sb, "...");
|
||||
return;
|
||||
}
|
||||
if (cur_len < 3) {
|
||||
sbuf_printf(sb, "\n%s", line_prefix);
|
||||
cur_len = line_len - strlen(line_prefix);
|
||||
}
|
||||
sbuf_printf(sb, "%02x ", smp_request[i]);
|
||||
cur_len = cur_len - 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
smp_command_sbuf(struct ccb_smpio *smpio, struct sbuf *sb,
|
||||
char *line_prefix, int first_line_len, int line_len)
|
||||
{
|
||||
sbuf_printf(sb, "%s. ", smp_command_desc(smpio->smp_request[1]));
|
||||
|
||||
/*
|
||||
* Acccount for the command description and the period and space
|
||||
* after the command description.
|
||||
*/
|
||||
first_line_len -= strlen(smp_command_desc(smpio->smp_request[1])) + 2;
|
||||
|
||||
smp_command_decode(smpio->smp_request, smpio->smp_request_len, sb,
|
||||
line_prefix, first_line_len, line_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print SMP error output. For userland commands, we need the cam_device
|
||||
* structure so we can get the path information from the CCB.
|
||||
*/
|
||||
#ifdef _KERNEL
|
||||
void
|
||||
smp_error_sbuf(struct ccb_smpio *smpio, struct sbuf *sb)
|
||||
#else /* !_KERNEL*/
|
||||
void
|
||||
smp_error_sbuf(struct cam_device *device, struct ccb_smpio *smpio,
|
||||
struct sbuf *sb)
|
||||
#endif /* _KERNEL/!_KERNEL */
|
||||
{
|
||||
char path_str[64];
|
||||
|
||||
#ifdef _KERNEL
|
||||
xpt_path_string(smpio->ccb_h.path, path_str, sizeof(path_str));
|
||||
#else
|
||||
cam_path_string(device, path_str, sizeof(path_str));
|
||||
#endif
|
||||
smp_command_sbuf(smpio, sb, path_str, 80 - strlen(path_str), 80);
|
||||
sbuf_printf(sb, "\n");
|
||||
|
||||
sbuf_cat(sb, path_str);
|
||||
sbuf_printf(sb, "SMP Error: %s (0x%x)\n",
|
||||
smp_error_desc(smpio->smp_response[2]),
|
||||
smpio->smp_response[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode the SMP REPORT GENERAL response. The format is current as of SPL
|
||||
* Revision 7, but the parsing should be backward compatible for older
|
||||
* versions of the spec.
|
||||
*/
|
||||
void
|
||||
smp_report_general_sbuf(struct smp_report_general_response *response,
|
||||
int response_len, struct sbuf *sb)
|
||||
{
|
||||
sbuf_printf(sb, "Report General\n");
|
||||
sbuf_printf(sb, "Response Length: %d words (%d bytes)\n",
|
||||
response->response_len,
|
||||
response->response_len * SMP_WORD_LEN);
|
||||
sbuf_printf(sb, "Expander Change Count: %d\n",
|
||||
scsi_2btoul(response->expander_change_count));
|
||||
sbuf_printf(sb, "Expander Route Indexes: %d\n",
|
||||
scsi_2btoul(response->expander_route_indexes));
|
||||
sbuf_printf(sb, "Long Response: %s\n",
|
||||
smp_yesno(response->long_response &
|
||||
SMP_RG_LONG_RESPONSE));
|
||||
sbuf_printf(sb, "Number of Phys: %d\n", response->num_phys);
|
||||
sbuf_printf(sb, "Table to Table Supported: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_TABLE_TO_TABLE_SUP));
|
||||
sbuf_printf(sb, "Zone Configuring: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_ZONE_CONFIGURING));
|
||||
sbuf_printf(sb, "Self Configuring: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_SELF_CONFIGURING));
|
||||
sbuf_printf(sb, "STP Continue AWT: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_STP_CONTINUE_AWT));
|
||||
sbuf_printf(sb, "Open Reject Retry Supported: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_OPEN_REJECT_RETRY_SUP));
|
||||
sbuf_printf(sb, "Configures Others: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_CONFIGURES_OTHERS));
|
||||
sbuf_printf(sb, "Configuring: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_CONFIGURING));
|
||||
sbuf_printf(sb, "Externally Configurable Route Table: %s\n",
|
||||
smp_yesno(response->config_bits0 &
|
||||
SMP_RG_CONFIGURING));
|
||||
sbuf_printf(sb, "Enclosure Logical Identifier: 0x%016jx\n",
|
||||
(uintmax_t)scsi_8btou64(response->encl_logical_id));
|
||||
|
||||
/*
|
||||
* If the response->response_len is 0, then we don't have the
|
||||
* extended information. Also, if the user didn't allocate enough
|
||||
* space for the full request, don't try to parse it.
|
||||
*/
|
||||
if ((response->response_len == 0)
|
||||
|| (response_len < (sizeof(struct smp_report_general_response) -
|
||||
sizeof(response->crc))))
|
||||
return;
|
||||
|
||||
sbuf_printf(sb, "STP Bus Inactivity Time Limit: %d\n",
|
||||
scsi_2btoul(response->stp_bus_inact_time_limit));
|
||||
sbuf_printf(sb, "STP Maximum Connect Time Limit: %d\n",
|
||||
scsi_2btoul(response->stp_max_conn_time_limit));
|
||||
sbuf_printf(sb, "STP SMP I_T Nexus Loss Time: %d\n",
|
||||
scsi_2btoul(response->stp_smp_it_nexus_loss_time));
|
||||
|
||||
sbuf_printf(sb, "Number of Zone Groups: %d\n",
|
||||
(response->config_bits1 & SMP_RG_NUM_ZONE_GROUPS_MASK) >>
|
||||
SMP_RG_NUM_ZONE_GROUPS_SHIFT);
|
||||
sbuf_printf(sb, "Zone Locked: %s\n",
|
||||
smp_yesno(response->config_bits1 & SMP_RG_ZONE_LOCKED));
|
||||
sbuf_printf(sb, "Physical Presence Supported: %s\n",
|
||||
smp_yesno(response->config_bits1 & SMP_RG_PP_SUPPORTED));
|
||||
sbuf_printf(sb, "Physical Presence Asserted: %s\n",
|
||||
smp_yesno(response->config_bits1 & SMP_RG_PP_ASSERTED));
|
||||
sbuf_printf(sb, "Zoning Supported: %s\n",
|
||||
smp_yesno(response->config_bits1 &
|
||||
SMP_RG_ZONING_SUPPORTED));
|
||||
sbuf_printf(sb, "Zoning Enabled: %s\n",
|
||||
smp_yesno(response->config_bits1 & SMP_RG_ZONING_ENABLED));
|
||||
|
||||
sbuf_printf(sb, "Saving: %s\n",
|
||||
smp_yesno(response->config_bits2 & SMP_RG_SAVING));
|
||||
sbuf_printf(sb, "Saving Zone Manager Password Supported: %s\n",
|
||||
smp_yesno(response->config_bits2 &
|
||||
SMP_RG_SAVING_ZM_PWD_SUP));
|
||||
sbuf_printf(sb, "Saving Zone Phy Information Supported: %s\n",
|
||||
smp_yesno(response->config_bits2 &
|
||||
SMP_RG_SAVING_PHY_INFO_SUP));
|
||||
sbuf_printf(sb, "Saving Zone Permission Table Supported: %s\n",
|
||||
smp_yesno(response->config_bits2 &
|
||||
SMP_RG_SAVING_ZPERM_TAB_SUP));
|
||||
sbuf_printf(sb, "Saving Zoning Enabled Supported: %s\n",
|
||||
smp_yesno(response->config_bits2 &
|
||||
SMP_RG_SAVING_ZENABLED_SUP));
|
||||
|
||||
sbuf_printf(sb, "Maximum Number of Routed SAS Addresses: %d\n",
|
||||
scsi_2btoul(response->max_num_routed_addrs));
|
||||
|
||||
sbuf_printf(sb, "Active Zone Manager SAS Address: 0x%016jx\n",
|
||||
scsi_8btou64(response->active_zm_address));
|
||||
|
||||
sbuf_printf(sb, "Zone Inactivity Time Limit: %d\n",
|
||||
scsi_2btoul(response->zone_lock_inact_time_limit));
|
||||
|
||||
sbuf_printf(sb, "First Enclosure Connector Element Index: %d\n",
|
||||
response->first_encl_conn_el_index);
|
||||
|
||||
sbuf_printf(sb, "Number of Enclosure Connector Element Indexes: %d\n",
|
||||
response->num_encl_conn_el_indexes);
|
||||
|
||||
sbuf_printf(sb, "Reduced Functionality: %s\n",
|
||||
smp_yesno(response->reduced_functionality &
|
||||
SMP_RG_REDUCED_FUNCTIONALITY));
|
||||
|
||||
sbuf_printf(sb, "Time to Reduced Functionality: %d\n",
|
||||
response->time_to_reduced_func);
|
||||
sbuf_printf(sb, "Initial Time to Reduced Functionality: %d\n",
|
||||
response->initial_time_to_reduced_func);
|
||||
sbuf_printf(sb, "Maximum Reduced Functionality Time: %d\n",
|
||||
response->max_reduced_func_time);
|
||||
|
||||
sbuf_printf(sb, "Last Self-Configuration Status Descriptor Index: %d\n",
|
||||
scsi_2btoul(response->last_sc_stat_desc_index));
|
||||
|
||||
sbuf_printf(sb, "Maximum Number of Storated Self-Configuration "
|
||||
"Status Descriptors: %d\n",
|
||||
scsi_2btoul(response->max_sc_stat_descs));
|
||||
|
||||
sbuf_printf(sb, "Last Phy Event List Descriptor Index: %d\n",
|
||||
scsi_2btoul(response->last_phy_evl_desc_index));
|
||||
|
||||
sbuf_printf(sb, "Maximum Number of Stored Phy Event List "
|
||||
"Descriptors: %d\n",
|
||||
scsi_2btoul(response->max_stored_pel_descs));
|
||||
|
||||
sbuf_printf(sb, "STP Reject to Open Limit: %d\n",
|
||||
scsi_2btoul(response->stp_reject_to_open_limit));
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode the SMP REPORT MANUFACTURER INFORMATION response. The format is
|
||||
* current as of SPL Revision 7, but the parsing should be backward
|
||||
* compatible for older versions of the spec.
|
||||
*/
|
||||
void
|
||||
smp_report_manuf_info_sbuf(struct smp_report_manuf_info_response *response,
|
||||
int response_len, struct sbuf *sb)
|
||||
{
|
||||
char vendor[16], product[48], revision[16];
|
||||
char comp_vendor[16];
|
||||
|
||||
sbuf_printf(sb, "Report Manufacturer Information\n");
|
||||
sbuf_printf(sb, "Expander Change count: %d\n",
|
||||
scsi_2btoul(response->expander_change_count));
|
||||
sbuf_printf(sb, "SAS 1.1 Format: %s\n",
|
||||
smp_yesno(response->sas_11_format & SMP_RMI_SAS11_FORMAT));
|
||||
cam_strvis(vendor, response->vendor, sizeof(response->vendor),
|
||||
sizeof(vendor));
|
||||
cam_strvis(product, response->product, sizeof(response->product),
|
||||
sizeof(product));
|
||||
cam_strvis(revision, response->revision, sizeof(response->revision),
|
||||
sizeof(revision));
|
||||
sbuf_printf(sb, "<%s %s %s>\n", vendor, product, revision);
|
||||
|
||||
if ((response->sas_11_format & SMP_RMI_SAS11_FORMAT) == 0) {
|
||||
uint8_t *curbyte;
|
||||
int line_start, line_cursor;
|
||||
|
||||
sbuf_printf(sb, "Vendor Specific Data:\n");
|
||||
|
||||
/*
|
||||
* Print out the bytes roughly in the style of hd(1), but
|
||||
* without the extra ASCII decoding. Hexadecimal line
|
||||
* numbers on the left, and 16 bytes per line, with an
|
||||
* extra space after the first 8 bytes.
|
||||
*
|
||||
* It would be nice if this sort of thing were available
|
||||
* in a library routine.
|
||||
*/
|
||||
for (curbyte = (uint8_t *)&response->comp_vendor, line_start= 1,
|
||||
line_cursor = 0; curbyte < (uint8_t *)&response->crc;
|
||||
curbyte++, line_cursor++) {
|
||||
if (line_start != 0) {
|
||||
sbuf_printf(sb, "%08lx ",
|
||||
(unsigned long)(curbyte -
|
||||
(uint8_t *)response));
|
||||
line_start = 0;
|
||||
line_cursor = 0;
|
||||
}
|
||||
sbuf_printf(sb, "%02x", *curbyte);
|
||||
|
||||
if (line_cursor == 15) {
|
||||
sbuf_printf(sb, "\n");
|
||||
line_start = 1;
|
||||
} else
|
||||
sbuf_printf(sb, " %s", (line_cursor == 7) ?
|
||||
" " : "");
|
||||
}
|
||||
if (line_cursor != 16)
|
||||
sbuf_printf(sb, "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
cam_strvis(comp_vendor, response->comp_vendor,
|
||||
sizeof(response->comp_vendor), sizeof(comp_vendor));
|
||||
sbuf_printf(sb, "Component Vendor: %s\n", comp_vendor);
|
||||
sbuf_printf(sb, "Component ID: %#x\n", scsi_2btoul(response->comp_id));
|
||||
sbuf_printf(sb, "Component Revision: %#x\n", response->comp_revision);
|
||||
sbuf_printf(sb, "Vendor Specific: 0x%016jx\n",
|
||||
(uintmax_t)scsi_8btou64(response->vendor_specific));
|
||||
}
|
||||
|
||||
/*
|
||||
* Compose a SMP REPORT GENERAL request and put it into a CCB. This is
|
||||
* current as of SPL Revision 7.
|
||||
*/
|
||||
void
|
||||
smp_report_general(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_report_general_request *request, int request_len,
|
||||
uint8_t *response, int response_len, int long_response,
|
||||
uint32_t timeout)
|
||||
{
|
||||
cam_fill_smpio(smpio,
|
||||
retries,
|
||||
cbfcnp,
|
||||
/*flags*/CAM_DIR_BOTH,
|
||||
(uint8_t *)request,
|
||||
request_len - SMP_CRC_LEN,
|
||||
response,
|
||||
response_len,
|
||||
timeout);
|
||||
|
||||
bzero(request, sizeof(*request));
|
||||
|
||||
request->frame_type = SMP_FRAME_TYPE_REQUEST;
|
||||
request->function = SMP_FUNC_REPORT_GENERAL;
|
||||
request->response_len = long_response ? SMP_RG_RESPONSE_LEN : 0;
|
||||
request->request_len = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compose a SMP DISCOVER request and put it into a CCB. This is current
|
||||
* as of SPL Revision 7.
|
||||
*/
|
||||
void
|
||||
smp_discover(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_discover_request *request, int request_len,
|
||||
uint8_t *response, int response_len, int long_response,
|
||||
int ignore_zone_group, int phy, uint32_t timeout)
|
||||
{
|
||||
cam_fill_smpio(smpio,
|
||||
retries,
|
||||
cbfcnp,
|
||||
/*flags*/CAM_DIR_BOTH,
|
||||
(uint8_t *)request,
|
||||
request_len - SMP_CRC_LEN,
|
||||
response,
|
||||
response_len,
|
||||
timeout);
|
||||
|
||||
bzero(request, sizeof(*request));
|
||||
request->frame_type = SMP_FRAME_TYPE_REQUEST;
|
||||
request->function = SMP_FUNC_DISCOVER;
|
||||
request->response_len = long_response ? SMP_DIS_RESPONSE_LEN : 0;
|
||||
request->request_len = long_response ? SMP_DIS_REQUEST_LEN : 0;
|
||||
if (ignore_zone_group != 0)
|
||||
request->ignore_zone_group |= SMP_DIS_IGNORE_ZONE_GROUP;
|
||||
request->phy = phy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compose a SMP REPORT MANUFACTURER INFORMATION request and put it into a
|
||||
* CCB. This is current as of SPL Revision 7.
|
||||
*/
|
||||
void
|
||||
smp_report_manuf_info(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_report_manuf_info_request *request,
|
||||
int request_len, uint8_t *response, int response_len,
|
||||
int long_response, uint32_t timeout)
|
||||
{
|
||||
cam_fill_smpio(smpio,
|
||||
retries,
|
||||
cbfcnp,
|
||||
/*flags*/CAM_DIR_BOTH,
|
||||
(uint8_t *)request,
|
||||
request_len - SMP_CRC_LEN,
|
||||
response,
|
||||
response_len,
|
||||
timeout);
|
||||
|
||||
bzero(request, sizeof(*request));
|
||||
|
||||
request->frame_type = SMP_FRAME_TYPE_REQUEST;
|
||||
request->function = SMP_FUNC_REPORT_MANUF_INFO;
|
||||
request->response_len = long_response ? SMP_RMI_RESPONSE_LEN : 0;
|
||||
request->request_len = long_response ? SMP_RMI_REQUEST_LEN : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compose a SMP PHY CONTROL request and put it into a CCB. This is
|
||||
* current as of SPL Revision 7.
|
||||
*/
|
||||
void
|
||||
smp_phy_control(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_phy_control_request *request, int request_len,
|
||||
uint8_t *response, int response_len, int long_response,
|
||||
uint32_t expected_exp_change_count, int phy, int phy_op,
|
||||
int update_pp_timeout_val, uint64_t attached_device_name,
|
||||
int prog_min_prl, int prog_max_prl, int slumber_partial,
|
||||
int pp_timeout_value, uint32_t timeout)
|
||||
{
|
||||
cam_fill_smpio(smpio,
|
||||
retries,
|
||||
cbfcnp,
|
||||
/*flags*/CAM_DIR_BOTH,
|
||||
(uint8_t *)request,
|
||||
request_len - SMP_CRC_LEN,
|
||||
response,
|
||||
response_len,
|
||||
timeout);
|
||||
|
||||
bzero(request, sizeof(*request));
|
||||
|
||||
request->frame_type = SMP_FRAME_TYPE_REQUEST;
|
||||
request->function = SMP_FUNC_PHY_CONTROL;
|
||||
request->response_len = long_response ? SMP_PC_RESPONSE_LEN : 0;
|
||||
request->request_len = long_response ? SMP_PC_REQUEST_LEN : 0;
|
||||
scsi_ulto2b(expected_exp_change_count, request->expected_exp_chg_cnt);
|
||||
request->phy = phy;
|
||||
request->phy_operation = phy_op;
|
||||
|
||||
if (update_pp_timeout_val != 0)
|
||||
request->update_pp_timeout |= SMP_PC_UPDATE_PP_TIMEOUT;
|
||||
|
||||
scsi_u64to8b(attached_device_name, request->attached_device_name);
|
||||
request->prog_min_phys_link_rate = (prog_min_prl <<
|
||||
SMP_PC_PROG_MIN_PL_RATE_SHIFT) & SMP_PC_PROG_MIN_PL_RATE_MASK;
|
||||
request->prog_max_phys_link_rate = (prog_max_prl <<
|
||||
SMP_PC_PROG_MAX_PL_RATE_SHIFT) & SMP_PC_PROG_MAX_PL_RATE_MASK;
|
||||
request->config_bits0 = slumber_partial;
|
||||
request->pp_timeout_value = pp_timeout_value;
|
||||
}
|
||||
|
520
sys/cam/scsi/smp_all.h
Normal file
520
sys/cam/scsi/smp_all.h
Normal file
@ -0,0 +1,520 @@
|
||||
/*-
|
||||
* Copyright (c) 2010 Spectra Logic Corporation
|
||||
* 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,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* substantially similar to the "NO WARRANTY" disclaimer below
|
||||
* ("Disclaimer") and any redistribution must be conditioned upon
|
||||
* including a substantially similar Disclaimer requirement for further
|
||||
* binary redistribution.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
|
||||
*
|
||||
* $Id: //depot/users/kenm/FreeBSD-test/sys/cam/scsi/smp_all.h#4 $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Serial Management Protocol definitions.
|
||||
*/
|
||||
|
||||
#ifndef _SCSI_SMP_ALL_H
|
||||
#define _SCSI_SMP_ALL_H 1
|
||||
|
||||
#define SMP_FRAME_TYPE_REQUEST 0x40
|
||||
#define SMP_FRAME_TYPE_RESPONSE 0x41
|
||||
#define SMP_WORD_LEN 4
|
||||
#define SMP_CRC_LEN 4
|
||||
|
||||
/*
|
||||
* SMP Functions (current as of SPL Revision 7)
|
||||
*/
|
||||
/* 0x00 to 0x7f: SMP input functions */
|
||||
/* 0x00 to 0x0f: General SMP input functions */
|
||||
#define SMP_FUNC_REPORT_GENERAL 0x00
|
||||
#define SMP_FUNC_REPORT_MANUF_INFO 0x01
|
||||
#define SMP_FUNC_REPORT_SC_STATUS 0x03
|
||||
#define SMP_FUNC_REPORT_ZONE_PERM_TBL 0x04
|
||||
#define SMP_FUNC_REPORT_ZONE_MAN_PWD 0x05
|
||||
#define SMP_FUNC_REPORT_BROADCAST 0x06
|
||||
|
||||
/* 0x10 to 0x1f: Phy-based SMP input functions */
|
||||
#define SMP_FUNC_DISCOVER 0x10
|
||||
#define SMP_FUNC_REPORT_PHY_ERR_LOG 0x11
|
||||
#define SMP_FUNC_REPORT_PHY_SATA 0x12
|
||||
#define SMP_FUNC_REPORT_ROUTE_INFO 0x13
|
||||
#define SMP_FUNC_REPORT_PHY_EVENT 0x14
|
||||
|
||||
/* 0x20 to 0x2f: Descriptor list-based SMP input functions */
|
||||
#define SMP_FUNC_DISCOVER_LIST 0x20
|
||||
#define SMP_FUNC_REPORT_PHY_EVENT_LIST 0x21
|
||||
#define SMP_FUNC_REPORT_EXP_RTL 0x22
|
||||
|
||||
/* 0x30 to 0x3f: Reserved for SMP input functions */
|
||||
/* 0x40 to 0x7f: Vendor specific */
|
||||
|
||||
/* 0x80 to 0xff: SMP output functions */
|
||||
/* 0x80 to 0x8f: General SMP output functions */
|
||||
#define SMP_FUNC_CONFIG_GENERAL 0x80
|
||||
#define SMP_FUNC_ENABLE_DISABLE_ZONING 0x81
|
||||
#define SMP_FUNC_ZONED_BROADCAST 0x85
|
||||
#define SMP_FUNC_ZONE_LOCK 0x86
|
||||
#define SMP_FUNC_ZONE_ACTIVATE 0x87
|
||||
#define SMP_FUNC_ZONE_UNLOCK 0x88
|
||||
#define SMP_FUNC_CONFIG_ZM_PWD 0x89
|
||||
#define SMP_FUNC_CONFIG_ZONE_PHY_INFO 0x8a
|
||||
#define SMP_FUNC_CONFIG_ZONE_PERM_TBL 0x8b
|
||||
|
||||
/* 0x90 to 0x9f: Phy-based SMP output functions */
|
||||
#define SMP_FUNC_CONFIG_ROUTE_INFO 0x90
|
||||
#define SMP_FUNC_PHY_CONTROL 0x91
|
||||
#define SMP_FUNC_PHY_TEST_FUNC 0x92
|
||||
#define SMP_FUNC_CONFIG_PHY_EVENT 0x93
|
||||
|
||||
/* 0xa0 to 0xbf: Reserved for SMP output functions */
|
||||
/* 0xc0 to 0xff: Vendor specific */
|
||||
|
||||
/*
|
||||
* Function Results (current as of SPL Revision 7)
|
||||
*/
|
||||
#define SMP_FR_ACCEPTED 0x00
|
||||
#define SMP_FR_UNKNOWN_FUNC 0x01
|
||||
#define SMP_FR_FUNCTION_FAILED 0x02
|
||||
#define SMP_FR_INVALID_REQ_FRAME_LEN 0x03
|
||||
#define SMP_FR_INVALID_EXP_CHG_CNT 0x04
|
||||
#define SMP_FR_BUSY 0x05
|
||||
#define SMP_FR_INCOMPLETE_DESC_LIST 0x06
|
||||
#define SMP_FR_PHY_DOES_NOT_EXIST 0x10
|
||||
#define SMP_FR_INDEX_DOES_NOT_EXIST 0x11
|
||||
#define SMP_FR_PHY_DOES_NOT_SUP_SATA 0x12
|
||||
#define SMP_FR_UNKNOWN_PHY_OP 0x13
|
||||
#define SMP_FR_UNKNOWN_PHY_TEST_FUNC 0x14
|
||||
#define SMP_FR_PHY_TEST_FUNC_INPROG 0x15
|
||||
#define SMP_FR_PHY_VACANT 0x16
|
||||
#define SMP_FR_UNKNOWN_PHY_EVENT_SRC 0x17
|
||||
#define SMP_FR_UNKNOWN_DESC_TYPE 0x18
|
||||
#define SMP_FR_UNKNOWN_PHY_FILTER 0x19
|
||||
#define SMP_FR_AFFILIATION_VIOLATION 0x1a
|
||||
#define SMP_FR_SMP_ZONE_VIOLATION 0x20
|
||||
#define SMP_FR_NO_MGMT_ACCESS_RIGHTS 0x21
|
||||
#define SMP_FR_UNKNOWN_ED_ZONING_VAL 0x22
|
||||
#define SMP_FR_ZONE_LOCK_VIOLATION 0x23
|
||||
#define SMP_FR_NOT_ACTIVATED 0x24
|
||||
#define SMP_FR_ZG_OUT_OF_RANGE 0x25
|
||||
#define SMP_FR_NO_PHYS_PRESENCE 0x26
|
||||
#define SMP_FR_SAVING_NOT_SUP 0x27
|
||||
#define SMP_FR_SRC_ZONE_DNE 0x28
|
||||
#define SMP_FR_DISABLED_PWD_NOT_SUP 0x29
|
||||
|
||||
/*
|
||||
* REPORT GENERAL request and response, current as of SPL Revision 7.
|
||||
*/
|
||||
struct smp_report_general_request
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t response_len;
|
||||
uint8_t request_len;
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
struct smp_report_general_response
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t function_result;
|
||||
uint8_t response_len;
|
||||
#define SMP_RG_RESPONSE_LEN 0x11
|
||||
uint8_t expander_change_count[2];
|
||||
uint8_t expander_route_indexes[2];
|
||||
uint8_t long_response;
|
||||
#define SMP_RG_LONG_RESPONSE 0x80
|
||||
uint8_t num_phys;
|
||||
uint8_t config_bits0;
|
||||
#define SMP_RG_TABLE_TO_TABLE_SUP 0x80
|
||||
#define SMP_RG_ZONE_CONFIGURING 0x40
|
||||
#define SMP_RG_SELF_CONFIGURING 0x20
|
||||
#define SMP_RG_STP_CONTINUE_AWT 0x10
|
||||
#define SMP_RG_OPEN_REJECT_RETRY_SUP 0x08
|
||||
#define SMP_RG_CONFIGURES_OTHERS 0x04
|
||||
#define SMP_RG_CONFIGURING 0x02
|
||||
#define SMP_RG_EXT_CONFIG_ROUTE_TABLE 0x01
|
||||
uint8_t reserved0;
|
||||
uint8_t encl_logical_id[8];
|
||||
uint8_t reserved1[8];
|
||||
uint8_t reserved2[2];
|
||||
uint8_t stp_bus_inact_time_limit[2];
|
||||
uint8_t stp_max_conn_time_limit[2];
|
||||
uint8_t stp_smp_it_nexus_loss_time[2];
|
||||
uint8_t config_bits1;
|
||||
#define SMP_RG_NUM_ZONE_GROUPS_MASK 0xc0
|
||||
#define SMP_RG_NUM_ZONE_GROUPS_SHIFT 6
|
||||
#define SMP_RG_ZONE_LOCKED 0x10
|
||||
#define SMP_RG_PP_SUPPORTED 0x08
|
||||
#define SMP_RG_PP_ASSERTED 0x04
|
||||
#define SMP_RG_ZONING_SUPPORTED 0x02
|
||||
#define SMP_RG_ZONING_ENABLED 0x01
|
||||
uint8_t config_bits2;
|
||||
#define SMP_RG_SAVING 0x10
|
||||
#define SMP_RG_SAVING_ZM_PWD_SUP 0x08
|
||||
#define SMP_RG_SAVING_PHY_INFO_SUP 0x04
|
||||
#define SMP_RG_SAVING_ZPERM_TAB_SUP 0x02
|
||||
#define SMP_RG_SAVING_ZENABLED_SUP 0x01
|
||||
uint8_t max_num_routed_addrs[2];
|
||||
uint8_t active_zm_address[8];
|
||||
uint8_t zone_lock_inact_time_limit[2];
|
||||
uint8_t reserved3[2];
|
||||
uint8_t reserved4;
|
||||
uint8_t first_encl_conn_el_index;
|
||||
uint8_t num_encl_conn_el_indexes;
|
||||
uint8_t reserved5;
|
||||
uint8_t reduced_functionality;
|
||||
#define SMP_RG_REDUCED_FUNCTIONALITY 0x80
|
||||
uint8_t time_to_reduced_func;
|
||||
uint8_t initial_time_to_reduced_func;
|
||||
uint8_t max_reduced_func_time;
|
||||
uint8_t last_sc_stat_desc_index[2];
|
||||
uint8_t max_sc_stat_descs[2];
|
||||
uint8_t last_phy_evl_desc_index[2];
|
||||
uint8_t max_stored_pel_descs[2];
|
||||
uint8_t stp_reject_to_open_limit[2];
|
||||
uint8_t reserved6[2];
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* REPORT MANUFACTURER INFORMATION request and response, current as of SPL
|
||||
* Revision 7.
|
||||
*/
|
||||
struct smp_report_manuf_info_request
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t response_len;
|
||||
uint8_t request_len;
|
||||
#define SMP_RMI_REQUEST_LEN 0x00
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
struct smp_report_manuf_info_response
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t function_result;
|
||||
uint8_t response_len;
|
||||
#define SMP_RMI_RESPONSE_LEN 0x0e
|
||||
uint8_t expander_change_count[2];
|
||||
uint8_t reserved0[2];
|
||||
uint8_t sas_11_format;
|
||||
#define SMP_RMI_SAS11_FORMAT 0x01
|
||||
uint8_t reserved1[3];
|
||||
uint8_t vendor[8];
|
||||
uint8_t product[16];
|
||||
uint8_t revision[4];
|
||||
uint8_t comp_vendor[8];
|
||||
uint8_t comp_id[2];
|
||||
uint8_t comp_revision;
|
||||
uint8_t reserved2;
|
||||
uint8_t vendor_specific[8];
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* DISCOVER request and response, current as of SPL Revision 7.
|
||||
*/
|
||||
struct smp_discover_request
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t response_len;
|
||||
uint8_t request_len;
|
||||
#define SMP_DIS_REQUEST_LEN 0x02
|
||||
uint8_t reserved0[4];
|
||||
uint8_t ignore_zone_group;
|
||||
#define SMP_DIS_IGNORE_ZONE_GROUP 0x01
|
||||
uint8_t phy;
|
||||
uint8_t reserved1[2];
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
struct smp_discover_response
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t function_result;
|
||||
uint8_t response_len;
|
||||
#define SMP_DIS_RESPONSE_LEN 0x20
|
||||
uint8_t expander_change_count[2];
|
||||
uint8_t reserved0[3];
|
||||
uint8_t phy;
|
||||
uint8_t reserved1[2];
|
||||
uint8_t attached_device;
|
||||
#define SMP_DIS_AD_TYPE_MASK 0x70
|
||||
#define SMP_DIS_AD_TYPE_NONE 0x00
|
||||
#define SMP_DIS_AD_TYPE_SAS_SATA 0x10
|
||||
#define SMP_DIS_AD_TYPE_EXP 0x20
|
||||
#define SMP_DIS_AD_TYPE_EXP_OLD 0x30
|
||||
#define SMP_DIS_ATTACH_REASON_MASK 0x0f
|
||||
uint8_t neg_logical_link_rate;
|
||||
#define SMP_DIS_LR_MASK 0x0f
|
||||
#define SMP_DIS_LR_DISABLED 0x01
|
||||
#define SMP_DIS_LR_PHY_RES_PROB 0x02
|
||||
#define SMP_DIS_LR_SPINUP_HOLD 0x03
|
||||
#define SMP_DIS_LR_PORT_SEL 0x04
|
||||
#define SMP_DIS_LR_RESET_IN_PROG 0x05
|
||||
#define SMP_DIS_LR_UNSUP_PHY_ATTACHED 0x06
|
||||
#define SMP_DIS_LR_G1_15GBPS 0x08
|
||||
#define SMP_DIS_LR_G2_30GBPS 0x09
|
||||
#define SMP_DIS_LR_G3_60GBPS 0x0a
|
||||
uint8_t config_bits0;
|
||||
#define SMP_DIS_ATTACHED_SSP_INIT 0x08
|
||||
#define SMP_DIS_ATTACHED_STP_INIT 0x04
|
||||
#define SMP_DIS_ATTACHED_SMP_INIT 0x02
|
||||
#define SMP_DIS_ATTACHED_SATA_HOST 0x01
|
||||
uint8_t config_bits1;
|
||||
#define SMP_DIS_ATTACHED_SATA_PORTSEL 0x80
|
||||
#define SMP_DIS_STP_BUFFER_TOO_SMALL 0x10
|
||||
#define SMP_DIS_ATTACHED_SSP_TARG 0x08
|
||||
#define SMP_DIS_ATTACHED_STP_TARG 0x04
|
||||
#define SMP_DIS_ATTACHED_SMP_TARG 0x02
|
||||
#define SMP_DIS_ATTACHED_SATA_DEV 0x01
|
||||
uint8_t sas_address[8];
|
||||
uint8_t attached_sas_address[8];
|
||||
uint8_t attached_phy_id;
|
||||
uint8_t config_bits2;
|
||||
#define SMP_DIS_ATT_SLUMB_CAP 0x10
|
||||
#define SMP_DIS_ATT_PAR_CAP 0x08
|
||||
#define SMP_DIS_ATT_IN_ZPSDS_PER 0x04
|
||||
#define SMP_DIS_ATT_REQ_IN_ZPSDS 0x02
|
||||
#define SMP_DIS_ATT_BREAK_RPL_CAP 0x01
|
||||
uint8_t reserved2[6];
|
||||
uint8_t link_rate0;
|
||||
#define SMP_DIS_PROG_MIN_LR_MASK 0xf0
|
||||
#define SMP_DIS_PROG_MIN_LR_SHIFT 4
|
||||
#define SMP_DIS_HARD_MIN_LR_MASK 0x0f
|
||||
uint8_t link_rate1;
|
||||
#define SMP_DIS_PROG_MAX_LR_MAX 0xf0
|
||||
#define SMP_DIS_PROG_MAX_LR_SHIFT 4
|
||||
#define SMP_DIS_HARD_MAX_LR_MASK 0x0f
|
||||
uint8_t phy_change_count;
|
||||
uint8_t pp_timeout;
|
||||
#define SMP_DIS_VIRTUAL_PHY 0x80
|
||||
#define SMP_DIS_PP_TIMEOUT_MASK 0x0f
|
||||
uint8_t routing_attr;
|
||||
uint8_t conn_type;
|
||||
uint8_t conn_el_index;
|
||||
uint8_t conn_phys_link;
|
||||
uint8_t config_bits3;
|
||||
#define SMP_DIS_PHY_POW_COND_MASK 0xc0
|
||||
#define SMP_DIS_PHY_POW_COND_SHIFT 6
|
||||
#define SMP_DIS_SAS_SLUMB_CAP 0x08
|
||||
#define SMP_DIS_SAS_PART_CAP 0x04
|
||||
#define SMP_DIS_SATA_SLUMB_CAP 0x02
|
||||
#define SMP_DIS_SATA_PART_CAP 0x01
|
||||
uint8_t config_bits4;
|
||||
#define SMP_DIS_SAS_SLUMB_ENB 0x08
|
||||
#define SMP_DIS_SAS_PART_ENB 0x04
|
||||
#define SMP_DIS_SATA_SLUMB_ENB 0x02
|
||||
#define SMP_DIS_SATA_PART_ENB 0x01
|
||||
uint8_t vendor_spec[2];
|
||||
uint8_t attached_dev_name[8];
|
||||
uint8_t config_bits5;
|
||||
#define SMP_DIS_REQ_IN_ZPSDS_CHG 0x40
|
||||
#define SMP_DIS_IN_ZPSDS_PER 0x20
|
||||
#define SMP_DIS_REQ_IN_ZPSDS 0x10
|
||||
#define SMP_DIS_ZG_PER 0x04
|
||||
#define SMP_DIS_IN_ZPSDS 0x02
|
||||
#define SMP_DIS_ZONING_ENB 0x01
|
||||
uint8_t reserved3[2];
|
||||
uint8_t zone_group;
|
||||
uint8_t self_config_status;
|
||||
uint8_t self_config_levels_comp;
|
||||
uint8_t reserved4[2];
|
||||
uint8_t self_config_sas_addr[8];
|
||||
uint8_t prog_phy_cap[4];
|
||||
uint8_t current_phy_cap[4];
|
||||
uint8_t attached_phy_cap[4];
|
||||
uint8_t reserved5[6];
|
||||
uint8_t neg_phys_link_rate;
|
||||
#define SMP_DIS_REASON_MASK 0xf0
|
||||
#define SMP_DIS_REASON_SHIFT 4
|
||||
#define SMP_DIS_PHYS_LR_MASK 0x0f
|
||||
uint8_t config_bits6;
|
||||
#define SMP_DIS_OPTICAL_MODE_ENB 0x04
|
||||
#define SMP_DIS_NEG_SSC 0x02
|
||||
#define SMP_DIS_HW_MUX_SUP 0x01
|
||||
uint8_t config_bits7;
|
||||
#define SMP_DIS_DEF_IN_ZPSDS_PER 0x20
|
||||
#define SMP_DIS_DEF_REQ_IN_ZPSDS 0x10
|
||||
#define SMP_DIS_DEF_ZG_PER 0x04
|
||||
#define SMP_DIS_DEF_ZONING_ENB 0x01
|
||||
uint8_t reserved6;
|
||||
uint8_t reserved7;
|
||||
uint8_t default_zone_group;
|
||||
uint8_t config_bits8;
|
||||
#define SMP_DIS_SAVED_IN_ZPSDS_PER 0x20
|
||||
#define SMP_DIS_SAVED_REQ_IN_SPSDS 0x10
|
||||
#define SMP_DIS_SAVED_ZG_PER 0x04
|
||||
#define SMP_DIS_SAVED_ZONING_ENB 0x01
|
||||
uint8_t reserved8;
|
||||
uint8_t reserved9;
|
||||
uint8_t saved_zone_group;
|
||||
uint8_t config_bits9;
|
||||
#define SMP_DIS_SHADOW_IN_ZPSDS_PER 0x20
|
||||
#define SMP_DIS_SHADOW_IN_REQ_IN_ZPSDS 0x10
|
||||
#define SMP_DIS_SHADOW_ZG_PER 0x04
|
||||
uint8_t reserved10;
|
||||
uint8_t reserved11;
|
||||
uint8_t shadow_zone_group;
|
||||
uint8_t device_slot_num;
|
||||
uint8_t device_slot_group_num;
|
||||
uint8_t device_slot_group_out_conn[6];
|
||||
uint8_t stp_buffer_size[2];
|
||||
uint8_t reserved12;
|
||||
uint8_t reserved13;
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* PHY CONTROL request and response. Current as of SPL Revision 7.
|
||||
*/
|
||||
struct smp_phy_control_request
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t response_len;
|
||||
#define SMP_PC_RESPONSE_LEN 0x00
|
||||
uint8_t request_len;
|
||||
#define SMP_PC_REQUEST_LEN 0x09
|
||||
uint8_t expected_exp_chg_cnt[2];
|
||||
uint8_t reserved0[3];
|
||||
uint8_t phy;
|
||||
uint8_t phy_operation;
|
||||
#define SMP_PC_PHY_OP_NOP 0x00
|
||||
#define SMP_PC_PHY_OP_LINK_RESET 0x01
|
||||
#define SMP_PC_PHY_OP_HARD_RESET 0x02
|
||||
#define SMP_PC_PHY_OP_DISABLE 0x03
|
||||
#define SMP_PC_PHY_OP_CLEAR_ERR_LOG 0x05
|
||||
#define SMP_PC_PHY_OP_CLEAR_AFFILIATON 0x06
|
||||
#define SMP_PC_PHY_OP_TRANS_SATA_PSS 0x07
|
||||
#define SMP_PC_PHY_OP_CLEAR_STP_ITN_LS 0x08
|
||||
#define SMP_PC_PHY_OP_SET_ATT_DEV_NAME 0x09
|
||||
uint8_t update_pp_timeout;
|
||||
#define SMP_PC_UPDATE_PP_TIMEOUT 0x01
|
||||
uint8_t reserved1[12];
|
||||
uint8_t attached_device_name[8];
|
||||
uint8_t prog_min_phys_link_rate;
|
||||
#define SMP_PC_PROG_MIN_PL_RATE_MASK 0xf0
|
||||
#define SMP_PC_PROG_MIN_PL_RATE_SHIFT 4
|
||||
uint8_t prog_max_phys_link_rate;
|
||||
#define SMP_PC_PROG_MAX_PL_RATE_MASK 0xf0
|
||||
#define SMP_PC_PROG_MAX_PL_RATE_SHIFT 4
|
||||
uint8_t config_bits0;
|
||||
#define SMP_PC_SP_NC 0x00
|
||||
#define SMP_PC_SP_DISABLE 0x02
|
||||
#define SMP_PC_SP_ENABLE 0x01
|
||||
#define SMP_PC_SAS_SLUMBER_NC 0x00
|
||||
#define SMP_PC_SAS_SLUMBER_DISABLE 0x80
|
||||
#define SMP_PC_SAS_SLUMBER_ENABLE 0x40
|
||||
#define SMP_PC_SAS_SLUMBER_MASK 0xc0
|
||||
#define SMP_PC_SAS_SLUMBER_SHIFT 6
|
||||
#define SMP_PC_SAS_PARTIAL_NC 0x00
|
||||
#define SMP_PC_SAS_PARTIAL_DISABLE 0x20
|
||||
#define SMP_PC_SAS_PARTIAL_ENABLE 0x10
|
||||
#define SMP_PC_SAS_PARTIAL_MASK 0x30
|
||||
#define SMP_PC_SAS_PARTIAL_SHIFT 4
|
||||
#define SMP_PC_SATA_SLUMBER_NC 0x00
|
||||
#define SMP_PC_SATA_SLUMBER_DISABLE 0x08
|
||||
#define SMP_PC_SATA_SLUMBER_ENABLE 0x04
|
||||
#define SMP_PC_SATA_SLUMBER_MASK 0x0c
|
||||
#define SMP_PC_SATA_SLUMBER_SHIFT 2
|
||||
#define SMP_PC_SATA_PARTIAL_NC 0x00
|
||||
#define SMP_PC_SATA_PARTIAL_DISABLE 0x02
|
||||
#define SMP_PC_SATA_PARTIAL_ENABLE 0x01
|
||||
#define SMP_PC_SATA_PARTIAL_MASK 0x03
|
||||
#define SMP_PC_SATA_PARTIAL_SHIFT 0
|
||||
uint8_t reserved2;
|
||||
uint8_t pp_timeout_value;
|
||||
#define SMP_PC_PP_TIMEOUT_MASK 0x0f
|
||||
uint8_t reserved3[3];
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
struct smp_phy_control_response
|
||||
{
|
||||
uint8_t frame_type;
|
||||
uint8_t function;
|
||||
uint8_t function_result;
|
||||
uint8_t response_len;
|
||||
#define SMP_PC_RESPONSE_LEN 0x00
|
||||
uint8_t crc[4];
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
const char *smp_error_desc(int function_result);
|
||||
const char *smp_command_desc(uint8_t cmd_num);
|
||||
void smp_command_decode(uint8_t *smp_request, int request_len, struct sbuf *sb,
|
||||
char *line_prefix, int first_line_len, int line_len);
|
||||
void smp_command_sbuf(struct ccb_smpio *smpio, struct sbuf *sb,
|
||||
char *line_prefix, int first_line_len, int line_len);
|
||||
|
||||
#ifdef _KERNEL
|
||||
void smp_error_sbuf(struct ccb_smpio *smpio, struct sbuf *sb);
|
||||
#else /* !_KERNEL*/
|
||||
void smp_error_sbuf(struct cam_device *device, struct ccb_smpio *smpio,
|
||||
struct sbuf *sb);
|
||||
#endif /* _KERNEL/!_KERNEL */
|
||||
|
||||
void smp_report_general_sbuf(struct smp_report_general_response *response,
|
||||
int response_len, struct sbuf *sb);
|
||||
|
||||
void smp_report_manuf_info_sbuf(struct smp_report_manuf_info_response *response,
|
||||
int response_len, struct sbuf *sb);
|
||||
|
||||
void smp_report_general(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_report_general_request *request,
|
||||
int request_len, uint8_t *response, int response_len,
|
||||
int long_response, uint32_t timeout);
|
||||
|
||||
void smp_discover(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_discover_request *request, int request_len,
|
||||
uint8_t *response, int response_len, int long_response,
|
||||
int ignore_zone_group, int phy, uint32_t timeout);
|
||||
|
||||
void smp_report_manuf_info(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_report_manuf_info_request *request,
|
||||
int request_len, uint8_t *response, int response_len,
|
||||
int long_response, uint32_t timeout);
|
||||
|
||||
void smp_phy_control(struct ccb_smpio *smpio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
struct smp_phy_control_request *request, int request_len,
|
||||
uint8_t *response, int response_len, int long_response,
|
||||
uint32_t expected_exp_change_count, int phy, int phy_op,
|
||||
int update_pp_timeout_val, uint64_t attached_device_name,
|
||||
int prog_min_prl, int prog_max_prl, int slumber_partial,
|
||||
int pp_timeout_value, uint32_t timeout);
|
||||
__END_DECLS
|
||||
|
||||
#endif /*_SCSI_SMP_ALL_H*/
|
@ -105,7 +105,10 @@ acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries)
|
||||
struct acl_entry *entry;
|
||||
const ace_t *ace;
|
||||
|
||||
KASSERT(nentries >= 1, ("empty ZFS ACL"));
|
||||
if (nentries < 1) {
|
||||
printf("acl_from_aces: empty ZFS ACL; returning EINVAL.\n");
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
if (nentries > ACL_MAX_ENTRIES) {
|
||||
/*
|
||||
|
@ -331,6 +331,16 @@ ndis_create_sysctls(arg)
|
||||
ndis_add_sysctl(sc, "NdisVersion",
|
||||
"NDIS API Version", "0x00050001", CTLFLAG_RD);
|
||||
|
||||
/*
|
||||
* Some miniport drivers rely on the existence of the SlotNumber,
|
||||
* NetCfgInstanceId and DriverDesc keys.
|
||||
*/
|
||||
ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", CTLFLAG_RD);
|
||||
ndis_add_sysctl(sc, "NetCfgInstanceId", "NetCfgInstanceId",
|
||||
"{12345678-1234-5678-CAFE0-123456789ABC}", CTLFLAG_RD);
|
||||
ndis_add_sysctl(sc, "DriverDesc", "Driver Description",
|
||||
"NDIS Network Adapter", CTLFLAG_RD);
|
||||
|
||||
/* Bus type (PCI, PCMCIA, etc...) */
|
||||
sprintf(buf, "%d", (int)sc->ndis_iftype);
|
||||
ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD);
|
||||
|
@ -228,6 +228,8 @@ static void srand(unsigned int);
|
||||
static void KeQuerySystemTime(uint64_t *);
|
||||
static uint32_t KeTickCount(void);
|
||||
static uint8_t IoIsWdmVersionAvailable(uint8_t, uint8_t);
|
||||
static int32_t IoOpenDeviceRegistryKey(struct device_object *, uint32_t,
|
||||
uint32_t, void **);
|
||||
static void ntoskrnl_thrfunc(void *);
|
||||
static ndis_status PsCreateSystemThread(ndis_handle *,
|
||||
uint32_t, void *, ndis_handle, void *, void *, void *);
|
||||
@ -3199,6 +3201,13 @@ IoIsWdmVersionAvailable(uint8_t major, uint8_t minor)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static int32_t
|
||||
IoOpenDeviceRegistryKey(struct device_object *devobj, uint32_t type,
|
||||
uint32_t mask, void **key)
|
||||
{
|
||||
return (NDIS_STATUS_INVALID_DEVICE_REQUEST);
|
||||
}
|
||||
|
||||
static ndis_status
|
||||
IoGetDeviceObjectPointer(name, reqaccess, fileobj, devobj)
|
||||
unicode_string *name;
|
||||
@ -4378,6 +4387,7 @@ image_patch_table ntoskrnl_functbl[] = {
|
||||
IMPORT_SFUNC(MmUnmapIoSpace, 2),
|
||||
IMPORT_SFUNC(KeInitializeSpinLock, 1),
|
||||
IMPORT_SFUNC(IoIsWdmVersionAvailable, 2),
|
||||
IMPORT_SFUNC(IoOpenDeviceRegistryKey, 4),
|
||||
IMPORT_SFUNC(IoGetDeviceObjectPointer, 4),
|
||||
IMPORT_SFUNC(IoGetDeviceProperty, 5),
|
||||
IMPORT_SFUNC(IoAllocateWorkItem, 1),
|
||||
|
@ -1573,6 +1573,8 @@ options ISP_TARGET_MODE=1
|
||||
# initiator=2
|
||||
# both=3 (not supported currently)
|
||||
#
|
||||
# ISP_INTERNAL_TARGET (trivial internal disk target, for testing)
|
||||
#
|
||||
options ISP_DEFAULT_ROLES=2
|
||||
|
||||
# Options used in dev/sym/ (Symbios SCSI driver).
|
||||
|
@ -140,6 +140,7 @@ cam/scsi/scsi_ses.c optional ses
|
||||
cam/scsi/scsi_sg.c optional sg
|
||||
cam/scsi/scsi_targ_bh.c optional targbh
|
||||
cam/scsi/scsi_target.c optional targ
|
||||
cam/scsi/smp_all.c optional scbus
|
||||
contrib/altq/altq/altq_cbq.c optional altq \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/pf"
|
||||
contrib/altq/altq/altq_cdnr.c optional altq
|
||||
@ -1252,12 +1253,18 @@ dev/ixgb/ixgb_ee.c optional ixgb
|
||||
dev/ixgb/ixgb_hw.c optional ixgb
|
||||
dev/ixgbe/ixgbe.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixv.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_phy.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_api.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_common.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_mbx.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_vf.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_82598.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_82599.c optional ixgbe inet \
|
||||
|
@ -100,8 +100,9 @@ CFLAGS+= --param inline-unit-growth=100
|
||||
CFLAGS+= --param large-function-growth=1000
|
||||
.else
|
||||
# XXX Actually a gross hack just for Octeon because of the Simple Executive.
|
||||
CFLAGS+= --param inline-unit-growth=1000
|
||||
CFLAGS+= --param inline-unit-growth=10000
|
||||
CFLAGS+= --param large-function-growth=100000
|
||||
CFLAGS+= --param max-inline-insns-single=10000
|
||||
.endif
|
||||
.endif
|
||||
WERROR?= -Werror
|
||||
|
@ -345,6 +345,7 @@ SCSI_NCR_MYADDR opt_ncr.h
|
||||
ISP_TARGET_MODE opt_isp.h
|
||||
ISP_FW_CRASH_DUMP opt_isp.h
|
||||
ISP_DEFAULT_ROLES opt_isp.h
|
||||
ISP_INTERNAL_TARGET opt_isp.h
|
||||
|
||||
# Options used only in dev/iscsi
|
||||
ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h
|
||||
|
@ -1,43 +0,0 @@
|
||||
Readme for the Octeon Executive Library
|
||||
|
||||
|
||||
The Octeon Executive Library provides runtime support and hardware
|
||||
abstraction for the Octeon processor. The executive is composed of the
|
||||
libcvmx.a library as well as header files that provide
|
||||
functionality with inline functions.
|
||||
|
||||
|
||||
Usage:
|
||||
|
||||
The libcvmx.a library is built for every application as part of the
|
||||
application build. (Please refer to the 'related pages' section of the
|
||||
HTML documentation for more information on the build system.)
|
||||
Applications using the executive should include the header files from
|
||||
$OCTEON_ROOT/target/include and link against the library that is built in
|
||||
the local obj directory. Each file using the executive
|
||||
should include the following two header files in order:
|
||||
|
||||
#include "cvmx-config.h"
|
||||
#include "cvmx.h"
|
||||
|
||||
The cvmx-config.h file contains configuration information for the
|
||||
executive and is generated by the cvmx-config script from an
|
||||
'executive-config.h' file. A sample version of this file is provided
|
||||
in the executive directory as 'executive-config.h.template'.
|
||||
|
||||
Copy this file to 'executive-config.h' into the 'config' subdirectory
|
||||
of the application directory and customize as required by the application.
|
||||
Applications that don't use any simple executive functionality can omit
|
||||
the cvmx-config.h header file. Please refer to the examples for a
|
||||
demonstration of where to put the executive-config.h file and for an
|
||||
example of generated cvmx-config.h.
|
||||
|
||||
For file specific information please see the documentation within the
|
||||
source files or the HTML documentation provided in docs/html/index.html.
|
||||
The HTML documentation is automatically generated by Doxygen from the
|
||||
source files.
|
||||
|
||||
|
||||
|
||||
==========================================================================
|
||||
Please see the release notes for version specific information.
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,6 +42,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
@ -48,7 +50,7 @@
|
||||
*
|
||||
* Definitions for the Internet Protocol (IP) support.
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,12 +42,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file defines macros for use in determining the current calling ABI.
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_ABI_H__
|
||||
|
@ -1,41 +1,43 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2009 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Functions for accessing memory and CSRs on Octeon when we are compiling
|
||||
@ -81,9 +83,24 @@ static inline uint64_t cvmx_ptr_to_phys(void *ptr)
|
||||
cvmx_warn_if(ptr==NULL, "cvmx_ptr_to_phys() passed a NULL pointer\n");
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_UBOOT
|
||||
/* U-boot is a special case, as it is running in error level, which disables the TLB completely.
|
||||
** U-boot may use kseg0 addresses, or may directly use physical addresses already */
|
||||
return(CAST64(ptr) & 0x7FFFFFFF);
|
||||
uint64_t uboot_tlb_ptr_to_phys(void *ptr);
|
||||
|
||||
if (((uint32_t)ptr) < 0x80000000)
|
||||
{
|
||||
/* Handle useg (unmapped due to ERL) here*/
|
||||
return(CAST64(ptr) & 0x7FFFFFFF);
|
||||
}
|
||||
else if (((uint32_t)ptr) < 0xC0000000)
|
||||
{
|
||||
/* Here we handle KSEG0/KSEG1 _pointers_. We know we are dealing
|
||||
** with 32 bit only values, so we treat them that way. Note that
|
||||
** a cvmx_phys_to_ptr(cvmx_ptr_to_phys(X)) will not return X in this case,
|
||||
** but the physical address of the KSEG0/KSEG1 address. */
|
||||
return(CAST64(ptr) & 0x1FFFFFFF);
|
||||
}
|
||||
else
|
||||
return(uboot_tlb_ptr_to_phys(ptr)); /* Should not get get here in !TLB case */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
@ -166,14 +183,49 @@ static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
|
||||
cvmx_warn_if(physical_address==0, "cvmx_phys_to_ptr() passed a zero address\n");
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_UBOOT
|
||||
/* U-boot is a special case, as it is running in error level, which disables the TLB completely.
|
||||
** U-boot may use kseg0 addresses, or may directly use physical addresses already */
|
||||
#if !CONFIG_OCTEON_UBOOT_TLB
|
||||
if (physical_address >= 0x80000000)
|
||||
return NULL;
|
||||
else
|
||||
return CASTPTR(void, (physical_address & 0x7FFFFFFF));
|
||||
#endif
|
||||
|
||||
/* U-boot is a special case, as it is running in 32 bit mode, using the TLB to map code/data
|
||||
** which can have a physical address above the 32 bit address space. 1-1 mappings are used
|
||||
** to allow the low 2 GBytes to be accessed as in error level.
|
||||
**
|
||||
** NOTE: This conversion can cause problems in u-boot, as users may want to enter addresses
|
||||
** like 0xBFC00000 (kseg1 boot bus address), which is a valid 64 bit physical address,
|
||||
** but is likely intended to be a boot bus address. */
|
||||
|
||||
if (physical_address < 0x80000000)
|
||||
{
|
||||
/* Handle useg here. ERL is set, so useg is unmapped. This is the only physical
|
||||
** address range that is directly addressable by u-boot. */
|
||||
return CASTPTR(void, physical_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
extern char uboot_start;
|
||||
/* Above 0x80000000 we can only support one case - a physical address
|
||||
** that is mapped for u-boot code/data. We check against the u-boot mem range,
|
||||
** and return NULL if it is out of this range.
|
||||
*/
|
||||
if (physical_address >= gd->bd->bi_uboot_ram_addr
|
||||
&& physical_address < gd->bd->bi_uboot_ram_addr + gd->bd->bi_uboot_ram_used_size)
|
||||
{
|
||||
return ((char *)&uboot_start + (physical_address - gd->bd->bi_uboot_ram_addr));
|
||||
}
|
||||
else
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (physical_address >= 0x80000000)
|
||||
return NULL;
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
if (sizeof(void*) == 8)
|
||||
{
|
||||
@ -199,7 +251,8 @@ static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
|
||||
2nd 256MB is mapped at 0x10000000 and the rest of memory is 1:1 */
|
||||
if ((physical_address >= 0x10000000) && (physical_address < 0x20000000))
|
||||
return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
|
||||
else if ((physical_address >= 0x410000000ull) && (physical_address < 0x420000000ull))
|
||||
else if (!OCTEON_IS_MODEL(OCTEON_CN6XXX) && (physical_address >= 0x410000000ull) &&
|
||||
(physical_address < 0x420000000ull))
|
||||
return CASTPTR(void, physical_address - 0x400000000ull);
|
||||
else
|
||||
return CASTPTR(void, physical_address);
|
||||
@ -464,7 +517,7 @@ static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
|
||||
/* Perform an immediate read after every write to an RSL register to force
|
||||
the write to complete. It doesn't matter what RSL read we do, so we
|
||||
choose CVMX_MIO_BOOT_BIST_STAT because it is fast and harmless */
|
||||
if ((csr_addr >> 40) == (0x800118))
|
||||
if (((csr_addr >> 40) & 0x7ffff) == (0x118))
|
||||
cvmx_read64_uint64(CVMX_MIO_BOOT_BIST_STAT);
|
||||
}
|
||||
|
||||
@ -503,7 +556,7 @@ static inline void cvmx_read_csr_async(uint64_t scraddr, uint64_t csr_addr)
|
||||
|
||||
|
||||
/**
|
||||
* Number of the Core on which the program is currently running.
|
||||
* Number of the Core on which the program is currently running.
|
||||
*
|
||||
* @return Number of cores
|
||||
*/
|
||||
@ -548,53 +601,36 @@ static inline int cvmx_dpop(uint64_t val)
|
||||
|
||||
|
||||
/**
|
||||
* Provide current cycle counter as a return value
|
||||
* @deprecated
|
||||
* Provide current cycle counter as a return value. Deprecated, use
|
||||
* cvmx_clock_get_count(CVMX_CLOCK_CORE) to get cycle counter.
|
||||
*
|
||||
* @return current cycle counter
|
||||
*/
|
||||
static inline uint64_t cvmx_get_cycle(void)
|
||||
{
|
||||
#if defined(CVMX_ABI_O32)
|
||||
uint32_t tmp_low, tmp_hi;
|
||||
|
||||
asm volatile (
|
||||
" .set push \n"
|
||||
" .set mips64r2 \n"
|
||||
" .set noreorder \n"
|
||||
" rdhwr %[tmpl], $31 \n"
|
||||
" dsrl %[tmph], %[tmpl], 32 \n"
|
||||
" sll %[tmpl], 0 \n"
|
||||
" sll %[tmph], 0 \n"
|
||||
" .set pop \n"
|
||||
: [tmpl] "=&r" (tmp_low), [tmph] "=&r" (tmp_hi) : );
|
||||
|
||||
return(((uint64_t)tmp_hi << 32) + tmp_low);
|
||||
#else
|
||||
uint64_t cycle;
|
||||
CVMX_RDHWR(cycle, 31);
|
||||
return(cycle);
|
||||
#endif
|
||||
return cvmx_clock_get_count(CVMX_CLOCK_CORE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads a chip global cycle counter. This counts CPU cycles since
|
||||
* chip reset. The counter is 64 bit.
|
||||
* This register does not exist on CN38XX pass 1 silicion
|
||||
* @deprecated
|
||||
* Reads a chip global cycle counter. This counts SCLK cycles since
|
||||
* chip reset. The counter is 64 bit. This function is deprecated as the rate
|
||||
* of the global cycle counter is different between Octeon+ and Octeon2, use
|
||||
* cvmx_clock_get_count(CVMX_CLOCK_SCLK) instead. For Octeon2, the clock rate
|
||||
* of SCLK may be differnet than the core clock.
|
||||
*
|
||||
* @return Global chip cycle count since chip reset.
|
||||
*/
|
||||
static inline uint64_t cvmx_get_cycle_global(void)
|
||||
{
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1))
|
||||
return 0;
|
||||
else
|
||||
return cvmx_read64_uint64(CVMX_IPD_CLK_COUNT);
|
||||
return cvmx_clock_get_count(CVMX_CLOCK_IPD);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wait for the specified number of cycle
|
||||
* Wait for the specified number of core clock cycles
|
||||
*
|
||||
* @param cycles
|
||||
*/
|
||||
@ -616,7 +652,7 @@ static inline void cvmx_wait(uint64_t cycles)
|
||||
*/
|
||||
static inline void cvmx_wait_usec(uint64_t usec)
|
||||
{
|
||||
uint64_t done = cvmx_get_cycle() + usec * cvmx_sysinfo_get()->cpu_clock_hz / 1000000;
|
||||
uint64_t done = cvmx_get_cycle() + usec * cvmx_clock_get_rate(CVMX_CLOCK_CORE) / 1000000;
|
||||
while (cvmx_get_cycle() < done)
|
||||
{
|
||||
/* Spin */
|
||||
@ -624,6 +660,22 @@ static inline void cvmx_wait_usec(uint64_t usec)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wait for the specified number of io clock cycles
|
||||
*
|
||||
* @param cycles
|
||||
*/
|
||||
static inline void cvmx_wait_io(uint64_t cycles)
|
||||
{
|
||||
uint64_t done = cvmx_clock_get_count(CVMX_CLOCK_SCLK) + cycles;
|
||||
|
||||
while (cvmx_clock_get_count(CVMX_CLOCK_SCLK) < done)
|
||||
{
|
||||
/* Spin */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform a soft reset of Octeon
|
||||
*
|
||||
|
@ -1,41 +1,43 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2009 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Function prototypes for accessing memory and CSRs on Octeon.
|
||||
@ -138,7 +140,7 @@ CVMX_FUNCTION void cvmx_send_single(uint64_t data);
|
||||
CVMX_FUNCTION void cvmx_read_csr_async(uint64_t scraddr, uint64_t csr_addr);
|
||||
|
||||
/**
|
||||
* Number of the Core on which the program is currently running.
|
||||
* Number of the Core on which the program is currently running.
|
||||
*
|
||||
* @return Number of cores
|
||||
*/
|
||||
@ -165,23 +167,28 @@ CVMX_FUNCTION uint32_t cvmx_pop(uint32_t val);
|
||||
CVMX_FUNCTION int cvmx_dpop(uint64_t val);
|
||||
|
||||
/**
|
||||
* Provide current cycle counter as a return value
|
||||
* @deprecated
|
||||
* Provide current cycle counter as a return value. Deprecated, use
|
||||
* cvmx_clock_get_count(CVMX_CLOCK_CORE) to get cycle counter.
|
||||
*
|
||||
* @return current cycle counter
|
||||
*/
|
||||
CVMX_FUNCTION uint64_t cvmx_get_cycle(void);
|
||||
|
||||
/**
|
||||
* Reads a chip global cycle counter. This counts CPU cycles since
|
||||
* chip reset. The counter is 64 bit.
|
||||
* This register does not exist on CN38XX pass 1 silicion
|
||||
* @deprecated
|
||||
* Reads a chip global cycle counter. This counts SCLK cycles since
|
||||
* chip reset. The counter is 64 bit. This function is deprecated as the rate
|
||||
* of the global cycle counter is different between Octeon+ and Octeon2, use
|
||||
* cvmx_clock_get_count(CVMX_CLOCK_SCLK) instead. For Octeon2, the clock rate
|
||||
* of SCLK may be differnet than the core clock.
|
||||
*
|
||||
* @return Global chip cycle count since chip reset.
|
||||
*/
|
||||
CVMX_FUNCTION uint64_t cvmx_get_cycle_global(void);
|
||||
CVMX_FUNCTION uint64_t cvmx_get_cycle_global(void) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
* Wait for the specified number of cycle
|
||||
* Wait for the specified number of core clock cycles
|
||||
*
|
||||
* @param cycles
|
||||
*/
|
||||
@ -194,6 +201,13 @@ CVMX_FUNCTION void cvmx_wait(uint64_t cycles);
|
||||
*/
|
||||
CVMX_FUNCTION void cvmx_wait_usec(uint64_t usec);
|
||||
|
||||
/**
|
||||
* Wait for the specified number of io clock cycles
|
||||
*
|
||||
* @param cycles
|
||||
*/
|
||||
CVMX_FUNCTION void cvmx_wait_io(uint64_t cycles);
|
||||
|
||||
/**
|
||||
* Perform a soft reset of Octeon
|
||||
*
|
||||
|
@ -1,41 +1,43 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2009 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Typedefs and defines for working with Octeon physical addresses.
|
||||
@ -63,29 +65,27 @@ typedef enum {
|
||||
CVMX_MIPS_XKSEG_SPACE_KSEG3 = 3LL
|
||||
} cvmx_mips_xkseg_space_t;
|
||||
|
||||
// decodes <14:13> of a kseg3 window address
|
||||
/* decodes <14:13> of a kseg3 window address */
|
||||
typedef enum {
|
||||
CVMX_ADD_WIN_SCR = 0L,
|
||||
CVMX_ADD_WIN_DMA = 1L, // see cvmx_add_win_dma_dec_t for further decode
|
||||
CVMX_ADD_WIN_DMA = 1L, /* see cvmx_add_win_dma_dec_t for further decode */
|
||||
CVMX_ADD_WIN_UNUSED = 2L,
|
||||
CVMX_ADD_WIN_UNUSED2 = 3L
|
||||
} cvmx_add_win_dec_t;
|
||||
|
||||
// decode within DMA space
|
||||
/* decode within DMA space */
|
||||
typedef enum {
|
||||
CVMX_ADD_WIN_DMA_ADD = 0L, // add store data to the write buffer entry, allocating it if necessary
|
||||
CVMX_ADD_WIN_DMA_SENDMEM = 1L, // send out the write buffer entry to DRAM
|
||||
// store data must be normal DRAM memory space address in this case
|
||||
CVMX_ADD_WIN_DMA_SENDDMA = 2L, // send out the write buffer entry as an IOBDMA command
|
||||
// see CVMX_ADD_WIN_DMA_SEND_DEC for data contents
|
||||
CVMX_ADD_WIN_DMA_SENDIO = 3L, // send out the write buffer entry as an IO write
|
||||
// store data must be normal IO space address in this case
|
||||
CVMX_ADD_WIN_DMA_SENDSINGLE = 4L, // send out a single-tick command on the NCB bus
|
||||
// no write buffer data needed/used
|
||||
CVMX_ADD_WIN_DMA_ADD = 0L, /* add store data to the write buffer entry, allocating it if necessary */
|
||||
CVMX_ADD_WIN_DMA_SENDMEM = 1L, /* send out the write buffer entry to DRAM */
|
||||
/* store data must be normal DRAM memory space address in this case */
|
||||
CVMX_ADD_WIN_DMA_SENDDMA = 2L, /* send out the write buffer entry as an IOBDMA command */
|
||||
/* see CVMX_ADD_WIN_DMA_SEND_DEC for data contents */
|
||||
CVMX_ADD_WIN_DMA_SENDIO = 3L, /* send out the write buffer entry as an IO write */
|
||||
/* store data must be normal IO space address in this case */
|
||||
CVMX_ADD_WIN_DMA_SENDSINGLE = 4L, /* send out a single-tick command on the NCB bus */
|
||||
/* no write buffer data needed/used */
|
||||
} cvmx_add_win_dma_dec_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Physical Address Decode
|
||||
*
|
||||
@ -116,63 +116,63 @@ typedef union {
|
||||
struct {
|
||||
cvmx_mips_space_t R : 2;
|
||||
uint64_t offset :62;
|
||||
} sva; // mapped or unmapped virtual address
|
||||
} sva; /* mapped or unmapped virtual address */
|
||||
|
||||
struct {
|
||||
uint64_t zeroes :33;
|
||||
uint64_t offset :31;
|
||||
} suseg; // mapped USEG virtual addresses (typically)
|
||||
} suseg; /* mapped USEG virtual addresses (typically) */
|
||||
|
||||
struct {
|
||||
uint64_t ones :33;
|
||||
cvmx_mips_xkseg_space_t sp : 2;
|
||||
uint64_t offset :29;
|
||||
} sxkseg; // mapped or unmapped virtual address
|
||||
} sxkseg; /* mapped or unmapped virtual address */
|
||||
|
||||
struct {
|
||||
cvmx_mips_space_t R : 2; // CVMX_MIPS_SPACE_XKPHYS in this case
|
||||
uint64_t cca : 3; // ignored by octeon
|
||||
cvmx_mips_space_t R : 2; /* CVMX_MIPS_SPACE_XKPHYS in this case */
|
||||
uint64_t cca : 3; /* ignored by octeon */
|
||||
uint64_t mbz :10;
|
||||
uint64_t pa :49; // physical address
|
||||
} sxkphys; // physical address accessed through xkphys unmapped virtual address
|
||||
uint64_t pa :49; /* physical address */
|
||||
} sxkphys; /* physical address accessed through xkphys unmapped virtual address */
|
||||
|
||||
struct {
|
||||
uint64_t mbz :15;
|
||||
uint64_t is_io : 1; // if set, the address is uncached and resides on MCB bus
|
||||
uint64_t did : 8; // the hardware ignores this field when is_io==0, else device ID
|
||||
uint64_t unaddr: 4; // the hardware ignores <39:36> in Octeon I
|
||||
uint64_t is_io : 1; /* if set, the address is uncached and resides on MCB bus */
|
||||
uint64_t did : 8; /* the hardware ignores this field when is_io==0, else device ID */
|
||||
uint64_t unaddr: 4; /* the hardware ignores <39:36> in Octeon I */
|
||||
uint64_t offset :36;
|
||||
} sphys; // physical address
|
||||
} sphys; /* physical address */
|
||||
|
||||
struct {
|
||||
uint64_t zeroes :24; // techically, <47:40> are dont-cares
|
||||
uint64_t unaddr: 4; // the hardware ignores <39:36> in Octeon I
|
||||
uint64_t zeroes :24; /* techically, <47:40> are dont-cares */
|
||||
uint64_t unaddr: 4; /* the hardware ignores <39:36> in Octeon I */
|
||||
uint64_t offset :36;
|
||||
} smem; // physical mem address
|
||||
} smem; /* physical mem address */
|
||||
|
||||
struct {
|
||||
uint64_t mem_region :2;
|
||||
uint64_t mbz :13;
|
||||
uint64_t is_io : 1; // 1 in this case
|
||||
uint64_t did : 8; // the hardware ignores this field when is_io==0, else device ID
|
||||
uint64_t unaddr: 4; // the hardware ignores <39:36> in Octeon I
|
||||
uint64_t is_io : 1; /* 1 in this case */
|
||||
uint64_t did : 8; /* the hardware ignores this field when is_io==0, else device ID */
|
||||
uint64_t unaddr: 4; /* the hardware ignores <39:36> in Octeon I */
|
||||
uint64_t offset :36;
|
||||
} sio; // physical IO address
|
||||
} sio; /* physical IO address */
|
||||
|
||||
struct {
|
||||
uint64_t ones : 49;
|
||||
cvmx_add_win_dec_t csrdec : 2; // CVMX_ADD_WIN_SCR (0) in this case
|
||||
cvmx_add_win_dec_t csrdec : 2; /* CVMX_ADD_WIN_SCR (0) in this case */
|
||||
uint64_t addr : 13;
|
||||
} sscr; // scratchpad virtual address - accessed through a window at the end of kseg3
|
||||
} sscr; /* scratchpad virtual address - accessed through a window at the end of kseg3 */
|
||||
|
||||
// there should only be stores to IOBDMA space, no loads
|
||||
/* there should only be stores to IOBDMA space, no loads */
|
||||
struct {
|
||||
uint64_t ones : 49;
|
||||
cvmx_add_win_dec_t csrdec : 2; // CVMX_ADD_WIN_DMA (1) in this case
|
||||
cvmx_add_win_dec_t csrdec : 2; /* CVMX_ADD_WIN_DMA (1) in this case */
|
||||
uint64_t unused2: 3;
|
||||
cvmx_add_win_dma_dec_t type : 3;
|
||||
uint64_t addr : 7;
|
||||
} sdma; // IOBDMA virtual address - accessed through a window at the end of kseg3
|
||||
} sdma; /* IOBDMA virtual address - accessed through a window at the end of kseg3 */
|
||||
|
||||
struct {
|
||||
uint64_t didspace : 24;
|
||||
@ -203,8 +203,8 @@ typedef union {
|
||||
#define CVMX_FULL_DID(did,subdid) (((did) << 3) | (subdid))
|
||||
|
||||
|
||||
// from include/ncb_rsl_id.v
|
||||
#define CVMX_OCT_DID_MIS 0ULL // misc stuff
|
||||
/* from include/ncb_rsl_id.v */
|
||||
#define CVMX_OCT_DID_MIS 0ULL /* misc stuff */
|
||||
#define CVMX_OCT_DID_GMX0 1ULL
|
||||
#define CVMX_OCT_DID_GMX1 2ULL
|
||||
#define CVMX_OCT_DID_PCI 3ULL
|
||||
@ -217,7 +217,7 @@ typedef union {
|
||||
#define CVMX_OCT_DID_PKT 10ULL
|
||||
#define CVMX_OCT_DID_TIM 11ULL
|
||||
#define CVMX_OCT_DID_TAG 12ULL
|
||||
// the rest are not on the IO bus
|
||||
/* the rest are not on the IO bus */
|
||||
#define CVMX_OCT_DID_L2C 16ULL
|
||||
#define CVMX_OCT_DID_LMC 17ULL
|
||||
#define CVMX_OCT_DID_SPX0 18ULL
|
||||
|
4615
sys/contrib/octeon-sdk/cvmx-agl-defs.h
Normal file
4615
sys/contrib/octeon-sdk/cvmx-agl-defs.h
Normal file
File diff suppressed because it is too large
Load Diff
402
sys/contrib/octeon-sdk/cvmx-app-hotplug.c
Normal file
402
sys/contrib/octeon-sdk/cvmx-app-hotplug.c
Normal file
@ -0,0 +1,402 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Provides APIs for applications to register for hotplug. It also provides
|
||||
* APIs for requesting shutdown of a running target application.
|
||||
*
|
||||
* <hr>$Revision: $<hr>
|
||||
*/
|
||||
|
||||
#include "cvmx-app-hotplug.h"
|
||||
#include "cvmx-spinlock.h"
|
||||
|
||||
//#define DEBUG 1
|
||||
|
||||
#ifndef CVMX_BUILD_FOR_LINUX_USER
|
||||
|
||||
static CVMX_SHARED cvmx_spinlock_t cvmx_app_hotplug_sync_lock = { CVMX_SPINLOCK_UNLOCKED_VAL };
|
||||
static CVMX_SHARED cvmx_spinlock_t cvmx_app_hotplug_lock = { CVMX_SPINLOCK_UNLOCKED_VAL };
|
||||
static CVMX_SHARED cvmx_app_hotplug_info_t *cvmx_app_hotplug_info_ptr = NULL;
|
||||
|
||||
static void __cvmx_app_hotplug_shutdown(int irq_number, uint64_t registers[32], void *user_arg);
|
||||
static void __cvmx_app_hotplug_sync(void);
|
||||
static void __cvmx_app_hotplug_reset(void);
|
||||
|
||||
/**
|
||||
* This routine registers an application for hotplug. It installs a handler for
|
||||
* any incoming shutdown request. It also registers a callback routine from the
|
||||
* application. This callback is invoked when the application receives a
|
||||
* shutdown notification.
|
||||
*
|
||||
* This routine only needs to be called once per application.
|
||||
*
|
||||
* @param fn Callback routine from the application.
|
||||
* @param arg Argument to the application callback routine.
|
||||
* @return Return 0 on success, -1 on failure
|
||||
*
|
||||
*/
|
||||
int cvmx_app_hotplug_register(void(*fn)(void*), void* arg)
|
||||
{
|
||||
/* Find the list of applications launched by bootoct utility. */
|
||||
|
||||
if (!(cvmx_app_hotplug_info_ptr = cvmx_app_hotplug_get_info(cvmx_sysinfo_get()->core_mask)))
|
||||
{
|
||||
/* Application not launched by bootoct? */
|
||||
printf("ERROR: cmvx_app_hotplug_register() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Register the callback */
|
||||
cvmx_app_hotplug_info_ptr->data = CAST64(arg);
|
||||
cvmx_app_hotplug_info_ptr->shutdown_callback = CAST64(fn);
|
||||
|
||||
#ifdef DEBUG
|
||||
cvmx_dprintf("cvmx_app_hotplug_register(): coremask 0x%x valid %d\n",
|
||||
cvmx_app_hotplug_info_ptr->coremask, cvmx_app_hotplug_info_ptr->valid);
|
||||
#endif
|
||||
|
||||
cvmx_interrupt_register(CVMX_IRQ_MBOX0, __cvmx_app_hotplug_shutdown, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the current application core for receiving hotplug shutdown requests.
|
||||
*
|
||||
* This routine makes sure that each core belonging to the application is enabled
|
||||
* to receive the shutdown notification and also provides a barrier sync to make
|
||||
* sure that all cores are ready.
|
||||
*/
|
||||
int cvmx_app_hotplug_activate(void)
|
||||
{
|
||||
/* Make sure all application cores are activating */
|
||||
__cvmx_app_hotplug_sync();
|
||||
|
||||
cvmx_spinlock_lock(&cvmx_app_hotplug_lock);
|
||||
|
||||
if (!cvmx_app_hotplug_info_ptr)
|
||||
{
|
||||
cvmx_spinlock_unlock(&cvmx_app_hotplug_lock);
|
||||
printf("ERROR: This application is not registered for hotplug\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Enable the interrupt before we mark the core as activated */
|
||||
cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
|
||||
|
||||
cvmx_app_hotplug_info_ptr->hotplug_activated_coremask |= (1<<cvmx_get_core_num());
|
||||
|
||||
#ifdef DEBUG
|
||||
cvmx_dprintf("cvmx_app_hotplug_activate(): coremask 0x%x valid %d sizeof %d\n",
|
||||
cvmx_app_hotplug_info_ptr->coremask, cvmx_app_hotplug_info_ptr->valid,
|
||||
sizeof(*cvmx_app_hotplug_info_ptr));
|
||||
#endif
|
||||
|
||||
cvmx_spinlock_unlock(&cvmx_app_hotplug_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine is only required if cvmx_app_hotplug_shutdown_request() was called
|
||||
* with wait=0. This routine waits for the application shutdown to complete.
|
||||
*
|
||||
* @param coremask Coremask the application is running on.
|
||||
* @return 0 on success, -1 on error
|
||||
*
|
||||
*/
|
||||
int cvmx_app_hotplug_shutdown_complete(uint32_t coremask)
|
||||
{
|
||||
cvmx_app_hotplug_info_t *hotplug_info_ptr;
|
||||
|
||||
if (!(hotplug_info_ptr = cvmx_app_hotplug_get_info(coremask)))
|
||||
{
|
||||
printf("\nERROR: Failed to get hotplug info for coremask: 0x%x\n", (unsigned int)coremask);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(!hotplug_info_ptr->shutdown_done);
|
||||
|
||||
/* Clean up the hotplug info region for this app */
|
||||
bzero(hotplug_info_ptr, sizeof(*hotplug_info_ptr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable recognition of any incoming shutdown request.
|
||||
*/
|
||||
|
||||
void cvmx_app_hotplug_shutdown_disable(void)
|
||||
{
|
||||
cvmx_interrupt_mask_irq(CVMX_IRQ_MBOX0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-enable recognition of incoming shutdown requests.
|
||||
*/
|
||||
|
||||
void cvmx_app_hotplug_shutdown_enable(void)
|
||||
{
|
||||
cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ISR for the incoming shutdown request interrupt.
|
||||
*/
|
||||
static void __cvmx_app_hotplug_shutdown(int irq_number, uint64_t registers[32], void *user_arg)
|
||||
{
|
||||
cvmx_sysinfo_t *sys_info_ptr = cvmx_sysinfo_get();
|
||||
uint32_t flags;
|
||||
|
||||
cvmx_interrupt_mask_irq(CVMX_IRQ_MBOX0);
|
||||
|
||||
/* Clear the interrupt */
|
||||
cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()), 1);
|
||||
|
||||
/* Make sure the write above completes */
|
||||
cvmx_read_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()));
|
||||
|
||||
if (!cvmx_app_hotplug_info_ptr)
|
||||
{
|
||||
printf("ERROR: Application is not registered for hotplug!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cvmx_app_hotplug_info_ptr->hotplug_activated_coremask != sys_info_ptr->core_mask)
|
||||
{
|
||||
printf("ERROR: Shutdown requested when not all app cores have activated hotplug\n"
|
||||
"Application coremask: 0x%x Hotplug coremask: 0x%x\n", (unsigned int)sys_info_ptr->core_mask,
|
||||
(unsigned int)cvmx_app_hotplug_info_ptr->hotplug_activated_coremask);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Call the application's own callback function */
|
||||
((void(*)(void*))(long)cvmx_app_hotplug_info_ptr->shutdown_callback)(CASTPTR(void *, cvmx_app_hotplug_info_ptr->data));
|
||||
|
||||
__cvmx_app_hotplug_sync();
|
||||
|
||||
if (cvmx_coremask_first_core(sys_info_ptr->core_mask))
|
||||
{
|
||||
bzero(cvmx_app_hotplug_info_ptr, sizeof(*cvmx_app_hotplug_info_ptr));
|
||||
#ifdef DEBUG
|
||||
cvmx_dprintf("__cvmx_app_hotplug_shutdown(): setting shutdown done! \n");
|
||||
#endif
|
||||
cvmx_app_hotplug_info_ptr->shutdown_done = 1;
|
||||
}
|
||||
|
||||
flags = cvmx_interrupt_disable_save();
|
||||
|
||||
__cvmx_app_hotplug_sync();
|
||||
|
||||
/* Reset the core */
|
||||
__cvmx_app_hotplug_reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the core. We just jump back to the reset vector for now.
|
||||
*/
|
||||
void __cvmx_app_hotplug_reset(void)
|
||||
{
|
||||
/* Code from SecondaryCoreLoop from bootloader, sleep until we recieve
|
||||
a NMI. */
|
||||
__asm__ volatile (
|
||||
".set noreorder \n"
|
||||
"\tsync \n"
|
||||
"\tnop \n"
|
||||
"1:\twait \n"
|
||||
"\tb 1b \n"
|
||||
"\tnop \n"
|
||||
".set reorder \n"
|
||||
::
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* We need a separate sync operation from cvmx_coremask_barrier_sync() to
|
||||
* avoid a deadlock on state.lock, since the application itself maybe doing a
|
||||
* cvmx_coremask_barrier_sync().
|
||||
*/
|
||||
static void __cvmx_app_hotplug_sync(void)
|
||||
{
|
||||
static CVMX_SHARED volatile uint32_t sync_coremask = 0;
|
||||
cvmx_sysinfo_t *sys_info_ptr = cvmx_sysinfo_get();
|
||||
|
||||
cvmx_spinlock_lock(&cvmx_app_hotplug_sync_lock);
|
||||
|
||||
sync_coremask |= cvmx_coremask_core(cvmx_get_core_num());
|
||||
|
||||
cvmx_spinlock_unlock(&cvmx_app_hotplug_sync_lock);
|
||||
|
||||
while (sync_coremask != sys_info_ptr->core_mask);
|
||||
}
|
||||
|
||||
#endif /* CVMX_BUILD_FOR_LINUX_USER */
|
||||
|
||||
/**
|
||||
* Return the hotplug info structure (cvmx_app_hotplug_info_t) pointer for the
|
||||
* application running on the given coremask.
|
||||
*
|
||||
* @param coremask Coremask of application.
|
||||
* @return Returns hotplug info struct on success, NULL on failure
|
||||
*
|
||||
*/
|
||||
cvmx_app_hotplug_info_t* cvmx_app_hotplug_get_info(uint32_t coremask)
|
||||
{
|
||||
const struct cvmx_bootmem_named_block_desc *block_desc;
|
||||
cvmx_app_hotplug_info_t *hip;
|
||||
cvmx_app_hotplug_global_t *hgp;
|
||||
int i;
|
||||
|
||||
block_desc = cvmx_bootmem_find_named_block(CVMX_APP_HOTPLUG_INFO_REGION_NAME);
|
||||
|
||||
if (!block_desc)
|
||||
{
|
||||
printf("ERROR: Hotplug info region is not setup\n");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_USER
|
||||
{
|
||||
size_t pg_sz = sysconf(_SC_PAGESIZE), size;
|
||||
off_t offset;
|
||||
char *vaddr;
|
||||
int fd;
|
||||
|
||||
if ((fd = open("/dev/mem", O_RDWR)) == -1) {
|
||||
perror("open");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to mmap() this memory, since this was allocated from the
|
||||
* kernel bootup code and does not reside in the RESERVE32 region.
|
||||
*/
|
||||
size = CVMX_APP_HOTPLUG_INFO_REGION_SIZE + pg_sz-1;
|
||||
offset = block_desc->base_addr & ~(pg_sz-1);
|
||||
if ((vaddr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset)) == MAP_FAILED)
|
||||
{
|
||||
perror("mmap");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hgp = (cvmx_app_hotplug_global_t *)(vaddr + ( block_desc->base_addr & (pg_sz-1)));
|
||||
}
|
||||
#else
|
||||
hgp = cvmx_phys_to_ptr(block_desc->base_addr);
|
||||
#endif
|
||||
|
||||
hip = hgp->hotplug_info_array;
|
||||
|
||||
#ifdef DEBUG
|
||||
cvmx_dprintf("cvmx_app_hotplug_get_info(): hotplug_info phy addr 0x%llx ptr %p\n",
|
||||
block_desc->base_addr, hgp);
|
||||
#endif
|
||||
|
||||
/* Look for the current app's info */
|
||||
|
||||
for (i=0; i<CVMX_APP_HOTPLUG_MAX_APPS; i++)
|
||||
{
|
||||
if (hip[i].coremask == coremask)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cvmx_dprintf("cvmx_app_hotplug_get_info(): coremask match %d -- coremask 0x%x valid %d\n",
|
||||
i, hip[i].coremask, hip[i].valid);
|
||||
#endif
|
||||
|
||||
return &hip[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine sends a shutdown request to a running target application.
|
||||
*
|
||||
* @param coremask Coremask the application is running on.
|
||||
* @param wait 1 - Wait for shutdown completion
|
||||
* 0 - Do not wait
|
||||
* @return 0 on success, -1 on error
|
||||
*
|
||||
*/
|
||||
|
||||
int cvmx_app_hotplug_shutdown_request(uint32_t coremask, int wait)
|
||||
{
|
||||
int i;
|
||||
cvmx_app_hotplug_info_t *hotplug_info_ptr;
|
||||
|
||||
if (!(hotplug_info_ptr = cvmx_app_hotplug_get_info(coremask)))
|
||||
{
|
||||
printf("\nERROR: Failed to get hotplug info for coremask: 0x%x\n", (unsigned int)coremask);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!hotplug_info_ptr->shutdown_callback)
|
||||
{
|
||||
printf("\nERROR: Target application has not registered for hotplug!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hotplug_info_ptr->hotplug_activated_coremask != coremask)
|
||||
{
|
||||
printf("\nERROR: Not all application cores have activated hotplug\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send IPIs to all application cores to request shutdown */
|
||||
for (i=0; i<CVMX_MAX_CORES; i++) {
|
||||
if (coremask & (1<<i))
|
||||
cvmx_write_csr(CVMX_CIU_MBOX_SETX(i), 1);
|
||||
}
|
||||
|
||||
if (wait)
|
||||
{
|
||||
while (!hotplug_info_ptr->shutdown_done);
|
||||
|
||||
/* Clean up the hotplug info region for this application */
|
||||
bzero(hotplug_info_ptr, sizeof(*hotplug_info_ptr));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
103
sys/contrib/octeon-sdk/cvmx-app-hotplug.h
Normal file
103
sys/contrib/octeon-sdk/cvmx-app-hotplug.h
Normal file
@ -0,0 +1,103 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Header file for the hotplug APIs
|
||||
*
|
||||
* <hr>$Revision: $<hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_APP_HOTPLUG_H__
|
||||
#define __CVMX_APP_HOTPLUG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
#include <asm/octeon/cvmx.h>
|
||||
#include <asm/octeon/cvmx-bootmem.h>
|
||||
#else
|
||||
#include "cvmx.h"
|
||||
#include "cvmx-coremask.h"
|
||||
#include "cvmx-interrupt.h"
|
||||
#include "cvmx-bootmem.h"
|
||||
#endif
|
||||
|
||||
#define CVMX_APP_HOTPLUG_MAX_APPS 32
|
||||
#define CVMX_APP_HOTPLUG_MAX_APPNAME_LEN 256
|
||||
|
||||
typedef struct cvmx_app_hotplug_info
|
||||
{
|
||||
char app_name[CVMX_APP_HOTPLUG_MAX_APPNAME_LEN];
|
||||
uint32_t coremask;
|
||||
uint32_t volatile hotplug_activated_coremask;
|
||||
int32_t valid;
|
||||
int32_t volatile shutdown_done;
|
||||
uint64_t shutdown_callback;
|
||||
uint64_t data;
|
||||
} cvmx_app_hotplug_info_t;
|
||||
|
||||
struct cvmx_app_hotplug_global
|
||||
{
|
||||
uint32_t avail_coremask;
|
||||
cvmx_app_hotplug_info_t hotplug_info_array[CVMX_APP_HOTPLUG_MAX_APPS];
|
||||
};
|
||||
|
||||
typedef struct cvmx_app_hotplug_global cvmx_app_hotplug_global_t;
|
||||
|
||||
int cvmx_app_hotplug_shutdown_request(uint32_t, int);
|
||||
cvmx_app_hotplug_info_t* cvmx_app_hotplug_get_info(uint32_t);
|
||||
#ifndef CVMX_BUILD_FOR_LINUX_USER
|
||||
int cvmx_app_hotplug_register(void(*)(void*), void*);
|
||||
int cvmx_app_hotplug_activate(void);
|
||||
void cvmx_app_hotplug_shutdown_disable(void);
|
||||
void cvmx_app_hotplug_shutdown_enable(void);
|
||||
#endif
|
||||
|
||||
#define CVMX_APP_HOTPLUG_INFO_REGION_SIZE sizeof(cvmx_app_hotplug_global_t)
|
||||
#define CVMX_APP_HOTPLUG_INFO_REGION_NAME "cvmx-app-hotplug-block"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CVMX_APP_HOTPLUG_H__ */
|
@ -1,45 +1,47 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Simple executive application initialization for Linux user space. This
|
||||
@ -59,7 +61,7 @@
|
||||
* -# Most hardware can only be initialized once. Unless you're very careful,
|
||||
* this also means you Linux application can only run once.
|
||||
*
|
||||
* <hr>$Revision: 41757 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
@ -107,11 +109,6 @@ extern uint64_t linux_mem32_max;
|
||||
extern uint64_t linux_mem32_wired;
|
||||
extern uint64_t linux_mem32_offset;
|
||||
|
||||
#define MIPS_CAVIUM_XKPHYS_READ 2010 /* XKPHYS */
|
||||
#define MIPS_CAVIUM_XKPHYS_WRITE 2011 /* XKPHYS */
|
||||
|
||||
static CVMX_SHARED int32_t warn_count;
|
||||
|
||||
/**
|
||||
* This function performs some default initialization of the Octeon executive. It initializes
|
||||
* the cvmx_bootmem memory allocator with the list of physical memory shared by the bootloader.
|
||||
@ -134,17 +131,17 @@ int cvmx_user_app_init(void)
|
||||
* library printf for output. It also makes sure that two
|
||||
* calls to simprintf provide atomic output.
|
||||
*
|
||||
* @param fmt Format string in the same format as printf.
|
||||
* @param format Format string in the same format as printf.
|
||||
*/
|
||||
void simprintf(const char *fmt, ...)
|
||||
void simprintf(const char *format, ...)
|
||||
{
|
||||
CVMX_SHARED static cvmx_spinlock_t simprintf_lock = CVMX_SPINLOCK_UNLOCKED_INITIALIZER;
|
||||
va_list ap;
|
||||
|
||||
cvmx_spinlock_lock(&simprintf_lock);
|
||||
printf("SIMPRINTF(%d): ", (int)cvmx_get_core_num());
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
cvmx_spinlock_unlock(&simprintf_lock);
|
||||
}
|
||||
@ -325,7 +322,10 @@ int main(int argc, const char *argv[])
|
||||
CVMX_SHARED static int32_t pending_fork;
|
||||
unsigned long cpumask;
|
||||
unsigned long cpu;
|
||||
int lastcpu = 0;
|
||||
int firstcpu = 0;
|
||||
int firstcore = 0;
|
||||
|
||||
cvmx_linux_enable_xkphys_access(0);
|
||||
|
||||
cvmx_sysinfo_linux_userspace_initialize();
|
||||
|
||||
@ -344,7 +344,7 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
|
||||
setup_cvmx_shared();
|
||||
cvmx_bootmem_init(cvmx_sysinfo_get()->phy_mem_desc_ptr);
|
||||
cvmx_bootmem_init(cvmx_sysinfo_get()->phy_mem_desc_addr);
|
||||
|
||||
/* Check to make sure the Chip version matches the configured version */
|
||||
octeon_model_version_check(cvmx_get_proc_id());
|
||||
@ -359,37 +359,40 @@ int main(int argc, const char *argv[])
|
||||
cvmx_sysinfo_t *system_info = cvmx_sysinfo_get();
|
||||
|
||||
cvmx_atomic_set32(&pending_fork, 1);
|
||||
for (cpu=0; cpu<16; cpu++)
|
||||
|
||||
/* Get the lowest logical cpu */
|
||||
firstcore = ffsl(cpumask) - 1;
|
||||
cpumask ^= (1<<(firstcore));
|
||||
while (1)
|
||||
{
|
||||
if (cpumask & (1<<cpu))
|
||||
if (cpumask == 0)
|
||||
{
|
||||
/* Turn off the bit for this CPU number. We've counted him */
|
||||
cpumask ^= (1<<cpu);
|
||||
/* If this is the last CPU to run on, use this process instead of forking another one */
|
||||
if (cpumask == 0)
|
||||
{
|
||||
lastcpu = 1;
|
||||
break;
|
||||
}
|
||||
/* Increment the number of CPUs running this app */
|
||||
cvmx_atomic_add32(&pending_fork, 1);
|
||||
/* Flush all IO streams before the fork. Otherwise any buffered
|
||||
data in the C library will be duplicated. This results in
|
||||
duplicate output from a single print */
|
||||
fflush(NULL);
|
||||
/* Fork a process for the new CPU */
|
||||
int pid = fork();
|
||||
if (pid == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (pid == -1)
|
||||
{
|
||||
perror("Fork failed");
|
||||
exit(errno);
|
||||
}
|
||||
cpu = firstcore;
|
||||
firstcpu = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cpu = ffsl(cpumask) - 1;
|
||||
/* Turn off the bit for this CPU number. We've counted him */
|
||||
cpumask ^= (1<<cpu);
|
||||
/* Increment the number of CPUs running this app */
|
||||
cvmx_atomic_add32(&pending_fork, 1);
|
||||
/* Flush all IO streams before the fork. Otherwise any buffered
|
||||
data in the C library will be duplicated. This results in
|
||||
duplicate output from a single print */
|
||||
fflush(NULL);
|
||||
/* Fork a process for the new CPU */
|
||||
int pid = fork();
|
||||
if (pid == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (pid == -1)
|
||||
{
|
||||
perror("Fork failed");
|
||||
exit(errno);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set affinity to lock me to the correct CPU */
|
||||
cpumask = (1<<cpu);
|
||||
@ -404,7 +407,7 @@ int main(int argc, const char *argv[])
|
||||
cvmx_atomic_add32(&pending_fork, -1);
|
||||
if (cvmx_atomic_get32(&pending_fork) == 0)
|
||||
cvmx_dprintf("Active coremask = 0x%x\n", system_info->core_mask);
|
||||
if (lastcpu)
|
||||
if (firstcpu)
|
||||
system_info->init_core = cvmx_get_core_num();
|
||||
cvmx_spinlock_unlock(&mask_lock);
|
||||
|
||||
@ -413,27 +416,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
cvmx_coremask_barrier_sync(system_info->core_mask);
|
||||
|
||||
int ret = sysmips(MIPS_CAVIUM_XKPHYS_WRITE, getpid(), 3, 0);
|
||||
if (ret != 0) {
|
||||
int32_t w = cvmx_atomic_fetch_and_add32(&warn_count, 1);
|
||||
if (!w) {
|
||||
switch(errno) {
|
||||
case EINVAL:
|
||||
perror("sysmips(MIPS_CAVIUM_XKPHYS_WRITE) failed.\n"
|
||||
" Did you configure your kernel with both:\n"
|
||||
" CONFIG_CAVIUM_OCTEON_USER_MEM_PER_PROCESS *and*\n"
|
||||
" CONFIG_CAVIUM_OCTEON_USER_IO_PER_PROCESS?");
|
||||
break;
|
||||
case EPERM:
|
||||
perror("sysmips(MIPS_CAVIUM_XKPHYS_WRITE) failed.\n"
|
||||
" Are you running as root?");
|
||||
break;
|
||||
default:
|
||||
perror("sysmips(MIPS_CAVIUM_XKPHYS_WRITE) failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cvmx_linux_enable_xkphys_access(1);
|
||||
|
||||
int result = appmain(argc, argv);
|
||||
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,6 +42,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,14 +54,15 @@
|
||||
#include "cvmx-sysinfo.h"
|
||||
#include "cvmx-bootmem.h"
|
||||
#include "cvmx-uart.h"
|
||||
#include "cvmx-ciu.h"
|
||||
#include "cvmx-coremask.h"
|
||||
#include "cvmx-core.h"
|
||||
#include "cvmx-interrupt.h"
|
||||
#include "cvmx-ebt3000.h"
|
||||
#include "cvmx-sim-magic.h"
|
||||
#include "cvmx-debug.h"
|
||||
#include "../../bootloader/u-boot/include/octeon_mem_map.h"
|
||||
|
||||
int cvmx_debug_uart;
|
||||
int cvmx_debug_uart = -1;
|
||||
|
||||
/**
|
||||
* @file
|
||||
@ -114,7 +117,7 @@ static void process_boot_desc_ver_6(octeon_boot_descriptor_t *app_desc_ptr, cvmx
|
||||
sys_info_ptr->stack_top = cvmx_bootinfo_ptr->stack_top;
|
||||
sys_info_ptr->stack_size = cvmx_bootinfo_ptr->stack_size;
|
||||
sys_info_ptr->init_core = cvmx_get_core_num();
|
||||
sys_info_ptr->phy_mem_desc_ptr = CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, cvmx_bootinfo_ptr->phy_mem_desc_addr));
|
||||
sys_info_ptr->phy_mem_desc_addr = cvmx_bootinfo_ptr->phy_mem_desc_addr;
|
||||
sys_info_ptr->exception_base_addr = cvmx_bootinfo_ptr->exception_base_addr;
|
||||
sys_info_ptr->cpu_clock_hz = cvmx_bootinfo_ptr->eclock_hz;
|
||||
sys_info_ptr->dram_data_rate_hz = cvmx_bootinfo_ptr->dclock_hz * 2;
|
||||
@ -129,7 +132,7 @@ static void process_boot_desc_ver_6(octeon_boot_descriptor_t *app_desc_ptr, cvmx
|
||||
if (cvmx_bootinfo_ptr->flags & OCTEON_BL_FLAG_CONSOLE_UART1)
|
||||
sys_info_ptr->console_uart_num = 1;
|
||||
|
||||
if (cvmx_bootinfo_ptr->dram_size > 16*1024*1024)
|
||||
if (cvmx_bootinfo_ptr->dram_size > 32*1024*1024)
|
||||
sys_info_ptr->system_dram_size = (uint64_t)cvmx_bootinfo_ptr->dram_size; /* older bootloaders incorrectly gave this in bytes, so don't convert */
|
||||
else
|
||||
sys_info_ptr->system_dram_size = (uint64_t)cvmx_bootinfo_ptr->dram_size * 1024 * 1024; /* convert from Megabytes to bytes */
|
||||
@ -140,7 +143,8 @@ static void process_boot_desc_ver_6(octeon_boot_descriptor_t *app_desc_ptr, cvmx
|
||||
sys_info_ptr->led_display_base_addr = cvmx_bootinfo_ptr->led_display_base_addr;
|
||||
}
|
||||
else if (sys_info_ptr->board_type == CVMX_BOARD_TYPE_EBT3000 ||
|
||||
sys_info_ptr->board_type == CVMX_BOARD_TYPE_EBT5800)
|
||||
sys_info_ptr->board_type == CVMX_BOARD_TYPE_EBT5800 ||
|
||||
sys_info_ptr->board_type == CVMX_BOARD_TYPE_EBT5810)
|
||||
{
|
||||
/* Default these variables so that users of structure can be the same no
|
||||
** matter what version fo boot info block the bootloader passes */
|
||||
@ -178,47 +182,11 @@ static void process_boot_desc_ver_6(octeon_boot_descriptor_t *app_desc_ptr, cvmx
|
||||
{
|
||||
printf("ERROR: Incompatible CVMX descriptor passed by bootloader: %d.%d\n",
|
||||
(int)cvmx_bootinfo_ptr->major_version, (int)cvmx_bootinfo_ptr->minor_version);
|
||||
while (1);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Interrupt handler for debugger Control-C interrupts.
|
||||
*
|
||||
* @param irq_number IRQ interrupt number
|
||||
* @param registers CPU registers at the time of the interrupt
|
||||
* @param user_arg Unused user argument
|
||||
*/
|
||||
static void process_debug_interrupt(int irq_number, uint64_t registers[32], void *user_arg)
|
||||
{
|
||||
int uart = irq_number - CVMX_IRQ_UART0;
|
||||
cvmx_uart_lsr_t lsrval;
|
||||
|
||||
/* Check for a Control-C interrupt from the debugger. This loop will eat
|
||||
all input received on the uart */
|
||||
lsrval.u64 = cvmx_read_csr(CVMX_MIO_UARTX_LSR(uart));
|
||||
while (lsrval.s.dr)
|
||||
{
|
||||
int c = cvmx_read_csr(CVMX_MIO_UARTX_RBR(uart));
|
||||
if (c == '\003')
|
||||
{
|
||||
register uint64_t tmp;
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
/* Pulse MCD0 signal on Ctrl-C to stop all the cores. Also
|
||||
set the MCD0 to be not masked by this core so we know
|
||||
the signal is received by someone */
|
||||
asm volatile (
|
||||
"dmfc0 %0, $22\n"
|
||||
"ori %0, %0, 0x1110\n"
|
||||
"dmtc0 %0, $22\n"
|
||||
: "=r" (tmp));
|
||||
}
|
||||
lsrval.u64 = cvmx_read_csr(CVMX_MIO_UARTX_LSR(uart));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interrupt handler for calling exit on Control-C interrupts.
|
||||
*
|
||||
@ -309,6 +277,7 @@ void __cvmx_app_init(uint64_t app_desc_addr)
|
||||
|
||||
/* app info structure used by the simple exec */
|
||||
cvmx_sysinfo_t *sys_info_ptr = cvmx_sysinfo_get();
|
||||
int breakflag = 0;
|
||||
|
||||
if (cvmx_coremask_first_core(app_desc_ptr->core_mask))
|
||||
{
|
||||
@ -316,8 +285,7 @@ void __cvmx_app_init(uint64_t app_desc_addr)
|
||||
if (app_desc_ptr->desc_version < 6)
|
||||
{
|
||||
printf("Obsolete bootloader, can't run application\n");
|
||||
while (1)
|
||||
;
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -332,95 +300,59 @@ void __cvmx_app_init(uint64_t app_desc_addr)
|
||||
}
|
||||
cvmx_coremask_barrier_sync(app_desc_ptr->core_mask);
|
||||
|
||||
/* All cores need to enable MCD0 signals if the debugger flag is set */
|
||||
if (sys_info_ptr->bootloader_config_flags & CVMX_BOOTINFO_CFG_FLAG_DEBUG)
|
||||
breakflag = sys_info_ptr->bootloader_config_flags & CVMX_BOOTINFO_CFG_FLAG_BREAK;
|
||||
|
||||
/* No need to initialize bootmem, interrupts, interrupt handler and error handler
|
||||
if version does not match. */
|
||||
if (cvmx_coremask_first_core(sys_info_ptr->core_mask))
|
||||
{
|
||||
/* Set all cores to stop on MCD0 signals */
|
||||
uint64_t tmp;
|
||||
asm volatile(
|
||||
"dmfc0 %0, $22, 0\n"
|
||||
"or %0, %0, 0x1100\n"
|
||||
"dmtc0 %0, $22, 0\n" : "=r" (tmp));
|
||||
/* Check to make sure the Chip version matches the configured version */
|
||||
uint32_t chip_id = cvmx_get_proc_id();
|
||||
/* Make sure we can properly run on this chip */
|
||||
octeon_model_version_check(chip_id);
|
||||
}
|
||||
|
||||
cvmx_interrupt_initialize();
|
||||
|
||||
if (cvmx_coremask_first_core(sys_info_ptr->core_mask))
|
||||
{
|
||||
/* Check to make sure the Chip version matches the configured version */
|
||||
uint32_t chip_id = cvmx_get_proc_id();
|
||||
int debugflag = sys_info_ptr->bootloader_config_flags & CVMX_BOOTINFO_CFG_FLAG_DEBUG;
|
||||
int breakflag = sys_info_ptr->bootloader_config_flags & CVMX_BOOTINFO_CFG_FLAG_BREAK;
|
||||
int uart;
|
||||
int break_uart = 0;
|
||||
unsigned int i;
|
||||
|
||||
/* Intialize the bootmem allocator with the descriptor that was provided by
|
||||
** the bootloader
|
||||
** IMPORTANT: All printfs must happen after this since PCI console uses named
|
||||
** blocks.
|
||||
*/
|
||||
cvmx_bootmem_init(sys_info_ptr->phy_mem_desc_ptr);
|
||||
|
||||
/* Make sure we can properly run on this chip */
|
||||
octeon_model_version_check(chip_id);
|
||||
|
||||
/* Default to the second uart port. Set this even if debug was
|
||||
not passed. The idea is that if the program crashes one would
|
||||
be able to break in on uart1 even without debug. */
|
||||
cvmx_debug_uart = 1;
|
||||
/* If the debugger flag is set, setup the uart Control-C interrupt
|
||||
handler */
|
||||
if (debugflag)
|
||||
* the bootloader
|
||||
* IMPORTANT: All printfs must happen after this since PCI console uses named
|
||||
* blocks.
|
||||
*/
|
||||
cvmx_bootmem_init(sys_info_ptr->phy_mem_desc_addr);
|
||||
if (breakflag && cvmx_debug_booted())
|
||||
{
|
||||
/* Search through the arguments for a debug=X */
|
||||
unsigned int i;
|
||||
for (i=0; i<app_desc_ptr->argc; i++)
|
||||
{
|
||||
const char *argv = CASTPTR(const char, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, app_desc_ptr->argv[i]));
|
||||
if (strncmp(argv, "debug=", 6) == 0)
|
||||
{
|
||||
/* Use the supplied uart as an override */
|
||||
cvmx_debug_uart = atoi(argv+6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cvmx_interrupt_register(CVMX_IRQ_UART0+cvmx_debug_uart, process_debug_interrupt, NULL);
|
||||
uart = cvmx_debug_uart;
|
||||
}
|
||||
else if (breakflag)
|
||||
{
|
||||
unsigned int i;
|
||||
int32_t *trampoline = CASTPTR(int32_t, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, BOOTLOADER_DEBUG_TRAMPOLINE));
|
||||
/* Default to the first uart port. */
|
||||
uart = 0;
|
||||
printf("ERROR: Using debug and break together in not supported.\n");
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
/* Search through the arguments for a break=X */
|
||||
for (i = 0; i < app_desc_ptr->argc; i++)
|
||||
{
|
||||
const char *argv = CASTPTR(const char, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, app_desc_ptr->argv[i]));
|
||||
if (strncmp(argv, "break=", 6) == 0)
|
||||
{
|
||||
/* Use the supplied uart as an override */
|
||||
uart = atoi(argv+6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Search through the arguments for a break=X or a debug=X. */
|
||||
for (i = 0; i < app_desc_ptr->argc; i++)
|
||||
{
|
||||
const char *argv = CASTPTR(const char, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, app_desc_ptr->argv[i]));
|
||||
if (strncmp(argv, "break=", 6) == 0)
|
||||
break_uart = atoi(argv + 6);
|
||||
else if (strncmp(argv, "debug=", 6) == 0)
|
||||
cvmx_debug_uart = atoi(argv + 6);
|
||||
}
|
||||
|
||||
/* On debug exception, call exit_on_break from all cores. */
|
||||
*trampoline = (int32_t)(long)&exit_on_break;
|
||||
cvmx_interrupt_register(CVMX_IRQ_UART0 + uart, process_break_interrupt, NULL);
|
||||
}
|
||||
if (debugflag || breakflag)
|
||||
{
|
||||
/* Enable uart interrupts for debugger Control-C processing */
|
||||
cvmx_uart_ier_t ier;
|
||||
ier.u64 = cvmx_read_csr(CVMX_MIO_UARTX_IER(uart));
|
||||
ier.s.erbfi = 1;
|
||||
cvmx_write_csr(CVMX_MIO_UARTX_IER(uart), ier.u64);
|
||||
|
||||
cvmx_interrupt_unmask_irq(CVMX_IRQ_UART0+uart);
|
||||
if (breakflag)
|
||||
{
|
||||
int32_t *trampoline = CASTPTR(int32_t, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, BOOTLOADER_DEBUG_TRAMPOLINE));
|
||||
/* On debug exception, call exit_on_break from all cores. */
|
||||
*trampoline = (int32_t)(long)&exit_on_break;
|
||||
cvmx_uart_enable_intr(break_uart, process_break_interrupt);
|
||||
}
|
||||
}
|
||||
|
||||
cvmx_coremask_barrier_sync(app_desc_ptr->core_mask);
|
||||
|
||||
/* Clear BEV now that we have installed exception handlers. */
|
||||
uint64_t tmp;
|
||||
asm volatile (
|
||||
@ -443,6 +375,11 @@ void __cvmx_app_init(uint64_t app_desc_addr)
|
||||
"dmtc0 %0, $22, 0\n" : "=r" (tmp));
|
||||
|
||||
CVMX_SYNC;
|
||||
|
||||
/* Now intialize the debug exception handler as BEV is cleared. */
|
||||
if (!breakflag)
|
||||
cvmx_debug_init();
|
||||
|
||||
/* Synchronise all cores at this point */
|
||||
cvmx_coremask_barrier_sync(app_desc_ptr->core_mask);
|
||||
|
||||
@ -470,11 +407,6 @@ int cvmx_user_app_init(void)
|
||||
printf("BIST FAILURE: COP0_CACHE_ERR: 0x%llx\n", (unsigned long long)bist_val);
|
||||
bist_errors++;
|
||||
}
|
||||
/* Clear parity error bits */
|
||||
CVMX_MF_CACHE_ERR(bist_val);
|
||||
bist_val &= ~0x7ull;
|
||||
CVMX_MT_CACHE_ERR(bist_val);
|
||||
|
||||
|
||||
mask = 0xfc00000000000000ull;
|
||||
CVMX_MF_CVM_MEM_CTL(bist_val);
|
||||
@ -485,29 +417,16 @@ int cvmx_user_app_init(void)
|
||||
bist_errors++;
|
||||
}
|
||||
|
||||
/* Clear DCACHE parity error bit */
|
||||
bist_val = 0;
|
||||
CVMX_MF_DCACHE_ERR(bist_val);
|
||||
|
||||
mask = 0x18ull;
|
||||
bist_val = cvmx_read_csr(CVMX_L2D_ERR);
|
||||
if (bist_val & mask)
|
||||
{
|
||||
printf("ERROR: ECC error detected in L2 Data, L2D_ERR: 0x%llx\n", (unsigned long long)bist_val);
|
||||
cvmx_write_csr(CVMX_L2D_ERR, bist_val); /* Clear error bits if set */
|
||||
}
|
||||
bist_val = cvmx_read_csr(CVMX_L2T_ERR);
|
||||
if (bist_val & mask)
|
||||
{
|
||||
printf("ERROR: ECC error detected in L2 Tags, L2T_ERR: 0x%llx\n", (unsigned long long)bist_val);
|
||||
cvmx_write_csr(CVMX_L2T_ERR, bist_val); /* Clear error bits if set */
|
||||
}
|
||||
|
||||
|
||||
/* Set up 4 cache lines of local memory, make available from Kernel space */
|
||||
CVMX_MF_CVM_MEM_CTL(tmp);
|
||||
tmp &= ~0x1ffull;
|
||||
tmp |= 0x104ull;
|
||||
/* Set WBTHRESH=4 as per Core-14752 errata in cn63xxp1.X. */
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X))
|
||||
{
|
||||
tmp &= ~(0xfull << 11);
|
||||
tmp |= 4 << 11;
|
||||
}
|
||||
CVMX_MT_CVM_MEM_CTL(tmp);
|
||||
|
||||
|
||||
@ -519,11 +438,9 @@ int cvmx_user_app_init(void)
|
||||
{
|
||||
printf("ERROR: 1-1 TLB mappings configured and oversize application loaded.\n");
|
||||
printf("ERROR: Either 1-1 TLB mappings must be disabled or application size reduced.\n");
|
||||
while (1)
|
||||
;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
/* Create 1-1 Mappings for all DRAM up to 8 gigs, excluding the low 1 Megabyte. This area
|
||||
** is reserved for the bootloader and exception vectors. By not mapping this area, NULL pointer
|
||||
** dereferences will be caught with TLB exceptions. Exception handlers should be written
|
||||
@ -549,67 +466,62 @@ int cvmx_user_app_init(void)
|
||||
#endif
|
||||
cvmx_core_add_fixed_tlb_mapping(0x8000000ULL, 0x8000000ULL, 0xc000000ULL, CVMX_TLB_PAGEMASK_64M);
|
||||
|
||||
/* Create 1-1 mapping for next 256 megs
|
||||
** bottom page is not valid */
|
||||
cvmx_core_add_fixed_tlb_mapping_bits(0x400000000ULL, 0, 0x410000000ULL | TLB_DIRTY | TLB_VALID | TLB_GLOBAL, CVMX_TLB_PAGEMASK_256M);
|
||||
|
||||
/* Map from 0.5 up to the installed memory size in 512 MByte chunks. If this loop runs out of memory,
|
||||
** the NULL pointer detection can be disabled to free up more TLB entries. */
|
||||
if (cvmx_sysinfo_get()->system_dram_size > 0x20000000ULL)
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
{
|
||||
for (base_addr = 0x20000000ULL; base_addr <= (cvmx_sysinfo_get()->system_dram_size - 0x20000000ULL); base_addr += 0x20000000ULL)
|
||||
for (base_addr = 0x20000000ULL; base_addr < (cvmx_sysinfo_get()->system_dram_size + 0x10000000ULL); base_addr += 0x20000000ULL)
|
||||
{
|
||||
if (0 > cvmx_core_add_fixed_tlb_mapping(base_addr, base_addr, base_addr + 0x10000000ULL, CVMX_TLB_PAGEMASK_256M))
|
||||
{
|
||||
printf("ERROR adding 1-1 TLB mapping for address 0x%llx\n", (unsigned long long)base_addr);
|
||||
while (1); /* Hang here, as expected memory mappings aren't set up if this fails */
|
||||
/* Exit from here, as expected memory mappings aren't set
|
||||
up if this fails */
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create 1-1 mapping for next 256 megs
|
||||
** bottom page is not valid */
|
||||
cvmx_core_add_fixed_tlb_mapping_bits(0x400000000ULL, 0, 0x410000000ULL | TLB_DIRTY | TLB_VALID | TLB_GLOBAL, CVMX_TLB_PAGEMASK_256M);
|
||||
|
||||
|
||||
/* Map from 0.5 up to the installed memory size in 512 MByte chunks. If this loop runs out of memory,
|
||||
** the NULL pointer detection can be disabled to free up more TLB entries. */
|
||||
if (cvmx_sysinfo_get()->system_dram_size > 0x20000000ULL)
|
||||
{
|
||||
for (base_addr = 0x20000000ULL; base_addr <= (cvmx_sysinfo_get()->system_dram_size - 0x20000000ULL); base_addr += 0x20000000ULL)
|
||||
{
|
||||
if (0 > cvmx_core_add_fixed_tlb_mapping(base_addr, base_addr, base_addr + 0x10000000ULL, CVMX_TLB_PAGEMASK_256M))
|
||||
{
|
||||
printf("ERROR adding 1-1 TLB mapping for address 0x%llx\n", (unsigned long long)base_addr);
|
||||
/* Exit from here, as expected memory mappings
|
||||
aren't set up if this fails */
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
cvmx_sysinfo_t *sys_info_ptr = cvmx_sysinfo_get();
|
||||
cvmx_bootmem_init(sys_info_ptr->phy_mem_desc_ptr);
|
||||
cvmx_bootmem_init(sys_info_ptr->phy_mem_desc_addr);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void __cvmx_app_exit(void)
|
||||
{
|
||||
if (cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_SIM)
|
||||
cvmx_debug_finish();
|
||||
|
||||
if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_SIM)
|
||||
{
|
||||
uint64_t val;
|
||||
uint64_t mask, expected;
|
||||
int bist_errors = 0;
|
||||
|
||||
mask = 0x1ull;
|
||||
expected = 0x0ull;
|
||||
CVMX_MF_DCACHE_ERR(val);
|
||||
val = (val & mask) ^ expected;
|
||||
if (val)
|
||||
{
|
||||
printf("DCACHE Parity error: 0x%llx\n", (unsigned long long)val);
|
||||
bist_errors++;
|
||||
}
|
||||
|
||||
mask = 0x18ull;
|
||||
expected = 0x0ull;
|
||||
val = cvmx_read_csr(CVMX_L2D_ERR);
|
||||
val = (val & mask) ^ expected;
|
||||
if (val)
|
||||
{
|
||||
printf("L2 Parity error: 0x%llx\n", (unsigned long long)val);
|
||||
bist_errors++;
|
||||
}
|
||||
|
||||
|
||||
while (1)
|
||||
;
|
||||
|
||||
CVMX_BREAK;
|
||||
}
|
||||
/* Hang forever, until more appropriate stand alone simple executive
|
||||
exit() is implemented */
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,50 +1,52 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Header file for simple executive application initialization. This defines
|
||||
* part of the ABI between the bootloader and the application.
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 52004 $<hr>
|
||||
*
|
||||
*/
|
||||
|
||||
@ -73,8 +75,7 @@ extern "C" {
|
||||
** must be incremented, and the minor version should be reset
|
||||
** to 0.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
struct cvmx_bootinfo {
|
||||
uint32_t major_version;
|
||||
uint32_t minor_version;
|
||||
|
||||
@ -121,7 +122,9 @@ typedef struct
|
||||
#endif
|
||||
|
||||
|
||||
} cvmx_bootinfo_t;
|
||||
};
|
||||
|
||||
typedef struct cvmx_bootinfo cvmx_bootinfo_t;
|
||||
|
||||
#define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST (1ull << 0)
|
||||
#define CVMX_BOOTINFO_CFG_FLAG_PCI_TARGET (1ull << 1)
|
||||
@ -166,6 +169,15 @@ enum cvmx_board_types_enum {
|
||||
CVMX_BOARD_TYPE_CB5601 = 26,
|
||||
CVMX_BOARD_TYPE_CB5200 = 27,
|
||||
CVMX_BOARD_TYPE_GENERIC = 28, /* Special 'generic' board type, supports many boards */
|
||||
CVMX_BOARD_TYPE_EBH5610 = 29,
|
||||
CVMX_BOARD_TYPE_LANAI2_A = 30,
|
||||
CVMX_BOARD_TYPE_LANAI2_U = 31,
|
||||
CVMX_BOARD_TYPE_EBB5600 = 32,
|
||||
CVMX_BOARD_TYPE_EBB6300 = 33,
|
||||
CVMX_BOARD_TYPE_NIC_XLE_10G = 34,
|
||||
CVMX_BOARD_TYPE_LANAI2_G = 35,
|
||||
CVMX_BOARD_TYPE_EBT5810 = 36,
|
||||
CVMX_BOARD_TYPE_NIC10E = 37,
|
||||
CVMX_BOARD_TYPE_MAX,
|
||||
|
||||
/* The range from CVMX_BOARD_TYPE_MAX to CVMX_BOARD_TYPE_CUST_DEFINED_MIN is reserved
|
||||
@ -193,8 +205,16 @@ enum cvmx_board_types_enum {
|
||||
CVMX_BOARD_TYPE_CUST_GCT108 = 10012,
|
||||
CVMX_BOARD_TYPE_CUST_AGS109 = 10013,
|
||||
CVMX_BOARD_TYPE_CUST_GCT110 = 10014,
|
||||
CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER = 10015,
|
||||
CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER= 10016,
|
||||
CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX = 10017,
|
||||
CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX = 10018,
|
||||
CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX= 10019,
|
||||
CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX= 10020,
|
||||
#if defined(OCTEON_VENDOR_LANNER)
|
||||
CVMX_BOARD_TYPE_CUST_LANNER_MR730= 10021,
|
||||
CVMX_BOARD_TYPE_CUST_LANNER_MR730 = 10021,
|
||||
#else
|
||||
CVMX_BOARD_TYPE_CUST_L2_ZINWELL = 10021,
|
||||
#endif
|
||||
CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000,
|
||||
|
||||
@ -206,6 +226,20 @@ enum cvmx_board_types_enum {
|
||||
#endif
|
||||
CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
|
||||
|
||||
|
||||
/* Range for IO modules */
|
||||
CVMX_BOARD_TYPE_MODULE_MIN = 30001,
|
||||
CVMX_BOARD_TYPE_MODULE_PCIE_RC_4X = 30002,
|
||||
CVMX_BOARD_TYPE_MODULE_PCIE_EP_4X = 30003,
|
||||
CVMX_BOARD_TYPE_MODULE_SGMII_MARVEL = 30004,
|
||||
CVMX_BOARD_TYPE_MODULE_SFPPLUS_BCM = 30005,
|
||||
CVMX_BOARD_TYPE_MODULE_SRIO = 30006,
|
||||
CVMX_BOARD_TYPE_MODULE_EBB5600_QLM0 = 30007,
|
||||
CVMX_BOARD_TYPE_MODULE_EBB5600_QLM1 = 30008,
|
||||
CVMX_BOARD_TYPE_MODULE_EBB5600_QLM2 = 30009,
|
||||
CVMX_BOARD_TYPE_MODULE_EBB5600_QLM3 = 30010,
|
||||
CVMX_BOARD_TYPE_MODULE_MAX = 31000,
|
||||
|
||||
/* The remaining range is reserved for future use. */
|
||||
};
|
||||
enum cvmx_chip_types_enum {
|
||||
@ -253,6 +287,15 @@ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum t
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5610)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_A)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_U)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB5600)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6300)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_10G)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_G)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5810)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC10E)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX)
|
||||
|
||||
/* Customer boards listed here */
|
||||
@ -275,9 +318,18 @@ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum t
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT108)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS109)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT110)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX)
|
||||
#if defined(OCTEON_VENDOR_LANNER)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR730)
|
||||
#else
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ZINWELL)
|
||||
#endif
|
||||
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX)
|
||||
|
||||
/* Customer private range */
|
||||
@ -286,6 +338,19 @@ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum t
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320)
|
||||
#endif
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
|
||||
|
||||
/* Module range */
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_MIN)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_PCIE_RC_4X)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_PCIE_EP_4X)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_SGMII_MARVEL)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_SFPPLUS_BCM)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_SRIO)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_EBB5600_QLM0)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_EBB5600_QLM1)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_EBB5600_QLM2)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_EBB5600_QLM3)
|
||||
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MODULE_MAX)
|
||||
}
|
||||
return "Unsupported Board";
|
||||
}
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,18 +42,77 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This is file defines ASM primitives for the executive.
|
||||
|
||||
* <hr>$Revision: 42280 $<hr>
|
||||
* <hr>$Revision: 52004 $<hr>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __CVMX_ASM_H__
|
||||
#define __CVMX_ASM_H__
|
||||
|
||||
#define COP0_INDEX $0,0 /* TLB read/write index */
|
||||
#define COP0_RANDOM $1,0 /* TLB random index */
|
||||
#define COP0_ENTRYLO0 $2,0 /* TLB entryLo0 */
|
||||
#define COP0_ENTRYLO1 $3,0 /* TLB entryLo1 */
|
||||
#define COP0_CONTEXT $4,0 /* Context */
|
||||
#define COP0_PAGEMASK $5,0 /* TLB pagemask */
|
||||
#define COP0_PAGEGRAIN $5,1 /* TLB config for max page sizes */
|
||||
#define COP0_WIRED $6,0 /* TLB number of wired entries */
|
||||
#define COP0_HWRENA $7,0 /* rdhw instruction enable per register */
|
||||
#define COP0_BADVADDR $8,0 /* Bad virtual address */
|
||||
#define COP0_COUNT $9,0 /* Mips count register */
|
||||
#define COP0_CVMCOUNT $9,6 /* Cavium count register */
|
||||
#define COP0_CVMCTL $9,7 /* Cavium control */
|
||||
#define COP0_ENTRYHI $10,0 /* TLB entryHi */
|
||||
#define COP0_COMPARE $11,0 /* Mips compare register */
|
||||
#define COP0_POWTHROTTLE $11,6 /* Power throttle register */
|
||||
#define COP0_CVMMEMCTL $11,7 /* Cavium memory control */
|
||||
#define COP0_STATUS $12,0 /* Mips status register */
|
||||
#define COP0_INTCTL $12,1 /* Useless (Vectored interrupts) */
|
||||
#define COP0_SRSCTL $12,2 /* Useless (Shadow registers) */
|
||||
#define COP0_CAUSE $13,0 /* Mips cause register */
|
||||
#define COP0_EPC $14,0 /* Exception program counter */
|
||||
#define COP0_PRID $15,0 /* Processor ID */
|
||||
#define COP0_EBASE $15,1 /* Exception base */
|
||||
#define COP0_CONFIG $16,0 /* Misc config options */
|
||||
#define COP0_CONFIG1 $16,1 /* Misc config options */
|
||||
#define COP0_CONFIG2 $16,2 /* Misc config options */
|
||||
#define COP0_CONFIG3 $16,3 /* Misc config options */
|
||||
#define COP0_WATCHLO0 $18,0 /* Address watch registers */
|
||||
#define COP0_WATCHLO1 $18,1 /* Address watch registers */
|
||||
#define COP0_WATCHHI0 $19,0 /* Address watch registers */
|
||||
#define COP0_WATCHHI1 $19,1 /* Address watch registers */
|
||||
#define COP0_XCONTEXT $20,0 /* OS context */
|
||||
#define COP0_MULTICOREDEBUG $22,0 /* Cavium debug */
|
||||
#define COP0_DEBUG $23,0 /* Debug status */
|
||||
#define COP0_DEPC $24,0 /* Debug PC */
|
||||
#define COP0_PERFCONTROL0 $25,0 /* Performance counter control */
|
||||
#define COP0_PERFCONTROL1 $25,2 /* Performance counter control */
|
||||
#define COP0_PERFVALUE0 $25,1 /* Performance counter */
|
||||
#define COP0_PERFVALUE1 $25,3 /* Performance counter */
|
||||
#define COP0_CACHEERRI $27,0 /* I cache error status */
|
||||
#define COP0_CACHEERRD $27,1 /* D cache error status */
|
||||
#define COP0_TAGLOI $28,0 /* I cache tagLo */
|
||||
#define COP0_TAGLOD $28,2 /* D cache tagLo */
|
||||
#define COP0_DATALOI $28,1 /* I cache dataLo */
|
||||
#define COP0_DATALOD $28,3 /* D cahce dataLo */
|
||||
#define COP0_TAGHI $29,2 /* ? */
|
||||
#define COP0_DATAHII $29,1 /* ? */
|
||||
#define COP0_DATAHID $29,3 /* ? */
|
||||
#define COP0_ERROREPC $30,0 /* Error PC */
|
||||
#define COP0_DESAVE $31,0 /* Debug scratch area */
|
||||
|
||||
/* This header file can be included from a .S file. Keep non-preprocessor
|
||||
things under !__ASSEMBLER__. */
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include "octeon-model.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -61,11 +121,23 @@ extern "C" {
|
||||
#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
|
||||
#define CVMX_TMP_STR2(x) #x
|
||||
|
||||
#if !OCTEON_IS_COMMON_BINARY()
|
||||
#if CVMX_COMPILED_FOR(OCTEON_CN63XX)
|
||||
#define CVMX_CAVIUM_OCTEON2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* other useful stuff */
|
||||
#define CVMX_BREAK asm volatile ("break")
|
||||
#define CVMX_SYNC asm volatile ("sync" : : :"memory")
|
||||
/* String version of SYNCW macro for using in inline asm constructs */
|
||||
#define CVMX_SYNCW_STR "syncw\nsyncw\n"
|
||||
#define CVMX_SYNCW_STR_OCTEON2 "syncw\n"
|
||||
#ifdef CVMX_CAVIUM_OCTEON2
|
||||
#define CVMX_SYNCW_STR CVMX_SYNCW_STR_OCTEON2
|
||||
#else
|
||||
#define CVMX_SYNCW_STR "syncw\nsyncw\n"
|
||||
#endif /* CVMX_CAVIUM_OCTEON2 */
|
||||
|
||||
#ifdef __OCTEON__
|
||||
#define CVMX_SYNCIO asm volatile ("nop") /* Deprecated, will be removed in future release */
|
||||
#define CVMX_SYNCIOBDMA asm volatile ("synciobdma" : : :"memory")
|
||||
@ -75,13 +147,20 @@ extern "C" {
|
||||
errata Core-401. This can cause a single syncw to not enforce
|
||||
ordering under very rare conditions. Even if it is rare, better safe
|
||||
than sorry */
|
||||
#define CVMX_SYNCW asm volatile ("syncw\nsyncw\n" : : :"memory")
|
||||
#define CVMX_SYNCW_OCTEON2 asm volatile ("syncw\n" : : :"memory")
|
||||
#ifdef CVMX_CAVIUM_OCTEON2
|
||||
#define CVMX_SYNCW CVMX_SYNCW_OCTEON2
|
||||
#else
|
||||
#define CVMX_SYNCW asm volatile ("syncw\nsyncw\n" : : :"memory")
|
||||
#endif /* CVMX_CAVIUM_OCTEON2 */
|
||||
#if defined(VXWORKS) || defined(__linux__)
|
||||
/* Define new sync instructions to be normal SYNC instructions for
|
||||
operating systems that use threads */
|
||||
#define CVMX_SYNCWS CVMX_SYNCW
|
||||
#define CVMX_SYNCS CVMX_SYNC
|
||||
#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
|
||||
/* Define new sync instructions to be normal SYNC instructions for
|
||||
operating systems that use threads */
|
||||
#define CVMX_SYNCWS CVMX_SYNCW
|
||||
#define CVMX_SYNCS CVMX_SYNC
|
||||
#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
|
||||
#define CVMX_SYNCWS_OCTEON2 CVMX_SYNCW_OCTEON2
|
||||
#define CVMX_SYNCWS_STR_OCTEON2 CVMX_SYNCW_STR_OCTEON2
|
||||
#else
|
||||
#if defined(CVMX_BUILD_FOR_TOOLCHAIN)
|
||||
/* While building simple exec toolchain, always use syncw to
|
||||
@ -89,15 +168,24 @@ extern "C" {
|
||||
#define CVMX_SYNCWS CVMX_SYNCW
|
||||
#define CVMX_SYNCS CVMX_SYNC
|
||||
#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
|
||||
#define CVMX_SYNCWS_OCTEON2 CVMX_SYNCW_OCTEON2
|
||||
#define CVMX_SYNCWS_STR_OCTEON2 CVMX_SYNCW_STR_OCTEON2
|
||||
#else
|
||||
/* Again, just like syncw, we may need two syncws instructions in a row due
|
||||
errata Core-401 */
|
||||
#define CVMX_SYNCWS asm volatile ("syncws\nsyncws\n" : : :"memory")
|
||||
errata Core-401. Only one syncws is required for Octeon2 models */
|
||||
#define CVMX_SYNCS asm volatile ("syncs" : : :"memory")
|
||||
#define CVMX_SYNCWS_STR "syncws\nsyncws\n"
|
||||
#define CVMX_SYNCWS_OCTEON2 asm volatile ("syncws\n" : : :"memory")
|
||||
#define CVMX_SYNCWS_STR_OCTEON2 "syncws\n"
|
||||
#ifdef CVMX_CAVIUM_OCTEON2
|
||||
#define CVMX_SYNCWS CVMX_SYNCWS_OCTEON2
|
||||
#define CVMX_SYNCWS_STR CVMX_SYNCWS_STR_OCTEON2
|
||||
#else
|
||||
#define CVMX_SYNCWS asm volatile ("syncws\nsyncws\n" : : :"memory")
|
||||
#define CVMX_SYNCWS_STR "syncws\nsyncws\n"
|
||||
#endif /* CVMX_CAVIUM_OCTEON2 */
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#else /* !__OCTEON__ */
|
||||
/* Not using a Cavium compiler, always use the slower sync so the assembler stays happy */
|
||||
#define CVMX_SYNCIO asm volatile ("nop") /* Deprecated, will be removed in future release */
|
||||
#define CVMX_SYNCIOBDMA asm volatile ("sync" : : :"memory")
|
||||
@ -106,6 +194,8 @@ extern "C" {
|
||||
#define CVMX_SYNCWS CVMX_SYNCW
|
||||
#define CVMX_SYNCS CVMX_SYNC
|
||||
#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
|
||||
#define CVMX_SYNCWS_OCTEON2 CVMX_SYNCW
|
||||
#define CVMX_SYNCWS_STR_OCTEON2 CVMX_SYNCW_STR
|
||||
#endif
|
||||
#define CVMX_SYNCI(address, offset) asm volatile ("synci " CVMX_TMP_STR(offset) "(%[rbase])" : : [rbase] "d" (address) )
|
||||
#define CVMX_PREFETCH0(address) CVMX_PREFETCH(address, 0)
|
||||
@ -137,6 +227,12 @@ extern "C" {
|
||||
#define CVMX_ICACHE_INVALIDATE2 { CVMX_SYNC; asm volatile ("cache 0, 0($0)" : : ); } // flush stores, invalidate entire icache
|
||||
#define CVMX_DCACHE_INVALIDATE { CVMX_SYNC; asm volatile ("cache 9, 0($0)" : : ); } // complete prefetches, invalidate entire dcache
|
||||
|
||||
#define CVMX_CACHE(op, address, offset) asm volatile ("cache " CVMX_TMP_STR(op) ", " CVMX_TMP_STR(offset) "(%[rbase])" : : [rbase] "d" (address) )
|
||||
#define CVMX_CACHE_LCKL2(address, offset) CVMX_CACHE(31, address, offset) // fetch and lock the state.
|
||||
#define CVMX_CACHE_WBIL2(address, offset) CVMX_CACHE(23, address, offset) // unlock the state.
|
||||
#define CVMX_CACHE_WBIL2I(address, offset) CVMX_CACHE(3, address, offset) // invalidate the cache block and clear the USED bits for the block
|
||||
#define CVMX_CACHE_LTGL2I(address, offset) CVMX_CACHE(7, address, offset) // load virtual tag and data for the L2 cache block into L2C_TAD0_TAG register
|
||||
|
||||
/* new instruction to make RC4 run faster */
|
||||
#define CVMX_BADDU(result, input1, input2) asm ("baddu %[rd],%[rs],%[rt]" : [rd] "=d" (result) : [rs] "d" (input1) , [rt] "d" (input2))
|
||||
|
||||
@ -232,7 +328,7 @@ extern "C" {
|
||||
ASM_STMT ("rdhwr\t%0,$" CVMX_TMP_STR(regstr) : "=d"(_v)); \
|
||||
result = (__typeof(result))_v; \
|
||||
}})
|
||||
|
||||
|
||||
|
||||
|
||||
# define CVMX_RDHWR(result, regstr) CVMX_RDHWRX(result, regstr, asm volatile)
|
||||
@ -408,18 +504,67 @@ extern "C" {
|
||||
#define CVMX_MF_AES_KEY(val,pos) asm volatile ("dmfc2 %[rt],0x0104+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
#define CVMX_MF_AES_KEYLENGTH(val) asm volatile ("dmfc2 %[rt],0x0110" : [rt] "=d" (val) : ) // read the keylen
|
||||
#define CVMX_MF_AES_DAT0(val) asm volatile ("dmfc2 %[rt],0x0111" : [rt] "=d" (val) : ) // first piece of input data
|
||||
/* GFM COP2 macros */
|
||||
/* index can be 0 or 1 */
|
||||
#define CVMX_MF_GFM_MUL(val, index) asm volatile ("dmfc2 %[rt],0x0258+" CVMX_TMP_STR(index) : [rt] "=d" (val) : )
|
||||
#define CVMX_MF_GFM_POLY(val) asm volatile ("dmfc2 %[rt],0x025e" : [rt] "=d" (val) : )
|
||||
#define CVMX_MF_GFM_RESINP(val, index) asm volatile ("dmfc2 %[rt],0x025a+" CVMX_TMP_STR(index) : [rt] "=d" (val) : )
|
||||
|
||||
#define CVMX_MT_GFM_MUL(val, index) asm volatile ("dmtc2 %[rt],0x0258+" CVMX_TMP_STR(index) : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_POLY(val) asm volatile ("dmtc2 %[rt],0x025e" : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_RESINP(val, index) asm volatile ("dmtc2 %[rt],0x025a+" CVMX_TMP_STR(index) : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_XOR0(val) asm volatile ("dmtc2 %[rt],0x025c" : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_XORMUL1(val) asm volatile ("dmtc2 %[rt],0x425d" : : [rt] "d" (val))
|
||||
// GFM
|
||||
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_GFM_MUL(val,pos) asm volatile ("dmfc2 %[rt],0x0258+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
#define CVMX_MF_GFM_POLY(val) asm volatile ("dmfc2 %[rt],0x025e" : [rt] "=d" (val) : )
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_GFM_RESINP(val,pos) asm volatile ("dmfc2 %[rt],0x025a+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_GFM_RESINP_REFLECT(val,pos) asm volatile ("dmfc2 %[rt],0x005a+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_GFM_MUL(val,pos) asm volatile ("dmtc2 %[rt],0x0258+" CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_POLY(val) asm volatile ("dmtc2 %[rt],0x025e" : : [rt] "d" (val))
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_GFM_RESINP(val,pos) asm volatile ("dmtc2 %[rt],0x025a+" CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_XOR0(val) asm volatile ("dmtc2 %[rt],0x025c" : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_XORMUL1(val) asm volatile ("dmtc2 %[rt],0x425d" : : [rt] "d" (val))
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_GFM_MUL_REFLECT(val,pos) asm volatile ("dmtc2 %[rt],0x0058+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
#define CVMX_MT_GFM_XOR0_REFLECT(val) asm volatile ("dmtc2 %[rt],0x005c" : : [rt] "d" (val))
|
||||
#define CVMX_MT_GFM_XORMUL1_REFLECT(val) asm volatile ("dmtc2 %[rt],0x405d" : : [rt] "d" (val))
|
||||
|
||||
// SNOW 3G
|
||||
|
||||
// pos can be 0-7
|
||||
#define CVMX_MF_SNOW3G_LFSR(val,pos) asm volatile ("dmfc2 %[rt],0x0240+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
// pos can be 0-2
|
||||
#define CVMX_MF_SNOW3G_FSM(val,pos) asm volatile ("dmfc2 %[rt],0x0251+" CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
#define CVMX_MF_SNOW3G_RESULT(val) asm volatile ("dmfc2 %[rt],0x0250" : [rt] "=d" (val) : )
|
||||
|
||||
// pos can be 0-7
|
||||
#define CVMX_MT_SNOW3G_LFSR(val,pos) asm volatile ("dmtc2 %[rt],0x0240+" CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
// pos can be 0-2
|
||||
#define CVMX_MT_SNOW3G_FSM(val,pos) asm volatile ("dmtc2 %[rt],0x0251+" CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
#define CVMX_MT_SNOW3G_RESULT(val) asm volatile ("dmtc2 %[rt],0x0250" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SNOW3G_START(val) asm volatile ("dmtc2 %[rt],0x404d" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SNOW3G_MORE(val) asm volatile ("dmtc2 %[rt],0x404e" : : [rt] "d" (val))
|
||||
|
||||
// SMS4
|
||||
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_SMS4_IV(val,pos) asm volatile ("dmfc2 %[rt],0x0102+"CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_SMS4_KEY(val,pos) asm volatile ("dmfc2 %[rt],0x0104+"CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
// pos can be 0-1
|
||||
#define CVMX_MF_SMS4_RESINP(val,pos) asm volatile ("dmfc2 %[rt],0x0100+"CVMX_TMP_STR(pos) : [rt] "=d" (val) : )
|
||||
#define CVMX_MT_SMS4_DEC_CBC0(val) asm volatile ("dmtc2 %[rt],0x010c" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_DEC_CBC1(val) asm volatile ("dmtc2 %[rt],0x311d" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_DEC0(val) asm volatile ("dmtc2 %[rt],0x010e" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_DEC1(val) asm volatile ("dmtc2 %[rt],0x311f" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_ENC_CBC0(val) asm volatile ("dmtc2 %[rt],0x0108" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_ENC_CBC1(val) asm volatile ("dmtc2 %[rt],0x3119" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_ENC0(val) asm volatile ("dmtc2 %[rt],0x010a" : : [rt] "d" (val))
|
||||
#define CVMX_MT_SMS4_ENC1(val) asm volatile ("dmtc2 %[rt],0x311b" : : [rt] "d" (val))
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_SMS4_IV(val,pos) asm volatile ("dmtc2 %[rt],0x0102+"CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_SMS4_KEY(val,pos) asm volatile ("dmtc2 %[rt],0x0104+"CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
// pos can be 0-1
|
||||
#define CVMX_MT_SMS4_RESINP(val,pos) asm volatile ("dmtc2 %[rt],0x0100+"CVMX_TMP_STR(pos) : : [rt] "d" (val))
|
||||
|
||||
/* check_ordering stuff */
|
||||
#if 0
|
||||
@ -436,19 +581,25 @@ extern "C" {
|
||||
|
||||
#define CVMX_MT_CYCLE(src) asm volatile ("dmtc0 %[rt],$9,6" :: [rt] "d" (src))
|
||||
|
||||
#define CVMX_MF_CACHE_ERR(val) asm volatile ("dmfc0 %[rt],$27,0" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_DCACHE_ERR(val) asm volatile ("dmfc0 %[rt],$27,1" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_CVM_MEM_CTL(val) asm volatile ("dmfc0 %[rt],$11,7" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_CVM_CTL(val) asm volatile ("dmfc0 %[rt],$9,7" : [rt] "=d" (val):)
|
||||
#define CVMX_MT_CACHE_ERR(val) asm volatile ("dmtc0 %[rt],$27,0" : : [rt] "d" (val))
|
||||
#define CVMX_MT_DCACHE_ERR(val) asm volatile ("dmtc0 %[rt],$27,1" : : [rt] "d" (val))
|
||||
#define CVMX_MT_CVM_MEM_CTL(val) asm volatile ("dmtc0 %[rt],$11,7" : : [rt] "d" (val))
|
||||
#define CVMX_MT_CVM_CTL(val) asm volatile ("dmtc0 %[rt],$9,7" : : [rt] "d" (val))
|
||||
#define VASTR(...) #__VA_ARGS__
|
||||
|
||||
#define CVMX_MF_COP0(val, cop0) asm volatile ("dmfc0 %[rt]," VASTR(cop0) : [rt] "=d" (val));
|
||||
#define CVMX_MT_COP0(val, cop0) asm volatile ("dmtc0 %[rt]," VASTR(cop0) : : [rt] "d" (val));
|
||||
|
||||
#define CVMX_MF_CACHE_ERR(val) CVMX_MF_COP0(val, COP0_CACHEERRI)
|
||||
#define CVMX_MF_DCACHE_ERR(val) CVMX_MF_COP0(val, COP0_CACHEERRD)
|
||||
#define CVMX_MF_CVM_MEM_CTL(val) CVMX_MF_COP0(val, COP0_CVMMEMCTL)
|
||||
#define CVMX_MF_CVM_CTL(val) CVMX_MF_COP0(val, COP0_CVMCTL)
|
||||
#define CVMX_MT_CACHE_ERR(val) CVMX_MT_COP0(val, COP0_CACHEERRI)
|
||||
#define CVMX_MT_DCACHE_ERR(val) CVMX_MT_COP0(val, COP0_CACHEERRD)
|
||||
#define CVMX_MT_CVM_MEM_CTL(val) CVMX_MT_COP0(val, COP0_CVMMEMCTL)
|
||||
#define CVMX_MT_CVM_CTL(val) CVMX_MT_COP0(val, COP0_CVMCTL)
|
||||
|
||||
/* Macros for TLB */
|
||||
#define CVMX_TLBWI asm volatile ("tlbwi" : : )
|
||||
#define CVMX_TLBWR asm volatile ("tlbwr" : : )
|
||||
#define CVMX_TLBR asm volatile ("tlbr" : : )
|
||||
#define CVMX_TLBP asm volatile ("tlbp" : : )
|
||||
#define CVMX_MT_ENTRY_HIGH(val) asm volatile ("dmtc0 %[rt],$10,0" : : [rt] "d" (val))
|
||||
#define CVMX_MT_ENTRY_LO_0(val) asm volatile ("dmtc0 %[rt],$2,0" : : [rt] "d" (val))
|
||||
#define CVMX_MT_ENTRY_LO_1(val) asm volatile ("dmtc0 %[rt],$3,0" : : [rt] "d" (val))
|
||||
@ -464,12 +615,18 @@ extern "C" {
|
||||
#define CVMX_MF_PAGEMASK(val) asm volatile ("mfc0 %[rt],$5,0" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_PAGEGRAIN(val) asm volatile ("mfc0 %[rt],$5,1" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_TLB_WIRED(val) asm volatile ("mfc0 %[rt],$6,0" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_TLB_INDEX(val) asm volatile ("mfc0 %[rt],$0,0" : [rt] "=d" (val):)
|
||||
#define CVMX_MF_TLB_RANDOM(val) asm volatile ("mfc0 %[rt],$1,0" : [rt] "=d" (val):)
|
||||
#define TLB_DIRTY (0x1ULL<<2)
|
||||
#define TLB_VALID (0x1ULL<<1)
|
||||
#define TLB_GLOBAL (0x1ULL<<0)
|
||||
|
||||
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
/* Macros to PUSH and POP Octeon2 ISA. */
|
||||
#define CVMX_PUSH_OCTEON2 asm volatile (".set push\n.set arch=octeon2")
|
||||
#define CVMX_POP_OCTEON2 asm volatile (".set pop")
|
||||
#endif
|
||||
|
||||
/* assembler macros to guarantee byte loads/stores are used */
|
||||
/* for an unaligned 16-bit access (these use AT register) */
|
||||
@ -510,4 +667,6 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* __CVMX_ASM_H__ */
|
||||
|
@ -1,66 +0,0 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
*
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Interface to the ASX hardware.
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_ASX_H__
|
||||
#define __CVMX_ASX_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CSR typedefs have been moved to cvmx-csr-*.h */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
147
sys/contrib/octeon-sdk/cvmx-asx0-defs.h
Normal file
147
sys/contrib/octeon-sdk/cvmx-asx0-defs.h
Normal file
@ -0,0 +1,147 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
/**
|
||||
* cvmx-asx0-defs.h
|
||||
*
|
||||
* Configuration and status register (CSR) type definitions for
|
||||
* Octeon asx0.
|
||||
*
|
||||
* This file is auto generated. Do not edit.
|
||||
*
|
||||
* <hr>$Revision$<hr>
|
||||
*
|
||||
*/
|
||||
#ifndef __CVMX_ASX0_TYPEDEFS_H__
|
||||
#define __CVMX_ASX0_TYPEDEFS_H__
|
||||
|
||||
#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
|
||||
#define CVMX_ASX0_DBG_DATA_DRV CVMX_ASX0_DBG_DATA_DRV_FUNC()
|
||||
static inline uint64_t CVMX_ASX0_DBG_DATA_DRV_FUNC(void)
|
||||
{
|
||||
if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX)))
|
||||
cvmx_warn("CVMX_ASX0_DBG_DATA_DRV not supported on this chip\n");
|
||||
return CVMX_ADD_IO_SEG(0x00011800B0000208ull);
|
||||
}
|
||||
#else
|
||||
#define CVMX_ASX0_DBG_DATA_DRV (CVMX_ADD_IO_SEG(0x00011800B0000208ull))
|
||||
#endif
|
||||
#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
|
||||
#define CVMX_ASX0_DBG_DATA_ENABLE CVMX_ASX0_DBG_DATA_ENABLE_FUNC()
|
||||
static inline uint64_t CVMX_ASX0_DBG_DATA_ENABLE_FUNC(void)
|
||||
{
|
||||
if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX)))
|
||||
cvmx_warn("CVMX_ASX0_DBG_DATA_ENABLE not supported on this chip\n");
|
||||
return CVMX_ADD_IO_SEG(0x00011800B0000200ull);
|
||||
}
|
||||
#else
|
||||
#define CVMX_ASX0_DBG_DATA_ENABLE (CVMX_ADD_IO_SEG(0x00011800B0000200ull))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* cvmx_asx0_dbg_data_drv
|
||||
*
|
||||
* ASX_DBG_DATA_DRV
|
||||
*
|
||||
*/
|
||||
union cvmx_asx0_dbg_data_drv
|
||||
{
|
||||
uint64_t u64;
|
||||
struct cvmx_asx0_dbg_data_drv_s
|
||||
{
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
uint64_t reserved_9_63 : 55;
|
||||
uint64_t pctl : 5; /**< These bits control the driving strength of the dbg
|
||||
interface. */
|
||||
uint64_t nctl : 4; /**< These bits control the driving strength of the dbg
|
||||
interface. */
|
||||
#else
|
||||
uint64_t nctl : 4;
|
||||
uint64_t pctl : 5;
|
||||
uint64_t reserved_9_63 : 55;
|
||||
#endif
|
||||
} s;
|
||||
struct cvmx_asx0_dbg_data_drv_cn38xx
|
||||
{
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
uint64_t reserved_8_63 : 56;
|
||||
uint64_t pctl : 4; /**< These bits control the driving strength of the dbg
|
||||
interface. */
|
||||
uint64_t nctl : 4; /**< These bits control the driving strength of the dbg
|
||||
interface. */
|
||||
#else
|
||||
uint64_t nctl : 4;
|
||||
uint64_t pctl : 4;
|
||||
uint64_t reserved_8_63 : 56;
|
||||
#endif
|
||||
} cn38xx;
|
||||
struct cvmx_asx0_dbg_data_drv_cn38xx cn38xxp2;
|
||||
struct cvmx_asx0_dbg_data_drv_s cn58xx;
|
||||
struct cvmx_asx0_dbg_data_drv_s cn58xxp1;
|
||||
};
|
||||
typedef union cvmx_asx0_dbg_data_drv cvmx_asx0_dbg_data_drv_t;
|
||||
|
||||
/**
|
||||
* cvmx_asx0_dbg_data_enable
|
||||
*
|
||||
* ASX_DBG_DATA_ENABLE
|
||||
*
|
||||
*/
|
||||
union cvmx_asx0_dbg_data_enable
|
||||
{
|
||||
uint64_t u64;
|
||||
struct cvmx_asx0_dbg_data_enable_s
|
||||
{
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
uint64_t reserved_1_63 : 63;
|
||||
uint64_t en : 1; /**< A 1->0 transistion, turns the dbg interface OFF. */
|
||||
#else
|
||||
uint64_t en : 1;
|
||||
uint64_t reserved_1_63 : 63;
|
||||
#endif
|
||||
} s;
|
||||
struct cvmx_asx0_dbg_data_enable_s cn38xx;
|
||||
struct cvmx_asx0_dbg_data_enable_s cn38xxp2;
|
||||
struct cvmx_asx0_dbg_data_enable_s cn58xx;
|
||||
struct cvmx_asx0_dbg_data_enable_s cn58xxp1;
|
||||
};
|
||||
typedef union cvmx_asx0_dbg_data_enable cvmx_asx0_dbg_data_enable_t;
|
||||
|
||||
#endif
|
1382
sys/contrib/octeon-sdk/cvmx-asxx-defs.h
Normal file
1382
sys/contrib/octeon-sdk/cvmx-asxx-defs.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,12 +42,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file provides atomic operations
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ -353,18 +355,48 @@ static inline int64_t cvmx_atomic_fetch_and_add64_nosync(int64_t *ptr, int64_t i
|
||||
{
|
||||
uint64_t tmp, ret;
|
||||
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: lld %[tmp], %[val] \n"
|
||||
" move %[ret], %[tmp] \n"
|
||||
" daddu %[tmp], %[inc] \n"
|
||||
" scd %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [inc] "r" (incr)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
{
|
||||
CVMX_PUSH_OCTEON2;
|
||||
if (__builtin_constant_p(incr) && incr == 1)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"laid %0,(%2)"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr) : "memory");
|
||||
}
|
||||
else if (__builtin_constant_p(incr) && incr == -1)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"ladd %0,(%2)"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr) : "memory");
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"laad %0,(%2),%3"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr), "r" (incr) : "memory");
|
||||
}
|
||||
CVMX_POP_OCTEON2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: lld %[tmp], %[val] \n"
|
||||
" move %[ret], %[tmp] \n"
|
||||
" daddu %[tmp], %[inc] \n"
|
||||
" scd %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [inc] "r" (incr)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -408,18 +440,48 @@ static inline int32_t cvmx_atomic_fetch_and_add32_nosync(int32_t *ptr, int32_t i
|
||||
{
|
||||
uint32_t tmp, ret;
|
||||
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: ll %[tmp], %[val] \n"
|
||||
" move %[ret], %[tmp] \n"
|
||||
" addu %[tmp], %[inc] \n"
|
||||
" sc %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [inc] "r" (incr)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
{
|
||||
CVMX_PUSH_OCTEON2;
|
||||
if (__builtin_constant_p(incr) && incr == 1)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lai %0,(%2)"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr) : "memory");
|
||||
}
|
||||
else if (__builtin_constant_p(incr) && incr == -1)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lad %0,(%2)"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr) : "memory");
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"laa %0,(%2),%3"
|
||||
: "=r" (ret), "+m" (ptr) : "r" (ptr), "r" (incr) : "memory");
|
||||
}
|
||||
CVMX_POP_OCTEON2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: ll %[tmp], %[val] \n"
|
||||
" move %[ret], %[tmp] \n"
|
||||
" addu %[tmp], %[inc] \n"
|
||||
" sc %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [inc] "r" (incr)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -538,9 +600,8 @@ static inline uint64_t cvmx_atomic_fetch_and_bclr64_nosync(uint64_t *ptr, uint64
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [msk] "r" (mask)
|
||||
: "memory");
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret), [msk] "+r" (mask)
|
||||
: : "memory");
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -572,9 +633,8 @@ static inline uint32_t cvmx_atomic_fetch_and_bclr32_nosync(uint32_t *ptr, uint32
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [msk] "r" (mask)
|
||||
: "memory");
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret), [msk] "+r" (mask)
|
||||
: : "memory");
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -596,17 +656,47 @@ static inline uint64_t cvmx_atomic_swap64_nosync(uint64_t *ptr, uint64_t new_val
|
||||
{
|
||||
uint64_t tmp, ret;
|
||||
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: lld %[ret], %[val] \n"
|
||||
" move %[tmp], %[new_val] \n"
|
||||
" scd %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [new_val] "r" (new_val)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
{
|
||||
CVMX_PUSH_OCTEON2;
|
||||
if (__builtin_constant_p(new_val) && new_val == 0)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lacd %0,(%1)"
|
||||
: "=r" (ret) : "r" (ptr) : "memory");
|
||||
}
|
||||
else if (__builtin_constant_p(new_val) && new_val == ~0ull)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lasd %0,(%1)"
|
||||
: "=r" (ret) : "r" (ptr) : "memory");
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lawd %0,(%1),%2"
|
||||
: "=r" (ret) : "r" (ptr), "r" (new_val) : "memory");
|
||||
}
|
||||
CVMX_POP_OCTEON2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: lld %[ret], %[val] \n"
|
||||
" move %[tmp], %[new_val] \n"
|
||||
" scd %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [new_val] "r" (new_val)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@ -628,17 +718,47 @@ static inline uint32_t cvmx_atomic_swap32_nosync(uint32_t *ptr, uint32_t new_val
|
||||
{
|
||||
uint32_t tmp, ret;
|
||||
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: ll %[ret], %[val] \n"
|
||||
" move %[tmp], %[new_val] \n"
|
||||
" sc %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [new_val] "r" (new_val)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
{
|
||||
CVMX_PUSH_OCTEON2;
|
||||
if (__builtin_constant_p(new_val) && new_val == 0)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"lac %0,(%1)"
|
||||
: "=r" (ret) : "r" (ptr) : "memory");
|
||||
}
|
||||
else if (__builtin_constant_p(new_val) && new_val == ~0u)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"las %0,(%1)"
|
||||
: "=r" (ret) : "r" (ptr) : "memory");
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"law %0,(%1),%2"
|
||||
: "=r" (ret) : "r" (ptr), "r" (new_val) : "memory");
|
||||
}
|
||||
CVMX_POP_OCTEON2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
__asm__ __volatile__(
|
||||
".set noreorder \n"
|
||||
"1: ll %[ret], %[val] \n"
|
||||
" move %[tmp], %[new_val] \n"
|
||||
" sc %[tmp], %[val] \n"
|
||||
" beqz %[tmp], 1b \n"
|
||||
" nop \n"
|
||||
".set reorder \n"
|
||||
: [val] "+m" (*ptr), [tmp] "=&r" (tmp), [ret] "=&r" (ret)
|
||||
: [new_val] "r" (new_val)
|
||||
: "memory");
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
@ -1,43 +1,45 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CVMX_BOOTLOADER__
|
||||
#define __CVMX_BOOTLOADER__
|
||||
|
||||
@ -48,7 +50,7 @@
|
||||
*
|
||||
* Bootloader definitions that are shared with other programs
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*/
|
||||
|
||||
|
||||
@ -65,17 +67,18 @@
|
||||
#define BOOTLOADER_HEADER_MAX_SIZE 0x200 /* limited by the space to the next exception handler */
|
||||
|
||||
#define BOOTLOADER_HEADER_CURRENT_MAJOR_REV 1
|
||||
#define BOOTLOADER_HEADER_CURRENT_MINOR_REV 1
|
||||
#define BOOTLOADER_HEADER_CURRENT_MINOR_REV 2
|
||||
/* Revision history
|
||||
* 1.1 Initial released revision. (SDK 1.9)
|
||||
* 1.2 TLB based relocatable image (SDK 2.0)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* offsets to struct bootloader_header fields for assembly use */
|
||||
#define MAGIC_OFFST 8
|
||||
#define HCRC_OFFST 12
|
||||
#define HLEN_OFFST 16
|
||||
#define DLEN_OFFST 24
|
||||
#define DCRC_OFFST 28
|
||||
#define GOT_OFFST 48
|
||||
#define GOT_ADDRESS_OFFSET 48
|
||||
|
||||
#define LOOKUP_STEP 8192
|
||||
#define LOOKUP_STEP (64*1024)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef struct bootloader_header
|
||||
@ -86,7 +89,7 @@ typedef struct bootloader_header
|
||||
*/
|
||||
uint32_t nop_instr; /* Must be 0x0 */
|
||||
uint32_t magic; /* Magic number to identify header */
|
||||
uint32_t hcrc; /* CRC of all of header excluding this field */
|
||||
uint32_t hcrc; /* CRC of all of header excluding this field */
|
||||
|
||||
uint16_t hlen; /* Length of header in bytes */
|
||||
uint16_t maj_rev; /* Major revision */
|
||||
@ -99,12 +102,11 @@ typedef struct bootloader_header
|
||||
uint32_t flags;
|
||||
uint16_t image_type; /* Defined in bootloader_image_t enum */
|
||||
uint16_t resv0; /* pad */
|
||||
|
||||
/* The next 4 fields are placed in compile-time, not by the utility */
|
||||
uint32_t got_address; /* compiled got address position in the image */
|
||||
uint32_t got_num_entries; /* number of got entries */
|
||||
uint32_t compiled_start; /* compaled start of the image address */
|
||||
uint32_t image_start; /* relocated start of image address */
|
||||
|
||||
uint32_t reserved1;
|
||||
uint32_t reserved2;
|
||||
uint32_t reserved3;
|
||||
uint32_t reserved4;
|
||||
|
||||
char comment_string[BOOTLOADER_HEADER_COMMENT_LEN]; /* Optional, for descriptive purposes */
|
||||
char version_string[BOOTLOADER_HEADER_VERSION_LEN]; /* Optional, for descriptive purposes */
|
||||
@ -118,7 +120,7 @@ typedef struct bootloader_header
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BL_HEADER_IMAGE_UKNOWN = 0x0,
|
||||
BL_HEADER_IMAGE_UNKNOWN = 0x0,
|
||||
BL_HEADER_IMAGE_STAGE2, /* Binary bootloader stage2 image (NAND boot) */
|
||||
BL_HEADER_IMAGE_STAGE3, /* Binary bootloader stage3 image (NAND boot)*/
|
||||
BL_HEADER_IMAGE_NOR, /* Binary bootloader for NOR boot */
|
||||
@ -136,6 +138,8 @@ typedef enum
|
||||
** by stage1 and stage2. */
|
||||
#define MAX_NAND_SEARCH_ADDR 0x400000
|
||||
|
||||
/* Maximum address to look for start of normal bootloader */
|
||||
#define MAX_NOR_SEARCH_ADDR 0x100000
|
||||
|
||||
/* Defines for RAM based environment set by the host or the previous bootloader
|
||||
** in a chain boot configuration. */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +1,53 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Simple allocate only memory allocator. Used to allocate memory at application
|
||||
* start time.
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*/
|
||||
|
||||
@ -89,14 +91,14 @@ typedef struct
|
||||
** Note: This structure must be naturally 64 bit aligned, as a single
|
||||
** memory image will be used by both 32 and 64 bit programs.
|
||||
*/
|
||||
typedef struct
|
||||
struct cvmx_bootmem_named_block_desc
|
||||
{
|
||||
uint64_t base_addr; /**< Base address of named block */
|
||||
uint64_t size; /**< Size actually allocated for named block (may differ from requested) */
|
||||
char name[CVMX_BOOTMEM_NAME_LEN]; /**< name of named block */
|
||||
} cvmx_bootmem_named_block_desc_t;
|
||||
|
||||
};
|
||||
|
||||
typedef struct cvmx_bootmem_named_block_desc cvmx_bootmem_named_block_desc_t;
|
||||
|
||||
/* Current descriptor versions */
|
||||
#define CVMX_BOOTMEM_DESC_MAJ_VER 3 /* CVMX bootmem descriptor major version */
|
||||
@ -127,10 +129,10 @@ typedef struct
|
||||
* Initialize the boot alloc memory structures. This is
|
||||
* normally called inside of cvmx_user_app_init()
|
||||
*
|
||||
* @param mem_desc_ptr Address of the free memory list
|
||||
* @param mem_desc_addr Address of the free memory list
|
||||
* @return
|
||||
*/
|
||||
extern int cvmx_bootmem_init(void *mem_desc_ptr);
|
||||
extern int cvmx_bootmem_init(uint64_t mem_desc_addr);
|
||||
|
||||
|
||||
/**
|
||||
@ -190,7 +192,7 @@ extern void *cvmx_bootmem_alloc_range(uint64_t size, uint64_t alignment, uint64_
|
||||
*
|
||||
* @return pointer to block of memory, NULL on error
|
||||
*/
|
||||
extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, char *name);
|
||||
extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, const char *name);
|
||||
|
||||
|
||||
|
||||
@ -207,7 +209,7 @@ extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, char *n
|
||||
*
|
||||
* @return pointer to block of memory, NULL on error
|
||||
*/
|
||||
extern void *cvmx_bootmem_alloc_named_address(uint64_t size, uint64_t address, char *name);
|
||||
extern void *cvmx_bootmem_alloc_named_address(uint64_t size, uint64_t address, const char *name);
|
||||
|
||||
|
||||
|
||||
@ -226,7 +228,7 @@ extern void *cvmx_bootmem_alloc_named_address(uint64_t size, uint64_t address, c
|
||||
*
|
||||
* @return pointer to block of memory, NULL on error
|
||||
*/
|
||||
extern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t align, char *name);
|
||||
extern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t align, const char *name);
|
||||
|
||||
/**
|
||||
* Frees a previously allocated named bootmem block.
|
||||
@ -236,7 +238,7 @@ extern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr, ui
|
||||
* @return 0 on failure,
|
||||
* !0 on success
|
||||
*/
|
||||
extern int cvmx_bootmem_free_named(char *name);
|
||||
extern int cvmx_bootmem_free_named(const char *name);
|
||||
|
||||
|
||||
/**
|
||||
@ -247,7 +249,7 @@ extern int cvmx_bootmem_free_named(char *name);
|
||||
* @return pointer to named block descriptor on success
|
||||
* 0 on failure
|
||||
*/
|
||||
cvmx_bootmem_named_block_desc_t * cvmx_bootmem_find_named_block(char *name);
|
||||
const cvmx_bootmem_named_block_desc_t *cvmx_bootmem_find_named_block(const char *name);
|
||||
|
||||
|
||||
|
||||
@ -310,7 +312,7 @@ int64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min, uint64_t
|
||||
*
|
||||
* @return physical address of block allocated, or -1 on failure
|
||||
*/
|
||||
int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t alignment, char *name, uint32_t flags);
|
||||
int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t alignment, const char *name, uint32_t flags);
|
||||
|
||||
|
||||
/**
|
||||
@ -319,13 +321,13 @@ int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr, uin
|
||||
*
|
||||
* @param name Name of memory block to find.
|
||||
* If NULL pointer given, then finds unused descriptor, if available.
|
||||
* @param flags Flags to control options for the allocation.
|
||||
* @param flags Flags to control options for the allocation.
|
||||
*
|
||||
* @return Pointer to memory block descriptor, NULL if not found.
|
||||
* If NULL returned when name parameter is NULL, then no memory
|
||||
* block descriptors are available.
|
||||
* @return Physical address of the memory block descriptor, zero if not
|
||||
* found. If zero returned when name parameter is NULL, then no
|
||||
* memory block descriptors are available.
|
||||
*/
|
||||
cvmx_bootmem_named_block_desc_t * cvmx_bootmem_phy_named_block_find(char *name, uint32_t flags);
|
||||
uint64_t cvmx_bootmem_phy_named_block_find(const char *name, uint32_t flags);
|
||||
|
||||
|
||||
/**
|
||||
@ -349,7 +351,7 @@ uint64_t cvmx_bootmem_phy_available_mem(uint64_t min_block_size);
|
||||
* @return 0 on failure
|
||||
* 1 on success
|
||||
*/
|
||||
int cvmx_bootmem_phy_named_block_free(char *name, uint32_t flags);
|
||||
int cvmx_bootmem_phy_named_block_free(const char *name, uint32_t flags);
|
||||
|
||||
/**
|
||||
* Frees a block to the bootmem allocator list. This must
|
||||
|
5527
sys/contrib/octeon-sdk/cvmx-ciu-defs.h
Normal file
5527
sys/contrib/octeon-sdk/cvmx-ciu-defs.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,65 +0,0 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
*
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Interface to the hardware Interrupt Unit.
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_CIU_H__
|
||||
#define __CVMX_CIU_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CSR typedefs have been moved to cvmx-csr-*.h */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
139
sys/contrib/octeon-sdk/cvmx-clock.c
Normal file
139
sys/contrib/octeon-sdk/cvmx-clock.c
Normal file
@ -0,0 +1,139 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Interface to Core, IO and DDR Clock.
|
||||
*
|
||||
* <hr>$Revision: 45089 $<hr>
|
||||
*/
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
#include <linux/module.h>
|
||||
#include <asm/octeon/octeon.h>
|
||||
#include <asm/octeon/cvmx-clock.h>
|
||||
#include <asm/octeon/cvmx-npei-defs.h>
|
||||
#include <asm/octeon/cvmx-pexp-defs.h>
|
||||
#include <asm/octeon/cvmx-dbg-defs.h>
|
||||
#else
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
#include "executive-config.h"
|
||||
#endif
|
||||
#include "cvmx.h"
|
||||
#endif
|
||||
|
||||
#ifndef CVMX_BUILD_FOR_UBOOT
|
||||
static uint64_t rate_eclk = 0;
|
||||
static uint64_t rate_sclk = 0;
|
||||
static uint64_t rate_dclk = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get clock rate based on the clock type.
|
||||
*
|
||||
* @param clock - Enumeration of the clock type.
|
||||
* @return - return the clock rate.
|
||||
*/
|
||||
uint64_t cvmx_clock_get_rate(cvmx_clock_t clock)
|
||||
{
|
||||
const uint64_t REF_CLOCK = 50000000;
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_UBOOT
|
||||
uint64_t rate_eclk = 0;
|
||||
uint64_t rate_sclk = 0;
|
||||
uint64_t rate_dclk = 0;
|
||||
#endif
|
||||
|
||||
if (cvmx_unlikely(!rate_eclk))
|
||||
{
|
||||
if (octeon_has_feature(OCTEON_FEATURE_NPEI))
|
||||
{
|
||||
cvmx_npei_dbg_data_t npei_dbg_data;
|
||||
npei_dbg_data.u64 = cvmx_read_csr(CVMX_PEXP_NPEI_DBG_DATA);
|
||||
rate_eclk = REF_CLOCK * npei_dbg_data.s.c_mul;
|
||||
rate_sclk = rate_eclk;
|
||||
}
|
||||
else if (octeon_has_feature(OCTEON_FEATURE_PCIE))
|
||||
{
|
||||
cvmx_mio_rst_boot_t mio_rst_boot;
|
||||
mio_rst_boot.u64 = cvmx_read_csr(CVMX_MIO_RST_BOOT);
|
||||
rate_eclk = REF_CLOCK * mio_rst_boot.s.c_mul;
|
||||
rate_sclk = REF_CLOCK * mio_rst_boot.s.pnr_mul;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvmx_dbg_data_t dbg_data;
|
||||
dbg_data.u64 = cvmx_read_csr(CVMX_DBG_DATA);
|
||||
rate_eclk = REF_CLOCK * dbg_data.s.c_mul;
|
||||
rate_sclk = rate_eclk;
|
||||
}
|
||||
}
|
||||
|
||||
switch (clock)
|
||||
{
|
||||
case CVMX_CLOCK_SCLK:
|
||||
case CVMX_CLOCK_TIM:
|
||||
case CVMX_CLOCK_IPD:
|
||||
return rate_sclk;
|
||||
|
||||
case CVMX_CLOCK_RCLK:
|
||||
case CVMX_CLOCK_CORE:
|
||||
return rate_eclk;
|
||||
|
||||
case CVMX_CLOCK_DDR:
|
||||
#if !defined(CVMX_BUILD_FOR_LINUX_HOST) && !defined(__OCTEON_NEWLIB__)
|
||||
if (cvmx_unlikely(!rate_dclk))
|
||||
rate_dclk = cvmx_sysinfo_get()->dram_data_rate_hz;
|
||||
#endif
|
||||
return rate_dclk;
|
||||
}
|
||||
|
||||
cvmx_dprintf("cvmx_clock_get_rate: Unknown clock type\n");
|
||||
return 0;
|
||||
}
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
EXPORT_SYMBOL(cvmx_clock_get_rate);
|
||||
#endif
|
139
sys/contrib/octeon-sdk/cvmx-clock.h
Normal file
139
sys/contrib/octeon-sdk/cvmx-clock.h
Normal file
@ -0,0 +1,139 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Interface to Core, IO and DDR Clock.
|
||||
*
|
||||
* <hr>$Revision: 45089 $<hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_CLOCK_H__
|
||||
#define __CVMX_CLOCK_H__
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
#include <asm/octeon/octeon.h>
|
||||
#include <asm/octeon/cvmx-lmcx-defs.h>
|
||||
#else
|
||||
#include "cvmx.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Enumeration of different Clocks in Octeon.
|
||||
*/
|
||||
typedef enum{
|
||||
CVMX_CLOCK_RCLK, /**< Clock used by cores, coherent bus and L2 cache. */
|
||||
CVMX_CLOCK_SCLK, /**< Clock used by IO blocks. */
|
||||
CVMX_CLOCK_DDR, /**< Clock used by DRAM */
|
||||
CVMX_CLOCK_CORE, /**< Alias for CVMX_CLOCK_RCLK */
|
||||
CVMX_CLOCK_TIM, /**< Alias for CVMX_CLOCK_SCLK */
|
||||
CVMX_CLOCK_IPD, /**< Alias for CVMX_CLOCK_SCLK */
|
||||
} cvmx_clock_t;
|
||||
|
||||
/**
|
||||
* Get cycle count based on the clock type.
|
||||
*
|
||||
* @param clock - Enumeration of the clock type.
|
||||
* @return - Get the number of cycles executed so far.
|
||||
*/
|
||||
static inline uint64_t cvmx_clock_get_count(cvmx_clock_t clock)
|
||||
{
|
||||
switch(clock)
|
||||
{
|
||||
case CVMX_CLOCK_RCLK:
|
||||
case CVMX_CLOCK_CORE:
|
||||
{
|
||||
#ifndef __mips__
|
||||
return cvmx_read_csr(CVMX_IPD_CLK_COUNT);
|
||||
#elif defined(CVMX_ABI_O32)
|
||||
uint32_t tmp_low, tmp_hi;
|
||||
|
||||
asm volatile (
|
||||
" .set push \n"
|
||||
" .set mips64r2 \n"
|
||||
" .set noreorder \n"
|
||||
" rdhwr %[tmpl], $31 \n"
|
||||
" dsrl %[tmph], %[tmpl], 32 \n"
|
||||
" sll %[tmpl], 0 \n"
|
||||
" sll %[tmph], 0 \n"
|
||||
" .set pop \n"
|
||||
: [tmpl] "=&r" (tmp_low), [tmph] "=&r" (tmp_hi) : );
|
||||
|
||||
return(((uint64_t)tmp_hi << 32) + tmp_low);
|
||||
#else
|
||||
uint64_t cycle;
|
||||
CVMX_RDHWR(cycle, 31);
|
||||
return(cycle);
|
||||
#endif
|
||||
}
|
||||
|
||||
case CVMX_CLOCK_SCLK:
|
||||
case CVMX_CLOCK_TIM:
|
||||
case CVMX_CLOCK_IPD:
|
||||
return cvmx_read_csr(CVMX_IPD_CLK_COUNT);
|
||||
|
||||
case CVMX_CLOCK_DDR:
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN6XXX))
|
||||
return cvmx_read_csr(CVMX_LMCX_DCLK_CNT(0));
|
||||
else
|
||||
return ((cvmx_read_csr(CVMX_LMCX_DCLK_CNT_HI(0)) << 32) | cvmx_read_csr(CVMX_LMCX_DCLK_CNT_LO(0)));
|
||||
}
|
||||
|
||||
cvmx_dprintf("cvmx_clock_get_count: Unknown clock type\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern uint64_t cvmx_clock_get_rate(cvmx_clock_t clock);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CVMX_CLOCK_H__ */
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,25 +42,45 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Support functions for managing command queues used for
|
||||
* various hardware blocks.
|
||||
*
|
||||
* <hr>$Revision: 42150 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*/
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
#include <linux/module.h>
|
||||
#include <asm/octeon/cvmx.h>
|
||||
#include <asm/octeon/cvmx-bootmem.h>
|
||||
#include <asm/octeon/cvmx-npei-defs.h>
|
||||
#include <asm/octeon/cvmx-pexp-defs.h>
|
||||
#include <asm/octeon/cvmx-dpi-defs.h>
|
||||
#include <asm/octeon/cvmx-pko-defs.h>
|
||||
#include <asm/octeon/cvmx-config.h>
|
||||
#include <asm/octeon/cvmx-fpa.h>
|
||||
#include <asm/octeon/cvmx-cmd-queue.h>
|
||||
#else
|
||||
#include "cvmx.h"
|
||||
#include "cvmx-bootmem.h"
|
||||
#if !defined(__FreeBSD__) || !defined(_KERNEL)
|
||||
#include "cvmx-config.h"
|
||||
#endif
|
||||
#include "cvmx-fpa.h"
|
||||
#include "cvmx-cmd-queue.h"
|
||||
#include "cvmx-bootmem.h"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* This application uses this pointer to access the global queue
|
||||
* state. It points to a bootmem named block.
|
||||
*/
|
||||
CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr = NULL;
|
||||
|
||||
CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
EXPORT_SYMBOL(__cvmx_cmd_queue_state_ptr);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @INTERNAL
|
||||
@ -78,7 +99,7 @@ static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
|
||||
return CVMX_CMD_QUEUE_SUCCESS;
|
||||
|
||||
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
|
||||
#if CONFIG_CAVIUM_RESERVE32
|
||||
#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
|
||||
if (octeon_reserve32_memory)
|
||||
__cvmx_cmd_queue_state_ptr = cvmx_bootmem_alloc_named_range(sizeof(*__cvmx_cmd_queue_state_ptr),
|
||||
octeon_reserve32_memory,
|
||||
@ -94,7 +115,7 @@ static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
|
||||
memset(__cvmx_cmd_queue_state_ptr, 0, sizeof(*__cvmx_cmd_queue_state_ptr));
|
||||
else
|
||||
{
|
||||
cvmx_bootmem_named_block_desc_t *block_desc = cvmx_bootmem_find_named_block(alloc_name);
|
||||
const cvmx_bootmem_named_block_desc_t *block_desc = cvmx_bootmem_find_named_block(alloc_name);
|
||||
if (block_desc)
|
||||
__cvmx_cmd_queue_state_ptr = cvmx_phys_to_ptr(block_desc->base_addr);
|
||||
else
|
||||
@ -149,17 +170,17 @@ cvmx_cmd_queue_result_t cvmx_cmd_queue_initialize(cvmx_cmd_queue_id_t queue_id,
|
||||
{
|
||||
if (max_depth != (int)qstate->max_depth)
|
||||
{
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initalized with different max_depth (%d).\n", (int)qstate->max_depth);
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initialized with different max_depth (%d).\n", (int)qstate->max_depth);
|
||||
return CVMX_CMD_QUEUE_INVALID_PARAM;
|
||||
}
|
||||
if (fpa_pool != qstate->fpa_pool)
|
||||
{
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initalized with different FPA pool (%u).\n", qstate->fpa_pool);
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initialized with different FPA pool (%u).\n", qstate->fpa_pool);
|
||||
return CVMX_CMD_QUEUE_INVALID_PARAM;
|
||||
}
|
||||
if ((pool_size>>3)-1 != qstate->pool_size_m1)
|
||||
{
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initalized with different FPA pool size (%u).\n", (qstate->pool_size_m1+1)<<3);
|
||||
cvmx_dprintf("ERROR: cvmx_cmd_queue_initialize: Queue already initialized with different FPA pool size (%u).\n", (qstate->pool_size_m1+1)<<3);
|
||||
return CVMX_CMD_QUEUE_INVALID_PARAM;
|
||||
}
|
||||
CVMX_SYNCWS;
|
||||
@ -275,11 +296,18 @@ int cvmx_cmd_queue_length(cvmx_cmd_queue_id_t queue_id)
|
||||
// FIXME: Implement other lengths
|
||||
return 0;
|
||||
case CVMX_CMD_QUEUE_DMA_BASE:
|
||||
if (octeon_has_feature(OCTEON_FEATURE_NPEI))
|
||||
{
|
||||
cvmx_npei_dmax_counts_t dmax_counts;
|
||||
dmax_counts.u64 = cvmx_read_csr(CVMX_PEXP_NPEI_DMAX_COUNTS(queue_id & 0x7));
|
||||
return dmax_counts.s.dbell;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvmx_dpi_dmax_counts_t dmax_counts;
|
||||
dmax_counts.u64 = cvmx_read_csr(CVMX_DPI_DMAX_COUNTS(queue_id & 0x7));
|
||||
return dmax_counts.s.dbell;
|
||||
}
|
||||
case CVMX_CMD_QUEUE_END:
|
||||
return CVMX_CMD_QUEUE_INVALID_PARAM;
|
||||
}
|
||||
@ -289,7 +317,7 @@ int cvmx_cmd_queue_length(cvmx_cmd_queue_id_t queue_id)
|
||||
|
||||
/**
|
||||
* Return the command buffer to be written to. The purpose of this
|
||||
* function is to allow CVMX routine access t othe low level buffer
|
||||
* function is to allow CVMX routine access to the low level buffer
|
||||
* for initial hardware setup. User applications should not call this
|
||||
* function directly.
|
||||
*
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,6 +42,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
@ -60,7 +62,7 @@
|
||||
* commands.
|
||||
*
|
||||
* Even though most software will never directly interact with
|
||||
* cvmx-cmd-queue, knowledge of its internal working can help
|
||||
* cvmx-cmd-queue, knowledge of its internal workings can help
|
||||
* in diagnosing performance problems and help with debugging.
|
||||
*
|
||||
* Command queue pointers are stored in a global named block
|
||||
@ -86,16 +88,17 @@
|
||||
* internal cycle counter to completely eliminate any causes of
|
||||
* bus traffic.
|
||||
*
|
||||
* <hr> $Revision: 42150 $ <hr>
|
||||
* <hr> $Revision: 50049 $ <hr>
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_CMD_QUEUE_H__
|
||||
#define __CVMX_CMD_QUEUE_H__
|
||||
|
||||
#ifndef CVMX_DONT_INCLUDE_CONFIG
|
||||
#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL)
|
||||
#include "executive-config.h"
|
||||
#include "cvmx-config.h"
|
||||
#endif
|
||||
|
||||
#include "cvmx-fpa.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -130,7 +133,7 @@ typedef enum
|
||||
} cvmx_cmd_queue_id_t;
|
||||
|
||||
/**
|
||||
* Command write operations can fail if the comamnd queue needs
|
||||
* Command write operations can fail if the command queue needs
|
||||
* a new buffer and the associated FPA pool is empty. It can also
|
||||
* fail if the number of queued command words reaches the maximum
|
||||
* set at initialization.
|
||||
@ -153,14 +156,14 @@ typedef struct
|
||||
uint64_t base_ptr_div128: 29; /**< Top of command buffer pointer shifted 7 */
|
||||
uint64_t unused2 : 6;
|
||||
uint64_t pool_size_m1 : 13; /**< FPA buffer size in 64bit words minus 1 */
|
||||
uint64_t index : 13; /**< Number of comamnds already used in buffer */
|
||||
uint64_t index : 13; /**< Number of commands already used in buffer */
|
||||
} __cvmx_cmd_queue_state_t;
|
||||
|
||||
/**
|
||||
* This structure contains the global state of all comamnd queues.
|
||||
* This structure contains the global state of all command queues.
|
||||
* It is stored in a bootmem named block and shared by all
|
||||
* applications running on Octeon. Tickets are stored in a differnet
|
||||
* cahce line that queue information to reduce the contention on the
|
||||
* applications running on Octeon. Tickets are stored in a different
|
||||
* cache line that queue information to reduce the contention on the
|
||||
* ll/sc used to get a ticket. If this is not the case, the update
|
||||
* of queue state causes the ll/sc to fail quite often.
|
||||
*/
|
||||
@ -209,7 +212,7 @@ int cvmx_cmd_queue_length(cvmx_cmd_queue_id_t queue_id);
|
||||
|
||||
/**
|
||||
* Return the command buffer to be written to. The purpose of this
|
||||
* function is to allow CVMX routine access t othe low level buffer
|
||||
* function is to allow CVMX routine access to the low level buffer
|
||||
* for initial hardware setup. User applications should not call this
|
||||
* function directly.
|
||||
*
|
||||
@ -292,8 +295,12 @@ static inline void __cvmx_cmd_queue_lock(cvmx_cmd_queue_id_t queue_id, __cvmx_cm
|
||||
*/
|
||||
static inline void __cvmx_cmd_queue_unlock(__cvmx_cmd_queue_state_t *qptr)
|
||||
{
|
||||
qptr->now_serving++;
|
||||
CVMX_SYNCWS;
|
||||
uint8_t ns;
|
||||
|
||||
ns = qptr->now_serving + 1;
|
||||
CVMX_SYNCWS; /* Order queue manipulation with respect to the unlock. */
|
||||
qptr->now_serving = ns;
|
||||
CVMX_SYNCWS; /* nudge out the unlock. */
|
||||
}
|
||||
|
||||
|
||||
@ -320,7 +327,7 @@ static inline __cvmx_cmd_queue_state_t *__cvmx_cmd_queue_get_state(cvmx_cmd_queu
|
||||
|
||||
/**
|
||||
* Write an arbitrary number of command words to a command queue.
|
||||
* This is a generic function; the fixed number of comamnd word
|
||||
* This is a generic function; the fixed number of command word
|
||||
* functions yield higher performance.
|
||||
*
|
||||
* @param queue_id Hardware command queue to write to
|
||||
@ -329,7 +336,7 @@ static inline __cvmx_cmd_queue_state_t *__cvmx_cmd_queue_get_state(cvmx_cmd_queu
|
||||
* updates. If you don't use this locking you must ensure
|
||||
* exclusivity some other way. Locking is strongly recommended.
|
||||
* @param cmd_count Number of command words to write
|
||||
* @param cmds Array of comamnds to write
|
||||
* @param cmds Array of commands to write
|
||||
*
|
||||
* @return CVMX_CMD_QUEUE_SUCCESS or a failure code
|
||||
*/
|
||||
@ -377,7 +384,7 @@ static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write(cvmx_cmd_queue_id_t q
|
||||
{
|
||||
uint64_t *ptr;
|
||||
int count;
|
||||
/* We need a new comamnd buffer. Fail if there isn't one available */
|
||||
/* We need a new command buffer. Fail if there isn't one available */
|
||||
uint64_t *new_buffer = (uint64_t *)cvmx_fpa_alloc(qptr->fpa_pool);
|
||||
if (cvmx_unlikely(new_buffer == NULL))
|
||||
{
|
||||
@ -466,7 +473,7 @@ static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write2(cvmx_cmd_queue_id_t
|
||||
/* Figure out how many command words will fit in this buffer. One
|
||||
location will be needed for the next buffer pointer */
|
||||
int count = qptr->pool_size_m1 - qptr->index;
|
||||
/* We need a new comamnd buffer. Fail if there isn't one available */
|
||||
/* We need a new command buffer. Fail if there isn't one available */
|
||||
uint64_t *new_buffer = (uint64_t *)cvmx_fpa_alloc(qptr->fpa_pool);
|
||||
if (cvmx_unlikely(new_buffer == NULL))
|
||||
{
|
||||
@ -557,7 +564,7 @@ static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write3(cvmx_cmd_queue_id_t
|
||||
/* Figure out how many command words will fit in this buffer. One
|
||||
location will be needed for the next buffer pointer */
|
||||
int count = qptr->pool_size_m1 - qptr->index;
|
||||
/* We need a new comamnd buffer. Fail if there isn't one available */
|
||||
/* We need a new command buffer. Fail if there isn't one available */
|
||||
uint64_t *new_buffer = (uint64_t *)cvmx_fpa_alloc(qptr->fpa_pool);
|
||||
if (cvmx_unlikely(new_buffer == NULL))
|
||||
{
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,12 +42,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Interface to the EBH-30xx specific devices
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1,39 +1,40 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
@ -41,6 +42,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CVMX_CN3010_EVB_HS5_H__
|
||||
#define __CVMX_CN3010_EVB_HS5_H__
|
||||
|
||||
@ -49,7 +51,7 @@
|
||||
*
|
||||
* Interface to the EBH-30xx specific devices
|
||||
*
|
||||
* <hr>$Revision: 41586 $<hr>
|
||||
* <hr>$Revision: 49448 $<hr>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1,42 +1,44 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
#include "cvmx.h"
|
||||
#include "cvmx-sysinfo.h"
|
||||
#include "cvmx-compactflash.h"
|
||||
@ -49,20 +51,20 @@
|
||||
/**
|
||||
* Convert nanosecond based time to setting used in the
|
||||
* boot bus timing register, based on timing multiple
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static uint32_t ns_to_tim_reg(int tim_mult, uint32_t nsecs)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
/* Compute # of eclock periods to get desired duration in nanoseconds */
|
||||
val = FLASH_RoundUP(nsecs * (cvmx_sysinfo_get()->cpu_clock_hz/1000000), 1000);
|
||||
|
||||
val = FLASH_RoundUP(nsecs * (cvmx_clock_get_rate(CVMX_CLOCK_SCLK)/1000000), 1000);
|
||||
|
||||
/* Factor in timing multiple, if not 1 */
|
||||
if (tim_mult != 1)
|
||||
val = FLASH_RoundUP(val, tim_mult);
|
||||
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
@ -86,7 +88,7 @@ uint64_t cvmx_compactflash_generate_dma_tim(int tim_mult, uint16_t *ident_data,
|
||||
return 0;
|
||||
|
||||
word53_field_valid = ident_data[53];
|
||||
word63_mwdma = ident_data[63];
|
||||
word63_mwdma = ident_data[63];
|
||||
word163_adv_timing_info = ident_data[163];
|
||||
|
||||
dma_tim.u64 = 0;
|
||||
@ -146,31 +148,31 @@ uint64_t cvmx_compactflash_generate_dma_tim(int tim_mult, uint16_t *ident_data,
|
||||
To = 80;
|
||||
Td = 55;
|
||||
Tkr = 20;
|
||||
|
||||
|
||||
oe_a = Td + 20; // Td (Seem to need more margin here....
|
||||
oe_n = MAX(To - oe_a, Tkr); // Tkr from cf spec, lengthened to meet To
|
||||
|
||||
|
||||
// oe_n + oe_h must be >= To (cycle time)
|
||||
dma_acks = 0; //Ti
|
||||
dma_ackh = 5; // Tj
|
||||
|
||||
|
||||
dma_arq = 8; // not spec'ed, value in eclocks, not affected by tim_mult
|
||||
pause = 25 - dma_arq * 1000/(cvmx_sysinfo_get()->cpu_clock_hz/1000000); // Tz
|
||||
pause = 25 - dma_arq * 1000/(cvmx_clock_get_rate(CVMX_CLOCK_SCLK)/1000000); // Tz
|
||||
break;
|
||||
case 3:
|
||||
To = 100;
|
||||
Td = 65;
|
||||
Tkr = 20;
|
||||
|
||||
|
||||
oe_a = Td + 20; // Td (Seem to need more margin here....
|
||||
oe_n = MAX(To - oe_a, Tkr); // Tkr from cf spec, lengthened to meet To
|
||||
|
||||
|
||||
// oe_n + oe_h must be >= To (cycle time)
|
||||
dma_acks = 0; //Ti
|
||||
dma_ackh = 5; // Tj
|
||||
|
||||
|
||||
dma_arq = 8; // not spec'ed, value in eclocks, not affected by tim_mult
|
||||
pause = 25 - dma_arq * 1000/(cvmx_sysinfo_get()->cpu_clock_hz/1000000); // Tz
|
||||
pause = 25 - dma_arq * 1000/(cvmx_clock_get_rate(CVMX_CLOCK_SCLK)/1000000); // Tz
|
||||
break;
|
||||
case 2:
|
||||
// +20 works
|
||||
@ -190,11 +192,11 @@ uint64_t cvmx_compactflash_generate_dma_tim(int tim_mult, uint16_t *ident_data,
|
||||
// oe_n + oe_h must be >= To (cycle time)
|
||||
dma_acks = 0 + 20; //Ti
|
||||
dma_ackh = 5; // Tj
|
||||
|
||||
|
||||
dma_arq = 8; // not spec'ed, value in eclocks, not affected by tim_mult
|
||||
pause = 25 - dma_arq * 1000/(cvmx_sysinfo_get()->cpu_clock_hz/1000000); // Tz
|
||||
pause = 25 - dma_arq * 1000/(cvmx_clock_get_rate(CVMX_CLOCK_SCLK)/1000000); // Tz
|
||||
// no fudge needed on pause
|
||||
|
||||
|
||||
break;
|
||||
case 1:
|
||||
case 0:
|
||||
@ -206,24 +208,24 @@ uint64_t cvmx_compactflash_generate_dma_tim(int tim_mult, uint16_t *ident_data,
|
||||
|
||||
if (mwdma_mode_ptr)
|
||||
*mwdma_mode_ptr = mwdma_mode;
|
||||
|
||||
|
||||
dma_tim.s.dmack_pi = 1;
|
||||
|
||||
|
||||
dma_tim.s.oe_n = ns_to_tim_reg(tim_mult, oe_n);
|
||||
dma_tim.s.oe_a = ns_to_tim_reg(tim_mult, oe_a);
|
||||
|
||||
|
||||
dma_tim.s.dmack_s = ns_to_tim_reg(tim_mult, dma_acks);
|
||||
dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh);
|
||||
|
||||
dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh);
|
||||
|
||||
dma_tim.s.dmarq = dma_arq;
|
||||
dma_tim.s.pause = ns_to_tim_reg(tim_mult, pause);
|
||||
|
||||
|
||||
dma_tim.s.rd_dly = 0; /* Sample right on edge */
|
||||
|
||||
|
||||
/* writes only */
|
||||
dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
|
||||
dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
|
||||
|
||||
|
||||
#if 0
|
||||
cvmx_dprintf("ns to ticks (mult %d) of %d is: %d\n", TIM_MULT, 60, ns_to_tim_reg(60));
|
||||
cvmx_dprintf("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: %d, dmarq: %d, pause: %d\n",
|
||||
@ -335,7 +337,7 @@ void cvmx_compactflash_set_piomode(int cs0, int cs1, int pio_mode)
|
||||
break;
|
||||
}
|
||||
/* Convert times in ns to clock cycles, rounding up */
|
||||
clocks_us = FLASH_RoundUP((uint64_t)cvmx_sysinfo_get()->cpu_clock_hz, 1000000);
|
||||
clocks_us = FLASH_RoundUP(cvmx_clock_get_rate(CVMX_CLOCK_SCLK), 1000000);
|
||||
|
||||
/* Convert times in clock cycles, rounding up. Octeon parameters are in
|
||||
minus one notation, so take off one after the conversion */
|
||||
|
@ -1,43 +1,45 @@
|
||||
/***********************license start***************
|
||||
* Copyright (c) 2008 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
*
|
||||
* * Neither the name of Cavium Networks nor the names of
|
||||
* its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
|
||||
* OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
|
||||
* RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
|
||||
* REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
|
||||
* DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
|
||||
* OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
|
||||
* POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
|
||||
* OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
*
|
||||
*
|
||||
* For any questions regarding licensing please contact marketing@caviumnetworks.com
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * 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.
|
||||
|
||||
* * Neither the name of Cavium Networks 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, including technical data, may be subject to U.S. export control
|
||||
* laws, including the U.S. Export Administration Act and its associated
|
||||
* regulations, and may be subject to export or import regulations in other
|
||||
* countries.
|
||||
|
||||
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
|
||||
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
|
||||
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
|
||||
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
|
||||
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
|
||||
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
|
||||
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
|
||||
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
|
||||
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
|
||||
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
|
||||
***********************license end**************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CVMX_COMPACTFLASH_H__
|
||||
#define __CVMX_COMPACTFLASH_H__
|
||||
#ifdef __cplusplus
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user