Merge ^/head r278756 through r278915.

This commit is contained in:
Dimitry Andric 2015-02-17 19:53:41 +00:00
commit 714e3c812d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang360-import/; revision=278916
270 changed files with 18480 additions and 8867 deletions

View File

@ -929,7 +929,7 @@ packageworld:
@${DESTDIR}/${DISTDIR}/${dist}.debug.meta
. else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
tar cvJLf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
usr/lib/debug
. endif
.endfor

View File

@ -93,6 +93,8 @@ OLD_FILES+=usr/lib/clang/3.5.1/lib/freebsd/libclang_rt.ubsan_cxx-x86_64.a
OLD_DIRS+=usr/lib/clang/3.5.1/lib/freebsd
OLD_DIRS+=usr/lib/clang/3.5.1/lib
OLD_DIRS+=usr/lib/clang/3.5.1
# 20150217: Removed remnants of ar(4) driver
OLD_FILES+=usr/include/sys/dev/ic/hd64570.h
# 20150212: /usr/games moving into /usr/bin
OLD_FILES+=usr/games/bcd
OLD_FILES+=usr/games/caesar

View File

@ -29,7 +29,7 @@
.\" @(#)symlink.7 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$
.\"
.Dd January 23, 2015
.Dd February 16, 2015
.Dt SYMLINK 7
.Os
.Sh NAME
@ -146,6 +146,7 @@ The following system calls follow symbolic links
unless given the
.Dv AT_SYMLINK_NOFOLLOW
flag:
.Xr chflagsat 2 ,
.Xr fchmodat 2 ,
.Xr fchownat 2 ,
.Xr fstatat 2

View File

