Merge ^/head r343807 through r343955.
This commit is contained in:
commit
9e43c218d5
2
UPDATING
2
UPDATING
@ -1942,7 +1942,7 @@ to fetch an UPDATING file from an older FreeBSD release.
|
||||
|
||||
Copyright information:
|
||||
|
||||
Copyright 1998-2009 M. Warner Losh. All Rights Reserved.
|
||||
Copyright 1998-2009 M. Warner Losh.
|
||||
|
||||
Redistribution, publication, translation and use, with or without
|
||||
modification, in full or in part, in any form or format of this
|
||||
|
@ -268,7 +268,8 @@ ATF_TC_BODY(cbrtl_powl, tc)
|
||||
long double y, z;
|
||||
size_t i;
|
||||
|
||||
#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7
|
||||
#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \
|
||||
__FreeBSD_cc_version < 1300002
|
||||
atf_tc_expect_fail("test fails with clang 7+ - bug 234040");
|
||||
#endif
|
||||
|
||||
|
@ -11,8 +11,12 @@
|
||||
defaults
|
||||
..
|
||||
dtb
|
||||
allwinner tags=package=runtime
|
||||
..
|
||||
overlays tags=package=runtime
|
||||
..
|
||||
rockchip tags=package=runtime
|
||||
..
|
||||
..
|
||||
firmware
|
||||
..
|
||||
|
@ -50,19 +50,12 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Expand the line buffer. Return -1 on error.
|
||||
#ifdef notdef
|
||||
* The `new size' does not account for a terminating '\0',
|
||||
* so we add 1 here.
|
||||
#endif
|
||||
*/
|
||||
int
|
||||
__slbexpand(FILE *fp, size_t newsize)
|
||||
{
|
||||
void *p;
|
||||
|
||||
#ifdef notdef
|
||||
++newsize;
|
||||
#endif
|
||||
if (fp->_lb._size >= newsize)
|
||||
return (0);
|
||||
if (newsize > INT_MAX) {
|
||||
@ -160,9 +153,6 @@ fgetln(FILE *fp, size_t *lenp)
|
||||
break;
|
||||
}
|
||||
*lenp = len;
|
||||
#ifdef notdef
|
||||
fp->_lb._base[len] = '\0';
|
||||
#endif
|
||||
ret = (char *)fp->_lb._base;
|
||||
end:
|
||||
FUNLOCKFILE_CANCELSAFE();
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 21, 2018
|
||||
.Dd February 10, 2019
|
||||
.Dt GETSOCKOPT 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -534,7 +534,11 @@ transfer rate to the given unsigned 32-bit value in bytes per second.
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std
|
||||
.Sh ERRORS
|
||||
The call succeeds unless:
|
||||
The
|
||||
.Fn getsockopt
|
||||
and
|
||||
.Fn setsockopt
|
||||
system calls succeed unless:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EBADF
|
||||
The argument
|
||||
@ -562,6 +566,15 @@ on a non-listening socket was attempted.
|
||||
.It Bq Er ENOMEM
|
||||
A memory allocation failed that was required to service the request.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Fn setsockopt
|
||||
system call may also return the following error:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er ENOBUFS
|
||||
Insufficient resources were available in the system
|
||||
to perform the operation.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ioctl 2 ,
|
||||
.Xr listen 2 ,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
|
||||
* Copyright (c) 2016, 2017 The FreeBSD Foundation
|
||||
* Copyright (c) 2016, 2017, 2019 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Konstantin Belousov
|
||||
@ -50,15 +50,9 @@ __FBSDID("$FreeBSD$");
|
||||
#ifdef WANT_HYPERV
|
||||
#include <dev/hyperv/hyperv.h>
|
||||
#endif
|
||||
#include <x86/ifunc.h>
|
||||
#include "libc_private.h"
|
||||
|
||||
static enum LMB {
|
||||
LMB_UNKNOWN,
|
||||
LMB_NONE,
|
||||
LMB_MFENCE,
|
||||
LMB_LFENCE
|
||||
} lfence_works = LMB_UNKNOWN;
|
||||
|
||||
static void
|
||||
cpuidp(u_int leaf, u_int p[4])
|
||||
{
|
||||
@ -84,68 +78,36 @@ cpuidp(u_int leaf, u_int p[4])
|
||||
: "0" (leaf));
|
||||
}
|
||||
|
||||
static enum LMB
|
||||
select_lmb(void)
|
||||
static void
|
||||
rdtsc_mb_lfence(void)
|
||||
{
|
||||
|
||||
lfence();
|
||||
}
|
||||
|
||||
static void
|
||||
rdtsc_mb_mfence(void)
|
||||
{
|
||||
|
||||
mfence();
|
||||
}
|
||||
|
||||
static void
|
||||
rdtsc_mb_none(void)
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_UIFUNC(static, void, rdtsc_mb, (void), static)
|
||||
{
|
||||
u_int p[4];
|
||||
/* Not a typo, string matches our cpuidp() registers use. */
|
||||
static const char intel_id[] = "GenuntelineI";
|
||||
|
||||
if ((cpu_feature & CPUID_SSE2) == 0)
|
||||
return (rdtsc_mb_none);
|
||||
cpuidp(0, p);
|
||||
return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ?
|
||||
LMB_LFENCE : LMB_MFENCE);
|
||||
}
|
||||
|
||||
static void
|
||||
init_fence(void)
|
||||
{
|
||||
#if defined(__i386__)
|
||||
u_int cpuid_supported, p[4];
|
||||
|
||||
lfence_works = LMB_NONE;
|
||||
__asm __volatile(
|
||||
" pushfl\n"
|
||||
" popl %%eax\n"
|
||||
" movl %%eax,%%ecx\n"
|
||||
" xorl $0x200000,%%eax\n"
|
||||
" pushl %%eax\n"
|
||||
" popfl\n"
|
||||
" pushfl\n"
|
||||
" popl %%eax\n"
|
||||
" xorl %%eax,%%ecx\n"
|
||||
" je 1f\n"
|
||||
" movl $1,%0\n"
|
||||
" jmp 2f\n"
|
||||
"1: movl $0,%0\n"
|
||||
"2:\n"
|
||||
: "=r" (cpuid_supported) : : "eax", "ecx", "cc");
|
||||
if (cpuid_supported) {
|
||||
cpuidp(0x1, p);
|
||||
if ((p[3] & CPUID_SSE2) != 0)
|
||||
lfence_works = select_lmb();
|
||||
}
|
||||
#elif defined(__amd64__)
|
||||
lfence_works = select_lmb();
|
||||
#else
|
||||
#error "Arch"
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
rdtsc_mb(void)
|
||||
{
|
||||
|
||||
again:
|
||||
if (__predict_true(lfence_works == LMB_LFENCE)) {
|
||||
lfence();
|
||||
return;
|
||||
} else if (lfence_works == LMB_MFENCE) {
|
||||
mfence();
|
||||
return;
|
||||
} else if (lfence_works == LMB_NONE) {
|
||||
return;
|
||||
}
|
||||
init_fence();
|
||||
goto again;
|
||||
rdtsc_mb_lfence : rdtsc_mb_mfence);
|
||||
}
|
||||
|
||||
static u_int
|
||||
|
@ -88,6 +88,9 @@ cap_openlog(cap_channel_t *chan, const char *ident, int logopt, int facility)
|
||||
}
|
||||
nvlist_add_number(nvl, "logopt", logopt);
|
||||
nvlist_add_number(nvl, "facility", facility);
|
||||
if (logopt & LOG_PERROR) {
|
||||
nvlist_add_descriptor(nvl, "stderr", STDERR_FILENO);
|
||||
}
|
||||
nvl = cap_xfer_nvlist(chan, nvl);
|
||||
if (nvl == NULL) {
|
||||
return;
|
||||
@ -131,6 +134,7 @@ cap_setlogmask(cap_channel_t *chan, int maskpri)
|
||||
*/
|
||||
|
||||
static char *LogTag;
|
||||
static int prev_stderr = -1;
|
||||
|
||||
static void
|
||||
slog_vsyslog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
|
||||
@ -146,6 +150,8 @@ slog_openlog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
|
||||
nvlist_t *nvlout __unused)
|
||||
{
|
||||
const char *ident;
|
||||
uint64_t logopt;
|
||||
int stderr_fd;
|
||||
|
||||
ident = dnvlist_get_string(nvlin, "ident", NULL);
|
||||
if (ident != NULL) {
|
||||
@ -153,8 +159,19 @@ slog_openlog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
|
||||
LogTag = strdup(ident);
|
||||
}
|
||||
|
||||
openlog(LogTag, nvlist_get_number(nvlin, "logopt"),
|
||||
nvlist_get_number(nvlin, "facility"));
|
||||
logopt = nvlist_get_number(nvlin, "logopt");
|
||||
if (logopt & LOG_PERROR) {
|
||||
stderr_fd = dnvlist_get_descriptor(nvlin, "stderr", -1);
|
||||
if (prev_stderr == -1)
|
||||
prev_stderr = dup(STDERR_FILENO);
|
||||
if (prev_stderr != -1)
|
||||
(void)dup2(stderr_fd, STDERR_FILENO);
|
||||
} else if (prev_stderr != -1) {
|
||||
(void)dup2(prev_stderr, STDERR_FILENO);
|
||||
close(prev_stderr);
|
||||
prev_stderr = -1;
|
||||
}
|
||||
openlog(LogTag, logopt, nvlist_get_number(nvlin, "facility"));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -166,6 +183,12 @@ slog_closelog(const nvlist_t *limits __unused, const nvlist_t *nvlin __unused,
|
||||
|
||||
free(LogTag);
|
||||
LogTag = NULL;
|
||||
|
||||
if (prev_stderr != -1) {
|
||||
(void)dup2(prev_stderr, STDERR_FILENO);
|
||||
close(prev_stderr);
|
||||
prev_stderr = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -198,4 +221,4 @@ syslog_command(const char *cmd, const nvlist_t *limits, nvlist_t *nvlin,
|
||||
return (0);
|
||||
}
|
||||
|
||||
CREATE_SERVICE("system.syslog", NULL, syslog_command, CASPER_SERVICE_STDIO);
|
||||
CREATE_SERVICE("system.syslog", NULL, syslog_command, 0);
|
||||
|
@ -118,7 +118,8 @@ quota_open(struct fstab *fs, int quotatype, int openflags)
|
||||
struct dqhdr64 dqh;
|
||||
struct group *grp;
|
||||
struct stat st;
|
||||
int qcmd, serrno;
|
||||
int qcmd, serrno = 0;
|
||||
int ufs;
|
||||
|
||||
if ((qf = calloc(1, sizeof(*qf))) == NULL)
|
||||
return (NULL);
|
||||
@ -129,15 +130,21 @@ quota_open(struct fstab *fs, int quotatype, int openflags)
|
||||
goto error;
|
||||
qf->dev = st.st_dev;
|
||||
qcmd = QCMD(Q_GETQUOTASIZE, quotatype);
|
||||
ufs = strcmp(fs->fs_vfstype, "ufs") == 0;
|
||||
/*
|
||||
* On UFS, hasquota() fills in qf->qfname. But we only care about
|
||||
* this for UFS. So we need to call hasquota() for UFS, first.
|
||||
*/
|
||||
if (ufs) {
|
||||
serrno = hasquota(fs, quotatype, qf->qfname,
|
||||
sizeof(qf->qfname));
|
||||
}
|
||||
if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0)
|
||||
return (qf);
|
||||
/* We only check the quota file for ufs */
|
||||
if (strcmp(fs->fs_vfstype, "ufs")) {
|
||||
if (!ufs) {
|
||||
errno = 0;
|
||||
goto error;
|
||||
}
|
||||
serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname));
|
||||
if (serrno == 0) {
|
||||
} else if (serrno == 0) {
|
||||
errno = EOPNOTSUPP;
|
||||
goto error;
|
||||
}
|
||||
|
@ -93,8 +93,7 @@ __ieee754_j0(double x)
|
||||
if(ix>=0x7ff00000) return one/(x*x);
|
||||
x = fabs(x);
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sin(x);
|
||||
c = cos(x);
|
||||
sincos(x, &s, &c);
|
||||
ss = s-c;
|
||||
cc = s+c;
|
||||
if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */
|
||||
@ -173,8 +172,7 @@ __ieee754_y0(double x)
|
||||
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
|
||||
* to compute the worse one.
|
||||
*/
|
||||
s = sin(x);
|
||||
c = cos(x);
|
||||
sincos(x, &s, &c);
|
||||
ss = s-c;
|
||||
cc = s+c;
|
||||
/*
|
||||
|
@ -55,8 +55,7 @@ __ieee754_j0f(float x)
|
||||
if(ix>=0x7f800000) return one/(x*x);
|
||||
x = fabsf(x);
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sinf(x);
|
||||
c = cosf(x);
|
||||
sincosf(x, &s, &c);
|
||||
ss = s-c;
|
||||
cc = s+c;
|
||||
if(ix<0x7f000000) { /* Make sure x+x does not overflow. */
|
||||
@ -128,8 +127,7 @@ __ieee754_y0f(float x)
|
||||
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
|
||||
* to compute the worse one.
|
||||
*/
|
||||
s = sinf(x);
|
||||
c = cosf(x);
|
||||
sincosf(x, &s, &c);
|
||||
ss = s-c;
|
||||
cc = s+c;
|
||||
/*
|
||||
|
@ -94,8 +94,7 @@ __ieee754_j1(double x)
|
||||
if(ix>=0x7ff00000) return one/x;
|
||||
y = fabs(x);
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sin(y);
|
||||
c = cos(y);
|
||||
sincos(y, &s, &c);
|
||||
ss = -s-c;
|
||||
cc = s-c;
|
||||
if(ix<0x7fe00000) { /* make sure y+y not overflow */
|
||||
@ -159,8 +158,7 @@ __ieee754_y1(double x)
|
||||
/* y1(x<0) = NaN and raise invalid exception. */
|
||||
if(hx<0) return vzero/vzero;
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sin(x);
|
||||
c = cos(x);
|
||||
sincos(x, &s, &c);
|
||||
ss = -s-c;
|
||||
cc = s-c;
|
||||
if(ix<0x7fe00000) { /* make sure x+x not overflow */
|
||||
|
@ -56,8 +56,7 @@ __ieee754_j1f(float x)
|
||||
if(ix>=0x7f800000) return one/x;
|
||||
y = fabsf(x);
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sinf(y);
|
||||
c = cosf(y);
|
||||
sincosf(y, &s, &c);
|
||||
ss = -s-c;
|
||||
cc = s-c;
|
||||
if(ix<0x7f000000) { /* make sure y+y not overflow */
|
||||
@ -114,8 +113,7 @@ __ieee754_y1f(float x)
|
||||
if(ix==0) return -one/vzero;
|
||||
if(hx<0) return vzero/vzero;
|
||||
if(ix >= 0x40000000) { /* |x| >= 2.0 */
|
||||
s = sinf(x);
|
||||
c = cosf(x);
|
||||
sincosf(x, &s, &c);
|
||||
ss = -s-c;
|
||||
cc = s-c;
|
||||
if(ix<0x7f000000) { /* make sure x+x not overflow */
|
||||
|
@ -54,7 +54,7 @@ double
|
||||
__ieee754_jn(int n, double x)
|
||||
{
|
||||
int32_t i,hx,ix,lx, sgn;
|
||||
double a, b, temp, di;
|
||||
double a, b, c, s, temp, di;
|
||||
double z, w;
|
||||
|
||||
/* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
|
||||
@ -91,11 +91,12 @@ __ieee754_jn(int n, double x)
|
||||
* 2 -s+c -c-s
|
||||
* 3 s+c c-s
|
||||
*/
|
||||
sincos(x, &s, &c);
|
||||
switch(n&3) {
|
||||
case 0: temp = cos(x)+sin(x); break;
|
||||
case 1: temp = -cos(x)+sin(x); break;
|
||||
case 2: temp = -cos(x)-sin(x); break;
|
||||
case 3: temp = cos(x)-sin(x); break;
|
||||
case 0: temp = c+s; break;
|
||||
case 1: temp = -c+s; break;
|
||||
case 2: temp = -c-s; break;
|
||||
case 3: temp = c-s; break;
|
||||
}
|
||||
b = invsqrtpi*temp/sqrt(x);
|
||||
} else {
|
||||
@ -216,7 +217,7 @@ __ieee754_yn(int n, double x)
|
||||
{
|
||||
int32_t i,hx,ix,lx;
|
||||
int32_t sign;
|
||||
double a, b, temp;
|
||||
double a, b, c, s, temp;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
@ -248,11 +249,12 @@ __ieee754_yn(int n, double x)
|
||||
* 2 -s+c -c-s
|
||||
* 3 s+c c-s
|
||||
*/
|
||||
sincos(x, &s, &c);
|
||||
switch(n&3) {
|
||||
case 0: temp = sin(x)-cos(x); break;
|
||||
case 1: temp = -sin(x)-cos(x); break;
|
||||
case 2: temp = -sin(x)+cos(x); break;
|
||||
case 3: temp = sin(x)+cos(x); break;
|
||||
case 0: temp = s-c; break;
|
||||
case 1: temp = -s-c; break;
|
||||
case 2: temp = -s+c; break;
|
||||
case 3: temp = s+c; break;
|
||||
}
|
||||
b = invsqrtpi*temp/sqrt(x);
|
||||
} else {
|
||||
|
@ -160,7 +160,8 @@ ATF_TC_BODY(reduction, tc)
|
||||
|
||||
unsigned i;
|
||||
|
||||
#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7
|
||||
#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \
|
||||
__FreeBSD_cc_version < 1300002
|
||||
atf_tc_expect_fail("test fails with clang 7+ - bug 234040");
|
||||
#endif
|
||||
|
||||
|
@ -49,7 +49,20 @@ rcvar="growfs_enable"
|
||||
growfs_start ()
|
||||
{
|
||||
echo "Growing root partition to fill device"
|
||||
rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }')
|
||||
FSTYPE=$(mount -p | awk '{ if ( $2 == "/") { print $3 }}')
|
||||
FSDEV=$(mount -p | awk '{ if ( $2 == "/") { print $1 }}')
|
||||
case "$FSTYPE" in
|
||||
ufs)
|
||||
rootdev=${FSDEV#/dev/}
|
||||
;;
|
||||
zfs)
|
||||
pool=${FSDEV%%/*}
|
||||
rootdev=$(zpool list -v $pool | tail -n 1 | awk '{ print $1 }')
|
||||
;;
|
||||
*)
|
||||
echo "Don't know how to grow root filesystem type: $FSTYPE"
|
||||
return
|
||||
esac
|
||||
if [ x"$rootdev" = x"${rootdev%/*}" ]; then
|
||||
# raw device
|
||||
rawdev="$rootdev"
|
||||
@ -91,7 +104,14 @@ growfs_start ()
|
||||
}
|
||||
}' dev="$rawdev"
|
||||
gpart commit "$rootdev"
|
||||
growfs -y /dev/"$rootdev"
|
||||
case "$FSTYPE" in
|
||||
ufs)
|
||||
growfs -y /dev/"$rootdev"
|
||||
;;
|
||||
zfs)
|
||||
zpool online -e $pool $rootdev
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2002 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2002 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -2348,7 +2348,8 @@ priv_script_go(void)
|
||||
if (ip)
|
||||
script_flush_env(ip->client);
|
||||
|
||||
return (wstatus & 0xff);
|
||||
return (WIFEXITED(wstatus) ?
|
||||
WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -282,13 +282,14 @@ ipfw_table_handler(int ac, char *av[])
|
||||
}
|
||||
break;
|
||||
case TOK_LIST:
|
||||
arg = is_all ? (void*)1 : NULL;
|
||||
if (is_all == 0) {
|
||||
ipfw_xtable_info i;
|
||||
if ((error = table_get_info(&oh, &i)) != 0)
|
||||
err(EX_OSERR, "failed to request table info");
|
||||
table_show_one(&i, NULL);
|
||||
table_show_one(&i, arg);
|
||||
} else {
|
||||
error = tables_foreach(table_show_one, NULL, 1);
|
||||
error = tables_foreach(table_show_one, arg, 1);
|
||||
if (error != 0)
|
||||
err(EX_OSERR, "failed to request tables list");
|
||||
}
|
||||
@ -821,13 +822,16 @@ table_show_one(ipfw_xtable_info *i, void *arg)
|
||||
{
|
||||
ipfw_obj_header *oh;
|
||||
int error;
|
||||
int is_all;
|
||||
|
||||
is_all = arg == NULL ? 0 : 1;
|
||||
|
||||
if ((error = table_do_get_list(i, &oh)) != 0) {
|
||||
err(EX_OSERR, "Error requesting table %s list", i->tablename);
|
||||
return (error);
|
||||
}
|
||||
|
||||
table_show_list(oh, 1);
|
||||
table_show_list(oh, is_all);
|
||||
|
||||
free(oh);
|
||||
return (0);
|
||||
|
@ -125,6 +125,7 @@ read_worklist(off_t t)
|
||||
new_lump(s, l, state);
|
||||
d -= l;
|
||||
}
|
||||
fclose(file);
|
||||
(void)fprintf(stderr, " done.\n");
|
||||
/*
|
||||
* Return the number of bytes already read
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" From: @(#)sysctl.8 8.1 (Berkeley) 6/6/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 24, 2018
|
||||
.Dd February 8, 2019
|
||||
.Dt SYSCTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -36,13 +36,13 @@
|
||||
.Nd get or set kernel state
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl bdehiNnoRTtqx
|
||||
.Op Fl bdehiNnoTtqWx
|
||||
.Op Fl B Ar bufsize
|
||||
.Op Fl f Ar filename
|
||||
.Ar name Ns Op = Ns Ar value Ns Op , Ns Ar value
|
||||
.Ar ...
|
||||
.Nm
|
||||
.Op Fl bdehNnoRTtqx
|
||||
.Op Fl bdehNnoTtqWx
|
||||
.Op Fl B Ar bufsize
|
||||
.Fl a
|
||||
.Sh DESCRIPTION
|
||||
|
@ -35,7 +35,7 @@
|
||||
.\" $FreeBSD$
|
||||
.\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
|
||||
.\"
|
||||
.Dd January 12, 2015
|
||||
.Dd February 6, 2019
|
||||
.Dt NG_IFACE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -144,6 +144,17 @@ In case when your graph ends up with some kind of serial line, either
|
||||
synchronous or modem, the
|
||||
.Nm
|
||||
is the right place to turn ALTQ on.
|
||||
.Sh Nesting
|
||||
.Nm
|
||||
supports nesting, a configuration when traffic of one
|
||||
.Nm
|
||||
interface flows through the other.
|
||||
The default maximum allowed nesting level is 2.
|
||||
It can be changed at runtime setting
|
||||
.Xr sysctl 8
|
||||
variable
|
||||
.Va net.graph.iface.max_nesting
|
||||
to the desired level of nesting.
|
||||
.Sh SEE ALSO
|
||||
.Xr altq 4 ,
|
||||
.Xr bpf 4 ,
|
||||
@ -151,6 +162,7 @@ is the right place to turn ALTQ on.
|
||||
.Xr ng_cisco 4 ,
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr ngctl 8
|
||||
.Xr sysctl
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm iface
|
||||
|
@ -1,6 +1,7 @@
|
||||
.\" $NetBSD: bus_space.9,v 1.9 1999/03/06 22:09:29 mycroft Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2005 M. Warner Losh. All Rights Reserved.
|
||||
.\" Copyright (c) 2005 M. Warner Losh.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"
|
||||
.\" Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>. All rights reserved.
|
||||
.\" Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 12, 2018
|
||||
.Dd January 12, 2019
|
||||
.Dt PWM 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -79,7 +79,7 @@ Get the current flags for the channel.
|
||||
Enable the PWM channel.
|
||||
.It Fn PWM_CHANNEL_ISENABLED "device_t dev" "int channel" "bool *enable"
|
||||
Test if the PWM channel is enabled.
|
||||
.It PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
|
||||
.It Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
|
||||
Get the maximum number of channels supported by the controller.
|
||||
.El
|
||||
.Sh HISTORY
|
||||
|
@ -374,8 +374,8 @@ FreeBSD 5.2 | | | |
|
||||
| | | | | | |
|
||||
| | | | | | DragonFly 5.2.2
|
||||
| FreeBSD | | NetBSD 7.2 | |
|
||||
| 11.2 | | | | |
|
||||
| | | | OpenBSD 6.4 |
|
||||
| 11.2 macOS | | | |
|
||||
| 10.14 | | OpenBSD 6.4 |
|
||||
| | | | | DragonFly 5.4.0
|
||||
*--FreeBSD | | v | |
|
||||
| 12.0 | | | DragonFly 5.4.1
|
||||
@ -756,6 +756,7 @@ DragonFly 5.2.2 2018-06-18 [DFB]
|
||||
FreeBSD 11.2 2018-06-27 [FBD]
|
||||
NetBSD 8.0 2018-07-17 [NBD]
|
||||
NetBSD 7.2 2018-08-29 [NBD]
|
||||
macOS 10.14 2018-09-24 [APL]
|
||||
OpenBSD 6.4 2018-10-18 [OBD]
|
||||
DragonFly 5.4.0 2018-12-03 [DFB]
|
||||
FreeBSD 12.0 2018-12-11 [FBD]
|
||||
|
@ -150,6 +150,7 @@ jsa [label="Joseph S. Atkinson\njsa@FreeBSD.org\n2010/07/15"]
|
||||
jsm [label="Jesper Schmitz Mouridsen\njsm@FreeBSD.org\n2018/06/30"]
|
||||
junovitch [label="Jason Unovitch\njunovitch@FreeBSD.org\n2015/07/27"]
|
||||
jylefort [label="Jean-Yves Lefort\njylefort@FreeBSD.org\n2005/04/12"]
|
||||
kai [label="Kai Knoblich\nkai@FreeBSD.org\n2019/02/01"]
|
||||
kami [label="Dominic Fandrey\nkami@FreeBSD.org\n2014/09/09"]
|
||||
kbowling [label="Kevin Bowling\nkbowling@FreeBSD.org\n2018/09/02"]
|
||||
kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2003/02/21"]
|
||||
@ -476,6 +477,8 @@ jadawin -> wen
|
||||
|
||||
joerg -> netchild
|
||||
|
||||
joneum -> kai
|
||||
|
||||
jrm -> dch
|
||||
jrm -> jwb
|
||||
|
||||
@ -573,6 +576,7 @@ miwi -> gahr
|
||||
miwi -> jhixson
|
||||
miwi -> joneum
|
||||
miwi -> jsm
|
||||
miwi -> kai
|
||||
miwi -> kmoore
|
||||
miwi -> lme
|
||||
miwi -> makc
|
||||
@ -714,6 +718,7 @@ tcberner -> yuri
|
||||
tcberner -> fernape
|
||||
tcberner -> arrowd
|
||||
tcberner -> rigoletto
|
||||
tcberner -> kai
|
||||
|
||||
thierry -> jadawin
|
||||
thierry -> riggs
|
||||
|
@ -216,6 +216,7 @@ jmcneill [label="Jared McNeill\njmcneill@FreeBSD.org\n2016/02/24"]
|
||||
jmg [label="John-Mark Gurney\njmg@FreeBSD.org\n1997/02/13"]
|
||||
jmmv [label="Julio Merino\njmmv@FreeBSD.org\n2013/11/02"]
|
||||
joerg [label="Joerg Wunsch\njoerg@FreeBSD.org\n1993/11/14"]
|
||||
johalun [label="Johannes Lundberg\njohalun@FreeBSD.org\n2019/01/19"]
|
||||
jon [label="Jonathan Chen\njon@FreeBSD.org\n2000/10/17"]
|
||||
jonathan [label="Jonathan Anderson\njonathan@FreeBSD.org\n2010/10/07"]
|
||||
jpaetzel [label="Josh Paetzel\njpaetzel@FreeBSD.org\n2011/01/21"]
|
||||
@ -558,6 +559,7 @@ imp -> dmlb
|
||||
imp -> emax
|
||||
imp -> furuta
|
||||
imp -> joe
|
||||
imp -> johalun
|
||||
imp -> jon
|
||||
imp -> keichii
|
||||
imp -> kibab
|
||||
|
@ -135,7 +135,7 @@ _CPUCFLAGS = -Wa,-me500 -msoft-float
|
||||
_CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64
|
||||
. endif
|
||||
. elif ${MACHINE_ARCH} == "powerpcspe"
|
||||
_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
||||
_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double -mcpu=8548
|
||||
. elif ${MACHINE_ARCH} == "powerpc64"
|
||||
_CPUCFLAGS = -mcpu=${CPUTYPE}
|
||||
. elif ${MACHINE_CPUARCH} == "mips"
|
||||
@ -362,7 +362,7 @@ CFLAGS += -mfloat-abi=softfp
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "powerpcspe"
|
||||
CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
||||
CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "riscv"
|
||||
|
@ -83,7 +83,6 @@ __DEFAULT_YES_OPTIONS = \
|
||||
CPP \
|
||||
CROSS_COMPILER \
|
||||
CRYPT \
|
||||
CTM \
|
||||
CUSE \
|
||||
CXX \
|
||||
CXGBETOOL \
|
||||
|
@ -120,5 +120,7 @@ beforecheck:
|
||||
# etc.
|
||||
aftercheck:
|
||||
@cd ${.CURDIR} && ${MAKE} clean
|
||||
@chflags -R 0 "${DESTDIR}"
|
||||
@rm -Rf "${DESTDIR}"
|
||||
|
||||
.endif
|
||||
|
@ -48,7 +48,7 @@ efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len)
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
dl = *len;
|
||||
rv = RS->GetVariable(uv, g, &attr, &dl, data);
|
||||
if (rv == EFI_SUCCESS)
|
||||
if (rv == EFI_SUCCESS || rv == EFI_BUFFER_TOO_SMALL)
|
||||
*len = dl;
|
||||
free(uv);
|
||||
return (rv);
|
||||
|
@ -102,8 +102,8 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
|
||||
options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default
|
||||
|
||||
# Kernel Sanitizers
|
||||
options COVERAGE # Generic kernel coverage. Used by KCOV
|
||||
options KCOV # Kernel Coverage Sanitizer
|
||||
#options COVERAGE # Generic kernel coverage. Used by KCOV
|
||||
#options KCOV # Kernel Coverage Sanitizer
|
||||
# Warning: KUBSAN can result in a kernel too large for loader to load
|
||||
#options KUBSAN # Kernel Undefined Behavior Sanitizer
|
||||
|
||||
|
@ -612,9 +612,6 @@ options EFIRT
|
||||
# Enable 32-bit runtime support for FreeBSD/i386 binaries.
|
||||
options COMPAT_FREEBSD32
|
||||
|
||||
# Emulate spx device for client side of SVR3 local X interface
|
||||
#XXX#options SPX_HACK
|
||||
|
||||
# Enable (32-bit) a.out binary support
|
||||
options COMPAT_AOUT
|
||||
|
||||
|
@ -65,9 +65,13 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8xx power regulator");
|
||||
#define AXP_POWERSRC_ACIN (1 << 7)
|
||||
#define AXP_POWERSRC_VBUS (1 << 5)
|
||||
#define AXP_POWERSRC_VBAT (1 << 3)
|
||||
#define AXP_POWERSRC_CHARING (1 << 2)
|
||||
#define AXP_POWERSRC_CHARING (1 << 2) /* Charging Direction */
|
||||
#define AXP_POWERSRC_SHORTED (1 << 1)
|
||||
#define AXP_POWERSRC_STARTUP (1 << 0)
|
||||
#define AXP_POWERMODE 0x01
|
||||
#define AXP_POWERMODE_BAT_CHARGING (1 << 6)
|
||||
#define AXP_POWERMODE_BAT_PRESENT (1 << 5)
|
||||
#define AXP_POWERMODE_BAT_VALID (1 << 4)
|
||||
#define AXP_ICTYPE 0x03
|
||||
#define AXP_POWERCTL1 0x10
|
||||
#define AXP_POWERCTL1_DCDC7 (1 << 6) /* AXP813/818 only */
|
||||
@ -117,14 +121,47 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8xx power regulator");
|
||||
#define AXP_POWERBAT 0x32
|
||||
#define AXP_POWERBAT_SHUTDOWN (1 << 7)
|
||||
#define AXP_IRQEN1 0x40
|
||||
#define AXP_IRQEN1_ACIN_HI (1 << 6)
|
||||
#define AXP_IRQEN1_ACIN_LO (1 << 5)
|
||||
#define AXP_IRQEN1_VBUS_HI (1 << 3)
|
||||
#define AXP_IRQEN1_VBUS_LO (1 << 2)
|
||||
#define AXP_IRQEN2 0x41
|
||||
#define AXP_IRQEN2_BAT_IN (1 << 7)
|
||||
#define AXP_IRQEN2_BAT_NO (1 << 6)
|
||||
#define AXP_IRQEN2_BATCHGC (1 << 3)
|
||||
#define AXP_IRQEN2_BATCHGD (1 << 2)
|
||||
#define AXP_IRQEN3 0x42
|
||||
#define AXP_IRQEN4 0x43
|
||||
#define AXP_IRQEN4_BATLVL_LO1 (1 << 1)
|
||||
#define AXP_IRQEN4_BATLVL_LO0 (1 << 0)
|
||||
#define AXP_IRQEN5 0x44
|
||||
#define AXP_IRQEN5_POKSIRQ (1 << 4)
|
||||
#define AXP_IRQEN5_POKLIRQ (1 << 3)
|
||||
#define AXP_IRQEN6 0x45
|
||||
#define AXP_IRQSTAT1 0x48
|
||||
#define AXP_IRQSTAT1_ACIN_HI (1 << 6)
|
||||
#define AXP_IRQSTAT1_ACIN_LO (1 << 5)
|
||||
#define AXP_IRQSTAT1_VBUS_HI (1 << 3)
|
||||
#define AXP_IRQSTAT1_VBUS_LO (1 << 2)
|
||||
#define AXP_IRQSTAT2 0x49
|
||||
#define AXP_IRQSTAT2_BAT_IN (1 << 7)
|
||||
#define AXP_IRQSTAT2_BAT_NO (1 << 6)
|
||||
#define AXP_IRQSTAT2_BATCHGC (1 << 3)
|
||||
#define AXP_IRQSTAT2_BATCHGD (1 << 2)
|
||||
#define AXP_IRQSTAT3 0x4a
|
||||
#define AXP_IRQSTAT4 0x4b
|
||||
#define AXP_IRQSTAT4_BATLVL_LO1 (1 << 1)
|
||||
#define AXP_IRQSTAT4_BATLVL_LO0 (1 << 0)
|
||||
#define AXP_IRQSTAT5 0x4c
|
||||
#define AXP_IRQSTAT5_POKSIRQ (1 << 4)
|
||||
#define AXP_IRQEN5_POKLIRQ (1 << 3)
|
||||
#define AXP_IRQSTAT6 0x4d
|
||||
#define AXP_BATSENSE_HI 0x78
|
||||
#define AXP_BATSENSE_LO 0x79
|
||||
#define AXP_BATCHG_HI 0x7a
|
||||
#define AXP_BATCHG_LO 0x7b
|
||||
#define AXP_BATDISCHG_HI 0x7c
|
||||
#define AXP_BATDISCHG_LO 0x7d
|
||||
#define AXP_GPIO0_CTRL 0x90
|
||||
#define AXP_GPIO0LDO_CTRL 0x91
|
||||
#define AXP_GPIO1_CTRL 0x92
|
||||
@ -138,6 +175,24 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8xx power regulator");
|
||||
#define AXP_GPIO_FUNC_LDO_OFF 4
|
||||
#define AXP_GPIO_SIGBIT 0x94
|
||||
#define AXP_GPIO_PD 0x97
|
||||
#define AXP_FUEL_GAUGECTL 0xb8
|
||||
#define AXP_FUEL_GAUGECTL_EN (1 << 7)
|
||||
|
||||
#define AXP_BAT_CAP 0xb9
|
||||
#define AXP_BAT_CAP_VALID (1 << 7)
|
||||
#define AXP_BAT_CAP_PERCENT 0x7f
|
||||
|
||||
#define AXP_BAT_MAX_CAP_HI 0xe0
|
||||
#define AXP_BAT_MAX_CAP_VALID (1 << 7)
|
||||
#define AXP_BAT_MAX_CAP_LO 0xe1
|
||||
|
||||
#define AXP_BAT_COULOMB_HI 0xe2
|
||||
#define AXP_BAT_COULOMB_VALID (1 << 7)
|
||||
#define AXP_BAT_COULOMB_LO 0xe3
|
||||
|
||||
#define AXP_BAT_CAP_WARN 0xe6
|
||||
#define AXP_BAT_CAP_WARN_LV1 0xf0 /* Bits 4, 5, 6, 7 */
|
||||
#define AXP_BAT_CAP_WARN_LV2 0xf /* Bits 0, 1, 2, 3 */
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
@ -710,6 +765,68 @@ axp8xx_intr(void *arg)
|
||||
|
||||
dev = arg;
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT1, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
if (bootverbose)
|
||||
device_printf(dev, "AXP_IRQSTAT1 val: %x\n", val);
|
||||
if (val & AXP_IRQSTAT1_ACIN_HI)
|
||||
devctl_notify("PMU", "AC", "plugged", NULL);
|
||||
if (val & AXP_IRQSTAT1_ACIN_LO)
|
||||
devctl_notify("PMU", "AC", "unplugged", NULL);
|
||||
if (val & AXP_IRQSTAT1_VBUS_HI)
|
||||
devctl_notify("PMU", "USB", "plugged", NULL);
|
||||
if (val & AXP_IRQSTAT1_VBUS_LO)
|
||||
devctl_notify("PMU", "USB", "unplugged", NULL);
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT1, val);
|
||||
}
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT2, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
if (bootverbose)
|
||||
device_printf(dev, "AXP_IRQSTAT2 val: %x\n", val);
|
||||
if (val & AXP_IRQSTAT2_BATCHGD)
|
||||
devctl_notify("PMU", "Battery", "charged", NULL);
|
||||
if (val & AXP_IRQSTAT2_BATCHGC)
|
||||
devctl_notify("PMU", "Battery", "charging", NULL);
|
||||
if (val & AXP_IRQSTAT2_BAT_NO)
|
||||
devctl_notify("PMU", "Battery", "absent", NULL);
|
||||
if (val & AXP_IRQSTAT2_BAT_IN)
|
||||
devctl_notify("PMU", "Battery", "plugged", NULL);
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT2, val);
|
||||
}
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT3, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT3, val);
|
||||
}
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT4, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
if (bootverbose)
|
||||
device_printf(dev, "AXP_IRQSTAT4 val: %x\n", val);
|
||||
if (val & AXP_IRQSTAT4_BATLVL_LO0)
|
||||
devctl_notify("PMU", "Battery", "lower than level 2", NULL);
|
||||
if (val & AXP_IRQSTAT4_BATLVL_LO1)
|
||||
devctl_notify("PMU", "Battery", "lower than level 1", NULL);
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT4, val);
|
||||
}
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT5, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
@ -723,6 +840,15 @@ axp8xx_intr(void *arg)
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT5, val);
|
||||
}
|
||||
|
||||
error = axp8xx_read(dev, AXP_IRQSTAT6, &val, 1);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
/* Acknowledge */
|
||||
axp8xx_write(dev, AXP_IRQSTAT6, val);
|
||||
}
|
||||
}
|
||||
|
||||
static device_t
|
||||
@ -1105,12 +1231,24 @@ axp8xx_attach(device_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable IRQ on short power key press */
|
||||
axp8xx_write(dev, AXP_IRQEN1, 0);
|
||||
axp8xx_write(dev, AXP_IRQEN2, 0);
|
||||
/* Enable interrupts */
|
||||
axp8xx_write(dev, AXP_IRQEN1,
|
||||
AXP_IRQEN1_VBUS_LO |
|
||||
AXP_IRQEN1_VBUS_HI |
|
||||
AXP_IRQEN1_ACIN_LO |
|
||||
AXP_IRQEN1_ACIN_HI);
|
||||
axp8xx_write(dev, AXP_IRQEN2,
|
||||
AXP_IRQEN2_BATCHGD |
|
||||
AXP_IRQEN2_BATCHGC |
|
||||
AXP_IRQEN2_BAT_NO |
|
||||
AXP_IRQEN2_BAT_IN);
|
||||
axp8xx_write(dev, AXP_IRQEN3, 0);
|
||||
axp8xx_write(dev, AXP_IRQEN4, 0);
|
||||
axp8xx_write(dev, AXP_IRQEN5, AXP_IRQEN5_POKSIRQ);
|
||||
axp8xx_write(dev, AXP_IRQEN4,
|
||||
AXP_IRQEN4_BATLVL_LO0 |
|
||||
AXP_IRQEN4_BATLVL_LO1);
|
||||
axp8xx_write(dev, AXP_IRQEN5,
|
||||
AXP_IRQEN5_POKSIRQ |
|
||||
AXP_IRQEN5_POKLIRQ);
|
||||
axp8xx_write(dev, AXP_IRQEN6, 0);
|
||||
|
||||
/* Install interrupt handler */
|
||||
|
502
sys/arm64/acpica/acpi_iort.c
Normal file
502
sys/arm64/acpica/acpi_iort.c
Normal file
@ -0,0 +1,502 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (C) 2018 Marvell International Ltd.
|
||||
*
|
||||
* Author: Jayachandran C Nair <jchandra@freebsd.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE 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 "opt_acpi.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <contrib/dev/acpica/include/acpi.h>
|
||||
#include <contrib/dev/acpica/include/accommon.h>
|
||||
#include <contrib/dev/acpica/include/actables.h>
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
/*
|
||||
* Track next XREF available for ITS groups.
|
||||
*/
|
||||
static u_int acpi_its_xref = ACPI_MSI_XREF;
|
||||
|
||||
/*
|
||||
* Some types of IORT nodes have a set of mappings. Each of them map
|
||||
* a range of device IDs [base..end] from the current node to another
|
||||
* node. The corresponding device IDs on destination node starts at
|
||||
* outbase.
|
||||
*/
|
||||
struct iort_map_entry {
|
||||
u_int base;
|
||||
u_int end;
|
||||
u_int outbase;
|
||||
u_int flags;
|
||||
u_int out_node_offset;
|
||||
struct iort_node *out_node;
|
||||
};
|
||||
|
||||
/*
|
||||
* The ITS group node does not have any outgoing mappings. It has a
|
||||
* of a list of GIC ITS blocks which can handle the device ID. We
|
||||
* will store the PIC XREF used by the block and the blocks proximity
|
||||
* data here, so that it can be retrieved together.
|
||||
*/
|
||||
struct iort_its_entry {
|
||||
u_int its_id;
|
||||
u_int xref;
|
||||
int pxm;
|
||||
};
|
||||
|
||||
/*
|
||||
* IORT node. Each node has some device specific data depending on the
|
||||
* type of the node. The node can also have a set of mappings, OR in
|
||||
* case of ITS group nodes a set of ITS entries.
|
||||
* The nodes are kept in a TAILQ by type.
|
||||
*/
|
||||
struct iort_node {
|
||||
TAILQ_ENTRY(iort_node) next; /* next entry with same type */
|
||||
enum AcpiIortNodeType type; /* ACPI type */
|
||||
u_int node_offset; /* offset in IORT - node ID */
|
||||
u_int nentries; /* items in array below */
|
||||
u_int usecount; /* for bookkeeping */
|
||||
union {
|
||||
ACPI_IORT_ROOT_COMPLEX pci_rc; /* PCI root complex */
|
||||
ACPI_IORT_SMMU smmu;
|
||||
ACPI_IORT_SMMU_V3 smmu_v3;
|
||||
} data;
|
||||
union {
|
||||
struct iort_map_entry *mappings; /* node mappings */
|
||||
struct iort_its_entry *its; /* ITS IDs array */
|
||||
} entries;
|
||||
};
|
||||
|
||||
/* Lists for each of the types. */
|
||||
static TAILQ_HEAD(, iort_node) pci_nodes = TAILQ_HEAD_INITIALIZER(pci_nodes);
|
||||
static TAILQ_HEAD(, iort_node) smmu_nodes = TAILQ_HEAD_INITIALIZER(smmu_nodes);
|
||||
static TAILQ_HEAD(, iort_node) its_groups = TAILQ_HEAD_INITIALIZER(its_groups);
|
||||
|
||||
/*
|
||||
* Lookup an ID in the mappings array. If successful, map the input ID
|
||||
* to the output ID and return the output node found.
|
||||
*/
|
||||
static struct iort_node *
|
||||
iort_entry_lookup(struct iort_node *node, u_int id, u_int *outid)
|
||||
{
|
||||
struct iort_map_entry *entry;
|
||||
int i;
|
||||
|
||||
entry = node->entries.mappings;
|
||||
for (i = 0; i < node->nentries; i++, entry++) {
|
||||
if (entry->base <= id && id <= entry->end)
|
||||
break;
|
||||
}
|
||||
if (i == node->nentries)
|
||||
return (NULL);
|
||||
if ((entry->flags & ACPI_IORT_ID_SINGLE_MAPPING) == 0)
|
||||
*outid = entry->outbase + (id - entry->base);
|
||||
else
|
||||
*outid = entry->outbase;
|
||||
return (entry->out_node);
|
||||
}
|
||||
|
||||
/*
|
||||
* Map a PCI RID to a SMMU node or an ITS node, based on outtype.
|
||||
*/
|
||||
static struct iort_node *
|
||||
iort_pci_rc_map(u_int seg, u_int rid, u_int outtype, u_int *outid)
|
||||
{
|
||||
struct iort_node *node, *out_node;
|
||||
u_int nxtid;
|
||||
|
||||
out_node = NULL;
|
||||
TAILQ_FOREACH(node, &pci_nodes, next) {
|
||||
if (node->data.pci_rc.PciSegmentNumber != seg)
|
||||
continue;
|
||||
out_node = iort_entry_lookup(node, rid, &nxtid);
|
||||
if (out_node != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Could not find a PCI RC node with segment and device ID. */
|
||||
if (out_node == NULL)
|
||||
return (NULL);
|
||||
|
||||
/* Node can be SMMU or ITS. If SMMU, we need another lookup. */
|
||||
if (outtype == ACPI_IORT_NODE_ITS_GROUP &&
|
||||
(out_node->type == ACPI_IORT_NODE_SMMU_V3 ||
|
||||
out_node->type == ACPI_IORT_NODE_SMMU)) {
|
||||
out_node = iort_entry_lookup(out_node, nxtid, &nxtid);
|
||||
if (out_node == NULL)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
KASSERT(out_node->type == outtype, ("mapping fail"));
|
||||
*outid = nxtid;
|
||||
return (out_node);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Not implemented, map a PCIe device to the SMMU it is associated with.
|
||||
*/
|
||||
int
|
||||
acpi_iort_map_smmu(u_int seg, u_int devid, void **smmu, u_int *sid)
|
||||
{
|
||||
/* XXX: convert oref to SMMU device */
|
||||
return (ENXIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate memory for a node, initialize and copy mappings. 'start'
|
||||
* argument provides the table start used to calculate the node offset.
|
||||
*/
|
||||
static void
|
||||
iort_copy_data(struct iort_node *node, ACPI_IORT_NODE *node_entry)
|
||||
{
|
||||
ACPI_IORT_ID_MAPPING *map_entry;
|
||||
struct iort_map_entry *mapping;
|
||||
int i;
|
||||
|
||||
map_entry = ACPI_ADD_PTR(ACPI_IORT_ID_MAPPING, node_entry,
|
||||
node_entry->MappingOffset);
|
||||
node->nentries = node_entry->MappingCount;
|
||||
node->usecount = 0;
|
||||
mapping = malloc(sizeof(*mapping) * node->nentries, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
node->entries.mappings = mapping;
|
||||
for (i = 0; i < node->nentries; i++, mapping++, map_entry++) {
|
||||
mapping->base = map_entry->InputBase;
|
||||
mapping->end = map_entry->InputBase + map_entry->IdCount - 1;
|
||||
mapping->outbase = map_entry->OutputBase;
|
||||
mapping->out_node_offset = map_entry->OutputReference;
|
||||
mapping->flags = map_entry->Flags;
|
||||
mapping->out_node = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate and copy an ITS group.
|
||||
*/
|
||||
static void
|
||||
iort_copy_its(struct iort_node *node, ACPI_IORT_NODE *node_entry)
|
||||
{
|
||||
struct iort_its_entry *its;
|
||||
ACPI_IORT_ITS_GROUP *itsg_entry;
|
||||
UINT32 *id;
|
||||
int i;
|
||||
|
||||
itsg_entry = (ACPI_IORT_ITS_GROUP *)node_entry->NodeData;
|
||||
node->nentries = itsg_entry->ItsCount;
|
||||
node->usecount = 0;
|
||||
its = malloc(sizeof(*its) * node->nentries, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
node->entries.its = its;
|
||||
id = &itsg_entry->Identifiers[0];
|
||||
for (i = 0; i < node->nentries; i++, its++, id++) {
|
||||
its->its_id = *id;
|
||||
its->pxm = -1;
|
||||
its->xref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk the IORT table and add nodes to corresponding list.
|
||||
*/
|
||||
static void
|
||||
iort_add_nodes(ACPI_IORT_NODE *node_entry, u_int node_offset)
|
||||
{
|
||||
ACPI_IORT_ROOT_COMPLEX *pci_rc;
|
||||
ACPI_IORT_SMMU *smmu;
|
||||
ACPI_IORT_SMMU_V3 *smmu_v3;
|
||||
struct iort_node *node;
|
||||
|
||||
node = malloc(sizeof(*node), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
node->type = node_entry->Type;
|
||||
node->node_offset = node_offset;
|
||||
|
||||
/* copy nodes depending on type */
|
||||
switch(node_entry->Type) {
|
||||
case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
|
||||
pci_rc = (ACPI_IORT_ROOT_COMPLEX *)node_entry->NodeData;
|
||||
memcpy(&node->data.pci_rc, pci_rc, sizeof(*pci_rc));
|
||||
iort_copy_data(node, node_entry);
|
||||
TAILQ_INSERT_TAIL(&pci_nodes, node, next);
|
||||
break;
|
||||
case ACPI_IORT_NODE_SMMU:
|
||||
smmu = (ACPI_IORT_SMMU *)node_entry->NodeData;
|
||||
memcpy(&node->data.smmu, smmu, sizeof(*smmu));
|
||||
iort_copy_data(node, node_entry);
|
||||
TAILQ_INSERT_TAIL(&smmu_nodes, node, next);
|
||||
break;
|
||||
case ACPI_IORT_NODE_SMMU_V3:
|
||||
smmu_v3 = (ACPI_IORT_SMMU_V3 *)node_entry->NodeData;
|
||||
memcpy(&node->data.smmu_v3, smmu_v3, sizeof(*smmu_v3));
|
||||
iort_copy_data(node, node_entry);
|
||||
TAILQ_INSERT_TAIL(&smmu_nodes, node, next);
|
||||
break;
|
||||
case ACPI_IORT_NODE_ITS_GROUP:
|
||||
iort_copy_its(node, node_entry);
|
||||
TAILQ_INSERT_TAIL(&its_groups, node, next);
|
||||
break;
|
||||
default:
|
||||
printf("ACPI: IORT: Dropping unhandled type %u\n",
|
||||
node_entry->Type);
|
||||
free(node, M_DEVBUF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For the mapping entry given, walk thru all the possible destination
|
||||
* nodes and resolve the output reference.
|
||||
*/
|
||||
static void
|
||||
iort_resolve_node(struct iort_map_entry *entry, int check_smmu)
|
||||
{
|
||||
struct iort_node *node, *np;
|
||||
|
||||
node = NULL;
|
||||
if (check_smmu) {
|
||||
TAILQ_FOREACH(np, &smmu_nodes, next) {
|
||||
if (entry->out_node_offset == np->node_offset) {
|
||||
node = np;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node == NULL) {
|
||||
TAILQ_FOREACH(np, &its_groups, next) {
|
||||
if (entry->out_node_offset == np->node_offset) {
|
||||
node = np;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node != NULL) {
|
||||
node->usecount++;
|
||||
entry->out_node = node;
|
||||
} else {
|
||||
printf("ACPI: IORT: Firmware Bug: no mapping for node %u\n",
|
||||
entry->out_node_offset);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Resolve all output node references to node pointers.
|
||||
*/
|
||||
static void
|
||||
iort_post_process_mappings(void)
|
||||
{
|
||||
struct iort_node *node;
|
||||
int i;
|
||||
|
||||
TAILQ_FOREACH(node, &pci_nodes, next)
|
||||
for (i = 0; i < node->nentries; i++)
|
||||
iort_resolve_node(&node->entries.mappings[i], TRUE);
|
||||
TAILQ_FOREACH(node, &smmu_nodes, next)
|
||||
for (i = 0; i < node->nentries; i++)
|
||||
iort_resolve_node(&node->entries.mappings[i], FALSE);
|
||||
/* TODO: named nodes */
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk MADT table, assign PIC xrefs to all ITS entries.
|
||||
*/
|
||||
static void
|
||||
madt_resolve_its_xref(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
{
|
||||
ACPI_MADT_GENERIC_TRANSLATOR *gict;
|
||||
struct iort_node *its_node;
|
||||
struct iort_its_entry *its_entry;
|
||||
u_int xref;
|
||||
int i, matches;
|
||||
|
||||
if (entry->Type != ACPI_MADT_TYPE_GENERIC_TRANSLATOR)
|
||||
return;
|
||||
|
||||
gict = (ACPI_MADT_GENERIC_TRANSLATOR *)entry;
|
||||
matches = 0;
|
||||
xref = acpi_its_xref++;
|
||||
TAILQ_FOREACH(its_node, &its_groups, next) {
|
||||
its_entry = its_node->entries.its;
|
||||
for (i = 0; i < its_node->nentries; i++, its_entry++) {
|
||||
if (its_entry->its_id == gict->TranslationId) {
|
||||
its_entry->xref = xref;
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matches == 0)
|
||||
printf("ACPI: IORT: Unused ITS block, ID %u\n",
|
||||
gict->TranslationId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk SRAT, assign proximity to all ITS entries.
|
||||
*/
|
||||
static void
|
||||
srat_resolve_its_pxm(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
{
|
||||
ACPI_SRAT_GIC_ITS_AFFINITY *gicits;
|
||||
struct iort_node *its_node;
|
||||
struct iort_its_entry *its_entry;
|
||||
int i, matches;
|
||||
|
||||
if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY)
|
||||
return;
|
||||
|
||||
matches = 0;
|
||||
gicits = (ACPI_SRAT_GIC_ITS_AFFINITY *)entry;
|
||||
TAILQ_FOREACH(its_node, &its_groups, next) {
|
||||
its_entry = its_node->entries.its;
|
||||
for (i = 0; i < its_node->nentries; i++, its_entry++) {
|
||||
if (its_entry->its_id == gicits->ItsId) {
|
||||
its_entry->pxm = acpi_map_pxm_to_vm_domainid(
|
||||
gicits->ProximityDomain);
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matches == 0)
|
||||
printf("ACPI: IORT: ITS block %u in SRAT not found in IORT!\n",
|
||||
gicits->ItsId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cross check the ITS Id with MADT and (if available) SRAT.
|
||||
*/
|
||||
static int
|
||||
iort_post_process_its(void)
|
||||
{
|
||||
ACPI_TABLE_MADT *madt;
|
||||
ACPI_TABLE_SRAT *srat;
|
||||
vm_paddr_t madt_pa, srat_pa;
|
||||
|
||||
/* Check ITS block in MADT */
|
||||
madt_pa = acpi_find_table(ACPI_SIG_MADT);
|
||||
KASSERT(madt_pa != 0, ("no MADT!"));
|
||||
madt = acpi_map_table(madt_pa, ACPI_SIG_MADT);
|
||||
KASSERT(madt != NULL, ("can't map MADT!"));
|
||||
acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
|
||||
madt_resolve_its_xref, NULL);
|
||||
acpi_unmap_table(madt);
|
||||
|
||||
/* Get proximtiy if available */
|
||||
srat_pa = acpi_find_table(ACPI_SIG_SRAT);
|
||||
if (srat_pa != 0) {
|
||||
srat = acpi_map_table(srat_pa, ACPI_SIG_SRAT);
|
||||
KASSERT(srat != NULL, ("can't map SRAT!"));
|
||||
acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length,
|
||||
srat_resolve_its_pxm, NULL);
|
||||
acpi_unmap_table(srat);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find, parse, and save IO Remapping Table ("IORT").
|
||||
*/
|
||||
static int
|
||||
acpi_parse_iort(void *dummy __unused)
|
||||
{
|
||||
ACPI_TABLE_IORT *iort;
|
||||
ACPI_IORT_NODE *node_entry;
|
||||
vm_paddr_t iort_pa;
|
||||
u_int node_offset;
|
||||
|
||||
iort_pa = acpi_find_table(ACPI_SIG_IORT);
|
||||
if (iort_pa == 0)
|
||||
return (ENXIO);
|
||||
|
||||
iort = acpi_map_table(iort_pa, ACPI_SIG_IORT);
|
||||
if (iort == NULL) {
|
||||
printf("ACPI: Unable to map the IORT table!\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
for (node_offset = iort->NodeOffset;
|
||||
node_offset < iort->Header.Length;
|
||||
node_offset += node_entry->Length) {
|
||||
node_entry = ACPI_ADD_PTR(ACPI_IORT_NODE, iort, node_offset);
|
||||
iort_add_nodes(node_entry, node_offset);
|
||||
}
|
||||
acpi_unmap_table(iort);
|
||||
iort_post_process_mappings();
|
||||
iort_post_process_its();
|
||||
return (0);
|
||||
}
|
||||
SYSINIT(acpi_parse_iort, SI_SUB_DRIVERS, SI_ORDER_FIRST, acpi_parse_iort, NULL);
|
||||
|
||||
/*
|
||||
* Provide ITS ID to PIC xref mapping.
|
||||
*/
|
||||
int
|
||||
acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm)
|
||||
{
|
||||
struct iort_node *its_node;
|
||||
struct iort_its_entry *its_entry;
|
||||
int i;
|
||||
|
||||
TAILQ_FOREACH(its_node, &its_groups, next) {
|
||||
its_entry = its_node->entries.its;
|
||||
for (i = 0; i < its_node->nentries; i++, its_entry++) {
|
||||
if (its_entry->its_id == its_id) {
|
||||
*xref = its_entry->xref;
|
||||
*pxm = its_entry->pxm;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find mapping for a PCIe device given segment and device ID
|
||||
* returns the XREF for MSI interrupt setup and the device ID to
|
||||
* use for the interrupt setup
|
||||
*/
|
||||
int
|
||||
acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid)
|
||||
{
|
||||
struct iort_node *node;
|
||||
|
||||
node = iort_pci_rc_map(seg, rid, ACPI_IORT_NODE_ITS_GROUP, devid);
|
||||
if (node == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
/* This should be an ITS node */
|
||||
KASSERT(node->type == ACPI_IORT_NODE_ITS_GROUP, ("bad group"));
|
||||
|
||||
/* return first node, we don't handle more than that now. */
|
||||
*xref = node->entries.its[0].xref;
|
||||
return (0);
|
||||
}
|
@ -96,6 +96,7 @@ ENTRY(arm64_setttb)
|
||||
END(arm64_setttb)
|
||||
|
||||
ENTRY(arm64_tlb_flushID)
|
||||
dsb ishst
|
||||
#ifdef SMP
|
||||
tlbi vmalle1is
|
||||
#else
|
||||
|
@ -305,6 +305,8 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
struct gic_v3_acpi_devinfo *di;
|
||||
struct gic_v3_softc *sc;
|
||||
device_t child, dev;
|
||||
u_int xref;
|
||||
int err, pxm;
|
||||
|
||||
if (entry->Type == ACPI_MADT_TYPE_GENERIC_TRANSLATOR) {
|
||||
/* We have an ITS, add it as a child */
|
||||
@ -321,7 +323,14 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
resource_list_add(&di->di_rl, SYS_RES_MEMORY, 0,
|
||||
gict->BaseAddress, gict->BaseAddress + 128 * 1024 - 1,
|
||||
128 * 1024);
|
||||
di->di_gic_dinfo.gic_domain = -1;
|
||||
err = acpi_iort_its_lookup(gict->TranslationId, &xref, &pxm);
|
||||
if (err == 0) {
|
||||
di->di_gic_dinfo.gic_domain = pxm;
|
||||
di->di_gic_dinfo.msi_xref = xref;
|
||||
} else {
|
||||
di->di_gic_dinfo.gic_domain = -1;
|
||||
di->di_gic_dinfo.msi_xref = ACPI_MSI_XREF;
|
||||
}
|
||||
sc->gic_nchildren++;
|
||||
device_set_ivars(child, di);
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ struct gic_v3_softc {
|
||||
|
||||
struct gic_v3_devinfo {
|
||||
int gic_domain;
|
||||
int msi_xref;
|
||||
};
|
||||
|
||||
#define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc)
|
||||
|
@ -1722,6 +1722,7 @@ static int
|
||||
gicv3_its_acpi_attach(device_t dev)
|
||||
{
|
||||
struct gicv3_its_softc *sc;
|
||||
struct gic_v3_devinfo *di;
|
||||
int err;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
@ -1729,13 +1730,13 @@ gicv3_its_acpi_attach(device_t dev)
|
||||
if (err != 0)
|
||||
return (err);
|
||||
|
||||
sc->sc_pic = intr_pic_register(dev,
|
||||
device_get_unit(dev) + ACPI_MSI_XREF);
|
||||
di = device_get_ivars(dev);
|
||||
sc->sc_pic = intr_pic_register(dev, di->msi_xref);
|
||||
intr_pic_add_handler(device_get_parent(dev), sc->sc_pic,
|
||||
gicv3_its_intr, sc, sc->sc_irq_base, sc->sc_irq_length);
|
||||
|
||||
/* Register this device to handle MSI interrupts */
|
||||
intr_msi_register(dev, device_get_unit(dev) + ACPI_MSI_XREF);
|
||||
intr_msi_register(dev, di->msi_xref);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -2862,6 +2862,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_entry_t newpte,
|
||||
|
||||
/* Create the new mapping */
|
||||
pmap_load_store(pte, newpte);
|
||||
dsb(ishst);
|
||||
|
||||
critical_exit();
|
||||
intr_restore(intr);
|
||||
@ -3281,6 +3282,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
|
||||
} else {
|
||||
/* New mappig */
|
||||
pmap_load_store(l3, new_l3);
|
||||
dsb(ishst);
|
||||
}
|
||||
|
||||
#if VM_NRESERVLEVEL > 0
|
||||
@ -3435,6 +3437,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags,
|
||||
* Map the superpage.
|
||||
*/
|
||||
(void)pmap_load_store(l2, new_l2);
|
||||
dsb(ishst);
|
||||
|
||||
atomic_add_long(&pmap_l2_mappings, 1);
|
||||
CTR2(KTR_PMAP, "pmap_enter_l2: success for va %#lx in pmap %p",
|
||||
|
@ -94,8 +94,8 @@ options USB_DEBUG # enable debug msgs
|
||||
options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default
|
||||
|
||||
# Kernel Sanitizers
|
||||
options COVERAGE # Generic kernel coverage. Used by KCOV
|
||||
options KCOV # Kernel Coverage Sanitizer
|
||||
#options COVERAGE # Generic kernel coverage. Used by KCOV
|
||||
#options KCOV # Kernel Coverage Sanitizer
|
||||
# Warning: KUBSAN can result in a kernel too large for loader to load
|
||||
#options KUBSAN # Kernel Undefined Behavior Sanitizer
|
||||
|
||||
@ -213,6 +213,8 @@ device gpioled
|
||||
device fdt_pinctrl
|
||||
device mv_gpio # Marvell GPIO controller
|
||||
device mvebu_pinctrl # Marvell Pinmux Controller
|
||||
device rk_gpio # RockChip GPIO Controller
|
||||
device rk_pinctrl # RockChip Pinmux Controller
|
||||
|
||||
# I2C
|
||||
device aw_rsb # Allwinner Reduced Serial Bus
|
||||
|
@ -119,7 +119,8 @@ typedef enum {
|
||||
ADA_Q_NCQ_TRIM_BROKEN = 0x02,
|
||||
ADA_Q_LOG_BROKEN = 0x04,
|
||||
ADA_Q_SMR_DM = 0x08,
|
||||
ADA_Q_NO_TRIM = 0x10
|
||||
ADA_Q_NO_TRIM = 0x10,
|
||||
ADA_Q_128KB = 0x20
|
||||
} ada_quirks;
|
||||
|
||||
#define ADA_Q_BIT_STRING \
|
||||
@ -128,7 +129,8 @@ typedef enum {
|
||||
"\002NCQ_TRIM_BROKEN" \
|
||||
"\003LOG_BROKEN" \
|
||||
"\004SMR_DM" \
|
||||
"\005NO_TRIM"
|
||||
"\005NO_TRIM" \
|
||||
"\006128KB"
|
||||
|
||||
typedef enum {
|
||||
ADA_CCB_RAHEAD = 0x01,
|
||||
@ -276,6 +278,11 @@ struct ada_quirk_entry {
|
||||
|
||||
static struct ada_quirk_entry ada_quirk_table[] =
|
||||
{
|
||||
{
|
||||
/* Sandisk X400 */
|
||||
{ T_DIRECT, SIP_MEDIA_FIXED, "*", "SanDisk?SD8SB8U1T00*", "X4162000*" },
|
||||
/*quirks*/ADA_Q_128KB
|
||||
},
|
||||
{
|
||||
/* Hitachi Advanced Format (4k) drives */
|
||||
{ T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??????????E3*", "*" },
|
||||
@ -1815,6 +1822,8 @@ adaregister(struct cam_periph *periph, void *arg)
|
||||
maxio = min(maxio, 65536 * softc->params.secsize);
|
||||
else /* 28bit ATA command limit */
|
||||
maxio = min(maxio, 256 * softc->params.secsize);
|
||||
if (softc->quirks & ADA_Q_128KB)
|
||||
maxio = min(maxio, 128 * 1024);
|
||||
softc->disk->d_maxsize = maxio;
|
||||
softc->disk->d_unit = periph->unit_number;
|
||||
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
|
||||
|
@ -130,7 +130,8 @@ typedef enum {
|
||||
DA_Q_NO_UNMAP = 0x20,
|
||||
DA_Q_RETRY_BUSY = 0x40,
|
||||
DA_Q_SMR_DM = 0x80,
|
||||
DA_Q_STRICT_UNMAP = 0x100
|
||||
DA_Q_STRICT_UNMAP = 0x100,
|
||||
DA_Q_128KB = 0x200
|
||||
} da_quirks;
|
||||
|
||||
#define DA_Q_BIT_STRING \
|
||||
@ -143,7 +144,8 @@ typedef enum {
|
||||
"\006NO_UNMAP" \
|
||||
"\007RETRY_BUSY" \
|
||||
"\010SMR_DM" \
|
||||
"\011STRICT_UNMAP"
|
||||
"\011STRICT_UNMAP" \
|
||||
"\012128KB"
|
||||
|
||||
typedef enum {
|
||||
DA_CCB_PROBE_RC = 0x01,
|
||||
@ -870,6 +872,11 @@ static struct da_quirk_entry da_quirk_table[] =
|
||||
"1.00"}, /*quirks*/ DA_Q_NO_RC16
|
||||
},
|
||||
/* ATA/SATA devices over SAS/USB/... */
|
||||
{
|
||||
/* Sandisk X400 */
|
||||
{ T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SanDisk SD8SB8U1*", "*" },
|
||||
/*quirks*/DA_Q_128KB
|
||||
},
|
||||
{
|
||||
/* Hitachi Advanced Format (4k) drives */
|
||||
{ T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??????????E3*", "*" },
|
||||
@ -2825,6 +2832,8 @@ daregister(struct cam_periph *periph, void *arg)
|
||||
softc->maxio = MAXPHYS; /* for safety */
|
||||
else
|
||||
softc->maxio = cpi.maxio;
|
||||
if (softc->quirks & DA_Q_128KB)
|
||||
softc->maxio = min(softc->maxio, 128 * 1024);
|
||||
softc->disk->d_maxsize = softc->maxio;
|
||||
softc->disk->d_unit = periph->unit_number;
|
||||
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
|
||||
|
@ -106,6 +106,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/elf.h>
|
||||
#ifdef __amd64__
|
||||
#include <machine/md_var.h>
|
||||
#endif
|
||||
|
||||
#include <security/audit/audit.h>
|
||||
|
||||
|
@ -98,6 +98,7 @@ arm/mv/mv_cp110_clock.c optional SOC_MARVELL_8K fdt
|
||||
arm/mv/mv_thermal.c optional SOC_MARVELL_8K mv_thermal fdt
|
||||
arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt
|
||||
arm/xilinx/uart_dev_cdnc.c optional uart soc_xilinx_zynq
|
||||
arm64/acpica/acpi_iort.c optional acpi
|
||||
arm64/acpica/acpi_machdep.c optional acpi
|
||||
arm64/acpica/OsdEnvironment.c optional acpi
|
||||
arm64/acpica/acpi_wakeup.c optional acpi
|
||||
@ -262,20 +263,23 @@ cddl/dev/dtrace/aarch64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}
|
||||
cddl/dev/dtrace/aarch64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
|
||||
cddl/dev/fbt/aarch64/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
|
||||
|
||||
arm64/rockchip/rk_i2c.c optional rk_i2c fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/rk805.c optional rk805 fdt soc_rockchip_rk3328
|
||||
arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/rk_pinctrl.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/rk_gpio.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_cru.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_armclk.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_composite.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_gate.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_mux.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_pll.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
# RockChip Drivers
|
||||
arm64/rockchip/rk_i2c.c optional fdt rk_i2c soc_rockchip_rk3328 | fdt rk_i2c soc_rockchip_rk3399
|
||||
arm64/rockchip/rk805.c optional fdt rk805 soc_rockchip_rk3328 | fdt rk805 soc_rockchip_rk3399
|
||||
arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399
|
||||
arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399
|
||||
arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399
|
||||
dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399
|
||||
dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399
|
||||
|
||||
# RockChip Clock support
|
||||
arm64/rockchip/clk/rk_cru.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_armclk.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_composite.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_gate.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_mux.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk_clk_pll.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk3328_cru.c optional fdt soc_rockchip_rk3328
|
||||
arm64/rockchip/clk/rk3399_cru.c optional fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/clk/rk3399_pmucru.c optional fdt soc_rockchip_rk3399
|
||||
arm64/rockchip/if_dwc_rk.c optional dwc_rk fdt soc_rockchip_rk3328 soc_rockchip_rk3399
|
||||
dev/dwc/if_dwc.c optional dwc_rk
|
||||
dev/dwc/if_dwc_if.m optional dwc_rk
|
||||
|
@ -201,7 +201,6 @@ SCHED_STATS opt_sched.h
|
||||
SCHED_ULE opt_sched.h
|
||||
SLEEPQUEUE_PROFILING
|
||||
SLHCI_DEBUG opt_slhci.h
|
||||
SPX_HACK
|
||||
STACK opt_stack.h
|
||||
SUIDDIR
|
||||
MSGMNB opt_sysvipc.h
|
||||
|
@ -352,6 +352,7 @@ DB_SHOW_COMMAND(thread, db_show_thread)
|
||||
db_printf(" proc (pid %d): %p\n", td->td_proc->p_pid, td->td_proc);
|
||||
if (td->td_name[0] != '\0')
|
||||
db_printf(" name: %s\n", td->td_name);
|
||||
db_printf(" pcb: %p\n", td->td_pcb);
|
||||
db_printf(" stack: %p-%p\n", (void *)td->td_kstack,
|
||||
(void *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE - 1));
|
||||
db_printf(" flags: %#x ", td->td_flags);
|
||||
|
@ -544,5 +544,12 @@ int acpi_get_cpus(device_t dev, device_t child, enum cpu_sets op,
|
||||
size_t setsize, cpuset_t *cpuset);
|
||||
int acpi_get_domain(device_t dev, device_t child, int *domain);
|
||||
|
||||
#ifdef __aarch64__
|
||||
/*
|
||||
* ARM specific ACPI interfaces, relating to IORT table.
|
||||
*/
|
||||
int acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid);
|
||||
int acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm);
|
||||
#endif
|
||||
#endif /* _KERNEL */
|
||||
#endif /* !_ACPIVAR_H_ */
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2003-2008 M. Warner Losh. All Rights Reserved.
|
||||
* Copyright (c) 2000,2001 Jonathan Chen. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2003-2008 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
|
@ -1164,6 +1164,8 @@ void free_atid(struct adapter *, int);
|
||||
void release_tid(struct adapter *, int, struct sge_wrq *);
|
||||
int cxgbe_media_change(struct ifnet *);
|
||||
void cxgbe_media_status(struct ifnet *, struct ifmediareq *);
|
||||
bool t4_os_dump_cimla(struct adapter *, int, bool);
|
||||
void t4_os_dump_devlog(struct adapter *);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
/* t4_netmap.c */
|
||||
|
@ -212,9 +212,11 @@ static void t4_report_fw_error(struct adapter *adap)
|
||||
|
||||
pcie_fw = t4_read_reg(adap, A_PCIE_FW);
|
||||
if (pcie_fw & F_PCIE_FW_ERR) {
|
||||
adap->flags &= ~FW_OK;
|
||||
CH_ERR(adap, "firmware reports adapter error: %s (0x%08x)\n",
|
||||
reason[G_PCIE_FW_EVAL(pcie_fw)], pcie_fw);
|
||||
adap->flags &= ~FW_OK;
|
||||
if (pcie_fw != 0xffffffff)
|
||||
t4_os_dump_devlog(adap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,13 +490,19 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
|
||||
* the error and also check to see if the firmware reported any
|
||||
* errors ...
|
||||
*/
|
||||
ret = (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -ETIMEDOUT;
|
||||
CH_ERR(adap, "command %#x in mbox %d timed out (0x%08x).\n",
|
||||
*(const u8 *)cmd, mbox, pcie_fw);
|
||||
CH_DUMP_MBOX(adap, mbox, 0, "cmdsent", cmd_rpl, true);
|
||||
CH_DUMP_MBOX(adap, mbox, data_reg, "current", NULL, true);
|
||||
|
||||
t4_report_fw_error(adap);
|
||||
if (pcie_fw & F_PCIE_FW_ERR) {
|
||||
ret = -ENXIO;
|
||||
t4_report_fw_error(adap);
|
||||
} else {
|
||||
ret = -ETIMEDOUT;
|
||||
t4_os_dump_devlog(adap);
|
||||
}
|
||||
|
||||
t4_fatal_err(adap, true);
|
||||
return ret;
|
||||
}
|
||||
@ -4348,6 +4356,10 @@ static bool sge_intr_handler(struct adapter *adap, int arg, bool verbose)
|
||||
*/
|
||||
static bool cim_intr_handler(struct adapter *adap, int arg, bool verbose)
|
||||
{
|
||||
static const struct intr_action cim_host_intr_actions[] = {
|
||||
{ F_TIMER0INT, 0, t4_os_dump_cimla },
|
||||
{ 0 },
|
||||
};
|
||||
static const struct intr_details cim_host_intr_details[] = {
|
||||
/* T6+ */
|
||||
{ F_PCIE2CIMINTFPARERR, "CIM IBQ PCIe interface parity error" },
|
||||
@ -4392,7 +4404,7 @@ static bool cim_intr_handler(struct adapter *adap, int arg, bool verbose)
|
||||
.enable_reg = A_CIM_HOST_INT_ENABLE,
|
||||
.fatal = 0,
|
||||
.details = cim_host_intr_details,
|
||||
.actions = NULL,
|
||||
.actions = cim_host_intr_actions,
|
||||
};
|
||||
static const struct intr_details cim_host_upacc_intr_details[] = {
|
||||
{ F_EEPROMWRINT, "CIM EEPROM came out of busy state" },
|
||||
|
@ -556,7 +556,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, pcie_relaxed_ordering, CTLFLAG_RDTUN,
|
||||
|
||||
static int t4_panic_on_fatal_err = 0;
|
||||
SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RDTUN,
|
||||
&t4_panic_on_fatal_err, 0, "panic on fatal firmware errors");
|
||||
&t4_panic_on_fatal_err, 0, "panic on fatal errors");
|
||||
|
||||
#ifdef TCP_OFFLOAD
|
||||
/*
|
||||
@ -648,7 +648,6 @@ static int sysctl_loadavg(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cctrl(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS);
|
||||
@ -2563,6 +2562,16 @@ vcxgbe_detach(device_t dev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct callout fatal_callout;
|
||||
|
||||
static void
|
||||
delayed_panic(void *arg)
|
||||
{
|
||||
struct adapter *sc = arg;
|
||||
|
||||
panic("%s: panic on fatal error", device_get_nameunit(sc->dev));
|
||||
}
|
||||
|
||||
void
|
||||
t4_fatal_err(struct adapter *sc, bool fw_error)
|
||||
{
|
||||
@ -2570,9 +2579,6 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
|
||||
t4_shutdown_adapter(sc);
|
||||
log(LOG_ALERT, "%s: encountered fatal error, adapter stopped.\n",
|
||||
device_get_nameunit(sc->dev));
|
||||
if (t4_panic_on_fatal_err)
|
||||
panic("panic requested on fatal error");
|
||||
|
||||
if (fw_error) {
|
||||
ASSERT_SYNCHRONIZED_OP(sc);
|
||||
sc->flags |= ADAP_ERR;
|
||||
@ -2581,6 +2587,12 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
|
||||
sc->flags |= ADAP_ERR;
|
||||
ADAPTER_UNLOCK(sc);
|
||||
}
|
||||
|
||||
if (t4_panic_on_fatal_err) {
|
||||
log(LOG_ALERT, "%s: panic on fatal error after 30s",
|
||||
device_get_nameunit(sc->dev));
|
||||
callout_reset(&fatal_callout, hz * 30, delayed_panic, sc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -6026,8 +6038,7 @@ t4_sysctls(struct adapter *sc)
|
||||
sysctl_cim_ibq_obq, "A", "CIM IBQ 5 (NCSI)");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_la",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
chip_id(sc) <= CHELSIO_T5 ? sysctl_cim_la : sysctl_cim_la_t6,
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_cim_la,
|
||||
"A", "CIM logic analyzer");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ma_la",
|
||||
@ -7249,35 +7260,10 @@ sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS)
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_la(SYSCTL_HANDLER_ARGS)
|
||||
static void
|
||||
sbuf_cim_la4(struct adapter *sc, struct sbuf *sb, uint32_t *buf, uint32_t cfg)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
u_int cfg;
|
||||
struct sbuf *sb;
|
||||
uint32_t *buf, *p;
|
||||
int rc;
|
||||
|
||||
MPASS(chip_id(sc) <= CHELSIO_T5);
|
||||
|
||||
rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
buf = malloc(sc->params.cim_la_size * sizeof(uint32_t), M_CXGBE,
|
||||
M_ZERO | M_WAITOK);
|
||||
|
||||
rc = -t4_cim_read_la(sc, buf, NULL);
|
||||
if (rc != 0)
|
||||
goto done;
|
||||
uint32_t *p;
|
||||
|
||||
sbuf_printf(sb, "Status Data PC%s",
|
||||
cfg & F_UPDBGLACAPTPCONLY ? "" :
|
||||
@ -7302,43 +7288,12 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS)
|
||||
p[6], p[7]);
|
||||
}
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
done:
|
||||
free(buf, M_CXGBE);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS)
|
||||
static void
|
||||
sbuf_cim_la6(struct adapter *sc, struct sbuf *sb, uint32_t *buf, uint32_t cfg)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
u_int cfg;
|
||||
struct sbuf *sb;
|
||||
uint32_t *buf, *p;
|
||||
int rc;
|
||||
|
||||
MPASS(chip_id(sc) > CHELSIO_T5);
|
||||
|
||||
rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
buf = malloc(sc->params.cim_la_size * sizeof(uint32_t), M_CXGBE,
|
||||
M_ZERO | M_WAITOK);
|
||||
|
||||
rc = -t4_cim_read_la(sc, buf, NULL);
|
||||
if (rc != 0)
|
||||
goto done;
|
||||
uint32_t *p;
|
||||
|
||||
sbuf_printf(sb, "Status Inst Data PC%s",
|
||||
cfg & F_UPDBGLACAPTPCONLY ? "" :
|
||||
@ -7365,14 +7320,78 @@ sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS)
|
||||
p[2], p[1], p[0], p[5], p[4], p[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
sbuf_cim_la(struct adapter *sc, struct sbuf *sb, int flags)
|
||||
{
|
||||
uint32_t cfg, *buf;
|
||||
int rc;
|
||||
|
||||
rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
MPASS(flags == M_WAITOK || flags == M_NOWAIT);
|
||||
buf = malloc(sc->params.cim_la_size * sizeof(uint32_t), M_CXGBE,
|
||||
M_ZERO | flags);
|
||||
if (buf == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
rc = -t4_cim_read_la(sc, buf, NULL);
|
||||
if (rc != 0)
|
||||
goto done;
|
||||
if (chip_id(sc) < CHELSIO_T6)
|
||||
sbuf_cim_la4(sc, sb, buf, cfg);
|
||||
else
|
||||
sbuf_cim_la6(sc, sb, buf, cfg);
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
done:
|
||||
free(buf, M_CXGBE);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_la(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc;
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
rc = sbuf_cim_la(sc, sb, M_WAITOK);
|
||||
if (rc == 0)
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
bool
|
||||
t4_os_dump_cimla(struct adapter *sc, int arg, bool verbose)
|
||||
{
|
||||
struct sbuf sb;
|
||||
int rc;
|
||||
|
||||
if (sbuf_new(&sb, NULL, 4096, SBUF_AUTOEXTEND) != &sb)
|
||||
return (false);
|
||||
rc = sbuf_cim_la(sc, &sb, M_NOWAIT);
|
||||
if (rc == 0) {
|
||||
rc = sbuf_finish(&sb);
|
||||
if (rc == 0) {
|
||||
log(LOG_DEBUG, "%s: CIM LA dump follows.\n%s",
|
||||
device_get_nameunit(sc->dev), sbuf_data(&sb));
|
||||
}
|
||||
}
|
||||
sbuf_delete(&sb);
|
||||
return (false);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -7625,19 +7644,18 @@ static const char * const devlog_facility_strings[] = {
|
||||
};
|
||||
|
||||
static int
|
||||
sysctl_devlog(SYSCTL_HANDLER_ARGS)
|
||||
sbuf_devlog(struct adapter *sc, struct sbuf *sb, int flags)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
int i, j, rc, nentries, first = 0;
|
||||
struct devlog_params *dparams = &sc->params.devlog;
|
||||
struct fw_devlog_e *buf, *e;
|
||||
int i, j, rc, nentries, first = 0;
|
||||
struct sbuf *sb;
|
||||
uint64_t ftstamp = UINT64_MAX;
|
||||
|
||||
if (dparams->addr == 0)
|
||||
return (ENXIO);
|
||||
|
||||
buf = malloc(dparams->size, M_CXGBE, M_NOWAIT);
|
||||
MPASS(flags == M_WAITOK || flags == M_NOWAIT);
|
||||
buf = malloc(dparams->size, M_CXGBE, M_ZERO | flags);
|
||||
if (buf == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
@ -7666,15 +7684,6 @@ sysctl_devlog(SYSCTL_HANDLER_ARGS)
|
||||
if (buf[first].timestamp == 0)
|
||||
goto done; /* nothing in the log */
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
goto done;
|
||||
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL) {
|
||||
rc = ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
sbuf_printf(sb, "%10s %15s %8s %8s %s\n",
|
||||
"Seq#", "Tstamp", "Level", "Facility", "Message");
|
||||
|
||||
@ -7697,14 +7706,51 @@ sysctl_devlog(SYSCTL_HANDLER_ARGS)
|
||||
if (++i == nentries)
|
||||
i = 0;
|
||||
} while (i != first);
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
done:
|
||||
free(buf, M_CXGBE);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_devlog(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
int rc;
|
||||
struct sbuf *sb;
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
rc = sbuf_devlog(sc, sb, M_WAITOK);
|
||||
if (rc == 0)
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
void
|
||||
t4_os_dump_devlog(struct adapter *sc)
|
||||
{
|
||||
int rc;
|
||||
struct sbuf sb;
|
||||
|
||||
if (sbuf_new(&sb, NULL, 4096, SBUF_AUTOEXTEND) != &sb)
|
||||
return;
|
||||
rc = sbuf_devlog(sc, &sb, M_NOWAIT);
|
||||
if (rc == 0) {
|
||||
rc = sbuf_finish(&sb);
|
||||
if (rc == 0) {
|
||||
log(LOG_DEBUG, "%s: device log follows.\n%s",
|
||||
device_get_nameunit(sc->dev), sbuf_data(&sb));
|
||||
}
|
||||
}
|
||||
sbuf_delete(&sb);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -10652,6 +10698,7 @@ mod_event(module_t mod, int cmd, void *arg)
|
||||
do_smt_write_rpl);
|
||||
sx_init(&t4_list_lock, "T4/T5 adapters");
|
||||
SLIST_INIT(&t4_list);
|
||||
callout_init(&fatal_callout, 1);
|
||||
#ifdef TCP_OFFLOAD
|
||||
sx_init(&t4_uld_list_lock, "T4/T5 ULDs");
|
||||
SLIST_INIT(&t4_uld_list);
|
||||
|
@ -479,6 +479,7 @@ t4vf_attach(device_t dev)
|
||||
sc->params.pci.mps = pci_get_max_payload(dev);
|
||||
|
||||
sc->flags |= IS_VF;
|
||||
TUNABLE_INT_FETCH("hw.cxgbe.dflags", &sc->debug_flags);
|
||||
|
||||
sc->sge_gts_reg = VF_SGE_REG(A_SGE_VF_GTS);
|
||||
sc->sge_kdoorbell_reg = VF_SGE_REG(A_SGE_VF_KDOORBELL);
|
||||
|
@ -249,6 +249,7 @@ static int em_if_mtu_set(if_ctx_t ctx, uint32_t mtu);
|
||||
static void em_if_timer(if_ctx_t ctx, uint16_t qid);
|
||||
static void em_if_vlan_register(if_ctx_t ctx, u16 vtag);
|
||||
static void em_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
|
||||
static void em_if_watchdog_reset(if_ctx_t ctx);
|
||||
|
||||
static void em_identify_hardware(if_ctx_t ctx);
|
||||
static int em_allocate_pci_resources(if_ctx_t ctx);
|
||||
@ -386,6 +387,7 @@ static device_method_t em_if_methods[] = {
|
||||
DEVMETHOD(ifdi_mtu_set, em_if_mtu_set),
|
||||
DEVMETHOD(ifdi_promisc_set, em_if_set_promisc),
|
||||
DEVMETHOD(ifdi_timer, em_if_timer),
|
||||
DEVMETHOD(ifdi_watchdog_reset, em_if_watchdog_reset),
|
||||
DEVMETHOD(ifdi_vlan_register, em_if_vlan_register),
|
||||
DEVMETHOD(ifdi_vlan_unregister, em_if_vlan_unregister),
|
||||
DEVMETHOD(ifdi_get_counter, em_if_get_counter),
|
||||
@ -721,7 +723,6 @@ em_set_num_queues(if_ctx_t ctx)
|
||||
*
|
||||
* return 0 on success, positive on failure
|
||||
*********************************************************************/
|
||||
|
||||
static int
|
||||
em_if_attach_pre(if_ctx_t ctx)
|
||||
{
|
||||
@ -731,15 +732,10 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
struct e1000_hw *hw;
|
||||
int error = 0;
|
||||
|
||||
INIT_DEBUGOUT("em_if_attach_pre begin");
|
||||
INIT_DEBUGOUT("em_if_attach_pre: begin");
|
||||
dev = iflib_get_dev(ctx);
|
||||
adapter = iflib_get_softc(ctx);
|
||||
|
||||
if (resource_disabled("em", device_get_unit(dev))) {
|
||||
device_printf(dev, "Disabled by device hint\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
adapter->ctx = adapter->osdep.ctx = ctx;
|
||||
adapter->dev = adapter->osdep.dev = dev;
|
||||
scctx = adapter->shared = iflib_get_softc_ctx(ctx);
|
||||
@ -777,7 +773,6 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
/* Determine hardware and mac info */
|
||||
em_identify_hardware(ctx);
|
||||
|
||||
scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
|
||||
scctx->isc_tx_nsegments = EM_MAX_SCATTER;
|
||||
scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx);
|
||||
if (bootverbose)
|
||||
@ -785,8 +780,6 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
scctx->isc_ntxqsets_max);
|
||||
|
||||
if (adapter->hw.mac.type >= igb_mac_min) {
|
||||
int try_second_bar;
|
||||
|
||||
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN);
|
||||
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN);
|
||||
scctx->isc_txd_size[0] = sizeof(union e1000_adv_tx_desc);
|
||||
@ -800,14 +793,13 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
CSUM_IP6_TCP | CSUM_IP6_UDP;
|
||||
if (adapter->hw.mac.type != e1000_82575)
|
||||
scctx->isc_tx_csum_flags |= CSUM_SCTP | CSUM_IP6_SCTP;
|
||||
|
||||
/*
|
||||
** Some new devices, as with ixgbe, now may
|
||||
** use a different BAR, so we need to keep
|
||||
** track of which is used.
|
||||
*/
|
||||
try_second_bar = pci_read_config(dev, scctx->isc_msix_bar, 4);
|
||||
if (try_second_bar == 0)
|
||||
scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
|
||||
if (pci_read_config(dev, scctx->isc_msix_bar, 4) == 0)
|
||||
scctx->isc_msix_bar += 4;
|
||||
} else if (adapter->hw.mac.type >= em_mac_min) {
|
||||
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
|
||||
@ -837,6 +829,16 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
*/
|
||||
scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO);
|
||||
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO;
|
||||
/*
|
||||
* We support MSI-X with 82574 only, but indicate to iflib(4)
|
||||
* that it shall give MSI at least a try with other devices.
|
||||
*/
|
||||
if (adapter->hw.mac.type == e1000_82574) {
|
||||
scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
|
||||
} else {
|
||||
scctx->isc_msix_bar = -1;
|
||||
scctx->isc_disable_msix = 1;
|
||||
}
|
||||
} else {
|
||||
scctx->isc_txqsizes[0] = roundup2((scctx->isc_ntxd[0] + 1) * sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
|
||||
scctx->isc_rxqsizes[0] = roundup2((scctx->isc_nrxd[0] + 1) * sizeof(struct e1000_rx_desc), EM_DBA_ALIGN);
|
||||
@ -847,6 +849,7 @@ em_if_attach_pre(if_ctx_t ctx)
|
||||
scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS;
|
||||
if (adapter->hw.mac.type < e1000_82543)
|
||||
scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM);
|
||||
/* INTx only */
|
||||
scctx->isc_msix_bar = 0;
|
||||
}
|
||||
|
||||
@ -1092,13 +1095,12 @@ em_if_attach_post(if_ctx_t ctx)
|
||||
*
|
||||
* return 0 on success, positive on failure
|
||||
*********************************************************************/
|
||||
|
||||
static int
|
||||
em_if_detach(if_ctx_t ctx)
|
||||
{
|
||||
struct adapter *adapter = iflib_get_softc(ctx);
|
||||
|
||||
INIT_DEBUGOUT("em_detach: begin");
|
||||
INIT_DEBUGOUT("em_if_detach: begin");
|
||||
|
||||
e1000_phy_hw_reset(&adapter->hw);
|
||||
|
||||
@ -1203,9 +1205,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
|
||||
* by the driver as a hw/sw initialization routine to get to a
|
||||
* consistent state.
|
||||
*
|
||||
* return 0 on success, positive on failure
|
||||
**********************************************************************/
|
||||
|
||||
static void
|
||||
em_if_init(if_ctx_t ctx)
|
||||
{
|
||||
@ -1214,6 +1214,7 @@ em_if_init(if_ctx_t ctx)
|
||||
struct ifnet *ifp = iflib_get_ifp(ctx);
|
||||
struct em_tx_queue *tx_que;
|
||||
int i;
|
||||
|
||||
INIT_DEBUGOUT("em_if_init: begin");
|
||||
|
||||
/* Get the latest mac address, User can use a LAA */
|
||||
@ -1697,37 +1698,24 @@ em_if_multi_set(if_ctx_t ctx)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Timer routine
|
||||
*
|
||||
* This routine checks for link status and updates statistics.
|
||||
* This routine schedules em_if_update_admin_status() to check for
|
||||
* link status and to gather statistics as well as to perform some
|
||||
* controller-specific hardware patting.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
static void
|
||||
em_if_timer(if_ctx_t ctx, uint16_t qid)
|
||||
{
|
||||
struct adapter *adapter = iflib_get_softc(ctx);
|
||||
struct em_rx_queue *que;
|
||||
int i;
|
||||
int trigger = 0;
|
||||
|
||||
if (qid != 0)
|
||||
return;
|
||||
|
||||
iflib_admin_intr_deferred(ctx);
|
||||
|
||||
/* Mask to use in the irq trigger */
|
||||
if (adapter->intr_type == IFLIB_INTR_MSIX) {
|
||||
for (i = 0, que = adapter->rx_queues; i < adapter->rx_num_queues; i++, que++)
|
||||
trigger |= que->eims;
|
||||
} else {
|
||||
trigger = E1000_ICS_RXDMT0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
em_if_update_admin_status(if_ctx_t ctx)
|
||||
{
|
||||
@ -1833,21 +1821,30 @@ em_if_update_admin_status(if_ctx_t ctx)
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC);
|
||||
}
|
||||
|
||||
static void
|
||||
em_if_watchdog_reset(if_ctx_t ctx)
|
||||
{
|
||||
struct adapter *adapter = iflib_get_softc(ctx);
|
||||
|
||||
/*
|
||||
* Just count the event; iflib(4) will already trigger a
|
||||
* sufficient reset of the controller.
|
||||
*/
|
||||
adapter->watchdog_events++;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* This routine disables all traffic on the adapter by issuing a
|
||||
* global reset on the MAC and deallocates TX/RX buffers.
|
||||
* global reset on the MAC.
|
||||
*
|
||||
* This routine should always be called with BOTH the CORE
|
||||
* and TX locks.
|
||||
**********************************************************************/
|
||||
|
||||
static void
|
||||
em_if_stop(if_ctx_t ctx)
|
||||
{
|
||||
struct adapter *adapter = iflib_get_softc(ctx);
|
||||
|
||||
INIT_DEBUGOUT("em_stop: begin");
|
||||
INIT_DEBUGOUT("em_if_stop: begin");
|
||||
|
||||
e1000_reset_hw(&adapter->hw);
|
||||
if (adapter->hw.mac.type >= e1000_82544)
|
||||
@ -1857,7 +1854,6 @@ em_if_stop(if_ctx_t ctx)
|
||||
e1000_cleanup_led(&adapter->hw);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Determine hardware revision.
|
||||
@ -1996,7 +1992,7 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix)
|
||||
&adapter->rx_queues[i % adapter->rx_num_queues].que_irq,
|
||||
IFLIB_INTR_TX, tx_que, tx_que->me, buf);
|
||||
|
||||
tx_que->msix = (vector % adapter->tx_num_queues);
|
||||
tx_que->msix = (vector % adapter->rx_num_queues);
|
||||
|
||||
/*
|
||||
* Set the bit to enable interrupt
|
||||
@ -2009,9 +2005,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix)
|
||||
adapter->ims |= tx_que->eims;
|
||||
adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4));
|
||||
} else if (adapter->hw.mac.type == e1000_82575) {
|
||||
tx_que->eims = E1000_EICR_TX_QUEUE0 << (i % adapter->tx_num_queues);
|
||||
tx_que->eims = E1000_EICR_TX_QUEUE0 << i;
|
||||
} else {
|
||||
tx_que->eims = 1 << (i % adapter->tx_num_queues);
|
||||
tx_que->eims = 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2226,11 +2222,9 @@ em_setup_msix(if_ctx_t ctx)
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Initialize the hardware to a configuration
|
||||
* as specified by the adapter structure.
|
||||
* Workaround for SmartSpeed on 82541 and 82547 controllers
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
static void
|
||||
lem_smartspeed(struct adapter *adapter)
|
||||
{
|
||||
@ -2395,6 +2389,12 @@ igb_init_dmac(struct adapter *adapter, u32 pba)
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Initialize the hardware to a configuration as specified by the
|
||||
* adapter structure.
|
||||
*
|
||||
**********************************************************************/
|
||||
static void
|
||||
em_reset(if_ctx_t ctx)
|
||||
{
|
||||
@ -2629,6 +2629,11 @@ em_reset(if_ctx_t ctx)
|
||||
e1000_check_for_link(hw);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the RSS mapping for NICs that support multiple transmit/
|
||||
* receive rings.
|
||||
*/
|
||||
|
||||
#define RSSKEYLEN 10
|
||||
static void
|
||||
em_initialize_rss_mapping(struct adapter *adapter)
|
||||
@ -2669,7 +2674,6 @@ em_initialize_rss_mapping(struct adapter *adapter)
|
||||
E1000_MRQC_RSS_FIELD_IPV6_TCP_EX |
|
||||
E1000_MRQC_RSS_FIELD_IPV6_EX |
|
||||
E1000_MRQC_RSS_FIELD_IPV6);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2769,7 +2773,7 @@ igb_initialize_rss_mapping(struct adapter *adapter)
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Setup networking device structure and register an interface.
|
||||
* Setup networking device structure and register interface media.
|
||||
*
|
||||
**********************************************************************/
|
||||
static int
|
||||
@ -4015,12 +4019,6 @@ em_add_hw_stats(struct adapter *adapter)
|
||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
|
||||
CTLFLAG_RD, &adapter->link_irq,
|
||||
"Link MSI-X IRQ Handled");
|
||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail",
|
||||
CTLFLAG_RD, &adapter->mbuf_defrag_failed,
|
||||
"Defragmenting mbuf chain failed");
|
||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail",
|
||||
CTLFLAG_RD, &adapter->no_tx_dma_setup,
|
||||
"Driver tx dma failure in xmit");
|
||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns",
|
||||
CTLFLAG_RD, &adapter->rx_overruns,
|
||||
"RX overruns");
|
||||
@ -4543,7 +4541,8 @@ em_enable_vectors_82574(if_ctx_t ctx)
|
||||
u16 edata;
|
||||
|
||||
e1000_read_nvm(hw, EM_NVM_PCIE_CTRL, 1, &edata);
|
||||
printf("Current cap: %#06x\n", edata);
|
||||
if (bootverbose)
|
||||
device_printf(dev, "EM_NVM_PCIE_CTRL = %#06x\n", edata);
|
||||
if (((edata & EM_NVM_MSIX_N_MASK) >> EM_NVM_MSIX_N_SHIFT) != 4) {
|
||||
device_printf(dev, "Writing to eeprom: increasing "
|
||||
"reported MSI-X vectors from 3 to 5...\n");
|
||||
|
@ -519,7 +519,6 @@ struct adapter {
|
||||
|
||||
u64 que_mask;
|
||||
|
||||
|
||||
struct em_int_delay_info tx_int_delay;
|
||||
struct em_int_delay_info tx_abs_int_delay;
|
||||
struct em_int_delay_info rx_int_delay;
|
||||
@ -529,9 +528,6 @@ struct adapter {
|
||||
/* Misc stats maintained by the driver */
|
||||
unsigned long dropped_pkts;
|
||||
unsigned long link_irq;
|
||||
unsigned long mbuf_defrag_failed;
|
||||
unsigned long no_tx_dma_setup;
|
||||
unsigned long no_tx_map_avail;
|
||||
unsigned long rx_overruns;
|
||||
unsigned long watchdog_events;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved.
|
||||
* Copyright (c) 2018 Ian Lepore. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved.
|
||||
* Copyright (c) 2017 Ruslan Bukin <br@bsdpad.com>
|
||||
* Copyright (c) 2018 Ian Lepore. All rights reserved.
|
||||
|
@ -3990,6 +3990,7 @@ iwn_notif_intr(struct iwn_softc *sc)
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
|
||||
uint16_t hw;
|
||||
int is_stopped;
|
||||
|
||||
bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map,
|
||||
BUS_DMASYNC_POSTREAD);
|
||||
@ -4021,6 +4022,11 @@ iwn_notif_intr(struct iwn_softc *sc)
|
||||
case IWN_MPDU_RX_DONE:
|
||||
/* An 802.11 frame has been received. */
|
||||
iwn_rx_done(sc, desc, data);
|
||||
|
||||
is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
|
||||
if (__predict_false(is_stopped))
|
||||
return;
|
||||
|
||||
break;
|
||||
|
||||
case IWN_RX_COMPRESSED_BA:
|
||||
@ -4061,6 +4067,11 @@ iwn_notif_intr(struct iwn_softc *sc)
|
||||
IWN_UNLOCK(sc);
|
||||
ieee80211_beacon_miss(ic);
|
||||
IWN_LOCK(sc);
|
||||
|
||||
is_stopped = (sc->sc_flags &
|
||||
IWN_FLAG_RUNNING) == 0;
|
||||
if (__predict_false(is_stopped))
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -4127,6 +4138,11 @@ iwn_notif_intr(struct iwn_softc *sc)
|
||||
IWN_UNLOCK(sc);
|
||||
ieee80211_scan_next(vap);
|
||||
IWN_LOCK(sc);
|
||||
|
||||
is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
|
||||
if (__predict_false(is_stopped))
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
case IWN5000_CALIBRATION_RESULT:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org>
|
||||
* Copyright (c) 2015-2016 Ilya Bakulin <kibab@FreeBSD.org>
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 Bernd Walter. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -3711,8 +3711,7 @@ netmap_attach_ext(struct netmap_adapter *arg, size_t size, int override_reg)
|
||||
hwna->up.nm_dtor = netmap_hw_dtor;
|
||||
}
|
||||
|
||||
nm_prinf("%s: netmap queues/slots: TX %d/%d, RX %d/%d\n",
|
||||
hwna->up.name,
|
||||
if_printf(ifp, "netmap queues/slots: TX %d/%d, RX %d/%d\n",
|
||||
hwna->up.num_tx_rings, hwna->up.num_tx_desc,
|
||||
hwna->up.num_rx_rings, hwna->up.num_rx_desc);
|
||||
return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001-2004 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001-2004 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -348,14 +348,52 @@ generic_pcie_acpi_route_interrupt(device_t bus, device_t dev, int pin)
|
||||
return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt));
|
||||
}
|
||||
|
||||
static u_int
|
||||
generic_pcie_get_xref(device_t pci, device_t child)
|
||||
{
|
||||
struct generic_pcie_acpi_softc *sc;
|
||||
uintptr_t rid;
|
||||
u_int xref, devid;
|
||||
int err;
|
||||
|
||||
sc = device_get_softc(pci);
|
||||
err = pcib_get_id(pci, child, PCI_ID_RID, &rid);
|
||||
if (err != 0)
|
||||
return (ACPI_MSI_XREF);
|
||||
err = acpi_iort_map_pci_msi(sc->base.ecam, rid, &xref, &devid);
|
||||
if (err != 0)
|
||||
return (ACPI_MSI_XREF);
|
||||
return (xref);
|
||||
}
|
||||
|
||||
static u_int
|
||||
generic_pcie_map_id(device_t pci, device_t child, uintptr_t *id)
|
||||
{
|
||||
struct generic_pcie_acpi_softc *sc;
|
||||
uintptr_t rid;
|
||||
u_int xref, devid;
|
||||
int err;
|
||||
|
||||
sc = device_get_softc(pci);
|
||||
err = pcib_get_id(pci, child, PCI_ID_RID, &rid);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
err = acpi_iort_map_pci_msi(sc->base.ecam, rid, &xref, &devid);
|
||||
if (err == 0)
|
||||
*id = devid;
|
||||
else
|
||||
*id = rid; /* RID not in IORT, likely FW bug, ignore */
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
generic_pcie_acpi_alloc_msi(device_t pci, device_t child, int count,
|
||||
int maxcount, int *irqs)
|
||||
{
|
||||
|
||||
#if defined(INTRNG)
|
||||
return (intr_alloc_msi(pci, child, ACPI_MSI_XREF, count, maxcount,
|
||||
irqs));
|
||||
return (intr_alloc_msi(pci, child, generic_pcie_get_xref(pci, child),
|
||||
count, maxcount, irqs));
|
||||
#else
|
||||
return (ENXIO);
|
||||
#endif
|
||||
@ -367,7 +405,8 @@ generic_pcie_acpi_release_msi(device_t pci, device_t child, int count,
|
||||
{
|
||||
|
||||
#if defined(INTRNG)
|
||||
return (intr_release_msi(pci, child, ACPI_MSI_XREF, count, irqs));
|
||||
return (intr_release_msi(pci, child, generic_pcie_get_xref(pci, child),
|
||||
count, irqs));
|
||||
#else
|
||||
return (ENXIO);
|
||||
#endif
|
||||
@ -379,7 +418,8 @@ generic_pcie_acpi_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
|
||||
{
|
||||
|
||||
#if defined(INTRNG)
|
||||
return (intr_map_msi(pci, child, ACPI_MSI_XREF, irq, addr, data));
|
||||
return (intr_map_msi(pci, child, generic_pcie_get_xref(pci, child), irq,
|
||||
addr, data));
|
||||
#else
|
||||
return (ENXIO);
|
||||
#endif
|
||||
@ -390,7 +430,8 @@ generic_pcie_acpi_alloc_msix(device_t pci, device_t child, int *irq)
|
||||
{
|
||||
|
||||
#if defined(INTRNG)
|
||||
return (intr_alloc_msix(pci, child, ACPI_MSI_XREF, irq));
|
||||
return (intr_alloc_msix(pci, child, generic_pcie_get_xref(pci, child),
|
||||
irq));
|
||||
#else
|
||||
return (ENXIO);
|
||||
#endif
|
||||
@ -401,7 +442,8 @@ generic_pcie_acpi_release_msix(device_t pci, device_t child, int irq)
|
||||
{
|
||||
|
||||
#if defined(INTRNG)
|
||||
return (intr_release_msix(pci, child, ACPI_MSI_XREF, irq));
|
||||
return (intr_release_msix(pci, child, generic_pcie_get_xref(pci, child),
|
||||
irq));
|
||||
#else
|
||||
return (ENXIO);
|
||||
#endif
|
||||
@ -412,14 +454,8 @@ generic_pcie_acpi_get_id(device_t pci, device_t child, enum pci_id_type type,
|
||||
uintptr_t *id)
|
||||
{
|
||||
|
||||
/*
|
||||
* Use the PCI RID to find the MSI ID for now, we support only 1:1
|
||||
* mapping
|
||||
*
|
||||
* On aarch64, more complex mapping would come from IORT table
|
||||
*/
|
||||
if (type == PCI_ID_MSI)
|
||||
return (pcib_get_id(pci, child, PCI_ID_RID, id));
|
||||
return (generic_pcie_map_id(pci, child, id));
|
||||
else
|
||||
return (pcib_get_id(pci, child, type, id));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ STATIC agBOOLEAN agtiapi_typhAlloc( ag_card_info_t *thisCardInst )
|
||||
struct agtiapi_softc *pmsc = thisCardInst->pCard;
|
||||
int wait = 0;
|
||||
|
||||
if( bus_dma_tag_create( agNULL, // parent
|
||||
if( bus_dma_tag_create( bus_get_dma_tag(pmsc->my_dev), // parent
|
||||
32, // alignment
|
||||
0, // boundary
|
||||
BUS_SPACE_MAXADDR, // lowaddr
|
||||
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-3-Clause
|
||||
*
|
||||
* Copyright (c) 2002 JF Hay. All rights reserved.
|
||||
* Copyright (c) 2000 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2000 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2002 JF Hay. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
* Copyright (c) 2003 Norikatsu Shigemura, Takenori Watanabe All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2006 Marcel Moolenaar. All rights reserved.
|
||||
* Copyright (c) 2002 JF Hay. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2001 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2016 Emmanuel Vadot <manu@freebsd.org>
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 M. Warner Losh.
|
||||
* Copyright (c) 2016 Emmanuel Vadot <manu@freebsd.org> All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,214 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 2009 Andrew Turner. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/stddef.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/priv.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_busdma.h>
|
||||
#include <dev/usb/usb_process.h>
|
||||
#include <dev/usb/usb_util.h>
|
||||
|
||||
#include <dev/usb/usb_controller.h>
|
||||
#include <dev/usb/usb_bus.h>
|
||||
#include <dev/usb/controller/ohci.h>
|
||||
#include <dev/usb/controller/ohcireg.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <arm/samsung/s3c2xx0/s3c24x0reg.h>
|
||||
|
||||
static device_probe_t ohci_s3c24x0_probe;
|
||||
static device_attach_t ohci_s3c24x0_attach;
|
||||
static device_detach_t ohci_s3c24x0_detach;
|
||||
|
||||
static int
|
||||
ohci_s3c24x0_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "S3C24x0 integrated OHCI controller");
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
static int
|
||||
ohci_s3c24x0_attach(device_t dev)
|
||||
{
|
||||
struct ohci_softc *sc = device_get_softc(dev);
|
||||
int err;
|
||||
int rid;
|
||||
|
||||
/* initialise some bus fields */
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = OHCI_MAX_DEVICES;
|
||||
sc->sc_bus.dma_bits = 32;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev),
|
||||
&ohci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
sc->sc_dev = dev;
|
||||
|
||||
rid = 0;
|
||||
sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
|
||||
&rid, RF_ACTIVE);
|
||||
|
||||
if (!(sc->sc_io_res)) {
|
||||
err = ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
|
||||
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
|
||||
sc->sc_io_size = rman_get_size(sc->sc_io_res);
|
||||
|
||||
rid = 0;
|
||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
||||
RF_ACTIVE);
|
||||
if (!(sc->sc_irq_res)) {
|
||||
goto error;
|
||||
}
|
||||
sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
|
||||
if (!(sc->sc_bus.bdev)) {
|
||||
goto error;
|
||||
}
|
||||
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
|
||||
|
||||
strlcpy(sc->sc_vendor, "Samsung", sizeof(sc->sc_vendor));
|
||||
|
||||
err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
|
||||
NULL, (void *)ohci_interrupt, sc, &sc->sc_intr_hdl);
|
||||
if (err) {
|
||||
sc->sc_intr_hdl = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl,
|
||||
OHCI_CONTROL, 0);
|
||||
|
||||
err = ohci_init(sc);
|
||||
if (!err) {
|
||||
err = device_probe_and_attach(sc->sc_bus.bdev);
|
||||
}
|
||||
if (err) {
|
||||
goto error;
|
||||
}
|
||||
return (0);
|
||||
|
||||
error:
|
||||
ohci_s3c24x0_detach(dev);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
ohci_s3c24x0_detach(device_t dev)
|
||||
{
|
||||
struct ohci_softc *sc = device_get_softc(dev);
|
||||
int err;
|
||||
|
||||
/* during module unload there are lots of children leftover */
|
||||
device_delete_children(dev);
|
||||
|
||||
/*
|
||||
* Put the controller into reset, then disable clocks and do
|
||||
* the MI tear down. We have to disable the clocks/hardware
|
||||
* after we do the rest of the teardown. We also disable the
|
||||
* clocks in the opposite order we acquire them, but that
|
||||
* doesn't seem to be absolutely necessary. We free up the
|
||||
* clocks after we disable them, so the system could, in
|
||||
* theory, reuse them.
|
||||
*/
|
||||
bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl,
|
||||
OHCI_CONTROL, 0);
|
||||
|
||||
if (sc->sc_irq_res && sc->sc_intr_hdl) {
|
||||
/*
|
||||
* only call ohci_detach() after ohci_init()
|
||||
*/
|
||||
ohci_detach(sc);
|
||||
|
||||
err = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl);
|
||||
sc->sc_intr_hdl = NULL;
|
||||
}
|
||||
if (sc->sc_irq_res) {
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
|
||||
sc->sc_irq_res = NULL;
|
||||
}
|
||||
if (sc->sc_io_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, 0,
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_method_t ohci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, ohci_s3c24x0_probe),
|
||||
DEVMETHOD(device_attach, ohci_s3c24x0_attach),
|
||||
DEVMETHOD(device_detach, ohci_s3c24x0_detach),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t ohci_driver = {
|
||||
.name = "ohci",
|
||||
.methods = ohci_methods,
|
||||
.size = sizeof(struct ohci_softc),
|
||||
};
|
||||
|
||||
static devclass_t ohci_devclass;
|
||||
|
||||
DRIVER_MODULE(ohci, s3c24x0, ohci_driver, ohci_devclass, 0, 0);
|
||||
MODULE_DEPEND(ohci, usb, 1, 1, 1);
|
@ -69,6 +69,7 @@ static const STRUCT_USB_HOST_ID ure_devs[] = {
|
||||
#define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
|
||||
URE_DEV(LENOVO, RTL8153, 0),
|
||||
URE_DEV(LENOVO, TBT3LAN, 0),
|
||||
URE_DEV(LENOVO, ONELINK, 0),
|
||||
URE_DEV(LENOVO, USBCLAN, 0),
|
||||
URE_DEV(NVIDIA, RTL8153, 0),
|
||||
URE_DEV(REALTEK, RTL8152, URE_FLAG_8152),
|
||||
|
@ -2782,6 +2782,7 @@ product LEADTEK 9531 0x2101 9531 GPS
|
||||
product LENOVO GIGALAN 0x304b USB 3.0 Ethernet
|
||||
product LENOVO ETHERNET 0x7203 USB 2.0 Ethernet
|
||||
product LENOVO RTL8153 0x7205 USB 3.0 Ethernet
|
||||
product LENOVO ONELINK 0x720a USB 3.0 Ethernet
|
||||
product LENOVO TBT3LAN 0x3069 LAN port in Thinkpad TB3 dock
|
||||
product LENOVO USBCLAN 0x3062 LAN port in Thinkpad USB-C dock
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-4-Clause
|
||||
*
|
||||
* Copyright (c) 2002
|
||||
* M Warner Losh <imp@freebsd.org>. All rights reserved.
|
||||
* Copyright (c) 2002 M Warner Losh <imp@freebsd.org>.
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
||||
*
|
||||
|
@ -38,7 +38,7 @@
|
||||
stdout = &uartd;
|
||||
};
|
||||
|
||||
memory {
|
||||
memory@80000000 {
|
||||
/* reg = <0x0 0x80000000 0x0 0x80000000>; */
|
||||
reg = <0x0 0x80000000 0x0 0x70000000>;
|
||||
};
|
||||
|
@ -74,13 +74,14 @@ static vfs_extattrctl_t nullfs_extattrctl;
|
||||
static int
|
||||
nullfs_mount(struct mount *mp)
|
||||
{
|
||||
int error = 0;
|
||||
struct vnode *lowerrootvp, *vp;
|
||||
struct vnode *nullm_rootvp;
|
||||
struct null_mount *xmp;
|
||||
struct null_node *nn;
|
||||
struct nameidata nd, *ndp;
|
||||
char *target;
|
||||
int isvnunlocked = 0, len;
|
||||
struct nameidata nd, *ndp = &nd;
|
||||
int error, len;
|
||||
bool isvnunlocked;
|
||||
|
||||
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
|
||||
|
||||
@ -110,14 +111,18 @@ nullfs_mount(struct mount *mp)
|
||||
/*
|
||||
* Unlock lower node to avoid possible deadlock.
|
||||
*/
|
||||
if ((mp->mnt_vnodecovered->v_op == &null_vnodeops) &&
|
||||
if (mp->mnt_vnodecovered->v_op == &null_vnodeops &&
|
||||
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
isvnunlocked = 1;
|
||||
isvnunlocked = true;
|
||||
} else {
|
||||
isvnunlocked = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find lower node
|
||||
*/
|
||||
ndp = &nd;
|
||||
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
|
||||
error = namei(ndp);
|
||||
|
||||
@ -140,10 +145,13 @@ nullfs_mount(struct mount *mp)
|
||||
/*
|
||||
* Check multi null mount to avoid `lock against myself' panic.
|
||||
*/
|
||||
if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
|
||||
NULLFSDEBUG("nullfs_mount: multi null mount?\n");
|
||||
vput(lowerrootvp);
|
||||
return (EDEADLK);
|
||||
if (mp->mnt_vnodecovered->v_op == &null_vnodeops) {
|
||||
nn = VTONULL(mp->mnt_vnodecovered);
|
||||
if (nn == NULL || lowerrootvp == nn->null_lowervp) {
|
||||
NULLFSDEBUG("nullfs_mount: multi null mount?\n");
|
||||
vput(lowerrootvp);
|
||||
return (EDEADLK);
|
||||
}
|
||||
}
|
||||
|
||||
xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
|
||||
|
@ -870,11 +870,14 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
struct vnode **dvp = ap->a_vpp;
|
||||
struct vnode *lvp, *ldvp;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct mount *mp;
|
||||
int error, locked;
|
||||
|
||||
locked = VOP_ISLOCKED(vp);
|
||||
lvp = NULLVPTOLOWERVP(vp);
|
||||
vhold(lvp);
|
||||
mp = vp->v_mount;
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
|
||||
ldvp = lvp;
|
||||
vref(lvp);
|
||||
@ -882,6 +885,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
vdrop(lvp);
|
||||
if (error != 0) {
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
@ -893,9 +897,10 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
if (error != 0) {
|
||||
vrele(ldvp);
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
return (ENOENT);
|
||||
}
|
||||
error = null_nodeget(vp->v_mount, ldvp, dvp);
|
||||
error = null_nodeget(mp, ldvp, dvp);
|
||||
if (error == 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
NULLVPTOLOWERVP(*dvp);
|
||||
@ -903,6 +908,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
|
||||
}
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -143,16 +143,26 @@ wakeup_32:
|
||||
mov $bootdata32 - bootgdt, %eax
|
||||
mov %ax, %ds
|
||||
|
||||
/* Get PCB and return address. */
|
||||
movl wakeup_pcb - wakeup_start(%ebx), %ecx
|
||||
movl wakeup_ret - wakeup_start(%ebx), %edx
|
||||
|
||||
/* Restore CR4 and CR3. */
|
||||
movl wakeup_cr4 - wakeup_start(%ebx), %eax
|
||||
/* Restore EFER, CR4 and CR3. */
|
||||
movl wakeup_efer - wakeup_start(%ebx), %eax
|
||||
movl wakeup_efer - wakeup_start + 4(%ebx), %edx
|
||||
cmpl $0, %eax
|
||||
jne 1f
|
||||
cmpl $0, %edx
|
||||
je 2f
|
||||
1: movl $MSR_EFER, %ecx
|
||||
wrmsr
|
||||
2: movl wakeup_cr4 - wakeup_start(%ebx), %eax
|
||||
cmpl $0, %eax
|
||||
je 3f
|
||||
mov %eax, %cr4
|
||||
movl wakeup_cr3 - wakeup_start(%ebx), %eax
|
||||
3: movl wakeup_cr3 - wakeup_start(%ebx), %eax
|
||||
mov %eax, %cr3
|
||||
|
||||
/* Get PCB and return address. */
|
||||
movl wakeup_ret - wakeup_start(%ebx), %edx
|
||||
movl wakeup_pcb - wakeup_start(%ebx), %ecx
|
||||
|
||||
/* Enable paging. */
|
||||
mov %cr0, %eax
|
||||
orl $CR0_PG, %eax
|
||||
@ -187,6 +197,9 @@ bootgdtdesc:
|
||||
.long bootgdt - wakeup_start /* Offset plus %ds << 4 */
|
||||
|
||||
ALIGN_DATA
|
||||
wakeup_efer:
|
||||
.long 0
|
||||
.long 0
|
||||
wakeup_cr4:
|
||||
.long 0
|
||||
wakeup_cr3:
|
||||
|
@ -885,9 +885,6 @@ options NKPT=31
|
||||
#####################################################################
|
||||
# ABI Emulation
|
||||
|
||||
# Emulate spx device for client side of SVR3 local X interface
|
||||
options SPX_HACK
|
||||
|
||||
# Enable (32-bit) a.out binary support
|
||||
options COMPAT_AOUT
|
||||
|
||||
|
@ -3247,7 +3247,7 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot)
|
||||
if ((prot & VM_PROT_WRITE) == 0)
|
||||
newpde &= ~(PG_RW | PG_M);
|
||||
#ifdef PMAP_PAE_COMP
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec)
|
||||
newpde |= pg_nx;
|
||||
#endif
|
||||
if (newpde != oldpde) {
|
||||
@ -3389,7 +3389,7 @@ __CONCAT(PMTYPE, protect)(pmap_t pmap, vm_offset_t sva, vm_offset_t eva,
|
||||
pbits &= ~(PG_RW | PG_M);
|
||||
}
|
||||
#ifdef PMAP_PAE_COMP
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec)
|
||||
pbits |= pg_nx;
|
||||
#endif
|
||||
|
||||
@ -3604,7 +3604,7 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
KASSERT((newpte & (PG_M | PG_RW)) != PG_M,
|
||||
("pmap_enter: flags includes VM_PROT_WRITE but prot doesn't"));
|
||||
#ifdef PMAP_PAE_COMP
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec)
|
||||
newpte |= pg_nx;
|
||||
#endif
|
||||
if ((flags & PMAP_ENTER_WIRED) != 0)
|
||||
@ -3841,7 +3841,7 @@ pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
|
||||
if ((m->oflags & VPO_UNMANAGED) == 0)
|
||||
newpde |= PG_MANAGED;
|
||||
#ifdef PMAP_PAE_COMP
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec)
|
||||
newpde |= pg_nx;
|
||||
#endif
|
||||
if (pmap != kernel_pmap)
|
||||
@ -4099,7 +4099,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
if ((m->oflags & VPO_UNMANAGED) == 0)
|
||||
newpte |= PG_MANAGED;
|
||||
#ifdef PMAP_PAE_COMP
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec)
|
||||
newpte |= pg_nx;
|
||||
#endif
|
||||
if (pmap != kernel_pmap)
|
||||
|
@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/cputypes.h>
|
||||
#include <machine/md_var.h>
|
||||
@ -136,7 +137,7 @@ int i386_pmap_PDRSHIFT;
|
||||
|
||||
int pat_works = 1;
|
||||
SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD,
|
||||
&pat_works, 1,
|
||||
&pat_works, 0,
|
||||
"Is page attribute table fully functional?");
|
||||
|
||||
int pg_ps_enabled = 1;
|
||||
@ -935,16 +936,19 @@ pmap_kremove(vm_offset_t va)
|
||||
|
||||
extern struct pmap_methods pmap_pae_methods, pmap_nopae_methods;
|
||||
int pae_mode;
|
||||
SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RD,
|
||||
&pae_mode, 1,
|
||||
SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
|
||||
&pae_mode, 0,
|
||||
"PAE");
|
||||
|
||||
void
|
||||
pmap_cold(void)
|
||||
{
|
||||
|
||||
if ((cpu_feature & CPUID_PAE) != 0) {
|
||||
pae_mode = 1;
|
||||
init_static_kenv((char *)bootinfo.bi_envp, 0);
|
||||
pae_mode = (cpu_feature & CPUID_PAE) != 0;
|
||||
if (pae_mode)
|
||||
TUNABLE_INT_FETCH("vm.pmap.pae_mode", &pae_mode);
|
||||
if (pae_mode) {
|
||||
pmap_methods_ptr = &pmap_pae_methods;
|
||||
pmap_pae_cold();
|
||||
} else {
|
||||
|
@ -130,13 +130,11 @@ SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
|
||||
nxstack, CTLFLAG_RW, &__elfN(nxstack), 0,
|
||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack");
|
||||
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#if defined(__amd64__)
|
||||
#if __ELF_WORD_SIZE == 32 && (defined(__amd64__) || defined(__i386__))
|
||||
int i386_read_exec = 0;
|
||||
SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0,
|
||||
"enable execution from readable segments");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
|
||||
|
||||
@ -2516,11 +2514,9 @@ __elfN(trans_prot)(Elf_Word flags)
|
||||
prot |= VM_PROT_WRITE;
|
||||
if (flags & PF_R)
|
||||
prot |= VM_PROT_READ;
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#if defined(__amd64__)
|
||||
#if __ELF_WORD_SIZE == 32 && (defined(__amd64__) || defined(__i386__))
|
||||
if (i386_read_exec && (flags & PF_R))
|
||||
prot |= VM_PROT_EXECUTE;
|
||||
#endif
|
||||
#endif
|
||||
return (prot);
|
||||
}
|
||||
|
@ -696,8 +696,10 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
else
|
||||
error = suword(--stack_base, imgp->args->argc) == 0 ?
|
||||
0 : EFAULT;
|
||||
if (error != 0)
|
||||
if (error != 0) {
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
goto exec_fail_dealloc;
|
||||
}
|
||||
|
||||
if (args->fdp != NULL) {
|
||||
/* Install a brand new file descriptor table. */
|
||||
|
@ -469,8 +469,8 @@ kcov_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag __unused,
|
||||
KASSERT(active_count > 0, ("%s: Open count is zero", __func__));
|
||||
active_count--;
|
||||
if (active_count == 0) {
|
||||
cov_register_pc(&trace_pc);
|
||||
cov_register_cmp(&trace_cmp);
|
||||
cov_unregister_pc();
|
||||
cov_unregister_cmp();
|
||||
}
|
||||
|
||||
td->td_kcov_info = NULL;
|
||||
@ -505,8 +505,8 @@ kcov_thread_dtor(void *arg __unused, struct thread *td)
|
||||
KASSERT(active_count > 0, ("%s: Open count is zero", __func__));
|
||||
active_count--;
|
||||
if (active_count == 0) {
|
||||
cov_register_pc(&trace_pc);
|
||||
cov_register_cmp(&trace_cmp);
|
||||
cov_unregister_pc();
|
||||
cov_unregister_cmp();
|
||||
}
|
||||
td->td_kcov_info = NULL;
|
||||
if (info->state != KCOV_STATE_DYING) {
|
||||
|
@ -410,6 +410,7 @@ namei(struct nameidata *ndp)
|
||||
dp = NULL;
|
||||
cnp->cn_nameptr = cnp->cn_pnbuf;
|
||||
if (cnp->cn_pnbuf[0] == '/') {
|
||||
ndp->ni_resflags |= NIRES_ABS;
|
||||
error = namei_handle_root(ndp, &dp);
|
||||
} else {
|
||||
if (ndp->ni_startdir != NULL) {
|
||||
@ -1302,6 +1303,7 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg,
|
||||
ndp->ni_dirp = namep;
|
||||
ndp->ni_dirfd = dirfd;
|
||||
ndp->ni_startdir = startdir;
|
||||
ndp->ni_resflags = 0;
|
||||
filecaps_init(&ndp->ni_filecaps);
|
||||
ndp->ni_cnd.cn_thread = td;
|
||||
if (rightsp != NULL)
|
||||
|
@ -3544,10 +3544,10 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd,
|
||||
goto out;
|
||||
}
|
||||
#ifdef CAPABILITIES
|
||||
if (newfd != AT_FDCWD) {
|
||||
if (newfd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) {
|
||||
/*
|
||||
* If the target already exists we require CAP_UNLINKAT
|
||||
* from 'newfd'.
|
||||
* from 'newfd', when newfd was used for the lookup.
|
||||
*/
|
||||
error = cap_check(&tond.ni_filecaps.fc_rights,
|
||||
&cap_unlinkat_rights);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD
|
||||
*
|
||||
* Copyright (c) 2013 M. Warner Losh. All Rights Reserved.
|
||||
* Copyright (c) 2013 M. Warner Losh.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -40,6 +40,7 @@ LINKS= \
|
||||
DTS= \
|
||||
allwinner/sun50i-a64-nanopi-a64.dts \
|
||||
allwinner/sun50i-a64-olinuxino.dts \
|
||||
allwinner/sun50i-a64-pine64-lts.dts \
|
||||
allwinner/sun50i-a64-pine64-plus.dts \
|
||||
allwinner/sun50i-a64-pine64.dts \
|
||||
allwinner/sun50i-a64-sopine-baseboard.dts \
|
||||
|
@ -2203,18 +2203,6 @@ ieee80211_ioctl_setregdomain(struct ieee80211vap *vap,
|
||||
return (error == 0 ? ENETRESET : error);
|
||||
}
|
||||
|
||||
static int
|
||||
ieee80211_ioctl_setroam(struct ieee80211vap *vap,
|
||||
const struct ieee80211req *ireq)
|
||||
{
|
||||
if (ireq->i_len != sizeof(vap->iv_roamparms))
|
||||
return EINVAL;
|
||||
/* XXX validate params */
|
||||
/* XXX? ENETRESET to push to device? */
|
||||
return copyin(ireq->i_data, vap->iv_roamparms,
|
||||
sizeof(vap->iv_roamparms));
|
||||
}
|
||||
|
||||
static int
|
||||
checkrate(const struct ieee80211_rateset *rs, int rate)
|
||||
{
|
||||
@ -2244,6 +2232,73 @@ checkmcs(const struct ieee80211_htrateset *rs, int mcs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ieee80211_ioctl_setroam(struct ieee80211vap *vap,
|
||||
const struct ieee80211req *ireq)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
struct ieee80211_roamparams_req *parms;
|
||||
struct ieee80211_roamparam *src, *dst;
|
||||
const struct ieee80211_htrateset *rs_ht;
|
||||
const struct ieee80211_rateset *rs;
|
||||
int changed, error, mode, is11n, nmodes;
|
||||
|
||||
if (ireq->i_len != sizeof(vap->iv_roamparms))
|
||||
return EINVAL;
|
||||
|
||||
parms = IEEE80211_MALLOC(sizeof(*parms), M_TEMP,
|
||||
IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
|
||||
if (parms == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
error = copyin(ireq->i_data, parms, ireq->i_len);
|
||||
if (error != 0)
|
||||
goto fail;
|
||||
|
||||
changed = 0;
|
||||
nmodes = IEEE80211_MODE_MAX;
|
||||
|
||||
/* validate parameters and check if anything changed */
|
||||
for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) {
|
||||
if (isclr(ic->ic_modecaps, mode))
|
||||
continue;
|
||||
src = &parms->params[mode];
|
||||
dst = &vap->iv_roamparms[mode];
|
||||
rs = &ic->ic_sup_rates[mode]; /* NB: 11n maps to legacy */
|
||||
rs_ht = &ic->ic_sup_htrates;
|
||||
is11n = (mode == IEEE80211_MODE_11NA ||
|
||||
mode == IEEE80211_MODE_11NG);
|
||||
/* XXX TODO: 11ac */
|
||||
if (src->rate != dst->rate) {
|
||||
if (!checkrate(rs, src->rate) &&
|
||||
(!is11n || !checkmcs(rs_ht, src->rate))) {
|
||||
error = EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
changed++;
|
||||
}
|
||||
if (src->rssi != dst->rssi)
|
||||
changed++;
|
||||
}
|
||||
if (changed) {
|
||||
/*
|
||||
* Copy new parameters in place and notify the
|
||||
* driver so it can push state to the device.
|
||||
*/
|
||||
/* XXX locking? */
|
||||
for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) {
|
||||
if (isset(ic->ic_modecaps, mode))
|
||||
vap->iv_roamparms[mode] = parms->params[mode];
|
||||
}
|
||||
|
||||
if (vap->iv_roaming == IEEE80211_ROAMING_DEVICE)
|
||||
error = ERESTART;
|
||||
}
|
||||
|
||||
fail: IEEE80211_FREE(parms, M_TEMP);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
ieee80211_ioctl_settxparams(struct ieee80211vap *vap,
|
||||
const struct ieee80211req *ireq)
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include <sys/rmlock.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/libkern.h>
|
||||
|
||||
@ -92,6 +93,13 @@ static MALLOC_DEFINE(M_NETGRAPH_IFACE, "netgraph_iface", "netgraph iface node");
|
||||
#define M_NETGRAPH_IFACE M_NETGRAPH
|
||||
#endif
|
||||
|
||||
static SYSCTL_NODE(_net_graph, OID_AUTO, iface, CTLFLAG_RW, 0,
|
||||
"Point to point netgraph interface");
|
||||
VNET_DEFINE_STATIC(int, ng_iface_max_nest) = 2;
|
||||
#define V_ng_iface_max_nest VNET(ng_iface_max_nest)
|
||||
SYSCTL_INT(_net_graph_iface, OID_AUTO, max_nesting, CTLFLAG_VNET | CTLFLAG_RW,
|
||||
&VNET_NAME(ng_iface_max_nest), 0, "Max nested tunnels");
|
||||
|
||||
/* This struct describes one address family */
|
||||
struct iffam {
|
||||
sa_family_t family; /* Address family */
|
||||
@ -355,7 +363,8 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m,
|
||||
}
|
||||
|
||||
/* Protect from deadly infinite recursion. */
|
||||
error = if_tunnel_check_nesting(ifp, m, NGM_IFACE_COOKIE, 1);
|
||||
error = if_tunnel_check_nesting(ifp, m, NGM_IFACE_COOKIE,
|
||||
V_ng_iface_max_nest);
|
||||
if (error) {
|
||||
m_freem(m);
|
||||
return (error);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user