aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-02-10 12:49:34 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-02-10 12:49:34 +0000
commit9e43c218d58856c03565dcbd6377985fe8fcc393 (patch)
treefaf32453a0f702d690f0c92c6984dd3af5a1988e
parentc232a6c2f7c4ebc0ff9d009b30c98ef19ccce316 (diff)
parent6cf360772f9dd37a798bc768cbcc8d496be7ff35 (diff)
Merge ^/head r343807 through r343955.
Notes
Notes: svn path=/projects/clang800-import/; revision=343956
-rw-r--r--UPDATING2
-rw-r--r--contrib/netbsd-tests/lib/libm/t_cbrt.c3
-rw-r--r--etc/mtree/BSD.root.dist4
-rw-r--r--lib/libc/stdio/fgetln.c10
-rw-r--r--lib/libc/sys/getsockopt.217
-rw-r--r--lib/libc/x86/sys/__vdso_gettc.c78
-rw-r--r--lib/libcasper/services/cap_syslog/cap_syslog.c29
-rw-r--r--lib/libutil/quotafile.c19
-rw-r--r--lib/msun/src/e_j0.c6
-rw-r--r--lib/msun/src/e_j0f.c6
-rw-r--r--lib/msun/src/e_j1.c6
-rw-r--r--lib/msun/src/e_j1f.c6
-rw-r--r--lib/msun/src/e_jn.c22
-rw-r--r--lib/msun/tests/trig_test.c3
-rwxr-xr-xlibexec/rc/rc.d/growfs24
-rw-r--r--libexec/talkd/extern.h2
-rw-r--r--sbin/dhclient/dhclient.c3
-rw-r--r--sbin/ipfw/tables.c10
-rw-r--r--sbin/recoverdisk/recoverdisk.c1
-rw-r--r--sbin/sysctl/sysctl.86
-rw-r--r--share/man/man4/ng_iface.414
-rw-r--r--share/man/man9/bus_space.93
-rw-r--r--share/man/man9/config_intrhook.92
-rw-r--r--share/man/man9/pwm.94
-rw-r--r--share/misc/bsd-family-tree5
-rw-r--r--share/misc/committers-ports.dot5
-rw-r--r--share/misc/committers-src.dot2
-rw-r--r--share/mk/bsd.cpu.mk4
-rw-r--r--share/mk/src.opts.mk1
-rw-r--r--share/mk/suite.test.mk2
-rw-r--r--stand/efi/libefi/efienv.c2
-rw-r--r--sys/amd64/conf/GENERIC4
-rw-r--r--sys/amd64/conf/NOTES3
-rw-r--r--sys/arm/allwinner/axp81x.c150
-rw-r--r--sys/arm64/acpica/acpi_iort.c502
-rw-r--r--sys/arm64/arm64/cpufunc_asm.S1
-rw-r--r--sys/arm64/arm64/gic_v3_acpi.c11
-rw-r--r--sys/arm64/arm64/gic_v3_var.h1
-rw-r--r--sys/arm64/arm64/gicv3_its.c7
-rw-r--r--sys/arm64/arm64/pmap.c3
-rw-r--r--sys/arm64/conf/GENERIC6
-rw-r--r--sys/cam/ata/ata_da.c13
-rw-r--r--sys/cam/scsi/scsi_da.c13
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c3
-rw-r--r--sys/conf/files.arm6432
-rw-r--r--sys/conf/options1
-rw-r--r--sys/ddb/db_ps.c1
-rw-r--r--sys/dev/acpica/acpivar.h7
-rw-r--r--sys/dev/cardbus/cardbus.c3
-rw-r--r--sys/dev/cxgbe/adapter.h2
-rw-r--r--sys/dev/cxgbe/common/t4_hw.c20
-rw-r--r--sys/dev/cxgbe/t4_main.c223
-rw-r--r--sys/dev/cxgbe/t4_vf.c1
-rw-r--r--sys/dev/e1000/if_em.c107
-rw-r--r--sys/dev/e1000/if_em.h4
-rw-r--r--sys/dev/flash/mx25l.c2
-rw-r--r--sys/dev/flash/n25q.c2
-rw-r--r--sys/dev/iwn/if_iwn.c16
-rw-r--r--sys/dev/mmc/bridge.h2
-rw-r--r--sys/dev/mmc/mmc.c2
-rw-r--r--sys/dev/mmc/mmc_private.h2
-rw-r--r--sys/dev/mmc/mmc_subr.c2
-rw-r--r--sys/dev/mmc/mmc_subr.h2
-rw-r--r--sys/dev/mmc/mmcbrvar.h2
-rw-r--r--sys/dev/mmc/mmcreg.h2
-rw-r--r--sys/dev/mmc/mmcsd.c2
-rw-r--r--sys/dev/mmc/mmcvar.h2
-rw-r--r--sys/dev/netmap/netmap.c3
-rw-r--r--sys/dev/pccbb/pccbbdevid.h2
-rw-r--r--sys/dev/pci/pci_host_generic_acpi.c62
-rw-r--r--sys/dev/pms/freebsd/driver/common/lxutil.c2
-rw-r--r--sys/dev/puc/puc_pci.c2
-rw-r--r--sys/dev/sio/sio_isa.c2
-rw-r--r--sys/dev/sio/sio_pccard.c2
-rw-r--r--sys/dev/sio/sio_pci.c2
-rw-r--r--sys/dev/sio/sio_puc.c2
-rw-r--r--sys/dev/uart/uart_bus_acpi.c2
-rw-r--r--sys/dev/uart/uart_bus_pccard.c2
-rw-r--r--sys/dev/uart/uart_bus_puc.c2
-rw-r--r--sys/dev/usb/controller/generic_ohci.c5
-rw-r--r--sys/dev/usb/controller/ohci_s3c24x0.c214
-rw-r--r--sys/dev/usb/net/if_ure.c1
-rw-r--r--sys/dev/usb/usbdevs1
-rw-r--r--sys/dev/wi/if_wivar.h3
-rw-r--r--sys/dts/arm/tegra124-jetson-tk1-fbsd.dts2
-rw-r--r--sys/fs/nullfs/null_vfsops.c26
-rw-r--r--sys/fs/nullfs/null_vnops.c8
-rw-r--r--sys/i386/acpica/acpi_wakecode.S27
-rw-r--r--sys/i386/conf/NOTES3
-rw-r--r--sys/i386/i386/pmap.c10
-rw-r--r--sys/i386/i386/pmap_base.c14
-rw-r--r--sys/kern/imgact_elf.c8
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_kcov.c8
-rw-r--r--sys/kern/vfs_lookup.c2
-rw-r--r--sys/kern/vfs_syscalls.c4
-rw-r--r--sys/mips/include/elf.h2
-rw-r--r--sys/modules/dtb/allwinner/Makefile1
-rw-r--r--sys/net80211/ieee80211_ioctl.c79
-rw-r--r--sys/netgraph/ng_iface.c11
-rw-r--r--sys/netgraph/ng_ipfw.c3
-rw-r--r--sys/netinet/cc/cc_cdg.c6
-rw-r--r--sys/netinet/sctp_usrreq.c7
-rw-r--r--sys/powerpc/include/openpicvar.h3
-rw-r--r--sys/powerpc/ofw/openpic_ofw.c5
-rw-r--r--sys/powerpc/powerpc/cpu.c33
-rw-r--r--sys/powerpc/powerpc/mem.c8
-rw-r--r--sys/powerpc/powerpc/openpic.c20
-rw-r--r--sys/riscv/riscv/elf_machdep.c2
-rw-r--r--sys/sys/namei.h9
-rw-r--r--sys/sys/sysent.h4
-rw-r--r--sys/vm/uma_core.c98
-rw-r--r--sys/vm/uma_int.h3
-rw-r--r--sys/vm/vm_kern.c6
-rw-r--r--sys/vm/vm_mmap.c7
-rw-r--r--sys/vm/vm_unix.c7
-rw-r--r--sys/x86/acpica/acpi_wakeup.c10
-rw-r--r--sys/x86/include/x86_var.h1
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc5
-rw-r--r--tools/build/options/WITH_CLANG_EXTRAS3
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd2
-rw-r--r--usr.bin/ipcs/ipcs.c27
-rw-r--r--usr.bin/newkey/update.c16
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.c16
-rw-r--r--usr.sbin/bluetooth/sdpd/ssar.c128
-rw-r--r--usr.sbin/dumpcis/main.c2
-rw-r--r--usr.sbin/newsyslog/newsyslog.c22
-rw-r--r--usr.sbin/pw/pw.88
-rw-r--r--usr.sbin/pwm/pwm.822
129 files changed, 1699 insertions, 759 deletions
diff --git a/UPDATING b/UPDATING
index bb1ab7ece48e..8c09eeeb26bc 100644
--- a/UPDATING
+++ b/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
diff --git a/contrib/netbsd-tests/lib/libm/t_cbrt.c b/contrib/netbsd-tests/lib/libm/t_cbrt.c
index 230ffb5a8065..d2cdd47a5beb 100644
--- a/contrib/netbsd-tests/lib/libm/t_cbrt.c
+++ b/contrib/netbsd-tests/lib/libm/t_cbrt.c
@@ -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
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
index e061bfb060be..c154a2fbcf86 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -11,8 +11,12 @@
defaults
..
dtb
+ allwinner tags=package=runtime
+ ..
overlays tags=package=runtime
..
+ rockchip tags=package=runtime
+ ..
..
firmware
..
diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c
index ba0736cbb0fc..f3e4a6874a4b 100644
--- a/lib/libc/stdio/fgetln.c
+++ b/lib/libc/stdio/fgetln.c
@@ -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();
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index 5dae6a6833dd..942346cdd728 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -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 ,
diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c
index ef2ca69edf7a..3a56b4af7bd9 100644
--- a/lib/libc/x86/sys/__vdso_gettc.c
+++ b/lib/libc/x86/sys/__vdso_gettc.c
@@ -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)
{
- u_int p[4];
- static const char intel_id[] = "GenuntelineI";
- cpuidp(0, p);
- return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ?
- LMB_LFENCE : LMB_MFENCE);
+ lfence();
}
static void
-init_fence(void)
+rdtsc_mb_mfence(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
+ mfence();
}
static void
-rdtsc_mb(void)
+rdtsc_mb_none(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;
+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 ?
+ rdtsc_mb_lfence : rdtsc_mb_mfence);
}
static u_int
diff --git a/lib/libcasper/services/cap_syslog/cap_syslog.c b/lib/libcasper/services/cap_syslog/cap_syslog.c
index 8309056bb160..6f8f7c0de8a2 100644
--- a/lib/libcasper/services/cap_syslog/cap_syslog.c
+++ b/lib/libcasper/services/cap_syslog/cap_syslog.c
@@ -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);
diff --git a/lib/libutil/quotafile.c b/lib/libutil/quotafile.c
index b460c5d1453e..84b4d0d351bc 100644
--- a/lib/libutil/quotafile.c
+++ b/lib/libutil/quotafile.c
@@ -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;
}
diff --git a/lib/msun/src/e_j0.c b/lib/msun/src/e_j0.c
index 184586aa8746..5d862b6f834d 100644
--- a/lib/msun/src/e_j0.c
+++ b/lib/msun/src/e_j0.c
@@ -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;
/*
diff --git a/lib/msun/src/e_j0f.c b/lib/msun/src/e_j0f.c
index c4bf9e6e6dbf..1c5ef4da1b49 100644
--- a/lib/msun/src/e_j0f.c
+++ b/lib/msun/src/e_j0f.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;
/*
diff --git a/lib/msun/src/e_j1.c b/lib/msun/src/e_j1.c
index ca10f92b2822..fb4462738368 100644
--- a/lib/msun/src/e_j1.c
+++ b/lib/msun/src/e_j1.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 */
diff --git a/lib/msun/src/e_j1f.c b/lib/msun/src/e_j1f.c
index 5265ec4c0adb..c6c45c107afa 100644
--- a/lib/msun/src/e_j1f.c
+++ b/lib/msun/src/e_j1f.c
@@ -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 */
diff --git a/lib/msun/src/e_jn.c b/lib/msun/src/e_jn.c
index 907b3d184b86..c7ba7da6567b 100644
--- a/lib/msun/src/e_jn.c
+++ b/lib/msun/src/e_jn.c
@@ -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 {
diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c
index 204c0d07f25f..483a5e187d50 100644
--- a/lib/msun/tests/trig_test.c
+++ b/lib/msun/tests/trig_test.c
@@ -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
diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs
index 9b69eb6b3520..98f1d9b649c1 100755
--- a/libexec/rc/rc.d/growfs
+++ b/libexec/rc/rc.d/growfs
@@ -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
diff --git a/libexec/talkd/extern.h b/libexec/talkd/extern.h
index 5c1f9bdea0e7..3314ebbbbfde 100644
--- a/libexec/talkd/extern.h
+++ b/libexec/talkd/extern.h
@@ -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
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index b903f13597d0..c65ff81b5cfc 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -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
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c
index 0c3f38060965..3fa806348a27 100644
--- a/sbin/ipfw/tables.c
+++ b/sbin/ipfw/tables.c
@@ -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);
diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c
index aef0bdd5717b..0487532cbb01 100644
--- a/sbin/recoverdisk/recoverdisk.c
+++ b/sbin/recoverdisk/recoverdisk.c
@@ -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
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index 35a2cc941748..55209ac33392 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -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
diff --git a/share/man/man4/ng_iface.4 b/share/man/man4/ng_iface.4
index 67d67f8956a7..0b406cdd298f 100644
--- a/share/man/man4/ng_iface.4
+++ b/share/man/man4/ng_iface.4
@@ -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
diff --git a/share/man/man9/bus_space.9 b/share/man/man9/bus_space.9
index 70f4c6a40c4a..5b43a97e98da 100644
--- a/share/man/man9/bus_space.9
+++ b/share/man/man9/bus_space.9
@@ -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:
diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9
index c92136fa076f..581f1728f8c3 100644
--- a/share/man/man9/config_intrhook.9
+++ b/share/man/man9/config_intrhook.9
@@ -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
diff --git a/share/man/man9/pwm.9 b/share/man/man9/pwm.9
index bad9301eed14..f7564a4eeca3 100644
--- a/share/man/man9/pwm.9
+++ b/share/man/man9/pwm.9
@@ -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
diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree
index 4f87fde3a302..4d4f24519fd7 100644
--- a/share/misc/bsd-family-tree
+++ b/share/misc/bsd-family-tree
@@ -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]
diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot
index 99b6f3ba3b2a..e547dfc08c95 100644
--- a/share/misc/committers-ports.dot
+++ b/share/misc/committers-ports.dot
@@ -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
diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot
index 438555fbc039..6dbbb6477198 100644
--- a/share/misc/committers-src.dot
+++ b/share/misc/committers-src.dot
@@ -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
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index 5d0e69458b4c..793f4870a50d 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -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"
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index be1d4efb8dde..96d28b6cc521 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -83,7 +83,6 @@ __DEFAULT_YES_OPTIONS = \
CPP \
CROSS_COMPILER \
CRYPT \
- CTM \
CUSE \
CXX \
CXGBETOOL \
diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk
index 5639691df721..d91d3df757d8 100644
--- a/share/mk/suite.test.mk
+++ b/share/mk/suite.test.mk
@@ -120,5 +120,7 @@ beforecheck:
# etc.
aftercheck:
@cd ${.CURDIR} && ${MAKE} clean
+ @chflags -R 0 "${DESTDIR}"
+ @rm -Rf "${DESTDIR}"
.endif
diff --git a/stand/efi/libefi/efienv.c b/stand/efi/libefi/efienv.c
index 06c54f80bc3c..55a2520e9dba 100644
--- a/stand/efi/libefi/efienv.c
+++ b/stand/efi/libefi/efienv.c
@@ -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);
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index ef7b1a0660ff..9a8532ba6f03 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -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
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index c6a538de8307..eb4234510f3f 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -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
diff --git a/sys/arm/allwinner/axp81x.c b/sys/arm/allwinner/axp81x.c
index 3f29223c8b9e..7bfe1a5398ec 100644
--- a/sys/arm/allwinner/axp81x.c
+++ b/sys/arm/allwinner/axp81x.c
@@ -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 */
diff --git a/sys/arm64/acpica/acpi_iort.c b/sys/arm64/acpica/acpi_iort.c
new file mode 100644
index 000000000000..edd87474c9c9
--- /dev/null
+++ b/sys/arm64/acpica/acpi_iort.c
@@ -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);
+}
diff --git a/sys/arm64/arm64/cpufunc_asm.S b/sys/arm64/arm64/cpufunc_asm.S
index db648cbd0085..7cc8c0fdd2c1 100644
--- a/sys/arm64/arm64/cpufunc_asm.S
+++ b/sys/arm64/arm64/cpufunc_asm.S
@@ -96,6 +96,7 @@ ENTRY(arm64_setttb)
END(arm64_setttb)
ENTRY(arm64_tlb_flushID)
+ dsb ishst
#ifdef SMP
tlbi vmalle1is
#else
diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c
index b4c096e8ee96..ff22086be928 100644
--- a/sys/arm64/arm64/gic_v3_acpi.c
+++ b/sys/arm64/arm64/gic_v3_acpi.c
@@ -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);
}
diff --git a/sys/arm64/arm64/gic_v3_var.h b/sys/arm64/arm64/gic_v3_var.h
index 7d62bebdbce5..085487055230 100644
--- a/sys/arm64/arm64/gic_v3_var.h
+++ b/sys/arm64/arm64/gic_v3_var.h
@@ -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)
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index 3ccf37333b08..a93ba5432177 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -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);
}
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 3c8bf9b48b1b..6b41dfd59f60 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -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 @@ validate:
} 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",
diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC
index a5e182ea6682..2c9e202ab1e1 100644
--- a/sys/arm64/conf/GENERIC
+++ b/sys/arm64/conf/GENERIC
@@ -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
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index d6fcdeddc5f6..200b855a0e59 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -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,
@@ -277,6 +279,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*", "*" },
/*quirks*/ADA_Q_4K
@@ -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;
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index c8be3a01f851..d7c6b30fca93 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -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,
@@ -871,6 +873,11 @@ static struct da_quirk_entry da_quirk_table[] =
},
/* 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*", "*" },
/*quirks*/DA_Q_4K
@@ -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;
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index d596eb4d6acf..c42d32e39d07 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -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>
diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index d5a338ff84a9..25eaa0ddbc6a 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -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
diff --git a/sys/conf/options b/sys/conf/options
index 235226e8fdd1..a602ff5b05a6 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -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
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 2c7c205785bf..64f8075e8061 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -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);
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index cf347faf35e1..a4e79fde9978 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -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_ */
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index ae877223ec20..21ff58c9262b 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -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:
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index e7a890af69d7..a6f723fb4f08 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -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 */
diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c
index 15b04194cc20..39c2aae63573 100644
--- a/sys/dev/cxgbe/common/t4_hw.c
+++ b/sys/dev/cxgbe/common/t4_hw.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" },
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 64f995bd842f..999033b518e1 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -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 @@ done:
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,15 +7320,79 @@ 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)
{
struct adapter *sc = arg1;
@@ -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,15 +7706,52 @@ 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)
{
struct adapter *sc = arg1;
@@ -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);
diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c
index 9ca96614904a..4d4f3736b88e 100644
--- a/sys/dev/cxgbe/t4_vf.c
+++ b/sys/dev/cxgbe/t4_vf.c
@@ -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);
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 12c431c7ec14..d41d8aa30512 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -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 @@ err_late:
*
* 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");
diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h
index f12fda8db759..bfc1b3f2a118 100644
--- a/sys/dev/e1000/if_em.h
+++ b/sys/dev/e1000/if_em.h
@@ -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;
diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c
index 960f93948e7f..6110c4082635 100644
--- a/sys/dev/flash/mx25l.c
+++ b/sys/dev/flash/mx25l.c
@@ -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.
*
diff --git a/sys/dev/flash/n25q.c b/sys/dev/flash/n25q.c
index 3ec4b12be954..428e998f41a5 100644
--- a/sys/dev/flash/n25q.c
+++ b/sys/dev/flash/n25q.c
@@ -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.
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index e1e521ecf677..0de12f049938 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -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:
diff --git a/sys/dev/mmc/bridge.h b/sys/dev/mmc/bridge.h
index 7af811f17662..d32abbacedb9 100644
--- a/sys/dev/mmc/bridge.h
+++ b/sys/dev/mmc/bridge.h
@@ -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
diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index 3519f1b0ed3a..4b77fc48c482 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -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
diff --git a/sys/dev/mmc/mmc_private.h b/sys/dev/mmc/mmc_private.h
index 633d0784d968..a633d2355504 100644
--- a/sys/dev/mmc/mmc_private.h
+++ b/sys/dev/mmc/mmc_private.h
@@ -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
diff --git a/sys/dev/mmc/mmc_subr.c b/sys/dev/mmc/mmc_subr.c
index 7945342a8afc..6469e76c6614 100644
--- a/sys/dev/mmc/mmc_subr.c
+++ b/sys/dev/mmc/mmc_subr.c
@@ -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
diff --git a/sys/dev/mmc/mmc_subr.h b/sys/dev/mmc/mmc_subr.h
index 33ea6760ec20..80c1ce2fad25 100644
--- a/sys/dev/mmc/mmc_subr.h
+++ b/sys/dev/mmc/mmc_subr.h
@@ -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
diff --git a/sys/dev/mmc/mmcbrvar.h b/sys/dev/mmc/mmcbrvar.h
index 7b0bc4739863..b05c029dff9f 100644
--- a/sys/dev/mmc/mmcbrvar.h
+++ b/sys/dev/mmc/mmcbrvar.h
@@ -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
diff --git a/sys/dev/mmc/mmcreg.h b/sys/dev/mmc/mmcreg.h
index 30d5abef1d89..bc71777ee701 100644
--- a/sys/dev/mmc/mmcreg.h
+++ b/sys/dev/mmc/mmcreg.h
@@ -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>
*
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c
index 9f439eeee195..0fda80f1d391 100644
--- a/sys/dev/mmc/mmcsd.c
+++ b/sys/dev/mmc/mmcsd.c
@@ -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
diff --git a/sys/dev/mmc/mmcvar.h b/sys/dev/mmc/mmcvar.h
index 1604c3060a2a..8d8c5547f3cd 100644
--- a/sys/dev/mmc/mmcvar.h
+++ b/sys/dev/mmc/mmcvar.h
@@ -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
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index 993c63da06c2..be7e636ae04c 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -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;
diff --git a/sys/dev/pccbb/pccbbdevid.h b/sys/dev/pccbb/pccbbdevid.h
index cc1aa3ffe7c8..77b9d363dc4d 100644
--- a/sys/dev/pccbb/pccbbdevid.h
+++ b/sys/dev/pccbb/pccbbdevid.h
@@ -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
diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c
index 785185e451a6..fa1bf4e6efc1 100644
--- a/sys/dev/pci/pci_host_generic_acpi.c
+++ b/sys/dev/pci/pci_host_generic_acpi.c
@@ -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));
}
diff --git a/sys/dev/pms/freebsd/driver/common/lxutil.c b/sys/dev/pms/freebsd/driver/common/lxutil.c
index 365ba5ae4116..ceafe98084e3 100644
--- a/sys/dev/pms/freebsd/driver/common/lxutil.c
+++ b/sys/dev/pms/freebsd/driver/common/lxutil.c
@@ -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
diff --git a/sys/dev/puc/puc_pci.c b/sys/dev/puc/puc_pci.c
index 012a16dc9e9b..0fbd5d7214d5 100644
--- a/sys/dev/puc/puc_pci.c
+++ b/sys/dev/puc/puc_pci.c
@@ -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
diff --git a/sys/dev/sio/sio_isa.c b/sys/dev/sio/sio_isa.c
index bef2a9ab9fa8..04fe5b4a6e48 100644
--- a/sys/dev/sio/sio_isa.c
+++ b/sys/dev/sio/sio_isa.c
@@ -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
diff --git a/sys/dev/sio/sio_pccard.c b/sys/dev/sio/sio_pccard.c
index 0abaa46eb51e..dbf4443e4be7 100644
--- a/sys/dev/sio/sio_pccard.c
+++ b/sys/dev/sio/sio_pccard.c
@@ -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
diff --git a/sys/dev/sio/sio_pci.c b/sys/dev/sio/sio_pci.c
index c3223a2d6f19..cd2e03e28966 100644
--- a/sys/dev/sio/sio_pci.c
+++ b/sys/dev/sio/sio_pci.c
@@ -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
diff --git a/sys/dev/sio/sio_puc.c b/sys/dev/sio/sio_puc.c
index 60b45f61e19d..ee6bb59b5591 100644
--- a/sys/dev/sio/sio_puc.c
+++ b/sys/dev/sio/sio_puc.c
@@ -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
diff --git a/sys/dev/uart/uart_bus_acpi.c b/sys/dev/uart/uart_bus_acpi.c
index a711c0c6a675..32eb3accd92b 100644
--- a/sys/dev/uart/uart_bus_acpi.c
+++ b/sys/dev/uart/uart_bus_acpi.c
@@ -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
diff --git a/sys/dev/uart/uart_bus_pccard.c b/sys/dev/uart/uart_bus_pccard.c
index 8b672ebeadb0..240cab869187 100644
--- a/sys/dev/uart/uart_bus_pccard.c
+++ b/sys/dev/uart/uart_bus_pccard.c
@@ -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
diff --git a/sys/dev/uart/uart_bus_puc.c b/sys/dev/uart/uart_bus_puc.c
index a90e01628f40..c6c7a705774d 100644
--- a/sys/dev/uart/uart_bus_puc.c
+++ b/sys/dev/uart/uart_bus_puc.c
@@ -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
diff --git a/sys/dev/usb/controller/generic_ohci.c b/sys/dev/usb/controller/generic_ohci.c
index abf20c79ea6b..b4aa2cb16716 100644
--- a/sys/dev/usb/controller/generic_ohci.c
+++ b/sys/dev/usb/controller/generic_ohci.c
@@ -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
diff --git a/sys/dev/usb/controller/ohci_s3c24x0.c b/sys/dev/usb/controller/ohci_s3c24x0.c
deleted file mode 100644
index 6255ae19df17..000000000000
--- a/sys/dev/usb/controller/ohci_s3c24x0.c
+++ /dev/null
@@ -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);
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index d0cd85bb6aaf..5608f8cd9463 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -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),
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index 73f03cd03319..6a669e83c643 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -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
diff --git a/sys/dev/wi/if_wivar.h b/sys/dev/wi/if_wivar.h
index ce9a07ad61f2..a97b0abe066e 100644
--- a/sys/dev/wi/if_wivar.h
+++ b/sys/dev/wi/if_wivar.h
@@ -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.
*
diff --git a/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts b/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts
index beed05d9b971..35bf3300a719 100644
--- a/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts
+++ b/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts
@@ -38,7 +38,7 @@
stdout = &uartd;
};
- memory {
+ memory@80000000 {
/* reg = <0x0 0x80000000 0x0 0x80000000>; */
reg = <0x0 0x80000000 0x0 0x70000000>;
};
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 8ea7b07575bf..fdb5e9e7e7e0 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -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),
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 2c7631d88ec3..b4f185956541 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -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);
}
diff --git a/sys/i386/acpica/acpi_wakecode.S b/sys/i386/acpica/acpi_wakecode.S
index 04799d5f5a06..682dadbf359f 100644
--- a/sys/i386/acpica/acpi_wakecode.S
+++ b/sys/i386/acpica/acpi_wakecode.S
@@ -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:
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 8ae4d95d45fb..a1fc6eb310b3 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -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
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 94e013723bb3..a77605efa44b 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -3247,7 +3247,7 @@ retry:
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 @@ retry:
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)
diff --git a/sys/i386/i386/pmap_base.c b/sys/i386/i386/pmap_base.c
index 5d1a5b06da9d..299ec9961f4c 100644
--- a/sys/i386/i386/pmap_base.c
+++ b/sys/i386/i386/pmap_base.c
@@ -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 {
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 0d946886fbe7..06d2e60c40c5 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -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,12 +2514,10 @@ __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);
}
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 0c916b07bed2..29d16e5706ea 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -696,8 +696,10 @@ interpret:
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. */
diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c
index d2631a687f13..84949a7296bd 100644
--- a/sys/kern/kern_kcov.c
+++ b/sys/kern/kern_kcov.c
@@ -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) {
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index d3679be42b83..9f336748fbdb 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -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)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index b19dd67b5cca..ef01081601f2 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3544,10 +3544,10 @@ again:
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);
diff --git a/sys/mips/include/elf.h b/sys/mips/include/elf.h
index fcc0c2546b6c..b019df7061e5 100644
--- a/sys/mips/include/elf.h
+++ b/sys/mips/include/elf.h
@@ -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
diff --git a/sys/modules/dtb/allwinner/Makefile b/sys/modules/dtb/allwinner/Makefile
index ee268a665ce2..72324cfcefcb 100644
--- a/sys/modules/dtb/allwinner/Makefile
+++ b/sys/modules/dtb/allwinner/Makefile
@@ -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 \
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 2b7e3dd7414b..6ef5f9fb2b75 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -2204,18 +2204,6 @@ ieee80211_ioctl_setregdomain(struct ieee80211vap *vap,
}
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)
{
int i;
@@ -2245,6 +2233,73 @@ checkmcs(const struct ieee80211_htrateset *rs, int mcs)
}
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)
{
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index 7f3b8b16c0a4..f1ddce70c86d 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -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);
diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c
index 63de133b9495..c7d24c8d4f4a 100644
--- a/sys/netgraph/ng_ipfw.c
+++ b/sys/netgraph/ng_ipfw.c
@@ -288,7 +288,6 @@ static int
ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee)
{
struct mbuf *m;
- struct ip *ip;
hook_p hook;
int error = 0;
@@ -330,8 +329,6 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee)
(m = m_pullup(m, sizeof(struct ip))) == NULL)
return (EINVAL);
- ip = mtod(m, struct ip *);
-
NG_SEND_DATA_ONLY(error, hook, m);
return (error);
diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c
index a232aeb2b3f6..44c566f73dbf 100644
--- a/sys/netinet/cc/cc_cdg.c
+++ b/sys/netinet/cc/cc_cdg.c
@@ -592,7 +592,11 @@ cdg_ack_received(struct cc_var *ccv, uint16_t ack_type)
qdiff_min = ((long)(cdg_data->minrtt_in_rtt -
cdg_data->minrtt_in_prevrtt) << D_P_E );
- calc_moving_average(cdg_data, qdiff_max, qdiff_min);
+ if (cdg_data->sample_q_size == 0) {
+ cdg_data->max_qtrend = qdiff_max;
+ cdg_data->min_qtrend = qdiff_min;
+ } else
+ calc_moving_average(cdg_data, qdiff_max, qdiff_min);
/* Probabilistic backoff with respect to gradient. */
if (slowstart && qdiff_min > 0)
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 27863c60e91e..433d02a08985 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -6115,6 +6115,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_INP_RUNLOCK(inp);
}
}
+ } else {
+ if (stcb) {
+ SCTP_TCB_UNLOCK(stcb);
+ }
}
break;
}
@@ -6209,6 +6213,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
if (info->pr_policy > SCTP_PR_SCTP_MAX) {
+ if (stcb) {
+ SCTP_TCB_UNLOCK(stcb);
+ }
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
break;
diff --git a/sys/powerpc/include/openpicvar.h b/sys/powerpc/include/openpicvar.h
index 36b2c93342fa..52e25d7f7cc6 100644
--- a/sys/powerpc/include/openpicvar.h
+++ b/sys/powerpc/include/openpicvar.h
@@ -34,6 +34,8 @@
#define OPENPIC_IRQMAX 256 /* h/w allows more */
+#define OPENPIC_QUIRK_SINGLE_BIND 1 /* Bind interrupts to only 1 CPU */
+
/* Names match the macros in openpicreg.h. */
struct openpic_timer {
uint32_t tcnt;
@@ -55,6 +57,7 @@ struct openpic_softc {
u_int sc_ncpu;
u_int sc_nirq;
int sc_psim;
+ u_int sc_quirks;
/* Saved states. */
uint32_t sc_saved_config;
diff --git a/sys/powerpc/ofw/openpic_ofw.c b/sys/powerpc/ofw/openpic_ofw.c
index 6a66c8dce00b..ad550051c5bf 100644
--- a/sys/powerpc/ofw/openpic_ofw.c
+++ b/sys/powerpc/ofw/openpic_ofw.c
@@ -128,14 +128,19 @@ openpic_ofw_probe(device_t dev)
static int
openpic_ofw_attach(device_t dev)
{
+ struct openpic_softc *sc;
phandle_t xref, node;
node = ofw_bus_get_node(dev);
+ sc = device_get_softc(dev);
if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) == -1 &&
OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 &&
OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1)
xref = node;
+
+ if (ofw_bus_is_compatible(dev, "fsl,mpic"))
+ sc->sc_quirks = OPENPIC_QUIRK_SINGLE_BIND;
return (openpic_common_attach(dev, xref));
}
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index da2f94da1a92..8d54593cc32c 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -89,6 +89,9 @@ int powerpc_pow_enabled;
void (*cpu_idle_hook)(sbintime_t) = NULL;
static void cpu_idle_60x(sbintime_t);
static void cpu_idle_booke(sbintime_t);
+#ifdef BOOKE_E500
+static void cpu_idle_e500mc(sbintime_t sbt);
+#endif
#if defined(__powerpc64__) && defined(AIM)
static void cpu_idle_powerx(sbintime_t);
static void cpu_idle_power9(sbintime_t);
@@ -585,10 +588,12 @@ cpu_booke_setup(int cpuid, uint16_t vers)
switch (vers) {
case FSL_E500mc:
bitmask = HID0_E500MC_BITMASK;
+ cpu_idle_hook = cpu_idle_e500mc;
break;
case FSL_E5500:
case FSL_E6500:
bitmask = HID0_E5500_BITMASK;
+ cpu_idle_hook = cpu_idle_e500mc;
break;
case FSL_E500v1:
case FSL_E500v2:
@@ -753,26 +758,28 @@ cpu_idle_60x(sbintime_t sbt)
#endif
}
+#ifdef BOOKE_E500
+static void
+cpu_idle_e500mc(sbintime_t sbt)
+{
+ /*
+ * Base binutils doesn't know what the 'wait' instruction is, so
+ * use the opcode encoding here.
+ */
+ __asm __volatile(".long 0x7c00007c");
+}
+#endif
+
static void
cpu_idle_booke(sbintime_t sbt)
{
register_t msr;
- uint16_t vers;
msr = mfmsr();
- vers = mfpvr() >> 16;
-#ifdef BOOKE
- switch (vers) {
- case FSL_E500mc:
- case FSL_E5500:
- case FSL_E6500:
- break;
- default:
- powerpc_sync();
- mtmsr(msr | PSL_WE);
- break;
- }
+#ifdef BOOKE_E500
+ powerpc_sync();
+ mtmsr(msr | PSL_WE);
#endif
}
diff --git a/sys/powerpc/powerpc/mem.c b/sys/powerpc/powerpc/mem.c
index 3512b480a447..3b1cbe35d189 100644
--- a/sys/powerpc/powerpc/mem.c
+++ b/sys/powerpc/powerpc/mem.c
@@ -112,9 +112,9 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
continue;
}
if (dev2unit(dev) == CDEV_MINOR_MEM) {
-kmem_direct_mapped: v = uio->uio_offset;
+ v = uio->uio_offset;
- off = uio->uio_offset & PAGE_MASK;
+kmem_direct_mapped: off = v & PAGE_MASK;
cnt = PAGE_SIZE - ((vm_offset_t)iov->iov_base &
PAGE_MASK);
cnt = min(cnt, PAGE_SIZE - off);
@@ -137,8 +137,10 @@ kmem_direct_mapped: v = uio->uio_offset;
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
va = uio->uio_offset;
- if ((va < VM_MIN_KERNEL_ADDRESS) || (va > virtual_end))
+ if ((va < VM_MIN_KERNEL_ADDRESS) || (va > virtual_end)) {
+ v = DMAP_TO_PHYS(va);
goto kmem_direct_mapped;
+ }
va = trunc_page(uio->uio_offset);
eva = round_page(uio->uio_offset
diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c
index 6941c70ef704..8511d5be1f33 100644
--- a/sys/powerpc/powerpc/openpic.c
+++ b/sys/powerpc/powerpc/openpic.c
@@ -35,6 +35,7 @@
#include <sys/proc.h>
#include <sys/rman.h>
#include <sys/sched.h>
+#include <sys/smp.h>
#include <machine/bus.h>
#include <machine/intr_machdep.h>
@@ -236,6 +237,7 @@ void
openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **priv __unused)
{
struct openpic_softc *sc;
+ uint32_t mask;
/* If we aren't directly connected to the CPU, this won't work */
if (dev != root_pic)
@@ -247,7 +249,23 @@ openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **priv __unused)
* XXX: openpic_write() is very special and just needs a 32 bits mask.
* For the moment, just play dirty and get the first half word.
*/
- openpic_write(sc, OPENPIC_IDEST(irq), cpumask.__bits[0] & 0xffffffff);
+ mask = cpumask.__bits[0] & 0xffffffff;
+ if (sc->sc_quirks & OPENPIC_QUIRK_SINGLE_BIND) {
+ int i = mftb() % CPU_COUNT(&cpumask);
+ int cpu, ncpu;
+
+ ncpu = 0;
+ CPU_FOREACH(cpu) {
+ if (!(mask & (1 << cpu)))
+ continue;
+ if (ncpu == i)
+ break;
+ ncpu++;
+ }
+ mask &= (1 << cpu);
+ }
+
+ openpic_write(sc, OPENPIC_IDEST(irq), mask);
}
void
diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c
index 909c91c67a71..d4904b1c2cd9 100644
--- a/sys/riscv/riscv/elf_machdep.c
+++ b/sys/riscv/riscv/elf_machdep.c
@@ -77,7 +77,7 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_maxuser = VM_MAXUSER_ADDRESS,
.sv_usrstack = USRSTACK,
.sv_psstrings = PS_STRINGS,
- .sv_stackprot = VM_PROT_ALL,
+ .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
.sv_copyout_strings = exec_copyout_strings,
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
index bec6ef3a48ef..bd5198bd936f 100644
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -88,6 +88,10 @@ struct nameidata {
struct vnode *ni_vp; /* vnode of result */
struct vnode *ni_dvp; /* vnode of intermediate directory */
/*
+ * Results: flags returned from namei
+ */
+ u_int ni_resflags;
+ /*
* Shared between namei and lookup/commit routines.
*/
size_t ni_pathlen; /* remaining chars in path */
@@ -160,6 +164,11 @@ struct nameidata {
#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */
/*
+ * Namei results flags
+ */
+#define NIRES_ABS 0x00000001 /* Path was absolute */
+
+/*
* Flags in ni_lcf, valid for the duration of the namei call.
*/
#define NI_LCF_STRICTRELATIVE 0x0001 /* relative lookup only */
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index 434b69b2f4e3..3afaf01449c5 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -163,10 +163,6 @@ extern struct sysentvec aout_sysvec;
extern struct sysent sysent[];
extern const char *syscallnames[];
-#if defined(__amd64__)
-extern int i386_read_exec;
-#endif
-
#define NO_SYSCALL (-1)
struct module;
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index c2571f1c4153..6be15c47c1ba 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -1746,7 +1746,6 @@ zone_ctor(void *mem, int size, void *udata, int flags)
zone->uz_name = arg->name;
zone->uz_ctor = arg->ctor;
zone->uz_dtor = arg->dtor;
- zone->uz_slab = zone_fetch_slab;
zone->uz_init = NULL;
zone->uz_fini = NULL;
zone->uz_sleeps = 0;
@@ -2797,7 +2796,7 @@ zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags)
keg = NULL;
/* Try to keep the buckets totally full */
for (i = 0; i < max; ) {
- if ((slab = zone->uz_slab(zone, keg, domain, flags)) == NULL)
+ if ((slab = zone_fetch_slab(zone, keg, domain, flags)) == NULL)
break;
keg = slab->us_keg;
#ifdef NUMA
@@ -3874,19 +3873,61 @@ sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS)
LIST_FOREACH(z, &kz->uk_zones, uz_link)
count++;
}
+ LIST_FOREACH(z, &uma_cachezones, uz_link)
+ count++;
+
rw_runlock(&uma_rwlock);
return (sysctl_handle_int(oidp, &count, 0, req));
}
+static void
+uma_vm_zone_stats(struct uma_type_header *uth, uma_zone_t z, struct sbuf *sbuf,
+ struct uma_percpu_stat *ups, bool internal)
+{
+ uma_zone_domain_t zdom;
+ uma_cache_t cache;
+ int i;
+
+
+ for (i = 0; i < vm_ndomains; i++) {
+ zdom = &z->uz_domain[i];
+ uth->uth_zone_free += zdom->uzd_nitems;
+ }
+ uth->uth_allocs = counter_u64_fetch(z->uz_allocs);
+ uth->uth_frees = counter_u64_fetch(z->uz_frees);
+ uth->uth_fails = counter_u64_fetch(z->uz_fails);
+ uth->uth_sleeps = z->uz_sleeps;
+ /*
+ * While it is not normally safe to access the cache
+ * bucket pointers while not on the CPU that owns the
+ * cache, we only allow the pointers to be exchanged
+ * without the zone lock held, not invalidated, so
+ * accept the possible race associated with bucket
+ * exchange during monitoring.
+ */
+ for (i = 0; i < mp_maxid + 1; i++) {
+ bzero(&ups[i], sizeof(*ups));
+ if (internal || CPU_ABSENT(i))
+ continue;
+ cache = &z->uz_cpu[i];
+ if (cache->uc_allocbucket != NULL)
+ ups[i].ups_cache_free +=
+ cache->uc_allocbucket->ub_cnt;
+ if (cache->uc_freebucket != NULL)
+ ups[i].ups_cache_free +=
+ cache->uc_freebucket->ub_cnt;
+ ups[i].ups_allocs = cache->uc_allocs;
+ ups[i].ups_frees = cache->uc_frees;
+ }
+}
+
static int
sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
{
struct uma_stream_header ush;
struct uma_type_header uth;
struct uma_percpu_stat *ups;
- uma_zone_domain_t zdom;
struct sbuf sbuf;
- uma_cache_t cache;
uma_keg_t kz;
uma_zone_t z;
int count, error, i;
@@ -3905,6 +3946,9 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
count++;
}
+ LIST_FOREACH(z, &uma_cachezones, uz_link)
+ count++;
+
/*
* Insert stream header.
*/
@@ -3939,44 +3983,26 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
if ((z->uz_flags & UMA_ZONE_SECONDARY) &&
(LIST_FIRST(&kz->uk_zones) != z))
uth.uth_zone_flags = UTH_ZONE_SECONDARY;
-
- for (i = 0; i < vm_ndomains; i++) {
- zdom = &z->uz_domain[i];
- uth.uth_zone_free += zdom->uzd_nitems;
- }
- uth.uth_allocs = counter_u64_fetch(z->uz_allocs);
- uth.uth_frees = counter_u64_fetch(z->uz_frees);
- uth.uth_fails = counter_u64_fetch(z->uz_fails);
- uth.uth_sleeps = z->uz_sleeps;
- /*
- * While it is not normally safe to access the cache
- * bucket pointers while not on the CPU that owns the
- * cache, we only allow the pointers to be exchanged
- * without the zone lock held, not invalidated, so
- * accept the possible race associated with bucket
- * exchange during monitoring.
- */
- for (i = 0; i < mp_maxid + 1; i++) {
- bzero(&ups[i], sizeof(*ups));
- if (kz->uk_flags & UMA_ZFLAG_INTERNAL ||
- CPU_ABSENT(i))
- continue;
- cache = &z->uz_cpu[i];
- if (cache->uc_allocbucket != NULL)
- ups[i].ups_cache_free +=
- cache->uc_allocbucket->ub_cnt;
- if (cache->uc_freebucket != NULL)
- ups[i].ups_cache_free +=
- cache->uc_freebucket->ub_cnt;
- ups[i].ups_allocs = cache->uc_allocs;
- ups[i].ups_frees = cache->uc_frees;
- }
+ uma_vm_zone_stats(&uth, z, &sbuf, ups,
+ kz->uk_flags & UMA_ZFLAG_INTERNAL);
ZONE_UNLOCK(z);
(void)sbuf_bcat(&sbuf, &uth, sizeof(uth));
for (i = 0; i < mp_maxid + 1; i++)
(void)sbuf_bcat(&sbuf, &ups[i], sizeof(ups[i]));
}
}
+ LIST_FOREACH(z, &uma_cachezones, uz_link) {
+ bzero(&uth, sizeof(uth));
+ ZONE_LOCK(z);
+ strlcpy(uth.uth_name, z->uz_name, UTH_MAX_NAME);
+ uth.uth_size = z->uz_size;
+ uma_vm_zone_stats(&uth, z, &sbuf, ups, false);
+ ZONE_UNLOCK(z);
+ (void)sbuf_bcat(&sbuf, &uth, sizeof(uth));
+ for (i = 0; i < mp_maxid + 1; i++)
+ (void)sbuf_bcat(&sbuf, &ups[i], sizeof(ups[i]));
+ }
+
rw_runlock(&uma_rwlock);
error = sbuf_finish(&sbuf);
sbuf_delete(&sbuf);
diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h
index 458dac03dcf0..557becfcca7b 100644
--- a/sys/vm/uma_int.h
+++ b/sys/vm/uma_int.h
@@ -304,7 +304,6 @@ struct uma_slab {
#endif
typedef struct uma_slab * uma_slab_t;
-typedef uma_slab_t (*uma_slaballoc)(uma_zone_t, uma_keg_t, int, int);
struct uma_zone_domain {
LIST_HEAD(,uma_bucket) uzd_buckets; /* full buckets */
@@ -345,7 +344,7 @@ struct uma_zone {
void *uz_arg; /* Import/release argument. */
uma_init uz_init; /* Initializer for each item */
uma_fini uz_fini; /* Finalizer for each item. */
- uma_slaballoc uz_slab; /* Allocate a slab from the backend. */
+ void *uz_spare;
uint64_t uz_bkt_count; /* Items in bucket cache */
uint64_t uz_bkt_max; /* Maximum bucket cache size */
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index 3720ffbee161..07f3a9913727 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -184,6 +184,7 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, vm_paddr_t low,
vm_offset_t addr, i, offset;
vm_page_t m;
int pflags, tries;
+ vm_prot_t prot;
size = round_page(size);
vmem = vm_dom[domain].vmd_kernel_arena;
@@ -193,6 +194,7 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, vm_paddr_t low,
pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED;
pflags &= ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL);
pflags |= VM_ALLOC_NOWAIT;
+ prot = (flags & M_EXEC) != 0 ? VM_PROT_ALL : VM_PROT_RW;
VM_OBJECT_WLOCK(object);
for (i = 0; i < size; i += PAGE_SIZE) {
tries = 0;
@@ -220,8 +222,8 @@ retry:
if ((flags & M_ZERO) && (m->flags & PG_ZERO) == 0)
pmap_zero_page(m);
m->valid = VM_PAGE_BITS_ALL;
- pmap_enter(kernel_pmap, addr + i, m, VM_PROT_RW,
- VM_PROT_RW | PMAP_ENTER_WIRED, 0);
+ pmap_enter(kernel_pmap, addr + i, m, prot,
+ prot | PMAP_ENTER_WIRED, 0);
}
VM_OBJECT_WUNLOCK(object);
return (addr);
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 84a42ab046ce..2edd269dc26c 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -74,6 +74,9 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/vmmeter.h>
+#if defined(__amd64__) || defined(__i386__) /* for i386_read_exec */
+#include <machine/md_var.h>
+#endif
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
@@ -411,13 +414,11 @@ ommap(struct thread *td, struct ommap_args *uap)
#define OMAP_FIXED 0x0100
prot = cvtbsdprot[uap->prot & 0x7];
-#ifdef COMPAT_FREEBSD32
-#if defined(__amd64__)
+#if (defined(COMPAT_FREEBSD32) && defined(__amd64__)) || defined(__i386__)
if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
prot != 0)
prot |= PROT_EXEC;
#endif
-#endif
flags = 0;
if (uap->flags & OMAP_ANON)
flags |= MAP_ANON;
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index 10d6d85c2158..58e14b16c93f 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
+#if defined(__amd64__) || defined(__i386__) /* for i386_read_exec */
+#include <machine/md_var.h>
+#endif
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -177,12 +180,10 @@ kern_break(struct thread *td, uintptr_t *addr)
}
#endif
prot = VM_PROT_RW;
-#ifdef COMPAT_FREEBSD32
-#if defined(__amd64__)
+#if (defined(COMPAT_FREEBSD32) && defined(__amd64__)) || defined(__i386__)
if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32))
prot |= VM_PROT_EXECUTE;
#endif
-#endif
rv = vm_map_insert(map, NULL, 0, old, new, prot, VM_PROT_ALL, 0);
if (rv != KERN_SUCCESS) {
#ifdef RACCT
diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c
index 29012d741405..66edf2c1c715 100644
--- a/sys/x86/acpica/acpi_wakeup.c
+++ b/sys/x86/acpica/acpi_wakeup.c
@@ -260,6 +260,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER) &
~(EFER_LMA));
#else
+ if ((amd_feature & AMDID_NX) != 0)
+ WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER));
WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4);
#endif
WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb);
@@ -375,8 +377,12 @@ acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES])
* page-aligned.
*/
for (i = 0; i < ACPI_WAKEPAGES; i++) {
- wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT,
- 0x500, 0xa0000, PAGE_SIZE, 0ul);
+ wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF,
+ M_NOWAIT
+#ifdef __i386__
+ | M_EXEC
+#endif
+ , 0x500, 0xa0000, PAGE_SIZE, 0ul);
if (wakepages[i] == NULL) {
printf("%s: can't alloc wake memory\n", __func__);
goto freepages;
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index 1b1b3ebd6055..71c78b656aa0 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -83,6 +83,7 @@ extern int _ugssel;
extern int use_xsave;
extern uint64_t xsave_mask;
extern u_int max_apic_id;
+extern int i386_read_exec;
extern int pti;
extern int hw_ibrs_active;
extern int hw_ssb_active;
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index eb932b2ad445..77212d92175d 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -6523,7 +6523,6 @@ OLD_FILES+=usr/bin/ypcat
OLD_FILES+=usr/bin/ypchfn
OLD_FILES+=usr/bin/ypchpass
OLD_FILES+=usr/bin/ypchsh
-OLD_FILES+=usr/bin/ypldap
OLD_FILES+=usr/bin/ypmatch
OLD_FILES+=usr/bin/yppasswd
OLD_FILES+=usr/bin/ypwhich
@@ -6547,6 +6546,7 @@ OLD_FILES+=usr/sbin/rpc.ypxfrd
OLD_FILES+=usr/sbin/yp_mkdb
OLD_FILES+=usr/sbin/ypbind
OLD_FILES+=usr/sbin/ypinit
+OLD_FILES+=usr/sbin/ypldap
OLD_FILES+=usr/sbin/yppoll
OLD_FILES+=usr/sbin/yppush
OLD_FILES+=usr/sbin/ypserv
@@ -6559,6 +6559,7 @@ OLD_FILES+=usr/share/man/man1/ypmatch.1.gz
OLD_FILES+=usr/share/man/man1/yppasswd.1.gz
OLD_FILES+=usr/share/man/man1/ypwhich.1.gz
OLD_FILES+=usr/share/man/man5/netid.5.gz
+OLD_FILES+=usr/share/man/man5/ypldap.conf.5.gz
OLD_FILES+=usr/share/man/man8/mknetid.8.gz
OLD_FILES+=usr/share/man/man8/rpc.yppasswdd.8.gz
OLD_FILES+=usr/share/man/man8/rpc.ypxfrd.8.gz
@@ -6569,6 +6570,7 @@ OLD_FILES+=usr/share/man/man8/nis.8.gz
OLD_FILES+=usr/share/man/man8/yp_mkdb.8.gz
OLD_FILES+=usr/share/man/man8/ypbind.8.gz
OLD_FILES+=usr/share/man/man8/ypinit.8.gz
+OLD_FILES+=usr/share/man/man8/ypldap.8.gz
OLD_FILES+=usr/share/man/man8/yppoll.8.gz
OLD_FILES+=usr/share/man/man8/yppush.8.gz
OLD_FILES+=usr/share/man/man8/ypserv.8.gz
@@ -6576,6 +6578,7 @@ OLD_FILES+=usr/share/man/man8/ypset.8.gz
OLD_FILES+=usr/share/man/man8/ypxfr.8.gz
OLD_FILES+=var/yp/Makefile
OLD_FILES+=var/yp/Makefile.dist
+OLD_DIRS+=var/yp
.endif
.if ${MK_NLS} == no
diff --git a/tools/build/options/WITH_CLANG_EXTRAS b/tools/build/options/WITH_CLANG_EXTRAS
index 87da08fef93f..a4d1310ec7a5 100644
--- a/tools/build/options/WITH_CLANG_EXTRAS
+++ b/tools/build/options/WITH_CLANG_EXTRAS
@@ -1,2 +1,3 @@
.\" $FreeBSD$
-Set to build additional clang and llvm tools, such as bugpoint.
+Set to build additional clang and llvm tools, such as bugpoint and
+clang-format.
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
index 9d6987cf592a..44f93c921b4d 100644
--- a/usr.bin/calendar/calendars/calendar.freebsd
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -170,6 +170,7 @@
04/29 Adam Weinberger <adamw@FreeBSD.org> born in Berkeley, California, United States, 1980
04/29 Eric Anholt <anholt@FreeBSD.org> born in Portland, Oregon, United States, 1983
05/01 Randall Stewart <rrs@FreeBSD.org> born in Spokane, Washington, United States, 1959
+05/02 Kai Knoblich <kai@FreeBSD.org> born in Hannover, Niedersachsen, Germany, 1982
05/02 Danilo G. Baio <dbaio@FreeBSD.org> born in Maringa, Parana, Brazil, 1986
05/02 Wojciech A. Koszek <wkoszek@FreeBSD.org> born in Czestochowa, Poland, 1987
05/03 Brian Dean <bsd@FreeBSD.org> born in Elkins, West Virginia, United States, 1966
@@ -231,6 +232,7 @@
06/04 Devin Teske <dteske@FreeBSD.org> born in Arcadia, California, United States, 1982
06/04 Zack Kirsch <zack@FreeBSD.org> born in Memphis, Tennessee, United States, 1982
06/04 Johannes Jost Meixner <xmj@FreeBSD.org> born in Wiesbaden, Germany, 1987
+06/05 Johannes Lundberg <johalun@FreeBSD.org> born in Ornskoldsvik, Sweden, 1975
06/06 Sergei Kolobov <sergei@FreeBSD.org> born in Karpinsk, Russian Federation, 1972
06/06 Ryan Libby <rlibby@FreeBSD.org> born in Kirkland, Washington, United States, 1985
06/06 Alan Eldridge <alane@FreeBSD.org> died in Denver, Colorado, United States, 2003
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c
index 61868a77f862..cc1884ad0e0b 100644
--- a/usr.bin/ipcs/ipcs.c
+++ b/usr.bin/ipcs/ipcs.c
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
}
kget(X_MSGINFO, &msginfo, sizeof(msginfo));
- if ((display & (MSGINFO | MSGTOTAL))) {
+ if (display & (MSGINFO | MSGTOTAL)) {
if (display & MSGTOTAL)
print_kmsqtotal(msginfo);
@@ -227,15 +227,10 @@ main(int argc, char *argv[])
printf("\n");
}
- } else
- if (display & (MSGINFO | MSGTOTAL)) {
- fprintf(stderr,
- "SVID messages facility "
- "not configured in the system\n");
- }
+ }
kget(X_SHMINFO, &shminfo, sizeof(shminfo));
- if ((display & (SHMINFO | SHMTOTAL))) {
+ if (display & (SHMINFO | SHMTOTAL)) {
if (display & SHMTOTAL)
print_kshmtotal(shminfo);
@@ -262,15 +257,10 @@ main(int argc, char *argv[])
}
printf("\n");
}
- } else
- if (display & (SHMINFO | SHMTOTAL)) {
- fprintf(stderr,
- "SVID shared memory facility "
- "not configured in the system\n");
- }
+ }
kget(X_SEMINFO, &seminfo, sizeof(seminfo));
- if ((display & (SEMINFO | SEMTOTAL))) {
+ if (display & (SEMINFO | SEMTOTAL)) {
struct semid_kernel *kxsema;
size_t kxsema_len;
@@ -299,12 +289,7 @@ main(int argc, char *argv[])
printf("\n");
}
- } else
- if (display & (SEMINFO | SEMTOTAL)) {
- fprintf(stderr,
- "SVID semaphores facility "
- "not configured in the system\n");
- }
+ }
if (!use_sysctl)
kvm_close(kd);
diff --git a/usr.bin/newkey/update.c b/usr.bin/newkey/update.c
index 11a1db94261a..b6d18c47c954 100644
--- a/usr.bin/newkey/update.c
+++ b/usr.bin/newkey/update.c
@@ -266,11 +266,14 @@ localupdate(char *name, char *filename, u_int op, u_int keylen __unused,
sprintf(tmpname, "%s.tmp", filename);
rf = fopen(filename, "r");
if (rf == NULL) {
- return (ERR_READ);
+ err = ERR_READ;
+ goto cleanup;
}
wf = fopen(tmpname, "w");
if (wf == NULL) {
- return (ERR_WRITE);
+ fclose(rf);
+ err = ERR_WRITE;
+ goto cleanup;
}
err = -1;
while (fgets(line, sizeof (line), rf)) {
@@ -310,13 +313,18 @@ localupdate(char *name, char *filename, u_int op, u_int keylen __unused,
fclose(rf);
if (err == 0) {
if (rename(tmpname, filename) < 0) {
- return (ERR_DBASE);
+ err = ERR_DBASE;
+ goto cleanup;
}
} else {
if (unlink(tmpname) < 0) {
- return (ERR_DBASE);
+ err = ERR_DBASE;
+ goto cleanup;
}
}
+
+cleanup:
+ free(tmpname);
return (err);
}
diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c
index 73b433c329f9..e303d80b0eef 100644
--- a/usr.bin/vtfontcvt/vtfontcvt.c
+++ b/usr.bin/vtfontcvt/vtfontcvt.c
@@ -63,10 +63,10 @@ struct glyph {
TAILQ_HEAD(glyph_list, glyph);
static SLIST_HEAD(, glyph) glyph_hash[FONTCVT_NHASH];
static struct glyph_list glyphs[VFNT_MAPS] = {
- TAILQ_HEAD_INITIALIZER(glyphs[0]),
- TAILQ_HEAD_INITIALIZER(glyphs[1]),
- TAILQ_HEAD_INITIALIZER(glyphs[2]),
- TAILQ_HEAD_INITIALIZER(glyphs[3]),
+ TAILQ_HEAD_INITIALIZER(glyphs[0]),
+ TAILQ_HEAD_INITIALIZER(glyphs[1]),
+ TAILQ_HEAD_INITIALIZER(glyphs[2]),
+ TAILQ_HEAD_INITIALIZER(glyphs[3]),
};
static unsigned int glyph_total, glyph_count[4], glyph_unique, glyph_dupe;
@@ -79,10 +79,10 @@ struct mapping {
TAILQ_HEAD(mapping_list, mapping);
static struct mapping_list maps[VFNT_MAPS] = {
- TAILQ_HEAD_INITIALIZER(maps[0]),
- TAILQ_HEAD_INITIALIZER(maps[1]),
- TAILQ_HEAD_INITIALIZER(maps[2]),
- TAILQ_HEAD_INITIALIZER(maps[3]),
+ TAILQ_HEAD_INITIALIZER(maps[0]),
+ TAILQ_HEAD_INITIALIZER(maps[1]),
+ TAILQ_HEAD_INITIALIZER(maps[2]),
+ TAILQ_HEAD_INITIALIZER(maps[3]),
};
static unsigned int mapping_total, map_count[4], map_folded_count[4],
mapping_unique, mapping_dupe;
diff --git a/usr.sbin/bluetooth/sdpd/ssar.c b/usr.sbin/bluetooth/sdpd/ssar.c
index 6e84ab236538..68cfa2facd21 100644
--- a/usr.sbin/bluetooth/sdpd/ssar.c
+++ b/usr.sbin/bluetooth/sdpd/ssar.c
@@ -47,6 +47,131 @@ int32_t server_prepare_attr_list(provider_p const provider,
uint8_t *rsp, uint8_t const * const rsp_end);
/*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const uint128_t *uuid)
+{
+ int128_t duuid;
+ uint32_t value;
+ uint8_t type;
+
+ while (buf < eob) {
+
+ SDP_GET8(type, buf);
+
+ switch (type) {
+ case SDP_DATA_UUID16:
+ if (buf + 2 > eob)
+ continue;
+ SDP_GET16(value, buf);
+
+ memcpy(&duuid, &uuid_base, sizeof(duuid));
+ duuid.b[2] = value >> 8 & 0xff;
+ duuid.b[3] = value & 0xff;
+
+ if (memcmp(&duuid, uuid, sizeof(duuid)) == 0)
+ return (0);
+ break;
+ case SDP_DATA_UUID32:
+ if (buf + 4 > eob)
+ continue;
+ SDP_GET32(value, buf);
+ memcpy(&duuid, &uuid_base, sizeof(duuid));
+ duuid.b[0] = value >> 24 & 0xff;
+ duuid.b[1] = value >> 16 & 0xff;
+ duuid.b[2] = value >> 8 & 0xff;
+ duuid.b[3] = value & 0xff;
+
+ if (memcmp(&duuid, uuid, sizeof(duuid)) == 0)
+ return (0);
+ break;
+ case SDP_DATA_UUID128:
+ if (buf + 16 > eob)
+ continue;
+ SDP_GET_UUID128(&duuid, buf);
+
+ if (memcmp(&duuid, uuid, sizeof(duuid)) == 0)
+ return (0);
+ break;
+ case SDP_DATA_UINT8:
+ case SDP_DATA_INT8:
+ case SDP_DATA_SEQ8:
+ buf++;
+ break;
+ case SDP_DATA_UINT16:
+ case SDP_DATA_INT16:
+ case SDP_DATA_SEQ16:
+ buf += 2;
+ break;
+ case SDP_DATA_UINT32:
+ case SDP_DATA_INT32:
+ case SDP_DATA_SEQ32:
+ buf += 4;
+ break;
+ case SDP_DATA_UINT64:
+ case SDP_DATA_INT64:
+ buf += 8;
+ break;
+ case SDP_DATA_UINT128:
+ case SDP_DATA_INT128:
+ buf += 16;
+ break;
+ case SDP_DATA_STR8:
+ if (buf + 1 > eob)
+ continue;
+ SDP_GET8(value, buf);
+ buf += value;
+ break;
+ case SDP_DATA_STR16:
+ if (buf + 2 > eob)
+ continue;
+ SDP_GET16(value, buf);
+ if (value > (eob - buf))
+ return (1);
+ buf += value;
+ break;
+ case SDP_DATA_STR32:
+ if (buf + 4 > eob)
+ continue;
+ SDP_GET32(value, buf);
+ if (value > (eob - buf))
+ return (1);
+ buf += value;
+ break;
+ case SDP_DATA_BOOL:
+ buf += 1;
+ break;
+ default:
+ return (1);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+ uint8_t buffer[256];
+ const attr_t *attr;
+ int len;
+
+ for (attr = provider->profile->attrs; attr->create != NULL; attr++) {
+
+ len = attr->create(buffer, buffer + sizeof(buffer),
+ (const uint8_t *)provider->profile, sizeof(*provider->profile));
+ if (len < 0)
+ continue;
+ if (server_search_uuid_sub(buffer, buffer + len, uuid) == 0)
+ return (0);
+ }
+ return (1);
+}
+
+/*
* Prepare SDP Service Search Attribute Response
*/
@@ -225,7 +350,8 @@ server_prepare_service_search_attribute_response(server_p srv, int32_t fd)
puuid.b[3] = provider->profile->uuid;
if (memcmp(&uuid, &puuid, sizeof(uuid)) != 0 &&
- memcmp(&uuid, &uuid_public_browse_group, sizeof(uuid)) != 0)
+ memcmp(&uuid, &uuid_public_browse_group, sizeof(uuid)) != 0 &&
+ server_search_uuid(provider, &uuid) != 0)
continue;
cs = server_prepare_attr_list(provider,
diff --git a/usr.sbin/dumpcis/main.c b/usr.sbin/dumpcis/main.c
index ab5563ce5b5b..c130e80e8112 100644
--- a/usr.sbin/dumpcis/main.c
+++ b/usr.sbin/dumpcis/main.c
@@ -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
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 07fa2439ede9..5826e8e2d40d 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID;
static struct cflist *get_worklist(char **files);
static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
- struct conf_entry *defconf_p, struct ilist *inclist);
+ struct conf_entry **defconf, struct ilist *inclist);
static void add_to_queue(const char *fname, struct ilist *inclist);
static char *sob(char *p);
static char *son(char *p);
@@ -374,6 +374,8 @@ main(int argc, char **argv)
while (wait(NULL) > 0 || errno == EINTR)
;
+ free(timefnamefmt);
+ free(requestor);
return (0);
}
@@ -841,7 +843,7 @@ get_worklist(char **files)
if (verbose)
printf("Processing %s\n", inc->file);
- parse_file(f, filelist, globlist, defconf, &inclist);
+ parse_file(f, filelist, globlist, &defconf, &inclist);
(void) fclose(f);
}
@@ -858,7 +860,6 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
- /* NOTREACHED */
}
/*
@@ -915,7 +916,7 @@ get_worklist(char **files)
* for a "glob" entry which does match.
*/
gmatch = 0;
- if (verbose > 2 && globlist != NULL)
+ if (verbose > 2)
printf("\t+ Checking globs for %s\n", *given);
STAILQ_FOREACH(ent, globlist, cf_nextp) {
fnres = fnmatch(ent->log, *given, FNM_PATHNAME);
@@ -1046,7 +1047,7 @@ expand_globs(struct cflist *work_p, struct cflist *glob_p)
*/
static void
parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
- struct conf_entry *defconf_p, struct ilist *inclist)
+ struct conf_entry **defconf_p, struct ilist *inclist)
{
char line[BUFSIZ], *parse, *q;
char *cp, *errline, *group;
@@ -1137,12 +1138,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
working = init_entry(q, NULL);
if (strcasecmp(DEFAULT_MARKER, q) == 0) {
special = 1;
- if (defconf_p != NULL) {
+ if (*defconf_p != NULL) {
warnx("Ignoring duplicate entry for %s!", q);
free_entry(working);
continue;
}
- defconf_p = working;
+ *defconf_p = working;
}
q = parse = missing_field(sob(parse + 1), errline);
@@ -1357,7 +1358,8 @@ no_trimat:
q = NULL;
else {
q = parse = sob(parse + 1); /* Optional field */
- *(parse = son(parse)) = '\0';
+ parse = son(parse);
+ *parse = '\0';
}
working->sig = SIGHUP;
@@ -2010,7 +2012,6 @@ do_zipwork(struct zipwork_entry *zwork)
const char **args, *pgm_name, *pgm_path;
char *zresult;
- command = NULL;
assert(zwork != NULL);
assert(zwork->zw_conf != NULL);
assert(zwork->zw_conf->compress > COMPRESS_NONE);
@@ -2114,8 +2115,7 @@ do_zipwork(struct zipwork_entry *zwork)
change_attrs(zresult, zwork->zw_conf);
out:
- if (command != NULL)
- sbuf_delete(command);
+ sbuf_delete(command);
free(args);
free(zresult);
}
diff --git a/usr.sbin/pw/pw.8 b/usr.sbin/pw/pw.8
index e848979ee519..18930fbf2285 100644
--- a/usr.sbin/pw/pw.8
+++ b/usr.sbin/pw/pw.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 10, 2017
+.Dd February 8, 2019
.Dt PW 8
.Os
.Sh NAME
@@ -979,6 +979,12 @@ Delete the gsmith user and their home directory, including contents.
.Bd -literal -offset indent
pw userdel -n gsmith -r
.Ed
+.Pp
+Add the existing user jsmith to the wheel group,
+in addition to the other groups jsmith is already a member of.
+.Bd -literal -offset indent
+pw groupmod wheel -m jsmith
+.Ed
.Sh EXIT STATUS
The
.Nm
diff --git a/usr.sbin/pwm/pwm.8 b/usr.sbin/pwm/pwm.8
index 92ef83705ed0..207dca407c8e 100644
--- a/usr.sbin/pwm/pwm.8
+++ b/usr.sbin/pwm/pwm.8
@@ -22,7 +22,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 12, 2018
+.Dd January 12, 2019
.Dt PWM 8
.Os
.Sh NAME
@@ -44,20 +44,25 @@
.Nm
.Op Fl f Ar device
.Fl c Ar channel
-.Fl p period
+.Fl p Ar period
.Nm
.Op Fl f Ar device
.Fl c Ar channel
-.Fl d duty
+.Fl d Ar duty
.Sh DESCRIPTION
The
.Nm
utility can be used to configure pwm controllers.
.Pp
The options are as follow:
-.Bl -tag -width ".Fl f Ar device"
+.Bl -tag -width "-c channel"
.It Fl c Ar channel
Channel number to operate on
+.It Fl f Ar device
+Device to operate on.
+If not specified,
+.Pa /dev/pwmc0
+is used.
.It Fl E
Enable the pwm channel
.It Fl D
@@ -73,16 +78,19 @@ Configure the duty (in nanoseconds or percentage) of the pwm channel
.Bl -bullet
.It
Show the configuration of the pwm channel:
-.Pp
+.Bd -literal
pwm -f /dev/pwmc0 -C
+.Ed
.It
Configure a 50000 ns period and a 25000 duty cycle:
-.Pp
+.Bd -literal
pwm -f /dev/pwmc0 -p 50000 -d 25000
+.Ed
.It
Configure a 50% duty cycle:
-.Pp
+.Bd -literal
pwm -f /dev/pwmc0 -d 50%
+.Ed
.El
.Sh SEE ALSO
.Xr pwm 9 ,