@ -4,99 +4,90 @@
jail_name_to_jid()
{
local check_name="$1"
(
line="$(jls -n 2> /dev/null | grep name=$check_name )"
for nv in $line; do
local name="${nv%=*}"
if [ "${name}" = "jid" ]; then
eval $nv
echo $jid
break
fi
done
)
jls -j "$check_name" -s 2>/dev/null | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g'
}
base=pkill_j_test
if [ `id -u` -ne 0 ]; then
echo "1..0 # skip Test needs uid 0."
exit 0
fi
echo "1..3"
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
name="pkill -j <jid>"
if [ `id -u` -eq 0 ]; then
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
sleep_amount=5
jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount &
jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount &
$sleep 5 &
sleep 0.5
$sleep $sleep_amount &
for i in `seq 1 10`; do
jid1=$(jail_name_to_jid ${base}_1_1)
jid2=$(jail_name_to_jid ${base}_1_2)
jid="${jid1},${jid2}"
if pkill -f -j "$jid" $sleep && sleep 0.5 &&
! -f ${PWD}/${base}_1_1.pid &&
! -f ${PWD}/${base}_1_2.pid ; then
echo "ok 1 - $name"
else
echo "not ok 1 - $name"
fi 2>/dev/null
rm -f $sleep
[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
wait
case "$jid" in
[0-9]+,[0-9]+)
break
;;
esac
sleep 0.1
done
if pkill -f -j "$jid" $sleep && sleep 0.5 &&
! -f ${PWD}/${base}_1_1.pid &&
! -f ${PWD}/${base}_1_2.pid ; then
echo "ok 1 - $name"
else
echo "ok 1 - $name # skip Test needs uid 0."
fi
echo "not ok 1 - $name"
fi 2>/dev/null
[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
wait
name="pkill -j any"
if [ `id -u` -eq 0 ]; then
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
sleep_amount=6
jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount &
jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount &
$sleep 5 &
sleep 0.5
chpid3=$!
if pkill -f -j any $sleep && sleep 0.5 &&
[ ! -f ${PWD}/${base}_2_1.pid -a
! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then
echo "ok 2 - $name"
else
echo "not ok 2 - $name"
fi 2>/dev/null
rm -f $sleep
[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
wait
$sleep $sleep_amount &
chpid3=$!
sleep 0.5
if pkill -f -j any $sleep && sleep 0.5 &&
[ ! -f ${PWD}/${base}_2_1.pid -a
! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then
echo "ok 2 - $name"
else
echo "ok 2 - $name # skip Test needs uid 0."
fi
echo "not ok 2 - $name"
fi 2>/dev/null
[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
wait
name="pkill -j none"
if [ `id -u` -eq 0 ]; then
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
daemon -p ${PWD}/${base}_3_1.pid $sleep 5
jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
sleep 1
if pkill -f -j none "$sleep 5" && sleep 1 &&
[ ! -f ${PWD}/${base}_3_1.pid -a -f ${PWD}/${base}_3_2.pid ] ; then
echo "ok 3 - $name"
else
ls ${PWD}/*.pid
echo "not ok 3 - $name"
fi 2>/dev/null
rm -f $sleep
[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid)
[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid)
sleep_amount=7
daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount
jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount &
sleep 1
if pkill -f -j none "$sleep $sleep_amount" && sleep 1 &&
[ ! -f ${PWD}/${base}_3_1.pid -a -f ${PWD}/${base}_3_2.pid ] ; then
echo "ok 3 - $name"
else
echo "ok 3 - $name # skip Test needs uid 0."
fi
ls ${PWD}/*.pid
echo "not ok 3 - $name"
fi 2>/dev/null
[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid)
[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid)
rm -f $sleep

View File

@ -122,7 +122,7 @@ cdcmd(int argc __unused, char **argv __unused)
(dest[0] == '.' && (dest[1] == '/' || dest[1] == '\0')) ||
(dest[0] == '.' && dest[1] == '.' && (dest[2] == '/' || dest[2] == '\0')) ||
(path = bltinlookup("CDPATH", 1)) == NULL)
path = nullstr;
path = "";
while ((p = padvance(&path, dest)) != NULL) {
if (stat(p, &statb) < 0) {
if (errno != ENOENT)
@ -182,7 +182,6 @@ cdlogical(char *dest)
struct stat statb;
int first;
int badstat;
size_t len;
/*
* Check each component of the path. If we find a symlink or
@ -190,9 +189,7 @@ cdlogical(char *dest)
* next time we get the value of the current directory.
*/
badstat = 0;
len = strlen(dest);
cdcomppath = stalloc(len + 1);
memcpy(cdcomppath, dest, len + 1);
cdcomppath = stsavestr(dest);
STARTSTACKSTR(p);
if (*dest == '/') {
STPUTC('/', p);
@ -277,7 +274,6 @@ findcwd(char *dir)
{
char *new;
char *p;
size_t len;
/*
* If our argument is NULL, we don't know the current directory
@ -286,9 +282,7 @@ findcwd(char *dir)
*/
if (dir == NULL || curdir == NULL)
return getpwd2();
len = strlen(dir);
cdcomppath = stalloc(len + 1);
memcpy(cdcomppath, dir, len + 1);
cdcomppath = stsavestr(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
STPUTS(curdir, new);

View File

@ -498,7 +498,7 @@ exphere(union node *redir, struct arglist *fn)
struct localvar *savelocalvars;
int need_longjmp = 0;
redir->nhere.expdoc = nullstr;
redir->nhere.expdoc = "";
savelocalvars = localvars;
localvars = NULL;
forcelocal++;

View File

@ -105,11 +105,12 @@ static void expbackq(union node *, int, int);
static int subevalvar(char *, char *, int, int, int, int, int);
static char *evalvar(char *, int);
static int varisset(const char *, int);
static void strtodest(const char *, int, int, int);
static void varvalue(const char *, int, int, int);
static void recordregion(int, int, int);
static void removerecordregions(int);
static void ifsbreakup(char *, struct arglist *);
static void expandmeta(struct strlist *, int);
static void expandmeta(struct strlist *);
static void expmeta(char *, char *);
static void addfname(char *);
static struct strlist *expsort(struct strlist *);
@ -175,7 +176,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
ifsbreakup(p, &exparg);
*exparg.lastp = NULL;
exparg.lastp = &exparg.list;
expandmeta(exparg.list, flag);
expandmeta(exparg.list);
} else {
sp = (struct strlist *)stalloc(sizeof (struct strlist));
sp->text = p;
@ -298,9 +299,9 @@ exptilde(char *p, int flag)
char c, *startp = p;
struct passwd *pw;
char *home;
int quotes = flag & (EXP_FULL | EXP_CASE);
while ((c = *p) != '\0') {
for (;;) {
c = *p;
switch(c) {
case CTLESC: /* This means CTL* are always considered quoted. */
case CTLVAR:
@ -311,31 +312,27 @@ exptilde(char *p, int flag)
case CTLQUOTEMARK:
return (startp);
case ':':
if (flag & EXP_VARTILDE)
goto done;
break;
if ((flag & EXP_VARTILDE) == 0)
break;
/* FALLTHROUGH */
case '\0':
case '/':
case CTLENDVAR:
goto done;
*p = '\0';
if (*(startp+1) == '\0') {
home = lookupvar("HOME");
} else {
pw = getpwnam(startp+1);
home = pw != NULL ? pw->pw_dir : NULL;
}
*p = c;
if (home == NULL || *home == '\0')
return (startp);
strtodest(home, flag, VSNORMAL, 1);
return (p);
}
p++;
}
done:
*p = '\0';
if (*(startp+1) == '\0') {
home = lookupvar("HOME");
} else {
pw = getpwnam(startp+1);
home = pw != NULL ? pw->pw_dir : NULL;
}
*p = c;
if (home == NULL || *home == '\0')
return (startp);
if (quotes)
STPUTS_QUOTES(home, DQSYNTAX, expdest);
else
STPUTS(home, expdest);
return (p);
}
@ -496,6 +493,17 @@ expbackq(union node *cmd, int quoted, int flag)
static void
recordleft(const char *str, const char *loc, char *startp)
{
int amount;
amount = ((str - 1) - (loc - startp)) - expdest;
STADJUST(amount, expdest);
while (loc != str - 1)
*startp++ = *loc++;
}
static int
subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
int varflags, int quotes)
@ -530,8 +538,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
error((char *)NULL);
}
error("%.*s: parameter %snot set", (int)(p - str - 1),
str, (varflags & VSNUL) ? "null or "
: nullstr);
str, (varflags & VSNUL) ? "null or " : "");
return 0;
case VSTRIMLEFT:
@ -540,7 +547,8 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
*loc = '\0';
if (patmatch(str, startp, quotes)) {
*loc = c;
goto recordleft;
recordleft(str, loc, startp);
return 1;
}
*loc = c;
if (quotes && *loc == CTLESC)
@ -554,7 +562,8 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
*loc = '\0';
if (patmatch(str, startp, quotes)) {
*loc = c;
goto recordleft;
recordleft(str, loc, startp);
return 1;
}
*loc = c;
loc--;
@ -602,13 +611,6 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
default:
abort();
}
recordleft:
amount = ((str - 1) - (loc - startp)) - expdest;
STADJUST(amount, expdest);
while (loc != str - 1)
*startp++ = *loc++;
return 1;
}
@ -633,6 +635,7 @@ evalvar(char *p, int flag)
int varlenb;
int easy;
int quotes = flag & (EXP_FULL | EXP_CASE);
int record;
varflags = (unsigned char)*p++;
subtype = varflags & VSTYPE;
@ -690,22 +693,15 @@ evalvar(char *p, int flag)
STADJUST(-varlenb, expdest);
}
} else {
char const *syntax = (varflags & VSQUOTE) ? DQSYNTAX
: BASESYNTAX;
if (subtype == VSLENGTH) {
for (;*val; val++)
if (!localeisutf8 ||
(*val & 0xC0) != 0x80)
varlen++;
}
else {
if (quotes)
STPUTS_QUOTES(val, syntax, expdest);
else
STPUTS(val, expdest);
}
else
strtodest(val, flag, subtype,
varflags & VSQUOTE);
}
}
@ -719,15 +715,11 @@ evalvar(char *p, int flag)
switch (subtype) {
case VSLENGTH:
expdest = cvtnum(varlen, expdest);
goto record;
record = 1;
break;
case VSNORMAL:
if (!easy)
break;
record:
recordregion(startloc, expdest - stackblock(),
varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' &&
(*var == '@' || *var == '*')));
record = easy;
break;
case VSPLUS:
@ -737,8 +729,7 @@ evalvar(char *p, int flag)
(varflags & VSQUOTE ? EXP_LIT_QUOTED : 0));
break;
}
if (easy)
goto record;
record = easy;
break;
case VSTRIMLEFT:
@ -760,7 +751,8 @@ evalvar(char *p, int flag)
}
/* Remove any recorded regions beyond start of variable */
removerecordregions(startloc);
goto record;
record = 1;
break;
case VSASSIGN:
case VSQUESTION:
@ -777,8 +769,7 @@ evalvar(char *p, int flag)
}
break;
}
if (easy)
goto record;
record = easy;
break;
case VSERROR:
@ -790,6 +781,11 @@ evalvar(char *p, int flag)
abort();
}
if (record)
recordregion(startloc, expdest - stackblock(),
varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' &&
(*var == '@' || *var == '*')));
if (subtype != VSNORMAL) { /* skip to end of alternative */
int nesting = 1;
for (;;) {
@ -1093,7 +1089,7 @@ static char expdir[PATH_MAX];
* The results are stored in the list exparg.
*/
static void
expandmeta(struct strlist *str, int flag __unused)
expandmeta(struct strlist *str)
{
char *p;
struct strlist **savelastp;
@ -1284,11 +1280,8 @@ addfname(char *name)
{
char *p;
struct strlist *sp;
size_t len;
len = strlen(name);
p = stalloc(len + 1);
memcpy(p, name, len + 1);
p = stsavestr(name);
sp = (struct strlist *)stalloc(sizeof *sp);
sp->text = p;
*exparg.lastp = sp;
@ -1478,16 +1471,14 @@ patmatch(const char *pattern, const char *string, int squoted)
endp = p;
if (*endp == '!' || *endp == '^')
endp++;
for (;;) {
do {
while (*endp == CTLQUOTEMARK)
endp++;
if (*endp == 0)
goto dft; /* no matching ] */
if (*endp == CTLESC)
endp++;
if (*++endp == ']')
break;
}
} while (*++endp != ']');
invert = 0;
if (*p == '!' || *p == '^') {
invert++;

View File

@ -85,7 +85,7 @@ chkmail(int silent)
setstackmark(&smark);
mpath = mpathset()? mpathval() : mailval();
for (i = 0 ; i < nmboxes ; i++) {
p = padvance(&mpath, nullstr);
p = padvance(&mpath, "");
if (p == NULL)
break;
if (*p == '\0')

View File

@ -180,6 +180,18 @@ stunalloc(pointer p)
}
char *
stsavestr(const char *s)
{
char *p;
size_t len;
len = strlen(s);
p = stalloc(len + 1);
memcpy(p, s, len + 1);
return p;
}
void
setstackmark(struct stackmark *mark)

View File

@ -52,6 +52,7 @@ void ckfree(pointer);
char *savestr(const char *);
pointer stalloc(int);
void stunalloc(pointer);
char *stsavestr(const char *);
void setstackmark(struct stackmark *);
void popstackmark(struct stackmark *);
char *growstackstr(void);

View File

@ -265,7 +265,7 @@ readcmd(int argc __unused, char **argv __unused)
/* Set any remaining args to "" */
while (*++ap != NULL)
setvar(*ap, nullstr, 0);
setvar(*ap, "", 0);
return status;
}

View File

@ -138,7 +138,7 @@ NXHERE nhere # fd<<!
fd int # file descriptor being redirected
next nodeptr # next redirection in list
doc nodeptr # input to command (NARG node)
expdoc temp char *expdoc # actual document (for NXHERE)
expdoc temp const char *expdoc # actual document (for NXHERE)
NNOT nnot # ! command (actually pipeline)
type int

View File

@ -1940,7 +1940,7 @@ getprompt(void *unused __unused)
*/
switch (whichprompt) {
case 0:
fmt = nullstr;
fmt = "";
break;
case 1:
fmt = ps1val();

View File

@ -48,6 +48,7 @@ FILES+= ifs1.0
FILES+= ifs2.0
FILES+= ifs3.0
FILES+= ifs4.0
FILES+= ifs5.0
FILES+= length1.0
FILES+= length2.0
FILES+= length3.0
@ -62,6 +63,7 @@ FILES+= pathname1.0
FILES+= pathname2.0
FILES+= pathname3.0
FILES+= pathname4.0
FILES+= pathname5.0
FILES+= plus-minus1.0
FILES+= plus-minus2.0
FILES+= plus-minus3.0

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -- $(echo a b c d)
[ "$#" = 4 ]

View File

@ -0,0 +1,3 @@
# $FreeBSD$
[ `echo '/[e]tc'` = /etc ]

View File

@ -872,7 +872,7 @@ unsetvar(const char *s)
if (vp->flags & VREADONLY)
return (1);
if (vp->text[vp->name_len + 1] != '\0')
setvar(s, nullstr, 0);
setvar(s, "", 0);
if ((vp->flags & VEXPORT) && localevar(vp->text)) {
change_env(s, 0);
setlocale(LC_ALL, "");

View File

@ -40,7 +40,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: addr2line.c 2185 2011-11-19 16:07:16Z jkoshy $");
ELFTC_VCSID("$Id: addr2line.c 3148 2015-02-15 18:47:39Z emaste $");
static struct option longopts[] = {
{"target" , required_argument, NULL, 'b'},

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: _elftc.h 2922 2013-03-17 22:53:15Z kaiwang27 $
* $Id: _elftc.h 3139 2015-01-05 03:17:06Z kaiwang27 $
*/
/**
@ -76,10 +76,17 @@
* SUCH DAMAGE.
*/
#ifndef LIST_FOREACH_SAFE
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef SLIST_FOREACH_SAFE
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
#endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: elfdefinitions.h 3110 2014-12-20 08:32:46Z kaiwang27 $
* $Id: elfdefinitions.h 3149 2015-02-15 19:00:06Z emaste $
*/
/*
@ -1395,6 +1395,12 @@ _ELF_DEFINE_RELOC(R_386_PC16, 21) \
_ELF_DEFINE_RELOC(R_386_8, 22) \
_ELF_DEFINE_RELOC(R_386_PC8, 23)
/*
*/
#define _ELF_DEFINE_AARCH64_RELOCATIONS() \
_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \
_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \
/*
* These are the symbols used in the Sun ``Linkers and Loaders
* Guide'', Document No: 817-1984-17. See the X86_64 relocations list
@ -1962,6 +1968,7 @@ _ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37)
#define _ELF_DEFINE_RELOCATIONS() \
_ELF_DEFINE_386_RELOCATIONS() \
_ELF_DEFINE_AARCH64_RELOCATIONS() \
_ELF_DEFINE_AMD64_RELOCATIONS() \
_ELF_DEFINE_ARM_RELOCATIONS() \
_ELF_DEFINE_IA64_RELOCATIONS() \

View File

@ -40,7 +40,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: main.c 3111 2014-12-20 08:33:01Z kaiwang27 $");
ELFTC_VCSID("$Id: main.c 3156 2015-02-15 21:40:01Z emaste $");
enum options
{

View File

@ -35,7 +35,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: sections.c 3134 2014-12-23 10:43:59Z kaiwang27 $");
ELFTC_VCSID("$Id: sections.c 3150 2015-02-15 19:07:46Z emaste $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: _libdwarf.h 3106 2014-12-19 16:00:58Z kaiwang27 $
* $Id: _libdwarf.h 3161 2015-02-15 21:43:36Z emaste $
*/
#ifndef __LIBDWARF_H_

View File

@ -26,7 +26,7 @@
#include "_libdwarf.h"
ELFTC_VCSID("$Id: dwarf_attrval.c 2977 2014-01-21 20:13:31Z kaiwang27 $");
ELFTC_VCSID("$Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste $");
int
dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err)

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_AT_name.3 2071 2011-10-27 03:20:00Z jkoshy $
.\" $Id: dwarf_get_AT_name.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd April 22, 2011
.Os

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_arange_info.3 2134 2011-11-10 08:40:14Z jkoshy $
.\" $Id: dwarf_get_arange_info.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd April 16, 2011
.Os

View File

@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_section_max_offsets.3 3098 2014-09-02 22:18:29Z kaiwang27 $
.\" $Id: dwarf_get_section_max_offsets.3 3141 2015-01-29 23:11:10Z jkoshy $
.\"
.Dd July 27, 2014
.Dd December 21, 2014
.Os
.Dt DWARF_GET_SECTION_MAX_OFFSETS
.Sh NAME
@ -101,7 +101,7 @@ is identical to function
.Fn dwarf_get_section_max_offsets_b
except that it does not provide argument
.Ar debug_types ,
thus it can not retrieve the size of the
and thus cannot return the size of the
.Dq \&.debug_types
section.
.Sh RETURN VALUES

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_hasattr.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_hasattr.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd April 17, 2010
.Os

View File

@ -26,7 +26,7 @@
#include "_libdwarf.h"
ELFTC_VCSID("$Id: dwarf_reloc.c 2075 2011-10-27 03:47:28Z jkoshy $");
ELFTC_VCSID("$Id: dwarf_reloc.c 3161 2015-02-15 21:43:36Z emaste $");
int
dwarf_set_reloc_application(int apply)

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_set_reloc_application.3 2075 2011-10-27 03:47:28Z jkoshy $
.\" $Id: dwarf_set_reloc_application.3 3161 2015-02-15 21:43:36Z emaste $
.\"
.Dd February 11, 2015
.Os

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_whatattr.3 2075 2011-10-27 03:47:28Z jkoshy $
.\" $Id: dwarf_whatattr.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd May 22, 2010
.Os

View File

@ -26,7 +26,7 @@
#include "_libdwarf.h"
ELFTC_VCSID("$Id: libdwarf.c 2070 2011-10-27 03:05:32Z jkoshy $");
ELFTC_VCSID("$Id: libdwarf.c 3161 2015-02-15 21:43:36Z emaste $");
struct _libdwarf_globals _libdwarf = {
.errhand = NULL,

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: libdwarf.h 3064 2014-06-06 19:35:55Z kaiwang27 $
* $Id: libdwarf.h 3149 2015-02-15 19:00:06Z emaste $
*/
#ifndef _LIBDWARF_H_

View File

@ -26,7 +26,7 @@
#include "_libdwarf.h"
ELFTC_VCSID("$Id: libdwarf_elf_init.c 2972 2013-12-23 06:46:04Z kaiwang27 $");
ELFTC_VCSID("$Id: libdwarf_elf_init.c 3161 2015-02-15 21:43:36Z emaste $");
static const char *debug_name[] = {
".debug_abbrev",

View File

@ -26,7 +26,7 @@
#include "_libdwarf.h"
ELFTC_VCSID("$Id: libdwarf_reloc.c 2948 2013-05-30 21:25:52Z kaiwang27 $");
ELFTC_VCSID("$Id: libdwarf_reloc.c 3149 2015-02-15 19:00:06Z emaste $");
Dwarf_Unsigned
_dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: _libelf_config.h 2287 2011-12-04 06:45:47Z jkoshy $
* $Id: _libelf_config.h 3143 2015-02-15 17:57:38Z emaste $
*/
#ifdef __DragonFly__

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf.3 3082 2014-07-28 09:13:33Z jkoshy $
.\" $Id: elf.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd July 28, 2014
.Os

View File

@ -37,7 +37,7 @@
#include "_libelf.h"
ELFTC_VCSID("$Id: elf_scn.c 3013 2014-03-23 06:16:59Z jkoshy $");
ELFTC_VCSID("$Id: elf_scn.c 3147 2015-02-15 18:45:23Z emaste $");
/*
* Load an ELF section table and create a list of Elf_Scn structures.

View File

@ -34,7 +34,7 @@
#include "_libelf.h"
#include "_libelf_ar.h"
ELFTC_VCSID("$Id: libelf_ar_util.c 3013 2014-03-23 06:16:59Z jkoshy $");
ELFTC_VCSID("$Id: libelf_ar_util.c 3157 2015-02-15 21:42:02Z emaste $");
/*
* Convert a string bounded by `start' and `start+sz' (exclusive) to a
@ -278,7 +278,6 @@ _libelf_ar_open(Elf *e, int reporterror)
* Handle special archive members for the SVR4 format.
*/
if (arh.ar_name[0] == '/') {
if (sz == 0)
goto error;

View File

@ -32,7 +32,7 @@
#include "_libelf.h"
ELFTC_VCSID("$Id: libelf_convert.m4 3009 2014-03-23 01:49:59Z jkoshy $");
ELFTC_VCSID("$Id: libelf_convert.m4 3158 2015-02-15 21:42:07Z emaste $");
/* WARNING: GENERATED FROM __file__. */

View File

@ -22,9 +22,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: nm.1 2377 2012-01-03 07:10:59Z jkoshy $
.\" $Id: nm.1 3145 2015-02-15 18:04:37Z emaste $
.\"
.Dd January 8, 2015
.Dd February 15, 2015
.Os
.Dt NM 1
.Sh NAME

View File

@ -48,7 +48,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: nm.c 3124 2014-12-21 05:46:28Z kaiwang27 $");
ELFTC_VCSID("$Id: nm.c 3145 2015-02-15 18:04:37Z emaste $");
/* symbol information list */
STAILQ_HEAD(sym_head, sym_entry);

View File

@ -47,7 +47,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: readelf.c 3110 2014-12-20 08:32:46Z kaiwang27 $");
ELFTC_VCSID("$Id: readelf.c 3155 2015-02-15 19:15:57Z emaste $");
/*
* readelf(1) options.
@ -1503,7 +1503,8 @@ r_type(unsigned int mach, unsigned int type)
static const char *
note_type(const char *name, unsigned int et, unsigned int nt)
{
if (strcmp(name, "CORE") == 0 && et == ET_CORE)
if ((strcmp(name, "CORE") == 0 || strcmp(name, "LINUX") == 0) &&
et == ET_CORE)
return note_type_linux_core(nt);
else if (strcmp(name, "FreeBSD") == 0)
if (et == ET_CORE)
@ -1559,13 +1560,27 @@ note_type_linux_core(unsigned int nt)
case 1: return "NT_PRSTATUS (Process status)";
case 2: return "NT_FPREGSET (Floating point information)";
case 3: return "NT_PRPSINFO (Process information)";
case 4: return "NT_TASKSTRUCT (Task structure)";
case 6: return "NT_AUXV (Auxiliary vector)";
case 0x46E62B7FUL: return "NT_PRXFPREG (Linux user_xfpregs structure)";
case 10: return "NT_PSTATUS (Linux process status)";
case 12: return "NT_FPREGS (Linux floating point regset)";
case 13: return "NT_PSINFO (Linux process information)";
case 16: return "NT_LWPSTATUS (Linux lwpstatus_t type)";
case 17: return "NT_LWPSINFO (Linux lwpinfo_t type)";
case 18: return "NT_WIN32PSTATUS (win32_pstatus structure)";
case 0x100: return "NT_PPC_VMX (ppc Altivec registers)";
case 0x102: return "NT_PPC_VSX (ppc VSX registers)";
case 0x202: return "NT_X86_XSTATE (x86 XSAVE extended state)";
case 0x300: return "NT_S390_HIGH_GPRS (s390 upper register halves)";
case 0x301: return "NT_S390_TIMER (s390 timer register)";
case 0x302: return "NT_S390_TODCMP (s390 TOD comparator register)";
case 0x303: return "NT_S390_TODPREG (s390 TOD programmable register)";
case 0x304: return "NT_S390_CTRS (s390 control registers)";
case 0x305: return "NT_S390_PREFIX (s390 prefix register)";
case 0x400: return "NT_ARM_VFP (arm VFP registers)";
case 0x46494c45UL: return "NT_FILE (mapped files)";
case 0x46E62B7FUL: return "NT_PRXFPREG (Linux user_xfpregs structure)";
case 0x53494749UL: return "NT_SIGINFO (siginfo_t data)";
default: return (note_type_unknown(nt));
}
}
@ -1605,7 +1620,8 @@ note_type_unknown(unsigned int nt)
{
static char s_nt[32];
snprintf(s_nt, sizeof(s_nt), "<unknown: %u>", nt);
snprintf(s_nt, sizeof(s_nt),
nt >= 0x100 ? "<unknown: 0x%x>" : "<unknown: %u>", nt);
return (s_nt);
}
@ -3154,6 +3170,10 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
warnx("gelf_getrel failed: %s", elf_errmsg(-1));
continue;
}
if (s->link >= re->shnum) {
warnx("invalid section link index %u", s->link);
continue;
}
symname = get_symbol_name(re, s->link, GELF_R_SYM(r.r_info));
symval = get_symbol_value(re, s->link, GELF_R_SYM(r.r_info));
if (re->ec == ELFCLASS32) {
@ -3206,6 +3226,10 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
warnx("gelf_getrel failed: %s", elf_errmsg(-1));
continue;
}
if (s->link >= re->shnum) {
warnx("invalid section link index %u", s->link);
continue;
}
symname = get_symbol_name(re, s->link, GELF_R_SYM(r.r_info));
symval = get_symbol_value(re, s->link, GELF_R_SYM(r.r_info));
if (re->ec == ELFCLASS32) {
@ -4219,14 +4243,22 @@ dump_attributes(struct readelf *re)
len = d->d_size - 1;
p++;
while (len > 0) {
if (len < 4) {
warnx("truncated attribute section length");
break;
}
seclen = re->dw_decode(&p, 4);
if (seclen > len) {
warnx("invalid attribute section length");
break;
}
len -= seclen;
printf("Attribute Section: %s\n", (char *) p);
nlen = strlen((char *) p) + 1;
if (nlen + 4 > seclen) {
warnx("invalid attribute section name");
break;
}
printf("Attribute Section: %s\n", (char *) p);
p += nlen;
seclen -= nlen + 4;
while (seclen > 0) {
@ -6696,10 +6728,8 @@ load_sections(struct readelf *re)
return;
}
if ((scn = elf_getscn(re->elf, 0)) == NULL) {
warnx("elf_getscn failed: %s", elf_errmsg(-1));
if ((scn = elf_getscn(re->elf, 0)) == NULL)
return;
}
(void) elf_errno();
do {

View File

@ -1395,8 +1395,11 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
}
// If there are no section headers we are done.
if (header.e_shnum == 0)
if (header.e_shnum == 0) {
if (arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS)
arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
return 0;
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_MODULES));

View File

@ -32,7 +32,7 @@
.\" @(#) dlopen.3 1.6 90/01/31 SMI
.\" $FreeBSD$
.\"
.Dd December 21, 2011
.Dd February 14, 2015
.Dt DLOPEN 3
.Os
.Sh NAME
@ -236,7 +236,7 @@ as follows, in the given order:
The referencing object itself (or the object from which the call to
.Fn dlsym
is made), if that object was linked using the
.Fl Wsymbolic
.Fl Bsymbolic
option to
.Xr ld 1 .
.It

View File

@ -181,7 +181,7 @@ fstabscan(void)
if (cp != NULL)
_fs_fstab.fs_passno = atoi(cp);
}
strcpy(subline, _fs_fstab.fs_mntops);
(void)strlcpy(subline, _fs_fstab.fs_mntops, sizeof(subline));
p = subline;
for (typexx = 0, cp = strsep(&p, ","); cp;
cp = strsep(&p, ",")) {

View File

@ -1450,7 +1450,7 @@ compat_group(void *retval, void *mdata, va_list ap)
pos = ftello(st->fp);
}
fin:
if (!stayopen && st->fp != NULL) {
if (st->fp != NULL && !stayopen) {
fclose(st->fp);
st->fp = NULL;
}

View File

@ -815,7 +815,7 @@ files_passwd(void *retval, void *mdata, va_list ap)
size_t bufsize, namesize;
uid_t uid;
uint32_t store;
int rv, stayopen, *errnop;
int rv, stayopen = 0, *errnop;
name = NULL;
uid = (uid_t)-1;

View File

@ -40,7 +40,7 @@ ulimit(int cmd, ...)
{
struct rlimit limit;
va_list ap;
long arg;
rlim_t arg;
if (cmd == UL_GETFSIZE) {
if (getrlimit(RLIMIT_FSIZE, &limit) == -1)
@ -53,14 +53,16 @@ ulimit(int cmd, ...)
va_start(ap, cmd);
arg = va_arg(ap, long);
va_end(ap);
limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512;
if (arg < 0)
arg = LONG_MAX;
if (arg > RLIM_INFINITY / 512)
arg = RLIM_INFINITY / 512;
limit.rlim_max = limit.rlim_cur = arg * 512;
/* The setrlimit() function sets errno to EPERM if needed. */
if (setrlimit(RLIMIT_FSIZE, &limit) == -1)
return (-1);
if (arg * 512 > LONG_MAX)
return (LONG_MAX);
return (arg);
return ((long)arg);
} else {
errno = EINVAL;
return (-1);

View File

@ -271,7 +271,7 @@ void _malloc_first_thread(void);
/*
* Function to clean up streams, called from abort() and exit().
*/
void (*__cleanup)(void) __hidden;
extern void (*__cleanup)(void) __hidden;
/*
* Get kern.osreldate to detect ABI revisions. Explicitly

View File

@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \
CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu
MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S
MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o

View File

@ -29,7 +29,8 @@ __FBSDID("$FreeBSD$");
#include "SYS.h"
_SYSENTRY(sigaction)
WEAK_REFERENCE(__sys_sigaction, _sigaction)
ENTRY(__sys_sigaction)
PIC_PROLOGUE(%o3, %o4)
SET(sigcode_installed, %o4, %o3)
lduw [%o3], %o4
@ -44,6 +45,6 @@ _SYSENTRY(sigaction)
1: _SYSCALL(sigaction)
retl
nop
_SYSEND(sigaction)
END(__sys_sigaction)
.comm sigcode_installed, 4, 4

View File

@ -65,7 +65,6 @@ INTERPOSED = \
sendmsg \
sendto \
setcontext \
sigaction \
sigprocmask \
sigsuspend \
sigtimedwait \
@ -76,6 +75,13 @@ INTERPOSED = \
write \
writev
.if ${MACHINE_CPUARCH} == "sparc64"
SRCS+= sigaction.c
NOASM+= sigaction.o
.else
INTERPOSED+= sigaction
.endif
SRCS+= ${INTERPOSED:S/$/.c/}
NOASM+= ${INTERPOSED:S/$/.o/}
PSEUDO+= ${INTERPOSED:C/^.*$/_&.o/}

View File

@ -332,10 +332,10 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
perror(hp->h_name);
return (-1);
}
if (fd2p == 0) {
(void) write(s, "", 1);
port = 0;
} else {
port = 0;
if (fd2p == 0)
(void) write(s, "", 1);
else {
char num[8];
int s2, sin2len;

View File

@ -6,5 +6,5 @@
const char *
elftc_version(void)
{
return "elftoolchain r3136M";
return "elftoolchain r3163M";
}

View File

@ -26,6 +26,7 @@
#define HAVE_ENCODER_SPARC 1
#define HAVE_ENCODER_X86 1
#define HAVE_FCNTL_H 1
#define HAVE_FUTIMENS 1
#define HAVE_FUTIMES 1
#define HAVE_GETOPT_H 1
#define HAVE_GETOPT_LONG 1

View File

@ -843,6 +843,7 @@ MAN+= \
udbp.4 \
udp.4 \
udplite.4 \
udl.4 \
uep.4 \
ufm.4 \
ufoma.4 \

67
share/man/man4/udl.4 Normal file
View File

@ -0,0 +1,67 @@
.\" $OpenBSD: udl.4,v 1.20 2012/09/18 17:11:41 jasper Exp $
.\" $FreeBSD$
.\"
.\" Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd February 15, 2015
.Dt UDL 4
.Os
.Sh NAME
.Nm udl
.Nd DisplayLink DL-120 / DL-160 USB display devices
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device udl"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
udl_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver supports USB display devices based on the DisplayLink DL-120 / DL-160
graphic chip.
.Sh HARDWARE
The following devices should work:
.Pp
.Bl -tag -width Ds -offset indent -compact
.It Century Corp. Japan Plus One LCD-8000U
.It Century Corp. Japan Plus One LCD-4300U
.It DisplayLink USB to DVI
.It ForwardVideo EasyCAP008 USB to DVI
.It HP USB 2.0 Docking Station (FQ834)
.It HP USB Graphics Adapter (NL571)
.It IOGEAR USB 2.0 External DVI (GUC2020)
.It Koenig CMP-USBVGA10 and CMP-USBVGA11
.It Lenovo 45K5296 USB to DVI
.It Lenovo ThinkVision LT1421
.It Lilliput UM-70
.It Nanovision MiMo UM-710 and UM-740
.It Rextron VCUD60 USB to DVI
.It Samsung LD220
.It StarTech CONV-USB2DVI
.It Sunweit USB to DVI
.It Unitek Y-2240 USB to DVI
.It VideoHome NBdock1920
.El
.Sh SEE ALSO
.Xr usb 4

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 22, 2012
.Dd February 16, 2015
.Dt WLAN 4
.Os
.Sh NAME
@ -182,12 +182,14 @@ may not interoperate.
.Xr mwl 4 ,
.Xr netintro 4 ,
.Xr ral 4 ,
.Xr rsu 4 ,
.Xr rum 4 ,
.Xr run 4 ,
.Xr uath 4 ,
.Xr upgt 4 ,
.Xr ural 4 ,
.Xr urtw 4 ,
.Xr urtwn 4 ,
.Xr wi 4 ,
.Xr wlan_acl 4 ,
.Xr wlan_ccmp 4 ,

View File

@ -1507,6 +1507,7 @@ cpususpend_handler(void)
vmm_resume_p();
/* Resume MCA and local APIC */
lapic_xapic_mode();
mca_resume();
lapic_setup(0);

View File

@ -58,9 +58,13 @@ cpuinfo_init(void)
/* ARMv4T CPU */
cpuinfo.architecture = 1;
cpuinfo.revision = (cpuinfo.midr >> 16) & 0x7F;
}
} else {
/* ARM new id scheme */
cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F;
cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F;
}
} else {
/* must be new id scheme */
/* non ARM -> must be new id scheme */
cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F;
cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F;
}

View File

@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/kdb.h>
#include <sys/stack.h>
#include <machine/armreg.h>
#include <machine/asm.h>
#include <machine/cpufunc.h>
@ -45,322 +46,15 @@ __FBSDID("$FreeBSD$");
#include <machine/pcb.h>
#include <machine/stack.h>
#include <machine/vmparam.h>
#include <ddb/ddb.h>
#include <ddb/db_access.h>
#include <ddb/db_sym.h>
#include <ddb/db_output.h>
/*
* Definitions for the instruction interpreter.
*
* The ARM EABI specifies how to perform the frame unwinding in the
* Exception Handling ABI for the ARM Architecture document. To perform
* the unwind we need to know the initial frame pointer, stack pointer,
* link register and program counter. We then find the entry within the
* index table that points to the function the program counter is within.
* This gives us either a list of three instructions to process, a 31-bit
* relative offset to a table of instructions, or a value telling us
* we can't unwind any further.
*
* When we have the instructions to process we need to decode them
* following table 4 in section 9.3. This describes a collection of bit
* patterns to encode that steps to take to update the stack pointer and
* link register to the correct values at the start of the function.
*/
/* A special case when we are unable to unwind past this function */
#define EXIDX_CANTUNWIND 1
/* The register names */
#define FP 11
#define SP 13
#define LR 14
#define PC 15
/*
* These are set in the linker script. Their addresses will be
* either the start or end of the exception table or index.
*/
extern int extab_start, extab_end, exidx_start, exidx_end;
/*
* Entry types.
* These are the only entry types that have been seen in the kernel.
*/
#define ENTRY_MASK 0xff000000
#define ENTRY_ARM_SU16 0x80000000
#define ENTRY_ARM_LU16 0x81000000
/* Instruction masks. */
#define INSN_VSP_MASK 0xc0
#define INSN_VSP_SIZE_MASK 0x3f
#define INSN_STD_MASK 0xf0
#define INSN_STD_DATA_MASK 0x0f
#define INSN_POP_TYPE_MASK 0x08
#define INSN_POP_COUNT_MASK 0x07
#define INSN_VSP_LARGE_INC_MASK 0xff
/* Instruction definitions */
#define INSN_VSP_INC 0x00
#define INSN_VSP_DEC 0x40
#define INSN_POP_MASKED 0x80
#define INSN_VSP_REG 0x90
#define INSN_POP_COUNT 0xa0
#define INSN_FINISH 0xb0
#define INSN_POP_REGS 0xb1
#define INSN_VSP_LARGE_INC 0xb2
/* An item in the exception index table */
struct unwind_idx {
uint32_t offset;
uint32_t insn;
};
/* The state of the unwind process */
struct unwind_state {
uint32_t registers[16];
uint32_t start_pc;
uint32_t *insn;
u_int entries;
u_int byte;
uint16_t update_mask;
};
/* Expand a 31-bit signed value to a 32-bit signed value */
static __inline int32_t
db_expand_prel31(uint32_t prel31)
{
return ((int32_t)(prel31 & 0x7fffffffu) << 1) / 2;
}
/*
* Perform a binary search of the index table to find the function
* with the largest address that doesn't exceed addr.
*/
static struct unwind_idx *
db_find_index(uint32_t addr)
{
unsigned int min, mid, max;
struct unwind_idx *start;
struct unwind_idx *item;
int32_t prel31_addr;
uint32_t func_addr;
start = (struct unwind_idx *)&exidx_start;
min = 0;
max = (&exidx_end - &exidx_start) / 2;
while (min != max) {
mid = min + (max - min + 1) / 2;
item = &start[mid];
prel31_addr = db_expand_prel31(item->offset);
func_addr = (uint32_t)&item->offset + prel31_addr;
if (func_addr <= addr) {
min = mid;
} else {
max = mid - 1;
}
}
return &start[min];
}
/* Reads the next byte from the instruction list */
static uint8_t
db_unwind_exec_read_byte(struct unwind_state *state)
{
uint8_t insn;
/* Read the unwind instruction */
insn = (*state->insn) >> (state->byte * 8);
/* Update the location of the next instruction */
if (state->byte == 0) {
state->byte = 3;
state->insn++;
state->entries--;
} else
state->byte--;
return insn;
}
/* Executes the next instruction on the list */
static int
db_unwind_exec_insn(struct unwind_state *state)
{
unsigned int insn;
uint32_t *vsp = (uint32_t *)state->registers[SP];
int update_vsp = 0;
/* This should never happen */
if (state->entries == 0)
return 1;
/* Read the next instruction */
insn = db_unwind_exec_read_byte(state);
if ((insn & INSN_VSP_MASK) == INSN_VSP_INC) {
state->registers[SP] += ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
} else if ((insn & INSN_VSP_MASK) == INSN_VSP_DEC) {
state->registers[SP] -= ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
} else if ((insn & INSN_STD_MASK) == INSN_POP_MASKED) {
unsigned int mask, reg;
/* Load the mask */
mask = db_unwind_exec_read_byte(state);
mask |= (insn & INSN_STD_DATA_MASK) << 8;
/* We have a refuse to unwind instruction */
if (mask == 0)
return 1;
/* Update SP */
update_vsp = 1;
/* Load the registers */
for (reg = 4; mask && reg < 16; mask >>= 1, reg++) {
if (mask & 1) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
/* If we have updated SP kep its value */
if (reg == SP)
update_vsp = 0;
}
}
} else if ((insn & INSN_STD_MASK) == INSN_VSP_REG &&
((insn & INSN_STD_DATA_MASK) != 13) &&
((insn & INSN_STD_DATA_MASK) != 15)) {
/* sp = register */
state->registers[SP] =
state->registers[insn & INSN_STD_DATA_MASK];
} else if ((insn & INSN_STD_MASK) == INSN_POP_COUNT) {
unsigned int count, reg;
/* Read how many registers to load */
count = insn & INSN_POP_COUNT_MASK;
/* Update sp */
update_vsp = 1;
/* Pop the registers */
for (reg = 4; reg <= 4 + count; reg++) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
}
/* Check if we are in the pop r14 version */
if ((insn & INSN_POP_TYPE_MASK) != 0) {
state->registers[14] = *vsp++;
}
} else if (insn == INSN_FINISH) {
/* Stop processing */
state->entries = 0;
} else if (insn == INSN_POP_REGS) {
unsigned int mask, reg;
mask = db_unwind_exec_read_byte(state);
if (mask == 0 || (mask & 0xf0) != 0)
return 1;
/* Update SP */
update_vsp = 1;
/* Load the registers */
for (reg = 0; mask && reg < 4; mask >>= 1, reg++) {
if (mask & 1) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
}
}
} else if ((insn & INSN_VSP_LARGE_INC_MASK) == INSN_VSP_LARGE_INC) {
unsigned int uleb128;
/* Read the increment value */
uleb128 = db_unwind_exec_read_byte(state);
state->registers[SP] += 0x204 + (uleb128 << 2);
} else {
/* We hit a new instruction that needs to be implemented */
db_printf("Unhandled instruction %.2x\n", insn);
return 1;
}
if (update_vsp) {
state->registers[SP] = (uint32_t)vsp;
}
#if 0
db_printf("fp = %08x, sp = %08x, lr = %08x, pc = %08x\n",
state->registers[FP], state->registers[SP], state->registers[LR],
state->registers[PC]);
#endif
return 0;
}
/* Performs the unwind of a function */
static int
db_unwind_tab(struct unwind_state *state)
{
uint32_t entry;
/* Set PC to a known value */
state->registers[PC] = 0;
/* Read the personality */
entry = *state->insn & ENTRY_MASK;
if (entry == ENTRY_ARM_SU16) {
state->byte = 2;
state->entries = 1;
} else if (entry == ENTRY_ARM_LU16) {
state->byte = 1;
state->entries = ((*state->insn >> 16) & 0xFF) + 1;
} else {
db_printf("Unknown entry: %x\n", entry);
return 1;
}
while (state->entries > 0) {
if (db_unwind_exec_insn(state) != 0)
return 1;
}
/*
* The program counter was not updated, load it from the link register.
*/
if (state->registers[PC] == 0) {
state->registers[PC] = state->registers[LR];
/*
* If the program counter changed, flag it in the update mask.
*/
if (state->start_pc != state->registers[PC])
state->update_mask |= 1 << PC;
}
return 0;
}
static void
db_stack_trace_cmd(struct unwind_state *state)
{
struct unwind_idx *index;
const char *name;
db_expr_t value;
db_expr_t offset;
@ -372,28 +66,7 @@ db_stack_trace_cmd(struct unwind_state *state)
finished = false;
while (!finished) {
/* Reset the mask of updated registers */
state->update_mask = 0;
/* The pc value is correct and will be overwritten, save it */
state->start_pc = state->registers[PC];
/* Find the item to run */
index = db_find_index(state->start_pc);
if (index->insn != EXIDX_CANTUNWIND) {
if (index->insn & (1U << 31)) {
/* The data is within the instruction */
state->insn = &index->insn;
} else {
/* A prel31 offset to the unwind table */
state->insn = (uint32_t *)
((uintptr_t)&index->insn +
db_expand_prel31(index->insn));
}
/* Run the unwind function */
finished = db_unwind_tab(state);
}
finished = unwind_stack_one(state);
/* Print the frame details */
sym = db_search_symbol(state->start_pc, DB_STGY_ANY, &offset);
@ -432,6 +105,9 @@ db_stack_trace_cmd(struct unwind_state *state)
}
db_printf("\n");
if (finished)
break;
/*
* Stop if directed to do so, or if we've unwound back to the
* kernel entry point, or if the unwind function didn't change
@ -441,9 +117,7 @@ db_stack_trace_cmd(struct unwind_state *state)
* the last frame printed before you see the unwind failure
* message (maybe it needs a STOP_UNWINDING).
*/
if (index->insn == EXIDX_CANTUNWIND) {
finished = true;
} else if (state->registers[PC] < VM_MIN_KERNEL_ADDRESS) {
if (state->registers[PC] < VM_MIN_KERNEL_ADDRESS) {
db_printf("Unable to unwind into user mode\n");
finished = true;
} else if (state->update_mask == 0) {

369
sys/arm/arm/unwind.c Normal file
View File

@ -0,0 +1,369 @@
/*
* Copyright 2013-2014 Andrew Turner.
* Copyright 2013-2014 Ian Lepore.
* Copyright 2013-2014 Rui Paulo.
* Copyright 2013 Eitan Adler.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <machine/stack.h>
/*
* Definitions for the instruction interpreter.
*
* The ARM EABI specifies how to perform the frame unwinding in the
* Exception Handling ABI for the ARM Architecture document. To perform
* the unwind we need to know the initial frame pointer, stack pointer,
* link register and program counter. We then find the entry within the
* index table that points to the function the program counter is within.
* This gives us either a list of three instructions to process, a 31-bit
* relative offset to a table of instructions, or a value telling us
* we can't unwind any further.
*
* When we have the instructions to process we need to decode them
* following table 4 in section 9.3. This describes a collection of bit
* patterns to encode that steps to take to update the stack pointer and
* link register to the correct values at the start of the function.
*/
/* A special case when we are unable to unwind past this function */
#define EXIDX_CANTUNWIND 1
/*
* These are set in the linker script. Their addresses will be
* either the start or end of the exception table or index.
*/
extern int extab_start, extab_end, exidx_start, exidx_end;
/*
* Entry types.
* These are the only entry types that have been seen in the kernel.
*/
#define ENTRY_MASK 0xff000000
#define ENTRY_ARM_SU16 0x80000000
#define ENTRY_ARM_LU16 0x81000000
/* Instruction masks. */
#define INSN_VSP_MASK 0xc0
#define INSN_VSP_SIZE_MASK 0x3f
#define INSN_STD_MASK 0xf0
#define INSN_STD_DATA_MASK 0x0f
#define INSN_POP_TYPE_MASK 0x08
#define INSN_POP_COUNT_MASK 0x07
#define INSN_VSP_LARGE_INC_MASK 0xff
/* Instruction definitions */
#define INSN_VSP_INC 0x00
#define INSN_VSP_DEC 0x40
#define INSN_POP_MASKED 0x80
#define INSN_VSP_REG 0x90
#define INSN_POP_COUNT 0xa0
#define INSN_FINISH 0xb0
#define INSN_POP_REGS 0xb1
#define INSN_VSP_LARGE_INC 0xb2
/* An item in the exception index table */
struct unwind_idx {
uint32_t offset;
uint32_t insn;
};
/* Expand a 31-bit signed value to a 32-bit signed value */
static __inline int32_t
expand_prel31(uint32_t prel31)
{
return ((int32_t)(prel31 & 0x7fffffffu) << 1) / 2;
}
/*
* Perform a binary search of the index table to find the function
* with the largest address that doesn't exceed addr.
*/
static struct unwind_idx *
find_index(uint32_t addr)
{
unsigned int min, mid, max;
struct unwind_idx *start;
struct unwind_idx *item;
int32_t prel31_addr;
uint32_t func_addr;
start = (struct unwind_idx *)&exidx_start;
min = 0;
max = (&exidx_end - &exidx_start) / 2;
while (min != max) {
mid = min + (max - min + 1) / 2;
item = &start[mid];
prel31_addr = expand_prel31(item->offset);
func_addr = (uint32_t)&item->offset + prel31_addr;
if (func_addr <= addr) {
min = mid;
} else {
max = mid - 1;
}
}
return &start[min];
}
/* Reads the next byte from the instruction list */
static uint8_t
unwind_exec_read_byte(struct unwind_state *state)
{
uint8_t insn;
/* Read the unwind instruction */
insn = (*state->insn) >> (state->byte * 8);
/* Update the location of the next instruction */
if (state->byte == 0) {
state->byte = 3;
state->insn++;
state->entries--;
} else
state->byte--;
return insn;
}
/* Executes the next instruction on the list */
static int
unwind_exec_insn(struct unwind_state *state)
{
unsigned int insn;
uint32_t *vsp = (uint32_t *)state->registers[SP];
int update_vsp = 0;
/* This should never happen */
if (state->entries == 0)
return 1;
/* Read the next instruction */
insn = unwind_exec_read_byte(state);
if ((insn & INSN_VSP_MASK) == INSN_VSP_INC) {
state->registers[SP] += ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
} else if ((insn & INSN_VSP_MASK) == INSN_VSP_DEC) {
state->registers[SP] -= ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
} else if ((insn & INSN_STD_MASK) == INSN_POP_MASKED) {
unsigned int mask, reg;
/* Load the mask */
mask = unwind_exec_read_byte(state);
mask |= (insn & INSN_STD_DATA_MASK) << 8;
/* We have a refuse to unwind instruction */
if (mask == 0)
return 1;
/* Update SP */
update_vsp = 1;
/* Load the registers */
for (reg = 4; mask && reg < 16; mask >>= 1, reg++) {
if (mask & 1) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
/* If we have updated SP kep its value */
if (reg == SP)
update_vsp = 0;
}
}
} else if ((insn & INSN_STD_MASK) == INSN_VSP_REG &&
((insn & INSN_STD_DATA_MASK) != 13) &&
((insn & INSN_STD_DATA_MASK) != 15)) {
/* sp = register */
state->registers[SP] =
state->registers[insn & INSN_STD_DATA_MASK];
} else if ((insn & INSN_STD_MASK) == INSN_POP_COUNT) {
unsigned int count, reg;
/* Read how many registers to load */
count = insn & INSN_POP_COUNT_MASK;
/* Update sp */
update_vsp = 1;
/* Pop the registers */
for (reg = 4; reg <= 4 + count; reg++) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
}
/* Check if we are in the pop r14 version */
if ((insn & INSN_POP_TYPE_MASK) != 0) {
state->registers[14] = *vsp++;
}
} else if (insn == INSN_FINISH) {
/* Stop processing */
state->entries = 0;
} else if (insn == INSN_POP_REGS) {
unsigned int mask, reg;
mask = unwind_exec_read_byte(state);
if (mask == 0 || (mask & 0xf0) != 0)
return 1;
/* Update SP */
update_vsp = 1;
/* Load the registers */
for (reg = 0; mask && reg < 4; mask >>= 1, reg++) {
if (mask & 1) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
}
}
} else if ((insn & INSN_VSP_LARGE_INC_MASK) == INSN_VSP_LARGE_INC) {
unsigned int uleb128;
/* Read the increment value */
uleb128 = unwind_exec_read_byte(state);
state->registers[SP] += 0x204 + (uleb128 << 2);
} else {
/* We hit a new instruction that needs to be implemented */
#if 0
db_printf("Unhandled instruction %.2x\n", insn);
#endif
return 1;
}
if (update_vsp) {
state->registers[SP] = (uint32_t)vsp;
}
#if 0
db_printf("fp = %08x, sp = %08x, lr = %08x, pc = %08x\n",
state->registers[FP], state->registers[SP], state->registers[LR],
state->registers[PC]);
#endif
return 0;
}
/* Performs the unwind of a function */
static int
unwind_tab(struct unwind_state *state)
{
uint32_t entry;
/* Set PC to a known value */
state->registers[PC] = 0;
/* Read the personality */
entry = *state->insn & ENTRY_MASK;
if (entry == ENTRY_ARM_SU16) {
state->byte = 2;
state->entries = 1;
} else if (entry == ENTRY_ARM_LU16) {
state->byte = 1;
state->entries = ((*state->insn >> 16) & 0xFF) + 1;
} else {
#if 0
db_printf("Unknown entry: %x\n", entry);
#endif
return 1;
}
while (state->entries > 0) {
if (unwind_exec_insn(state) != 0)
return 1;
}
/*
* The program counter was not updated, load it from the link register.
*/
if (state->registers[PC] == 0) {
state->registers[PC] = state->registers[LR];
/*
* If the program counter changed, flag it in the update mask.
*/
if (state->start_pc != state->registers[PC])
state->update_mask |= 1 << PC;
}
return 0;
}
int
unwind_stack_one(struct unwind_state *state)
{
struct unwind_idx *index;
int finished;
/* Reset the mask of updated registers */
state->update_mask = 0;
/* The pc value is correct and will be overwritten, save it */
state->start_pc = state->registers[PC];
/* Find the item to run */
index = find_index(state->start_pc);
finished = 0;
if (index->insn != EXIDX_CANTUNWIND) {
if (index->insn & (1U << 31)) {
/* The data is within the instruction */
state->insn = &index->insn;
} else {
/* A prel31 offset to the unwind table */
state->insn = (uint32_t *)
((uintptr_t)&index->insn +
expand_prel31(index->insn));
}
/* Run the unwind function */
finished = unwind_tab(state);
}
/* This is the top of the stack, finish */
if (index->insn == EXIDX_CANTUNWIND)
finished = 1;
return (finished);
}

View File

@ -247,7 +247,7 @@ bcm_bsc_attach(device_t dev)
/* Check the unit we are attaching by its base address. */
start = rman_get_start(sc->sc_mem_res);
for (i = 0; i < nitems(bcm_bsc_pins); i++) {
if (bcm_bsc_pins[i].start == start)
if (bcm_bsc_pins[i].start == (start & BCM_BSC_BASE_MASK))
break;
}
if (i == nitems(bcm_bsc_pins)) {

View File

@ -35,9 +35,10 @@ struct {
uint32_t scl;
unsigned long start;
} bcm_bsc_pins[] = {
{ 0, 1, 0x20205000 }, /* BSC0 GPIO pins and base address. */
{ 2, 3, 0x20804000 } /* BSC1 GPIO pins and base address. */
{ 0, 1, 0x205000 }, /* BSC0 GPIO pins and base address. */
{ 2, 3, 0x804000 } /* BSC1 GPIO pins and base address. */
};
#define BCM_BSC_BASE_MASK 0x00ffffff
struct bcm_bsc_softc {
device_t sc_dev;

View File

@ -52,6 +52,53 @@ struct bcm2835_mbox_tag_hdr {
uint32_t val_len;
};
#define BCM2835_MBOX_POWER_ID_EMMC 0x00000000
#define BCM2835_MBOX_POWER_ID_UART0 0x00000001
#define BCM2835_MBOX_POWER_ID_UART1 0x00000002
#define BCM2835_MBOX_POWER_ID_USB_HCD 0x00000003
#define BCM2835_MBOX_POWER_ID_I2C0 0x00000004
#define BCM2835_MBOX_POWER_ID_I2C1 0x00000005
#define BCM2835_MBOX_POWER_ID_I2C2 0x00000006
#define BCM2835_MBOX_POWER_ID_SPI 0x00000007
#define BCM2835_MBOX_POWER_ID_CCP2TX 0x00000008
#define BCM2835_MBOX_POWER_ON (1 << 0)
#define BCM2835_MBOX_POWER_WAIT (1 << 1)
#define BCM2835_MBOX_TAG_GET_POWER_STATE 0x00020001
#define BCM2835_MBOX_TAG_SET_POWER_STATE 0x00028001
struct msg_get_power_state {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_hdr tag_hdr;
union {
struct {
uint32_t device_id;
} req;
struct {
uint32_t device_id;
uint32_t state;
} resp;
} body;
uint32_t end_tag;
};
struct msg_set_power_state {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_hdr tag_hdr;
union {
struct {
uint32_t device_id;
uint32_t state;
} req;
struct {
uint32_t device_id;
uint32_t state;
} resp;
} body;
uint32_t end_tag;
};
#define BCM2835_MBOX_CLOCK_ID_EMMC 0x00000001
#define BCM2835_MBOX_CLOCK_ID_UART 0x00000002
#define BCM2835_MBOX_CLOCK_ID_ARM 0x00000003

View File

@ -39,4 +39,22 @@
#define FR_RSP (-2)
#define FR_RFP (-3)
/* The state of the unwind process */
struct unwind_state {
uint32_t registers[16];
uint32_t start_pc;
uint32_t *insn;
u_int entries;
u_int byte;
uint16_t update_mask;
};
/* The register names */
#define FP 11
#define SP 13
#define LR 14
#define PC 15
int unwind_stack_one(struct unwind_state *);
#endif /* !_MACHINE_STACK_H_ */

View File

@ -397,6 +397,8 @@
};
bsc0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "broadcom,bcm2835-bsc",
"broadcom,bcm2708-bsc";
reg = <0x205000 0x20>;
@ -405,6 +407,8 @@
};
bsc1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "broadcom,bcm2835-bsc",
"broadcom,bcm2708-bsc";
reg = <0x804000 0x20>;

View File

@ -1141,7 +1141,7 @@ dev/cxgb/sys/uipc_mvec.c optional cxgb pci \
dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \
compile-with "${NORMAL_C} -I$S/dev/cxgb"
dev/cxgbe/t4_mp_ring.c optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe ${GCC_MS_EXTENSIONS}"
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
dev/cxgbe/t4_main.c optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
dev/cxgbe/t4_netmap.c optional cxgbe pci \
@ -2563,8 +2563,16 @@ dev/usb/template/usb_template_mtp.c optional usb_template
dev/usb/template/usb_template_phone.c optional usb_template
dev/usb/template/usb_template_serialnet.c optional usb_template
#
# USB video drivers
#
dev/usb/video/udl.c optional udl
#
# USB END
#
dev/videomode/videomode.c optional videomode
dev/videomode/edid.c optional videomode
dev/videomode/pickmode.c optional videomode
dev/videomode/vesagtf.c optional videomode
dev/utopia/idtphy.c optional utopia
dev/utopia/suni.c optional utopia
dev/utopia/utopia.c optional utopia
@ -3616,19 +3624,16 @@ ofed/drivers/infiniband/core/fmr_pool.c optional ofed \
ofed/drivers/infiniband/core/iwcm.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/local_sa.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/mad_rmpp.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/multicast.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/notice.c optional ofed \
ofed/drivers/infiniband/core/packer.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/packer.c optional ofed \
ofed/drivers/infiniband/core/peer_mem.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/sa_query.c optional ofed \
@ -3733,6 +3738,9 @@ ofed/drivers/infiniband/hw/mlx4/mad.c optional mlx4ib \
ofed/drivers/infiniband/hw/mlx4/main.c optional mlx4ib \
no-depend obj-prefix "mlx4ib_" \
compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
ofed/drivers/infiniband/hw/mlx4/mlx4_exp.c optional mlx4ib \
no-depend obj-prefix "mlx4ib_" \
compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
ofed/drivers/infiniband/hw/mlx4/mr.c optional mlx4ib \
no-depend obj-prefix "mlx4ib_" \
compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"

View File

@ -57,6 +57,7 @@ arm/arm/trap.c optional !armv6
arm/arm/trap-v6.c optional armv6
arm/arm/uio_machdep.c standard
arm/arm/undefined.c standard
arm/arm/unwind.c optional ddb
arm/arm/vm_machdep.c standard
arm/arm/vfp.c standard
board_id.h standard \

View File

@ -39,7 +39,6 @@ CLANG_NO_IAS34= -no-integrated-as
.endif
.if ${COMPILER_TYPE} == "gcc"
GCC_MS_EXTENSIONS= -fms-extensions
.if ${COMPILER_VERSION} >= 40300
# Catch-all for all the things that are in our tree, but for which we're
# not yet ready for this compiler. Note: we likely only really "support"

View File

@ -97,7 +97,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
.if ${MACHINE_CPUARCH} == "mips"
CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000
.endif
CFLAGS.gcc+= -fno-common -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
CFLAGS.gcc+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
.if defined(CFLAGS_ARCH_PARAMS)
@ -162,7 +162,7 @@ NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
# Infiniband C flags. Correct include paths and omit errors that linux
# does not honor.
OFEDINCLUDES= -I$S/ofed/include/
OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith
OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
OFED_C= ${OFED_C_NOIMP} ${.IMPSRC}

View File

@ -105,6 +105,7 @@ CFLAGS+= -I. -I${SYSDIR}
CFLAGS+= -I${SYSDIR}/contrib/altq
CFLAGS.gcc+= -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= -fms-extensions
CFLAGS.gcc+= --param inline-unit-growth=100
CFLAGS.gcc+= --param large-function-growth=1000

View File

@ -889,6 +889,9 @@ TDMA_TXRATE_QUARTER_DEFAULT opt_tdma.h
TDMA_TXRATE_11NA_DEFAULT opt_tdma.h
TDMA_TXRATE_11NG_DEFAULT opt_tdma.h
# VideoMode
PICKMODE_DEBUG opt_videomode.h
# Network stack virtualization options
VIMAGE opt_global.h
VNET_DEBUG opt_global.h

View File

@ -1239,7 +1239,9 @@ extern HAL_BOOL ar9300_set_mac_address(struct ath_hal *ah, const u_int8_t *);
extern void ar9300_get_bss_id_mask(struct ath_hal *ah, u_int8_t *mac);
extern HAL_BOOL ar9300_set_bss_id_mask(struct ath_hal *, const u_int8_t *);
extern HAL_STATUS ar9300_select_ant_config(struct ath_hal *ah, u_int32_t cfg);
#if 0
extern u_int32_t ar9300_ant_ctrl_common_get(struct ath_hal *ah, HAL_BOOL is_2ghz);
#endif
extern HAL_BOOL ar9300_ant_swcom_sel(struct ath_hal *ah, u_int8_t ops,
u_int32_t *common_tbl1, u_int32_t *common_tbl2);
extern HAL_BOOL ar9300_set_regulatory_domain(struct ath_hal *ah,

View File

@ -57,6 +57,9 @@ ar9300_beacon_init(struct ath_hal *ah,
/* Add the fraction adjustment lost due to unit conversions. */
beacon_period_usec += beacon_period_fraction;
HALDEBUG(ah, HAL_DEBUG_BEACON,
"%s: next_beacon=0x%08x, beacon_period=%d, opmode=%d, beacon_period_usec=%d\n",
__func__, next_beacon, beacon_period, opmode, beacon_period_usec);
OS_REG_WRITE(ah, AR_BEACON_PERIOD, beacon_period_usec);
OS_REG_WRITE(ah, AR_DMA_BEACON_PERIOD, beacon_period_usec);

View File

@ -36,6 +36,9 @@
static HAL_BOOL ar9300ClrMulticastFilterIndex(struct ath_hal *ah, uint32_t ix);
static HAL_BOOL ar9300SetMulticastFilterIndex(struct ath_hal *ah, uint32_t ix);
static void ar9300_beacon_set_beacon_timers(struct ath_hal *ah,
const HAL_BEACON_TIMERS *bt);
static void
ar9300SetChainMasks(struct ath_hal *ah, uint32_t tx_chainmask,
uint32_t rx_chainmask)
@ -193,10 +196,9 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
/* Beacon functions */
/* ah_setBeaconTimers */
ah->ah_beaconInit = ar9300_freebsd_beacon_init;
/* ah_setBeaconTimers */
ah->ah_setBeaconTimers = ar9300_beacon_set_beacon_timers;
ah->ah_setStationBeaconTimers = ar9300_set_sta_beacon_timers;
/* ah_resetStationBeaconTimers */
/* ah_getNextTBTT */
ah->ah_getNextTBTT = ar9300_get_next_tbtt;
/* Interrupt functions */
@ -669,6 +671,55 @@ ar9300SetMulticastFilterIndex(struct ath_hal *ah, uint32_t ix)
return (AH_TRUE);
}
#define TU_TO_USEC(_tu) ((_tu) << 10)
#define ONE_EIGHTH_TU_TO_USEC(_tu8) ((_tu8) << 7)
/*
* Initializes all of the hardware registers used to
* send beacons. Note that for station operation the
* driver calls ar9300_set_sta_beacon_timers instead.
*/
static void
ar9300_beacon_set_beacon_timers(struct ath_hal *ah,
const HAL_BEACON_TIMERS *bt)
{
uint32_t bperiod;
#if 0
HALASSERT(opmode == HAL_M_IBSS || opmode == HAL_M_HOSTAP);
if (opmode == HAL_M_IBSS) {
OS_REG_SET_BIT(ah, AR_TXCFG, AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY);
}
#endif
/* XXX TODO: should migrate the HAL code to always use ONE_EIGHTH_TU */
OS_REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bt->bt_nexttbtt));
OS_REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, ONE_EIGHTH_TU_TO_USEC(bt->bt_nextdba));
OS_REG_WRITE(ah, AR_NEXT_SWBA, ONE_EIGHTH_TU_TO_USEC(bt->bt_nextswba));
OS_REG_WRITE(ah, AR_NEXT_NDP_TIMER, TU_TO_USEC(bt->bt_nextatim));
bperiod = TU_TO_USEC(bt->bt_intval & HAL_BEACON_PERIOD);
/* XXX TODO! */
// ahp->ah_beaconInterval = bt->bt_intval & HAL_BEACON_PERIOD;
OS_REG_WRITE(ah, AR_BEACON_PERIOD, bperiod);
OS_REG_WRITE(ah, AR_DMA_BEACON_PERIOD, bperiod);
OS_REG_WRITE(ah, AR_SWBA_PERIOD, bperiod);
OS_REG_WRITE(ah, AR_NDP_PERIOD, bperiod);
/*
* Reset TSF if required.
*/
if (bt->bt_intval & HAL_BEACON_RESET_TSF)
ar9300_reset_tsf(ah);
/* enable timers */
/* NB: flags == 0 handled specially for backwards compatibility */
OS_REG_SET_BIT(ah, AR_TIMER_MODE,
bt->bt_flags != 0 ? bt->bt_flags :
AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN);
}
/*
* RF attach stubs
*/

View File

@ -162,7 +162,6 @@ ar9300_gpio_cfg_output(
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
(gpio == AR9382_GPIO_9_INPUT_ONLY))
{
return AH_FALSE;
@ -348,7 +347,6 @@ ar9300_gpio_cfg_input(struct ath_hal *ah, u_int32_t gpio)
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
(gpio > AR9382_MAX_GPIO_INPUT_PIN_NUM))
{
return AH_FALSE;
@ -378,7 +376,6 @@ ar9300_gpio_set(struct ath_hal *ah, u_int32_t gpio, u_int32_t val)
{
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
(gpio == AR9382_GPIO_9_INPUT_ONLY))
{
return AH_FALSE;
@ -397,8 +394,7 @@ ar9300_gpio_get(struct ath_hal *ah, u_int32_t gpio)
{
u_int32_t gpio_in;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
(gpio == AR9382_GPIO_PIN_11_RESERVED))
if (gpio == AR9382_GPIO_PIN_8_RESERVED)
{
return 0xffffffff;
}
@ -453,7 +449,6 @@ ar9300_gpio_set_intr(struct ath_hal *ah, u_int gpio, u_int32_t ilevel)
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
(gpio > AR9382_MAX_GPIO_INPUT_PIN_NUM))
{
return;
@ -549,8 +544,7 @@ ar9300_gpio_get_mask(struct ath_hal *ah)
if (AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_AR9380_PCIE) {
mask = (1 << AR9382_MAX_GPIO_PIN_NUM) - 1;
mask &= ~(1 << AR9382_GPIO_PIN_8_RESERVED |
1 << AR9382_GPIO_PIN_11_RESERVED);
mask &= ~(1 << AR9382_GPIO_PIN_8_RESERVED);
}
return mask;
}
@ -562,8 +556,7 @@ ar9300_gpio_set_mask(struct ath_hal *ah, u_int32_t mask, u_int32_t pol_map)
if (AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_AR9380_PCIE) {
invalid = ~((1 << AR9382_MAX_GPIO_PIN_NUM) - 1);
invalid |= 1 << AR9382_GPIO_PIN_8_RESERVED |
1 << AR9382_GPIO_PIN_11_RESERVED;
invalid |= 1 << AR9382_GPIO_PIN_8_RESERVED;
}
if (mask & invalid) {
ath_hal_printf(ah, "%s: invalid GPIO mask 0x%x\n", __func__, mask);

View File

@ -683,6 +683,7 @@ ar9300_get_capability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
{
struct ath_hal_9300 *ahp = AH9300(ah);
const HAL_CAPABILITIES *p_cap = &AH_PRIVATE(ah)->ah_caps;
struct ar9300_ani_state *ani;
switch (type) {
case HAL_CAP_CIPHER: /* cipher handled in hardware */
@ -911,6 +912,34 @@ ar9300_get_capability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
return HAL_ENOTSUPP;
}
#endif
/* FreeBSD ANI */
case HAL_CAP_INTMIT: /* interference mitigation */
switch (capability) {
case HAL_CAP_INTMIT_PRESENT: /* hardware capability */
return HAL_OK;
case HAL_CAP_INTMIT_ENABLE:
return (ahp->ah_proc_phy_err & HAL_PROCESS_ANI) ?
HAL_OK : HAL_ENXIO;
case HAL_CAP_INTMIT_NOISE_IMMUNITY_LEVEL:
case HAL_CAP_INTMIT_OFDM_WEAK_SIGNAL_LEVEL:
// case HAL_CAP_INTMIT_CCK_WEAK_SIGNAL_THR:
case HAL_CAP_INTMIT_FIRSTEP_LEVEL:
case HAL_CAP_INTMIT_SPUR_IMMUNITY_LEVEL:
ani = ar9300_ani_get_current_state(ah);
if (ani == AH_NULL)
return HAL_ENXIO;
switch (capability) {
/* XXX AR9300 HAL has OFDM/CCK noise immunity level params? */
case 2: *result = ani->ofdm_noise_immunity_level; break;
case 3: *result = !ani->ofdm_weak_sig_detect_off; break;
// case 4: *result = ani->cck_weak_sig_threshold; break;
case 5: *result = ani->firstep_level; break;
case 6: *result = ani->spur_immunity_level; break;
}
return HAL_OK;
}
return HAL_EINVAL;
default:
return ath_hal_getcapability(ah, type, capability, result);
}
@ -986,6 +1015,27 @@ ar9300_set_capability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
return AH_TRUE;
}
return AH_FALSE;
/* FreeBSD interrupt mitigation / ANI */
case HAL_CAP_INTMIT: { /* interference mitigation */
/* This maps the public ANI commands to the internal ANI commands */
/* Private: HAL_ANI_CMD; Public: HAL_CAP_INTMIT_CMD */
static const HAL_ANI_CMD cmds[] = {
HAL_ANI_PRESENT,
HAL_ANI_MODE,
HAL_ANI_NOISE_IMMUNITY_LEVEL,
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
HAL_ANI_CCK_WEAK_SIGNAL_THR,
HAL_ANI_FIRSTEP_LEVEL,
HAL_ANI_SPUR_IMMUNITY_LEVEL,
};
#define N(a) (sizeof(a) / sizeof(a[0]))
return capability < N(cmds) ?
ar9300_ani_control(ah, cmds[capability], setting) :
AH_FALSE;
#undef N
}
case HAL_CAP_RXBUFSIZE: /* set MAC receive buffer size */
ahp->rx_buf_size = setting & AR_DATABUF_MASK;
OS_REG_WRITE(ah, AR_DATABUF, ahp->rx_buf_size);

View File

@ -525,7 +525,7 @@ static void krping_setup_wr(struct krping_cb *cb)
case MW:
cb->bind_attr.wr_id = 0xabbaabba;
cb->bind_attr.send_flags = 0; /* unsignaled */
cb->bind_attr.length = cb->size;
cb->bind_attr.bind_info.length = cb->size;
break;
default:
break;
@ -627,7 +627,7 @@ static int krping_setup_buffers(struct krping_cb *cb)
cb->page_list, cb->page_list_len);
break;
case MW:
cb->mw = ib_alloc_mw(cb->pd);
cb->mw = ib_alloc_mw(cb->pd,IB_MW_TYPE_1);
if (IS_ERR(cb->mw)) {
DEBUG_LOG(cb, "recv_buf alloc_mw failed\n");
ret = PTR_ERR(cb->mw);
@ -898,15 +898,15 @@ static u32 krping_rdma_rkey(struct krping_cb *cb, u64 buf, int post_inv)
* Update the MW with new buf info.
*/
if (buf == (u64)cb->start_dma_addr) {
cb->bind_attr.mw_access_flags = IB_ACCESS_REMOTE_READ;
cb->bind_attr.mr = cb->start_mr;
cb->bind_attr.bind_info.mw_access_flags = IB_ACCESS_REMOTE_READ;
cb->bind_attr.bind_info.mr = cb->start_mr;
} else {
cb->bind_attr.mw_access_flags = IB_ACCESS_REMOTE_WRITE;
cb->bind_attr.mr = cb->rdma_mr;
cb->bind_attr.bind_info.mw_access_flags = IB_ACCESS_REMOTE_WRITE;
cb->bind_attr.bind_info.mr = cb->rdma_mr;
}
cb->bind_attr.addr = buf;
cb->bind_attr.bind_info.addr = buf;
DEBUG_LOG(cb, "binding mw rkey 0x%x to buf %llx mr rkey 0x%x\n",
cb->mw->rkey, buf, cb->bind_attr.mr->rkey);
cb->mw->rkey, buf, cb->bind_attr.bind_info.mr->rkey);
ret = ib_bind_mw(cb->qp, cb->mw, &cb->bind_attr);
if (ret) {
PRINTF(cb, "bind mw error %d\n", ret);
@ -2304,7 +2304,7 @@ int krping_doit(char *cmd, void *cookie)
goto out;
}
cb->cm_id = rdma_create_id(krping_cma_event_handler, cb, RDMA_PS_TCP);
cb->cm_id = rdma_create_id(krping_cma_event_handler, cb, RDMA_PS_TCP, IB_QPT_RC);
if (IS_ERR(cb->cm_id)) {
ret = PTR_ERR(cb->cm_id);
PRINTF(cb, "rdma_create_id error %d\n", ret);

View File

@ -95,7 +95,7 @@ prt_attach_devices(ACPI_PCI_ROUTING_TABLE *entry, void *arg)
int error;
/* We only care about entries that reference a link device. */
if (entry->Source == NULL || entry->Source[0] == '\0')
if (entry->Source[0] == '\0')
return;
/*
@ -222,7 +222,7 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
if (bootverbose) {
device_printf(pcib, "matched entry for %d.%d.INT%c",
pci_get_bus(dev), pci_get_slot(dev), 'A' + pin);
if (prt->Source != NULL && prt->Source[0] != '\0')
if (prt->Source[0] != '\0')
printf(" (src %s:%u)", prt->Source, prt->SourceIndex);
printf("\n");
}
@ -234,8 +234,7 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
* XXX: If the source index is non-zero, ignore the source device and
* assume that this is a hard-wired entry.
*/
if (prt->Source == NULL || prt->Source[0] == '\0' ||
prt->SourceIndex != 0) {
if (prt->Source[0] == '\0' || prt->SourceIndex != 0) {
if (bootverbose)
device_printf(pcib, "slot %d INT%c hardwired to IRQ %d\n",
pci_get_slot(dev), 'A' + pin, prt->SourceIndex);

View File

@ -279,6 +279,13 @@ ath_pci_attach(device_t dev)
*/
sc->sc_invalid = 1;
ATH_LOCK_INIT(sc);
ATH_PCU_LOCK_INIT(sc);
ATH_RX_LOCK_INIT(sc);
ATH_TX_LOCK_INIT(sc);
ATH_TX_IC_LOCK_INIT(sc);
ATH_TXSTATUS_LOCK_INIT(sc);
/*
* Arrange interrupt line.
*/
@ -329,7 +336,7 @@ ath_pci_attach(device_t dev)
if (fw == NULL) {
device_printf(dev, "%s: couldn't find firmware\n",
__func__);
goto bad3;
goto bad4;
}
device_printf(dev, "%s: EEPROM firmware @ %p\n",
@ -339,30 +346,20 @@ ath_pci_attach(device_t dev)
if (! sc->sc_eepromdata) {
device_printf(dev, "%s: can't malloc eepromdata\n",
__func__);
goto bad3;
goto bad4;
}
memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
firmware_put(fw, 0);
}
#endif /* ATH_EEPROM_FIRMWARE */
ATH_LOCK_INIT(sc);
ATH_PCU_LOCK_INIT(sc);
ATH_RX_LOCK_INIT(sc);
ATH_TX_LOCK_INIT(sc);
ATH_TX_IC_LOCK_INIT(sc);
ATH_TXSTATUS_LOCK_INIT(sc);
error = ath_attach(pci_get_device(dev), sc);
if (error == 0) /* success */
return 0;
ATH_TXSTATUS_LOCK_DESTROY(sc);
ATH_PCU_LOCK_DESTROY(sc);
ATH_RX_LOCK_DESTROY(sc);
ATH_TX_IC_LOCK_DESTROY(sc);
ATH_TX_LOCK_DESTROY(sc);
ATH_LOCK_DESTROY(sc);
#ifdef ATH_EEPROM_FIRMWARE
bad4:
#endif
bus_dma_tag_destroy(sc->sc_dmat);
bad3:
bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
@ -370,6 +367,14 @@ ath_pci_attach(device_t dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
bad1:
bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
ATH_TXSTATUS_LOCK_DESTROY(sc);
ATH_PCU_LOCK_DESTROY(sc);
ATH_RX_LOCK_DESTROY(sc);
ATH_TX_IC_LOCK_DESTROY(sc);
ATH_TX_LOCK_DESTROY(sc);
ATH_LOCK_DESTROY(sc);
bad:
return (error);
}

View File

@ -77,6 +77,10 @@ typedef struct atkbd_state {
static void atkbd_timeout(void *arg);
static void atkbd_shutdown_final(void *v);
static int atkbd_reset(KBDC kbdc, int flags, int c);
#define HAS_QUIRK(p, q) (((atkbdc_softc_t *)(p))->quirks & q)
#define ALLOW_DISABLE_KBD(kbdc) !HAS_QUIRK(kbdc, KBDC_QUIRK_KEEP_ACTIVATED)
int
atkbd_probe_unit(device_t dev, int irq, int flags)
@ -1095,6 +1099,39 @@ atkbd_shutdown_final(void *v)
#endif
}
static int
atkbd_reset(KBDC kbdc, int flags, int c)
{
/* reset keyboard hardware */
if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) {
/*
* KEYBOARD ERROR
* Keyboard reset may fail either because the keyboard
* doen't exist, or because the keyboard doesn't pass
* the self-test, or the keyboard controller on the
* motherboard and the keyboard somehow fail to shake hands.
* It is just possible, particularly in the last case,
* that the keyboard controller may be left in a hung state.
* test_controller() and test_kbd_port() appear to bring
* the keyboard controller back (I don't know why and how,
* though.)
*/
empty_both_buffers(kbdc, 10);
test_controller(kbdc);
test_kbd_port(kbdc);
/*
* We could disable the keyboard port and interrupt... but,
* the keyboard may still exist (see above).
*/
set_controller_command_byte(kbdc,
ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
if (bootverbose)
printf("atkbd: failed to reset the keyboard.\n");
return (EIO);
}
return (0);
}
/* local functions */
static int
@ -1250,13 +1287,14 @@ probe_keyboard(KBDC kbdc, int flags)
kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS);
} else {
/* try to restore the command byte as before */
set_controller_command_byte(kbdc, 0xff, c);
set_controller_command_byte(kbdc,
ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
kbdc_set_device_mask(kbdc, m);
}
#endif
kbdc_lock(kbdc, FALSE);
return err;
return (HAS_QUIRK(kbdc, KBDC_QUIRK_IGNORE_PROBE_RESULT) ? 0 : err);
}
static int
@ -1299,6 +1337,12 @@ init_keyboard(KBDC kbdc, int *type, int flags)
return EIO;
}
if (HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) &&
atkbd_reset(kbdc, flags, c)) {
kbdc_lock(kbdc, FALSE);
return EIO;
}
/*
* Check if we have an XT keyboard before we attempt to reset it.
* The procedure assumes that the keyboard and the controller have
@ -1343,31 +1387,9 @@ init_keyboard(KBDC kbdc, int *type, int flags)
if (bootverbose)
printf("atkbd: keyboard ID 0x%x (%d)\n", id, *type);
/* reset keyboard hardware */
if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) {
/*
* KEYBOARD ERROR
* Keyboard reset may fail either because the keyboard
* doen't exist, or because the keyboard doesn't pass
* the self-test, or the keyboard controller on the
* motherboard and the keyboard somehow fail to shake hands.
* It is just possible, particularly in the last case,
* that the keyboard controller may be left in a hung state.
* test_controller() and test_kbd_port() appear to bring
* the keyboard controller back (I don't know why and how,
* though.)
*/
empty_both_buffers(kbdc, 10);
test_controller(kbdc);
test_kbd_port(kbdc);
/*
* We could disable the keyboard port and interrupt... but,
* the keyboard may still exist (see above).
*/
set_controller_command_byte(kbdc, 0xff, c);
if (!HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) &&
atkbd_reset(kbdc, flags, c)) {
kbdc_lock(kbdc, FALSE);
if (bootverbose)
printf("atkbd: failed to reset the keyboard.\n");
return EIO;
}
@ -1387,7 +1409,8 @@ init_keyboard(KBDC kbdc, int *type, int flags)
* The XT kbd isn't usable unless the proper scan
* code set is selected.
*/
set_controller_command_byte(kbdc, 0xff, c);
set_controller_command_byte(kbdc, ALLOW_DISABLE_KBD(kbdc)
? 0xff : KBD_KBD_CONTROL_BITS, c);
kbdc_lock(kbdc, FALSE);
printf("atkbd: unable to set the XT keyboard mode.\n");
return EIO;
@ -1402,6 +1425,17 @@ init_keyboard(KBDC kbdc, int *type, int flags)
c |= KBD_TRANSLATION;
#endif
/*
* Some keyboards require a SETLEDS command to be sent after
* the reset command before they will send keystrokes to us
*/
if (HAS_QUIRK(kbdc, KBDC_QUIRK_SETLEDS_ON_INIT) &&
send_kbd_command_and_data(kbdc, KBDC_SET_LEDS, 0) != KBD_ACK) {
printf("atkbd: setleds failed\n");
}
if (!ALLOW_DISABLE_KBD(kbdc))
send_kbd_command(kbdc, KBDC_ENABLE_KBD);
/* enable the keyboard port and intr. */
if (!set_controller_command_byte(kbdc,
KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK,
@ -1412,7 +1446,9 @@ init_keyboard(KBDC kbdc, int *type, int flags)
* This is serious; we are left with the disabled
* keyboard intr.
*/
set_controller_command_byte(kbdc, 0xff, c);
set_controller_command_byte(kbdc, ALLOW_DISABLE_KBD(kbdc)
? 0xff : (KBD_KBD_CONTROL_BITS | KBD_TRANSLATION |
KBD_OVERRIDE_KBD_LOCK), c);
kbdc_lock(kbdc, FALSE);
printf("atkbd: unable to enable the keyboard port and intr.\n");
return EIO;

View File

@ -114,6 +114,41 @@ static int wait_for_kbd_ack(atkbdc_softc_t *kbdc);
static int wait_for_aux_data(atkbdc_softc_t *kbdc);
static int wait_for_aux_ack(atkbdc_softc_t *kbdc);
struct atkbdc_quirks {
const char* bios_vendor;
const char* maker;
const char* product;
int quirk;
};
static struct atkbdc_quirks quirks[] = {
{"coreboot", "Acer", "Peppy",
KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT |
KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT},
{NULL, NULL, NULL, 0}
};
#define QUIRK_STR_MATCH(s1, s2) (s1 == NULL || \
(s2 != NULL && !strcmp(s1, s2)))
static int
atkbdc_getquirks(void)
{
int i;
char* bios_vendor = kern_getenv("smbios.bios.vendor");
char* maker = kern_getenv("smbios.system.maker");
char* product = kern_getenv("smbios.system.product");
for (i=0; quirks[i].quirk != 0; ++i)
if (QUIRK_STR_MATCH(quirks[i].bios_vendor, bios_vendor) &&
QUIRK_STR_MATCH(quirks[i].maker, maker) &&
QUIRK_STR_MATCH(quirks[i].product, product))
return (quirks[i].quirk);
return (0);
}
atkbdc_softc_t
*atkbdc_get_softc(int unit)
{
@ -295,6 +330,7 @@ atkbdc_setup(atkbdc_softc_t *sc, bus_space_tag_t tag, bus_space_handle_t h0,
#else
sc->retry = 5000;
#endif
sc->quirks = atkbdc_getquirks();
return 0;
}
@ -1124,7 +1160,8 @@ void
kbdc_set_device_mask(KBDC p, int mask)
{
kbdcp(p)->command_mask =
mask & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS);
mask & (((kbdcp(p)->quirks & KBDC_QUIRK_KEEP_ACTIVATED)
? 0 : KBD_KBD_CONTROL_BITS) | KBD_AUX_CONTROL_BITS);
}
int

View File

@ -202,6 +202,11 @@ typedef struct atkbdc_softc {
kqueue kbd; /* keyboard data queue */
kqueue aux; /* auxiliary data queue */
int retry;
int quirks; /* controller doesn't like deactivate */
#define KBDC_QUIRK_KEEP_ACTIVATED (1 << 0)
#define KBDC_QUIRK_IGNORE_PROBE_RESULT (1 << 1)
#define KBDC_QUIRK_RESET_AFTER_PROBE (1 << 2)
#define KBDC_QUIRK_SETLEDS_ON_INIT (1 << 3)
} atkbdc_softc_t;
enum kbdc_device_ivar {

View File

@ -371,6 +371,10 @@ static devclass_t psm_devclass;
/* other flags (flags) */
#define PSM_FLAGS_FINGERDOWN 0x0001 /* VersaPad finger down */
#define kbdcp(p) ((atkbdc_softc_t *)(p))
#define ALWAYS_RESTORE_CONTROLLER(kbdc) !(kbdcp(kbdc)->quirks \
& KBDC_QUIRK_KEEP_ACTIVATED)
/* Tunables */
static int tap_enabled = -1;
TUNABLE_INT("hw.psm.tap_enabled", &tap_enabled);
@ -1231,7 +1235,8 @@ psmprobe(device_t dev)
* this is CONTROLLER ERROR; I don't know how to recover
* from this error...
*/
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
printf("psm%d: unable to set the command byte.\n", unit);
endprobe(ENXIO);
}
@ -1270,7 +1275,8 @@ psmprobe(device_t dev)
recover_from_error(sc->kbdc);
if (sc->config & PSM_CONFIG_IGNPORTERROR)
break;
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
if (verbose)
printf("psm%d: the aux port is not functioning (%d).\n",
unit, i);
@ -1293,7 +1299,8 @@ psmprobe(device_t dev)
*/
if (!reset_aux_dev(sc->kbdc)) {
recover_from_error(sc->kbdc);
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
if (verbose)
printf("psm%d: failed to reset the aux "
"device.\n", unit);
@ -1315,7 +1322,8 @@ psmprobe(device_t dev)
if (!enable_aux_dev(sc->kbdc) || !disable_aux_dev(sc->kbdc)) {
/* MOUSE ERROR */
recover_from_error(sc->kbdc);
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
if (verbose)
printf("psm%d: failed to enable the aux device.\n",
unit);
@ -1337,7 +1345,8 @@ psmprobe(device_t dev)
/* verify the device is a mouse */
sc->hw.hwid = get_aux_id(sc->kbdc);
if (!is_a_mouse(sc->hw.hwid)) {
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
if (verbose)
printf("psm%d: unknown device type (%d).\n", unit,
sc->hw.hwid);
@ -1443,7 +1452,8 @@ psmprobe(device_t dev)
* this is CONTROLLER ERROR; I don't know the proper way to
* recover from this error...
*/
restore_controller(sc->kbdc, command_byte);
if (ALWAYS_RESTORE_CONTROLLER(sc->kbdc))
restore_controller(sc->kbdc, command_byte);
printf("psm%d: unable to set the command byte.\n", unit);
endprobe(ENXIO);
}

View File

@ -176,7 +176,7 @@ iwch_destroy_cq(struct ib_cq *ib_cq)
}
static struct ib_cq *
iwch_create_cq(struct ib_device *ibdev, int entries, int vector,
iwch_create_cq(struct ib_device *ibdev, struct ib_cq_init_attr *attr,
struct ib_ucontext *ib_context,
struct ib_udata *udata)
{
@ -187,6 +187,7 @@ iwch_create_cq(struct ib_device *ibdev, int entries, int vector,
struct iwch_ucontext *ucontext = NULL;
static int warned;
size_t resplen;
int entries = attr->cqe;
CTR3(KTR_IW_CXGB, "%s ib_dev %p entries %d", __FUNCTION__, ibdev, entries);
rhp = to_iwch_dev(ibdev);
@ -545,16 +546,14 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
int mr_id)
{
__be64 *pages;
int shift, i, n;
int shift, n, len;
int i, k, entry;
int err = 0;
struct ib_umem_chunk *chunk;
struct iwch_dev *rhp;
struct iwch_pd *php;
struct iwch_mr *mhp;
struct iwch_reg_user_mr_resp uresp;
#ifdef notyet
int j, k, len;
#endif
struct scatterlist *sg;
CTR2(KTR_IW_CXGB, "%s ib_pd %p", __FUNCTION__, pd);
@ -575,9 +574,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
shift = ffs(mhp->umem->page_size) - 1;
n = 0;
list_for_each_entry(chunk, &mhp->umem->chunk_list, list)
n += chunk->nents;
n = mhp->umem->nmap;
err = iwch_alloc_pbl(mhp, n);
if (err)
@ -591,7 +588,21 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
i = n = 0;
#ifdef notyet
for_each_sg(mhp->umem->sg_head.sgl, sg, mhp->umem->nmap, entry) {
len = sg_dma_len(sg) >> shift;
for (k = 0; k < len; ++k) {
pages[i++] = cpu_to_be64(sg_dma_address(sg) +
mhp->umem->page_size * k);
if (i == PAGE_SIZE / sizeof *pages) {
err = iwch_write_pbl(mhp, pages, i, n);
if (err)
goto pbl_done;
n += i;
i = 0;
}
}
}
#if 0
TAILQ_FOREACH(chunk, &mhp->umem->chunk_list, entry)
for (j = 0; j < chunk->nmap; ++j) {
len = sg_dma_len(&chunk->page_list[j]) >> shift;
@ -612,9 +623,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
if (i)
err = iwch_write_pbl(mhp, pages, i, n);
#ifdef notyet
pbl_done:
#endif
cxfree(pages);
if (err)
goto err_pbl;
@ -672,7 +681,7 @@ static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc)
return ibmr;
}
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd)
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
{
struct iwch_dev *rhp;
struct iwch_pd *php;

View File

@ -551,18 +551,18 @@ int iwch_bind_mw(struct ib_qp *qp,
if (mw_bind->send_flags & IB_SEND_SIGNALED)
t3_wr_flags = T3_COMPLETION_FLAG;
sgl.addr = mw_bind->addr;
sgl.lkey = mw_bind->mr->lkey;
sgl.length = mw_bind->length;
sgl.addr = mw_bind->bind_info.addr;
sgl.lkey = mw_bind->bind_info.mr->lkey;
sgl.length = mw_bind->bind_info.length;
wqe->bind.reserved = 0;
wqe->bind.type = T3_VA_BASED_TO;
/* TBD: check perms */
wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->mw_access_flags);
wqe->bind.mr_stag = htobe32(mw_bind->mr->lkey);
wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->bind_info.mw_access_flags);
wqe->bind.mr_stag = htobe32(mw_bind->bind_info.mr->lkey);
wqe->bind.mw_stag = htobe32(mw->rkey);
wqe->bind.mw_len = htobe32(mw_bind->length);
wqe->bind.mw_va = htobe64(mw_bind->addr);
wqe->bind.mw_len = htobe32(mw_bind->bind_info.length);
wqe->bind.mw_va = htobe64(mw_bind->bind_info.addr);
err = iwch_sgl2pbl_map(rhp, &sgl, 1, &pbl_addr, &page_size);
if (err) {
mtx_unlock(&qhp->lock);

View File

@ -775,7 +775,7 @@ int c4iw_destroy_cq(struct ib_cq *ib_cq)
}
struct ib_cq *
c4iw_create_cq(struct ib_device *ibdev, int entries, int vector,
c4iw_create_cq(struct ib_device *ibdev, struct ib_cq_init_attr *attr,
struct ib_ucontext *ib_context, struct ib_udata *udata)
{
struct c4iw_dev *rhp;
@ -785,6 +785,7 @@ c4iw_create_cq(struct ib_device *ibdev, int entries, int vector,
int ret;
size_t memsize, hwentries;
struct c4iw_mm_entry *mm, *mm2;
int entries = attr->cqe;
CTR3(KTR_IW_CXGBE, "%s ib_dev %p entries %d", __func__, ibdev, entries);

View File

@ -864,7 +864,7 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(
int page_list_len);
struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth);
int c4iw_dealloc_mw(struct ib_mw *mw);
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd);
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64
virt, int acc, struct ib_udata *udata, int mr_id);
struct ib_mr *c4iw_get_dma_mr(struct ib_pd *pd, int acc);
@ -881,8 +881,7 @@ int c4iw_reregister_phys_mem(struct ib_mr *mr,
int acc, u64 *iova_start);
int c4iw_dereg_mr(struct ib_mr *ib_mr);
int c4iw_destroy_cq(struct ib_cq *ib_cq);
struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
int vector,
struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, struct ib_cq_init_attr *attr,
struct ib_ucontext *ib_context,
struct ib_udata *udata);
int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);

View File

@ -563,9 +563,9 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
{
__be64 *pages;
int shift, n, len;
int i, j, k;
int i, k, entry;
int err = 0;
struct ib_umem_chunk *chunk;
struct scatterlist *sg;
struct c4iw_dev *rhp;
struct c4iw_pd *php;
struct c4iw_mr *mhp;
@ -594,11 +594,8 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
}
shift = ffs(mhp->umem->page_size) - 1;
n = 0;
list_for_each_entry(chunk, &mhp->umem->chunk_list, list)
n += chunk->nents;
n = mhp->umem->nmap;
err = alloc_pbl(mhp, n);
if (err)
goto err;
@ -610,25 +607,23 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
}
i = n = 0;
list_for_each_entry(chunk, &mhp->umem->chunk_list, list)
for (j = 0; j < chunk->nmap; ++j) {
len = sg_dma_len(&chunk->page_list[j]) >> shift;
for (k = 0; k < len; ++k) {
pages[i++] = cpu_to_be64(sg_dma_address(
&chunk->page_list[j]) +
for_each_sg(mhp->umem->sg_head.sgl, sg, mhp->umem->nmap, entry) {
len = sg_dma_len(sg) >> shift;
for (k = 0; k < len; ++k) {
pages[i++] = cpu_to_be64(sg_dma_address(sg) +
mhp->umem->page_size * k);
if (i == PAGE_SIZE / sizeof *pages) {
err = write_pbl(&mhp->rhp->rdev,
pages,
mhp->attr.pbl_addr + (n << 3), i);
if (err)
goto pbl_done;
n += i;
i = 0;
}
if (i == PAGE_SIZE / sizeof *pages) {
err = write_pbl(&mhp->rhp->rdev,
pages,
mhp->attr.pbl_addr + (n << 3), i);
if (err)
goto pbl_done;
n += i;
i = 0;
}
}
}
if (i)
err = write_pbl(&mhp->rhp->rdev, pages,
@ -662,7 +657,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
return ERR_PTR(err);
}
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd)
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
{
struct c4iw_dev *rhp;
struct c4iw_pd *php;

View File

@ -134,7 +134,8 @@ fb_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
break;
case FBIO_BLANK: /* blank display */
error = 0; /* TODO */
if (info->setblankmode != NULL)
error = info->setblankmode(info->fb_priv, *(int *)data);
break;
default:

View File

@ -1,372 +0,0 @@
/*-
* Copyright (c) 1995 John Hay. 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 [your name]
* and [any other names deserving credit ]
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY [your name] 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.
*
* $FreeBSD$
*/
#ifndef _HD64570_H_
#define _HD64570_H_
typedef struct msci_channel
{
union
{
unsigned short us_trb; /* rw */
struct
{
unsigned char uc_trbl;
unsigned char uc_trbh;
}uc_trb;
}u_trb;
unsigned char st0; /* ro */
unsigned char st1; /* rw */
unsigned char st2; /* rw */
unsigned char st3; /* ro */
unsigned char fst; /* rw */
unsigned char unused0;
unsigned char ie0; /* rw */
unsigned char ie1; /* rw */
unsigned char ie2; /* rw */
unsigned char fie; /* rw */
unsigned char cmd; /* wo */
unsigned char unused1;
unsigned char md0; /* rw */
unsigned char md1; /* rw */
unsigned char md2; /* rw */
unsigned char ctl; /* rw */
unsigned char sa0; /* rw */
unsigned char sa1; /* rw */
unsigned char idl; /* rw */
unsigned char tmc; /* rw */
unsigned char rxs; /* rw */
unsigned char txs; /* rw */
unsigned char trc0; /* rw */
unsigned char trc1; /* rw */
unsigned char rrc; /* rw */
unsigned char unused2;
unsigned char cst0; /* rw */
unsigned char cst1; /* rw */
unsigned char unused3[2];
}msci_channel;
#define trb u_trb.us_trb
#define trbl u_trb.uc_trb.uc_trbl
#define trbh u_trb.uc_trb.uc_trbh
typedef struct timer_channel
{
unsigned short tcnt; /* rw */
unsigned short tconr; /* wo */
unsigned char tcsr; /* rw */
unsigned char tepr; /* rw */
unsigned char unused[2];
}timer_channel;
typedef struct dmac_channel
{
unsigned short dar; /* rw */
unsigned char darb; /* rw */
unsigned char unused0;
unsigned short sar; /* rw On odd numbered dmacs (tx) only */
unsigned char sarb; /* rw */
#define cpb sarb
unsigned char unused1;
unsigned short cda; /* rw */
unsigned short eda; /* rw */
unsigned short bfl; /* rw On even numbered dmacs (rx) only */
unsigned short bcr; /* rw */
unsigned char dsr; /* rw */
unsigned char dmr; /* rw */
unsigned char unused2;
unsigned char fct; /* rw */
unsigned char dir; /* rw */
unsigned char dcr; /* rw */
unsigned char unused3[10];
}dmac_channel;
/* x is the channel number. rx channels are even numbered and tx, odd. */
#define DMAC_RXCH(x) ((x*2) + 0)
#define DMAC_TXCH(x) ((x*2) + 1)
typedef struct sca_regs
{
unsigned char lpr; /* rw */
unsigned char unused0; /* -- */
/* Wait system */
unsigned char pabr0; /* rw */
unsigned char pabr1; /* rw */
unsigned char wcrl; /* rw */
unsigned char wcrm; /* rw */
unsigned char wcrh; /* rw */
unsigned char unused1;
/* DMAC */
unsigned char pcr; /* rw */
unsigned char dmer; /* rw */
unsigned char unused2[6];
/* Interrupt */
unsigned char isr0; /* ro */
unsigned char isr1; /* ro */
unsigned char isr2; /* ro */
unsigned char unused3;
unsigned char ier0; /* rw */
unsigned char ier1; /* rw */
unsigned char ier2; /* rw */
unsigned char unused4;
unsigned char itcr; /* rw */
unsigned char unused5;
unsigned char ivr; /* rw */
unsigned char unused6;
unsigned char imvr; /* rw */
unsigned char unused7[3];
/* MSCI Channel 0 */
msci_channel msci[2];
timer_channel timer[4];
dmac_channel dmac[4];
}sca_regs;
#define SCA_CMD_TXRESET 0x01
#define SCA_CMD_TXENABLE 0x02
#define SCA_CMD_TXDISABLE 0x03
#define SCA_CMD_TXCRCINIT 0x04
#define SCA_CMD_TXCRCEXCL 0x05
#define SCA_CMS_TXEOM 0x06
#define SCA_CMD_TXABORT 0x07
#define SCA_CMD_MPON 0x08
#define SCA_CMD_TXBCLEAR 0x09
#define SCA_CMD_RXRESET 0x11
#define SCA_CMD_RXENABLE 0x12
#define SCA_CMD_RXDISABLE 0x13
#define SCA_CMD_RXCRCINIT 0x14
#define SCA_CMD_RXMSGREJ 0x15
#define SCA_CMD_MPSEARCH 0x16
#define SCA_CMD_RXCRCEXCL 0x17
#define SCA_CMD_RXCRCCALC 0x18
#define SCA_CMD_NOP 0x00
#define SCA_CMD_RESET 0x21
#define SCA_CMD_SEARCH 0x31
#define SCA_MD0_CRC_1 0x01
#define SCA_MD0_CRC_CCITT 0x02
#define SCA_MD0_CRC_ENABLE 0x04
#define SCA_MD0_AUTO_ENABLE 0x10
#define SCA_MD0_MODE_ASYNC 0x00
#define SCA_MD0_MODE_BYTESYNC1 0x20
#define SCA_MD0_MODE_BISYNC 0x40
#define SCA_MD0_MODE_BYTESYNC2 0x60
#define SCA_MD0_MODE_HDLC 0x80
#define SCA_MD1_NOADDRCHK 0x00
#define SCA_MD1_SNGLADDR1 0x40
#define SCA_MD1_SNGLADDR2 0x80
#define SCA_MD1_DUALADDR 0xC0
#define SCA_MD2_DUPLEX 0x00
#define SCA_MD2_ECHO 0x01
#define SCA_MD2_LOOPBACK 0x03
#define SCA_MD2_ADPLLx8 0x00
#define SCA_MD2_ADPLLx16 0x08
#define SCA_MD2_ADPLLx32 0x10
#define SCA_MD2_NRZ 0x00
#define SCA_MD2_NRZI 0x20
#define SCA_MD2_MANCHESTER 0x80
#define SCA_MD2_FM0 0xC0
#define SCA_MD2_FM1 0xA0
#define SCA_CTL_RTS 0x01
#define SCA_CTL_IDLPAT 0x10
#define SCA_CTL_UDRNC 0x20
#define SCA_RXS_DIV_MASK 0x0F
#define SCA_RXS_DIV1 0x00
#define SCA_RXS_DIV2 0x01
#define SCA_RXS_DIV4 0x02
#define SCA_RXS_DIV8 0x03
#define SCA_RXS_DIV16 0x04
#define SCA_RXS_DIV32 0x05
#define SCA_RXS_DIV64 0x06
#define SCA_RXS_DIV128 0x07
#define SCA_RXS_DIV256 0x08
#define SCA_RXS_DIV512 0x09
#define SCA_RXS_CLK_RXC0 0x00
#define SCA_RXS_CLK_RXC1 0x20
#define SCA_RXS_CLK_INT 0x40
#define SCA_RXS_CLK_ADPLL_OUT 0x60
#define SCA_RXS_CLK_ADPLL_IN 0x70
#define SCA_TXS_DIV_MASK 0x0F
#define SCA_TXS_DIV1 0x00
#define SCA_TXS_DIV2 0x01
#define SCA_TXS_DIV4 0x02
#define SCA_TXS_DIV8 0x03
#define SCA_TXS_DIV16 0x04
#define SCA_TXS_DIV32 0x05
#define SCA_TXS_DIV64 0x06
#define SCA_TXS_DIV128 0x07
#define SCA_TXS_DIV256 0x08
#define SCA_TXS_DIV512 0x09
#define SCA_TXS_CLK_TXC 0x00
#define SCA_TXS_CLK_INT 0x40
#define SCA_TXS_CLK_RX 0x60
#define SCA_ST0_RXRDY 0x01
#define SCA_ST0_TXRDY 0x02
#define SCA_ST0_RXINT 0x40
#define SCA_ST0_TXINT 0x80
#define SCA_ST1_IDLST 0x01
#define SCA_ST1_ABTST 0x02
#define SCA_ST1_DCDCHG 0x04
#define SCA_ST1_CTSCHG 0x08
#define SCA_ST1_FLAG 0x10
#define SCA_ST1_TXIDL 0x40
#define SCA_ST1_UDRN 0x80
/* ST2 and FST look the same */
#define SCA_FST_CRCERR 0x04
#define SCA_FST_OVRN 0x08
#define SCA_FST_RESFRM 0x10
#define SCA_FST_ABRT 0x20
#define SCA_FST_SHRT 0x40
#define SCA_FST_EOM 0x80
#define SCA_ST3_RXENA 0x01
#define SCA_ST3_TXENA 0x02
#define SCA_ST3_DCD 0x04
#define SCA_ST3_CTS 0x08
#define SCA_ST3_ADPLLSRCH 0x10
#define SCA_ST3_TXDATA 0x20
#define SCA_FIE_EOMFE 0x80
#define SCA_IE0_RXRDY 0x01
#define SCA_IE0_TXRDY 0x02
#define SCA_IE0_RXINT 0x40
#define SCA_IE0_TXINT 0x80
#define SCA_IE1_IDLDE 0x01
#define SCA_IE1_ABTDE 0x02
#define SCA_IE1_DCD 0x04
#define SCA_IE1_CTS 0x08
#define SCA_IE1_FLAG 0x10
#define SCA_IE1_IDL 0x40
#define SCA_IE1_UDRN 0x80
#define SCA_IE2_CRCERR 0x04
#define SCA_IE2_OVRN 0x08
#define SCA_IE2_RESFRM 0x10
#define SCA_IE2_ABRT 0x20
#define SCA_IE2_SHRT 0x40
#define SCA_IE2_EOM 0x80
/* This is for RRC, TRC0 and TRC1. */
#define SCA_RCR_MASK 0x1F
#define SCA_IE1_
#define SCA_IV_CHAN0 0x00
#define SCA_IV_CHAN1 0x20
#define SCA_IV_RXRDY 0x04
#define SCA_IV_TXRDY 0x06
#define SCA_IV_RXINT 0x08
#define SCA_IV_TXINT 0x0A
#define SCA_IV_DMACH0 0x00
#define SCA_IV_DMACH1 0x08
#define SCA_IV_DMACH2 0x20
#define SCA_IV_DMACH3 0x28
#define SCA_IV_DMIA 0x14
#define SCA_IV_DMIB 0x16
#define SCA_IV_TIMER0 0x1C
#define SCA_IV_TIMER1 0x1E
#define SCA_IV_TIMER2 0x3C
#define SCA_IV_TIMER3 0x3E
/*
* DMA registers
*/
#define SCA_DSR_EOT 0x80
#define SCA_DSR_EOM 0x40
#define SCA_DSR_BOF 0x20
#define SCA_DSR_COF 0x10
#define SCA_DSR_DE 0x02
#define SCA_DSR_DWE 0x01
#define SCA_DMR_TMOD 0x10
#define SCA_DMR_NF 0x04
#define SCA_DMR_CNTE 0x02
#define SCA_DMER_EN 0x80
#define SCA_DCR_ABRT 0x01
#define SCA_DCR_FCCLR 0x02 /* Clear frame end intr counter */
#define SCA_DIR_EOT 0x80
#define SCA_DIR_EOM 0x40
#define SCA_DIR_BOF 0x20
#define SCA_DIR_COF 0x10
#define SCA_PCR_BRC 0x10
#define SCA_PCR_CCC 0x08
#define SCA_PCR_PR2 0x04
#define SCA_PCR_PR1 0x02
#define SCA_PCR_PR0 0x01
typedef struct sca_descriptor
{
unsigned short cp;
unsigned short bp;
unsigned char bpb;
unsigned char unused0;
unsigned short len;
unsigned char stat;
unsigned char unused1;
}sca_descriptor;
#define SCA_DESC_EOT 0x01
#define SCA_DESC_CRC 0x04
#define SCA_DESC_OVRN 0x08
#define SCA_DESC_RESD 0x10
#define SCA_DESC_ABORT 0x20
#define SCA_DESC_SHRTFRM 0x40
#define SCA_DESC_EOM 0x80
#define SCA_DESC_ERRORS 0x7C
/*
***************************************************************************
** END
***************************************************************************
**/
#endif /* _HD64570_H_ */

View File

@ -1052,7 +1052,7 @@ struct card
*/
#define IOREF_CSR 1 /* access Tulip CSRs with IO cycles if 1 */
#if (defined(__FreeBSD__) && defined(DEVICE_POLLING))
#if defined(DEVICE_POLLING)
# define DEV_POLL 1
#else
# define DEV_POLL 0
@ -1076,15 +1076,10 @@ struct softc
struct ifnet *ifp;
struct ifmedia ifm; /* hooks for ifconfig(8) */
# if NSPPP
# if (__FreeBSD_version < 600000)
struct sppp spppcom; /* must be first in sc for fbsd < 6 */
# endif
struct sppp *sppp;
# elif P2P
struct p2pcom p2pcom;
struct p2pcom *p2p;
# elif (__FreeBSD_version < 600000)
struct ifnet ifnet; /* must be first in sc for fbsd < 6 */
# endif
#endif
@ -1092,13 +1087,8 @@ struct softc
#if NETGRAPH
node_p ng_node; /* pointer to our node struct */
hook_p ng_hook; /* non-zero means NETGRAPH owns device */
# if (__FreeBSD_version >= 503000)
struct ifaltq ng_sndq;
struct ifaltq ng_fastq;
# else
struct ifqueue ng_sndq;
struct ifqueue ng_fastq;
# endif
#endif
struct callout callout; /* watchdog needs this */
@ -1115,13 +1105,8 @@ struct softc
# ifdef DEVICE_POLLING
int quota; /* used for incoming packet flow control */
# endif
# if (__FreeBSD_version >= 500000)
struct mtx top_mtx; /* lock card->watchdog vs core_ioctl */
struct mtx bottom_mtx; /* lock for buf queues & descriptor rings */
# else /* FreeBSD-4 */
int top_spl; /* lock card->watchdog vs core_ioctl */
int bottom_spl; /* lock for buf queues & descriptor rings */
# endif
/* Top-half state used by all card types; lock with top_lock, */
@ -1154,23 +1139,11 @@ struct softc
# define WRITE_CSR(csr, val) bus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)
# define NAME_UNIT device_get_nameunit(sc->dev)
# define DRIVER_DEBUG ((sc->config.debug) || (sc->ifp->if_flags & IFF_DEBUG))
# if (__FreeBSD_version >= 500000)
# define TOP_TRYLOCK mtx_trylock(&sc->top_mtx)
# define TOP_UNLOCK mtx_unlock (&sc->top_mtx)
# define BOTTOM_TRYLOCK mtx_trylock(&sc->bottom_mtx)
# define BOTTOM_UNLOCK mtx_unlock (&sc->bottom_mtx)
# if (__FreeBSD_version >= 700000)
# define CHECK_CAP priv_check(curthread, PRIV_DRIVER)
# else
# define CHECK_CAP suser(curthread)
# endif
# else /* FreeBSD-4 */
# define TOP_TRYLOCK (sc->top_spl = splimp())
# define TOP_UNLOCK splx(sc->top_spl)
# define BOTTOM_TRYLOCK 1 /* giant_lock protects */
# define BOTTOM_UNLOCK /* nothing */
# define CHECK_CAP suser(curproc)
# endif
# define TOP_TRYLOCK mtx_trylock(&sc->top_mtx)
# define TOP_UNLOCK mtx_unlock (&sc->top_mtx)
# define BOTTOM_TRYLOCK mtx_trylock(&sc->bottom_mtx)
# define BOTTOM_UNLOCK mtx_unlock (&sc->bottom_mtx)
# define CHECK_CAP priv_check(curthread, PRIV_DRIVER)
# define DISABLE_INTR /* nothing */
# define ENABLE_INTR /* nothing */
# define IRQ_NONE /* nothing */
@ -1181,28 +1154,13 @@ struct softc
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, fbsd_dmamap_load, ring, 0)
# if (NBPFILTER != 0)
# if (__FreeBSD_version >= 500000)
# define LMC_BPF_MTAP(mbuf) BPF_MTAP(sc->ifp, mbuf)
# else /* FreeBSD-4 */
# define LMC_BPF_MTAP(mbuf) if (sc->ifp->if_bpf) bpf_mtap(sc->ifp, mbuf)
# endif
# define LMC_BPF_MTAP(mbuf) BPF_MTAP(sc->ifp, mbuf)
# define LMC_BPF_ATTACH(dlt, len) bpfattach(sc->ifp, dlt, len)
# define LMC_BPF_DETACH bpfdetach(sc->ifp)
# endif
# if (__FreeBSD_version >= 500000)
# define IF_DROP(ifq) _IF_DROP(ifq)
# define IF_QFULL(ifq) _IF_QFULL(ifq)
# endif
# if (__FreeBSD_version < 500000)
# define INTR_MPSAFE 0
# define BUS_DMA_COHERENT 0
# endif
# if (__FreeBSD_version >= 600000)
# define IFF_RUNNING IFF_DRV_RUNNING
# endif
# define IF_DROP(ifq) _IF_DROP(ifq)
# define IF_QFULL(ifq) _IF_QFULL(ifq)
# define IFF_RUNNING IFF_DRV_RUNNING
#if (NBPFILTER == 0)
@ -1211,40 +1169,6 @@ struct softc
# define LMC_BPF_DETACH /* nothing */
#endif
#if (defined(__bsdi__) || /* unconditionally */ \
(defined(__FreeBSD__) && (__FreeBSD_version < 503000)) || \
(defined(__NetBSD__) && (__NetBSD_Version__ < 106000000)) || \
(defined(__OpenBSD__) && ( OpenBSD < 200111)))
# define IFQ_ENQUEUE(ifq, m, pa, err) \
do { \
if (pa==0); /* suppress warning */ \
if (IF_QFULL(ifq)) \
{ \
IF_DROP(ifq); \
m_freem(m); \
err = ENOBUFS; \
} \
else \
{ \
IF_ENQUEUE(ifq, m); \
err = 0; \
} \
} while (0)
# define IFQ_DEQUEUE(ifq, m) do { IF_DEQUEUE((ifq), m) } while (0)
# define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_head == NULL)
# define IFQ_SET_MAXLEN(ifq, len) (ifq)->ifq_maxlen = len
# define IFQ_SET_READY(ifq) /* nothing */
# define IFQ_PURGE(ifq) \
do { \
while ((ifq)->ifq_head != NULL) \
{ \
struct mbuf *m; \
IF_DEQUEUE(ifq, m); \
m_freem(m); \
} \
} while (0)
#endif
#define HSSI_DESC "SBE/LMC HSSI Card"
#define T3_DESC "SBE/LMC T3 Card"
#define SSI_DESC "SBE/LMC SSI Card"
@ -1315,10 +1239,6 @@ static void t1_send_bop(softc_t *, int);
static int t1_ioctl(softc_t *, struct ioctl *);
#if IFNET
# if ((defined(__FreeBSD__) && (__FreeBSD_version < 500000)) ||\
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__))
static void netisr_dispatch(int, struct mbuf *);
# endif
static void lmc_raw_input(struct ifnet *, struct mbuf *);
#endif /* IFNET */
@ -1372,25 +1292,12 @@ static void lmc_ifnet_detach(softc_t *);
#endif /* IFNET */
#if NETGRAPH
# if (__FreeBSD_version >= 500000)
static int ng_constructor(node_p);
# else /* FreeBSD-4 */
static int ng_constructor(node_p *);
# endif
# if (__FreeBSD_version >= 500000)
static int ng_rcvmsg(node_p, item_p, hook_p);
# else /* FreeBSD-4 */
static int ng_rcvmsg(node_p, struct ng_mesg *,
const char *, struct ng_mesg **);
# endif
static int ng_shutdown(node_p);
static int ng_newhook(node_p, hook_p, const char *);
static int ng_connect(hook_p);
# if (__FreeBSD_version >= 500000)
static int ng_rcvdata(hook_p, item_p);
# else /* FreeBSD-4 */
static int ng_rcvdata(hook_p, struct mbuf *, meta_p);
# endif
static int ng_disconnect(hook_p);
# if (IFNET == 0)
static void ng_watchdog(void *);

View File

@ -656,9 +656,8 @@ netmap_update_config(struct netmap_adapter *na)
u_int txr, txd, rxr, rxd;
txr = txd = rxr = rxd = 0;
if (na->nm_config) {
na->nm_config(na, &txr, &txd, &rxr, &rxd);
} else {
if (na->nm_config == NULL ||
na->nm_config(na, &txr, &txd, &rxr, &rxd)) {
/* take whatever we had at init time */
txr = na->num_tx_rings;
txd = na->num_tx_desc;
@ -2168,7 +2167,7 @@ netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
error = ENXIO;
break;
}
rmb(); /* make sure following reads are not from cache */
mb(); /* make sure following reads are not from cache */
na = priv->np_na; /* we have a reference */
@ -3071,16 +3070,14 @@ netmap_init(void)
error = netmap_mem_init();
if (error != 0)
goto fail;
/* XXX could use make_dev_credv() to get error number */
#ifdef __FreeBSD__
/* support for the 'eternal' flag */
/*
* MAKEDEV_ETERNAL_KLD avoids an expensive check on syscalls
* when the module is compiled in.
* XXX could use make_dev_credv() to get error number
*/
netmap_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD,
&netmap_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0600,
"netmap");
#else
netmap_dev = make_dev(&netmap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"netmap");
#endif
if (!netmap_dev)
goto fail;

View File

@ -605,8 +605,6 @@ pci_read_device(device_t pcib, int d, int b, int s, int f, size_t size)
if (REG(PCIR_DEVVENDOR, 4) != 0xfffffffful) {
devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
if (devlist_entry == NULL)
return (NULL);
cfg = &devlist_entry->cfg;

View File

@ -82,19 +82,13 @@ dummy_random_init(void)
*
* Caveat Emptor.
*/
u_int
void
dummy_random_read_phony(uint8_t *buf, u_int count)
{
/* If no entropy device is loaded, don't spam the console with warnings */
static int warned = 0;
u_long randval;
size_t size, i;
if (!warned) {
log(LOG_WARNING, "random device not loaded/active; using insecure pseudo-random number generator\n");
warned = 1;
}
/* srandom() is called in kern/init_main.c:proc0_post() */
/* Fill buf[] with random(9) output */
@ -103,8 +97,6 @@ dummy_random_read_phony(uint8_t *buf, u_int count)
size = MIN(count - i, sizeof(randval));
memcpy(buf + i, &randval, (size_t)size);
}
return (count);
}
struct random_adaptor randomdev_dummy = {

View File

@ -149,10 +149,14 @@ random_adaptor_choose(void)
(random_adaptor_previous == NULL ? "NULL" : random_adaptor_previous->ra_ident),
random_adaptor->ra_ident);
#endif
if (random_adaptor_previous != NULL)
if (random_adaptor_previous != NULL) {
randomdev_deinit_reader();
(random_adaptor_previous->ra_deinit)();
}
(random_adaptor->ra_init)();
}
randomdev_init_reader(random_adaptor->ra_read);
}

View File

@ -214,11 +214,11 @@ random_harvest(const void *entropy, u_int count, u_int bits, enum random_entropy
*/
/* Hold the address of the routine which is actually called */
static u_int (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
static void (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
/* Initialise the reader when/if it is loaded */
void
randomdev_init_reader(u_int (*reader)(uint8_t *, u_int))
randomdev_init_reader(void (*reader)(uint8_t *, u_int))
{
read_func = reader;
@ -240,5 +240,10 @@ int
read_random(void *buf, int count)
{
return ((int)(*read_func)(buf, (u_int)count));
if (count < 0)
return 0;
read_func(buf, count);
return count;
}

View File

@ -37,12 +37,12 @@ typedef void random_init_func_t(void);
typedef void random_deinit_func_t(void);
void randomdev_init_harvester(void (*)(const void *, u_int, u_int, enum random_entropy_source));
void randomdev_init_reader(u_int (*)(uint8_t *, u_int));
void randomdev_init_reader(void (*)(uint8_t *, u_int));
void randomdev_deinit_harvester(void);
void randomdev_deinit_reader(void);
/* Stub/fake routines for when no entropy processor is loaded */
extern u_int dummy_random_read_phony(uint8_t *, u_int);
extern void dummy_random_read_phony(uint8_t *, u_int);
/* kern.random sysctls */
#ifdef SYSCTL_DECL /* from sysctl.h */

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