diff --git a/Makefile.inc1 b/Makefile.inc1 index 86721de54db7..89d73582cbd9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -761,12 +761,13 @@ _worldtmp: .PHONY rm -rf ${LIBCOMPATTMP} .endif .else + @echo ">>> Deleting stale files in build tree..." ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ - delete-old delete-old-libs + delete-old delete-old-libs >/dev/null .if defined(LIBCOMPAT) ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ DESTDIR=${LIBCOMPATTMP} \ - delete-old delete-old-libs + delete-old delete-old-libs >/dev/null .endif rm -rf ${WORLDTMP}/legacy/usr/include .if ${USING_SYSTEM_COMPILER} == "yes" @@ -2336,11 +2337,12 @@ _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair _cddl_lib_libavl= cddl/lib/libavl _cddl_lib_libuutil= cddl/lib/libuutil +.if ${MK_ZFS} != "no" _cddl_lib_libzfs_core= cddl/lib/libzfs_core +cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L +.endif _cddl_lib_libctf= cddl/lib/libctf _cddl_lib= cddl/lib -cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L -cddl/lib/libzfs__L: lib/libgeom__L cddl/lib/libctf__L: lib/libz__L .endif # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh index 0259db367e94..3fe90f7a091f 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh @@ -38,6 +38,14 @@ ## +reader() +{ + while true + do + sleep 0.1 + cat /etc/motd > /dev/null + done +} if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' @@ -46,6 +54,9 @@ fi dtrace=$1 +reader & +child=$! + $dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}' status=$? @@ -53,4 +64,6 @@ if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi +kill $child + exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh index 5e61f053636f..b92a5380b9bc 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh @@ -39,6 +39,15 @@ ## +reader() +{ + while true + do + sleep 0.1 + cat /etc/motd > /dev/null + done +} + if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 @@ -46,6 +55,9 @@ fi dtrace=$1 +reader & +child=$! + $dtrace -qZf wassup'{printf("Iamkool");}' \ -qf read'{printf("I am done"); exit(0);}' @@ -55,4 +67,6 @@ if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi +kill $child + exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d index 6fb996c96181..e4eae881432f 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #pragma D option quiet +#pragma D option dynvarsize=2m /* * This test verifies that the basename() and dirname() functions are working @@ -54,12 +55,16 @@ BEGIN dir[i++] = "f"; dir[i++] = "f/"; dir[i++] = "/////"; + /* + * basename(3) and basename(1) return different results for the empty + * string on FreeBSD, so we need special handling. dir[i++] = ""; + */ end = i; i = 0; - printf("#!/usr/bin/ksh\n\n"); + printf("#!/usr/bin/env ksh\n\n"); } tick-1ms @@ -83,5 +88,19 @@ tick-1ms tick-1ms /i == end/ { + dir[i] = ""; + printf("if [ \"`basename \"%s\"`\" != \"%s\" -a \".\" != \"%s\" ]; then\n", + dir[i], basename(dir[i]), basename(dir[i])); + printf(" echo \"basename(\\\"%s\\\") is \\\"%s\\\"; ", + dir[i], basename(dir[i])); + printf("expected \\\"`basename \"%s\"`\\\" or \\\".\\\"\"\n", dir[i]); + printf("fi\n\n"); + printf("if [ `dirname \"%s\"` != \"%s\" ]; then\n", + dir[i], dirname(dir[i])); + printf(" echo \"dirname(\\\"%s\\\") is \\\"%s\\\"; ", + dir[i], dirname(dir[i])); + printf("expected \\\"`dirname \"%s\"`\"\\\"\n", dir[i]); + printf("fi\n\n"); + exit(0); } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out index e16541adbb03..0f94599df1ea 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh if [ `basename "/foo/bar/baz"` != "baz" ]; then echo "basename(\"/foo/bar/baz\") is \"baz\"; expected \"`basename "/foo/bar/baz"`"\" @@ -152,8 +152,8 @@ if [ `dirname "/////"` != "/" ]; then echo "dirname(\"/////\") is \"/\"; expected \"`dirname "/////"`"\" fi -if [ `basename ""` != "." ]; then - echo "basename(\"\") is \".\"; expected \"`basename ""`"\" +if [ "`basename ""`" != "." -a "." != "." ]; then + echo "basename(\"\") is \".\"; expected \"`basename ""`\" or \".\"" fi if [ `dirname ""` != "." ]; then diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d index 2f0541853a53..842eb67fc75e 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #pragma D option quiet +#pragma D option dynvarsize=2m BEGIN { diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh index a5114f4917e5..1afc62159a35 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh @@ -31,11 +31,12 @@ fi dtrace=$1 -$dtrace -ln 'syscall::*$1:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::$1*:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort -$dtrace -ln 'syscall::p$1[0-9][0-9]:entry' read | awk '{print $(NF-1),$NF}' | \ - sort +$dtrace -ln 'syscall:freebsd:*$1:entry' read | \ + awk '{print $(NF-1),$NF}' | grep -v -E 'compat.\.' | sort +$dtrace -ln 'syscall:freebsd:$1*:entry' read | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort +$dtrace -ln 'syscall:freebsd:w$1[0-9]:entry' ait | \ + awk '{print $(NF-1),$NF}' | sort exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out index 8a9ac6d96c5a..db7134cefe77 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out @@ -1,15 +1,22 @@ FUNCTION NAME +aio_read entry +obs_vread entry pread entry read entry +rtprio_thread entry FUNCTION NAME read entry readlink entry +readlinkat entry readv entry FUNCTION NAME read entry readlink entry +readlinkat entry readv entry FUNCTION NAME readlink entry +readlinkat entry FUNCTION NAME -pread64 entry +wait4 entry +wait6 entry diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c new file mode 100644 index 000000000000..bc9f57ba6a8c --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.c @@ -0,0 +1,47 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2017 Li-Wen Hsu + */ + +#include +#include +#include + +int +main(void) +{ + + sigset_t set; + siginfo_t info; + struct timespec timeout; + + (void)sigemptyset(&set); + (void)sigaddset(&set, SIGHUP); + timeout.tv_sec = 1; + timeout.tv_nsec = 0; + + for (;;) + (void)sigtimedwait(&set, &info, &timeout); + + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d index 1402b23ad6eb..2afb6a8d207e 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d @@ -45,6 +45,7 @@ BEGIN } syscall::*wait*:entry +/pid == $1/ { exit(0); } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d index 8fe3a19d0c9c..879ac46e0806 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d @@ -39,6 +39,7 @@ BEGIN { i = 0; + notused = $1; } syscall::open:entry diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe new file mode 100644 index 000000000000..55364b795210 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe @@ -0,0 +1,30 @@ +#!/usr/bin/env ksh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2017 Li-Wen Hsu + +while true +do + sleep 0.1 + cat /etc/motd > /dev/null +done diff --git a/cddl/usr.sbin/dtrace/tests/common/probes/Makefile b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile index 8b8d779fe87e..4adb82857b08 100644 --- a/cddl/usr.sbin/dtrace/tests/common/probes/Makefile +++ b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile @@ -32,6 +32,7 @@ TESTEXES= \ CFILES= \ + tst.probestar.c \ diff --git a/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile index b5f6ae079e21..eb871e9585e7 100644 --- a/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile +++ b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile @@ -68,6 +68,7 @@ ${PACKAGE}FILES= \ tst.zerosize.d \ TESTEXES= \ + tst.NoSpecBuffer.exe \ CFILES= \ diff --git a/cddl/usr.sbin/dtrace/tests/tools/dtest.sh b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh index b5ad87440291..dc1f0244739c 100755 --- a/cddl/usr.sbin/dtrace/tests/tools/dtest.sh +++ b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh @@ -1,3 +1,5 @@ +#!/bin/sh + # $FreeBSD$ usage() @@ -84,6 +86,12 @@ runtest() ;; esac + if [ $retval -eq 0 ] && \ + head -n 1 $STDOUT | grep -q -E '^#!/.*ksh$'; then + ksh $STDOUT + retval=$? + fi + return $retval } diff --git a/kerberos5/lib/libkafs5/Makefile b/kerberos5/lib/libkafs5/Makefile index dbce7f280b51..a44c9a0897fc 100644 --- a/kerberos5/lib/libkafs5/Makefile +++ b/kerberos5/lib/libkafs5/Makefile @@ -26,7 +26,7 @@ SRCS= afssys.c afskrb5.c common.c krb5_err.h CFLAGS+= -I${KRB5DIR}/lib/kafs \ -I${KRB5DIR}/lib/krb5 \ - -I${.OBJDIR:H}/libkrb5/ \ + -I${.OBJDIR:H}/libkrb5 \ -I${KRB5DIR}/lib/roken CLEANFILES= kafs5.3 diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 595d969b9dd4..16af7d87111b 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -158,7 +158,7 @@ __vdso_init_hpet(uint32_t u) if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)new_map) == 0 && new_map != MAP_FAILED) - munmap((void *)new_map, PAGE_SIZE); + munmap((void *)new_map, PAGE_SIZE); return; fail: diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index 949b0a5b7aad..121c106c1e8e 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -84,6 +84,10 @@ SRCS.ilogb2_test= ilogb_test.c LIBADD+= m +.if ${MACHINE_CPUARCH} == "i386" +# XXX: __fldcw macro mismatch between fenv.h and ieeefp.h . +CWARNFLAGS.clang+= -Wno-error=macro-redefined +.endif WARNS?= 1 # Copied from lib/msun/Makefile diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index ad697606a239..2289af45b4d4 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -156,10 +156,6 @@ ATF_TC_BODY(reduction, tc) 9.8477555741888350649e+4314L, 1.6061597222105160737e+4326L, }; -#elif LDBL_MANT_DIG == 113 - static const long double ld_pi_odd[] = { - /* XXX */ - }; #endif #if defined(__clang__) && \ @@ -205,7 +201,7 @@ ATF_TC_BODY(reduction, tc) ATF_CHECK(fabs(tan(-d_pi_odd[i] * 2)) < 2 * DBL_EPSILON); } -#if LDBL_MANT_DIG > 53 +#if LDBL_MANT_DIG == 64 /* XXX: || LDBL_MANT_DIG == 113 */ for (i = 0; i < nitems(ld_pi_odd); i++) { ATF_CHECK(fabsl(sinl(ld_pi_odd[i])) < LDBL_EPSILON); ATF_CHECK(cosl(ld_pi_odd[i]) == -1.0); diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 64f8ac6cfbd5..403c07c7c313 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -88,7 +88,7 @@ _meta_filemon= 1 # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used # for _meta_filemon but not for _SKIP_DEPEND. -.if defined(_SKIP_BUILD) +.if !defined(NO_SKIP_DEPEND) && defined(_SKIP_BUILD) _SKIP_DEPEND= 1 .endif .if ${MK_DIRDEPS_BUILD} == "no" diff --git a/share/mk/bsd.stand.mk b/share/mk/bsd.stand.mk index 43dd8ce55901..838a3ca7c45f 100644 --- a/share/mk/bsd.stand.mk +++ b/share/mk/bsd.stand.mk @@ -21,6 +21,9 @@ CFLAGS+= -fPIC -mno-red-zone .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -fPIC -mgeneral-regs-only .endif +.if ${MACHINE_CPUARCH} == "arm" +CFLAGS+= -fPIC +.endif .if ${MACHINE_CPUARCH} == "mips" CFLAGS+= -G0 -fno-pic -mno-abicalls .endif diff --git a/sys/arm/include/ucontext.h b/sys/arm/include/ucontext.h index 3cc511341f64..67a640f0cf01 100644 --- a/sys/arm/include/ucontext.h +++ b/sys/arm/include/ucontext.h @@ -78,7 +78,7 @@ typedef struct { * Originally, rest of this structure was named __fpu, 35 * 4 bytes * long, never accessed from kernel. */ - size_t mc_vfp_size; + __size_t mc_vfp_size; void *mc_vfp_ptr; unsigned int mc_spare[33]; } mcontext_t; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 47971af04aac..158b0efa6d7e 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -265,6 +265,7 @@ print_registers(struct trapframe *frame) void do_el1h_sync(struct thread *td, struct trapframe *frame) { + struct trapframe *oframe; uint32_t exception; uint64_t esr, far; @@ -281,6 +282,18 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) "do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, frame->tf_elr, frame); + oframe = td->td_frame; + + switch (exception) { + case EXCP_BRK: + case EXCP_WATCHPT_EL1: + case EXCP_SOFTSTP_EL1: + break; + default: + td->td_frame = frame; + break; + } + switch(exception) { case EXCP_FP_SIMD: case EXCP_TRAP_FP: @@ -313,7 +326,8 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) case EXCP_WATCHPT_EL1: case EXCP_SOFTSTP_EL1: #ifdef KDB - kdb_trap(exception, 0, frame); + kdb_trap(exception, 0, + (td->td_frame != NULL) ? td->td_frame : frame); #else panic("No debugger in kernel.\n"); #endif @@ -323,6 +337,8 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) panic("Unknown kernel exception %x esr_el1 %lx\n", exception, esr); } + + td->td_frame = oframe; } /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index 55adcccaa6cf..3b2b227d0cce 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -4269,6 +4269,16 @@ spa_import_rootpool(const char *name) == 0); if ((spa = spa_lookup(pname)) != NULL) { + /* + * The pool could already be imported, + * e.g., after reboot -r. + */ + if (spa->spa_state == POOL_STATE_ACTIVE) { + mutex_exit(&spa_namespace_lock); + nvlist_free(config); + return (0); + } + /* * Remove the existing root pool from the namespace so * that we can replace it with the correct config diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c index ea711d5ecd6d..bd593349b8fa 100644 --- a/sys/compat/cloudabi/cloudabi_fd.c +++ b/sys/compat/cloudabi/cloudabi_fd.c @@ -111,8 +111,6 @@ cloudabi_sys_fd_create1(struct thread *td, return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps)); case CLOUDABI_FILETYPE_SOCKET_DGRAM: return (kern_socket(td, AF_UNIX, SOCK_DGRAM, 0)); - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: - return (kern_socket(td, AF_UNIX, SOCK_SEQPACKET, 0)); case CLOUDABI_FILETYPE_SOCKET_STREAM: return (kern_socket(td, AF_UNIX, SOCK_STREAM, 0)); default: @@ -145,9 +143,6 @@ cloudabi_sys_fd_create2(struct thread *td, case CLOUDABI_FILETYPE_SOCKET_DGRAM: error = kern_socketpair(td, AF_UNIX, SOCK_DGRAM, 0, fds); break; - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: - error = kern_socketpair(td, AF_UNIX, SOCK_SEQPACKET, 0, fds); - break; case CLOUDABI_FILETYPE_SOCKET_STREAM: error = kern_socketpair(td, AF_UNIX, SOCK_STREAM, 0, fds); break; @@ -245,8 +240,6 @@ cloudabi_convert_filetype(const struct file *fp) switch (so->so_type) { case SOCK_DGRAM: return (CLOUDABI_FILETYPE_SOCKET_DGRAM); - case SOCK_SEQPACKET: - return (CLOUDABI_FILETYPE_SOCKET_SEQPACKET); case SOCK_STREAM: return (CLOUDABI_FILETYPE_SOCKET_STREAM); default: @@ -400,7 +393,6 @@ cloudabi_remove_conflicting_rights(cloudabi_filetype_t filetype, *inheriting = 0; break; case CLOUDABI_FILETYPE_SOCKET_DGRAM: - case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: case CLOUDABI_FILETYPE_SOCKET_STREAM: *base &= CLOUDABI_RIGHT_FD_READ | CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | diff --git a/sys/compat/cloudabi/cloudabi_mem.c b/sys/compat/cloudabi/cloudabi_mem.c index 30d9a6fee8ea..a1ecf3623c02 100644 --- a/sys/compat/cloudabi/cloudabi_mem.c +++ b/sys/compat/cloudabi/cloudabi_mem.c @@ -89,14 +89,6 @@ cloudabi_sys_mem_advise(struct thread *td, behav)); } -int -cloudabi_sys_mem_lock(struct thread *td, struct cloudabi_sys_mem_lock_args *uap) -{ - - return (kern_mlock(td->td_proc, td->td_ucred, - __DECONST(uintptr_t, uap->mapping), uap->mapping_len)); -} - int cloudabi_sys_mem_map(struct thread *td, struct cloudabi_sys_mem_map_args *uap) { @@ -160,15 +152,6 @@ cloudabi_sys_mem_sync(struct thread *td, struct cloudabi_sys_mem_sync_args *uap) flags)); } -int -cloudabi_sys_mem_unlock(struct thread *td, - struct cloudabi_sys_mem_unlock_args *uap) -{ - - return (kern_munlock(td, __DECONST(uintptr_t, uap->mapping), - uap->mapping_len)); -} - int cloudabi_sys_mem_unmap(struct thread *td, struct cloudabi_sys_mem_unmap_args *uap) diff --git a/sys/compat/cloudabi/cloudabi_sock.c b/sys/compat/cloudabi/cloudabi_sock.c index 9d0e03691d1a..f8adf06abf74 100644 --- a/sys/compat/cloudabi/cloudabi_sock.c +++ b/sys/compat/cloudabi/cloudabi_sock.c @@ -49,43 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* Converts FreeBSD's struct sockaddr to CloudABI's cloudabi_sockaddr_t. */ -static void -cloudabi_convert_sockaddr(const struct sockaddr *sa, socklen_t sal, - cloudabi_sockaddr_t *rsa) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - /* Zero-sized socket address. */ - if (sal < offsetof(struct sockaddr, sa_family) + sizeof(sa->sa_family)) - return; - - switch (sa->sa_family) { - case AF_INET: - if (sal < sizeof(struct sockaddr_in)) - return; - sin = (const struct sockaddr_in *)sa; - rsa->sa_family = CLOUDABI_AF_INET; - memcpy(&rsa->sa_inet.addr, &sin->sin_addr, - sizeof(rsa->sa_inet.addr)); - rsa->sa_inet.port = ntohs(sin->sin_port); - return; - case AF_INET6: - if (sal < sizeof(struct sockaddr_in6)) - return; - sin6 = (const struct sockaddr_in6 *)sa; - rsa->sa_family = CLOUDABI_AF_INET6; - memcpy(&rsa->sa_inet6.addr, &sin6->sin6_addr, - sizeof(rsa->sa_inet6.addr)); - rsa->sa_inet6.port = ntohs(sin6->sin6_port); - return; - case AF_UNIX: - rsa->sa_family = CLOUDABI_AF_UNIX; - return; - } -} - /* Copies a pathname into a UNIX socket address structure. */ static int copyin_sockaddr_un(const char *path, size_t pathlen, struct sockaddr_un *sun) @@ -112,27 +75,8 @@ int cloudabi_sys_sock_accept(struct thread *td, struct cloudabi_sys_sock_accept_args *uap) { - struct sockaddr *sa; - cloudabi_sockstat_t ss = {}; - socklen_t sal; - int error; - if (uap->buf == NULL) { - /* Only return the new file descriptor number. */ - return (kern_accept(td, uap->sock, NULL, NULL, NULL)); - } else { - /* Also return properties of the new socket descriptor. */ - sal = MAX(sizeof(struct sockaddr_in), - sizeof(struct sockaddr_in6)); - error = kern_accept(td, uap->sock, (void *)&sa, &sal, NULL); - if (error != 0) - return (error); - - /* TODO(ed): Fill the other members of cloudabi_sockstat_t. */ - cloudabi_convert_sockaddr(sa, sal, &ss.ss_peername); - free(sa, M_SONAME); - return (copyout(&ss, uap->buf, sizeof(ss))); - } + return (kern_accept(td, uap->sock, NULL, NULL, NULL)); } int @@ -200,7 +144,6 @@ cloudabi_sys_sock_stat_get(struct thread *td, cloudabi_sockstat_t ss = {}; cap_rights_t rights; struct file *fp; - struct sockaddr *sa; struct socket *so; int error; @@ -210,27 +153,6 @@ cloudabi_sys_sock_stat_get(struct thread *td, return (error); so = fp->f_data; - CURVNET_SET(so->so_vnet); - - /* Set ss_sockname. */ - error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - if (error == 0) { - cloudabi_convert_sockaddr(sa, sa->sa_len, &ss.ss_sockname); - free(sa, M_SONAME); - } - - /* Set ss_peername. */ - if ((so->so_state & (SS_ISCONNECTED | SS_ISCONFIRMING)) != 0) { - error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa); - if (error == 0) { - cloudabi_convert_sockaddr(sa, sa->sa_len, - &ss.ss_peername); - free(sa, M_SONAME); - } - } - - CURVNET_RESTORE(); - /* Set ss_error. */ SOCK_LOCK(so); ss.ss_error = cloudabi_convert_errno(so->so_error); @@ -249,8 +171,8 @@ cloudabi_sys_sock_stat_get(struct thread *td, int cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, size_t datalen, cloudabi_fd_t *fds, size_t fdslen, - cloudabi_msgflags_t flags, size_t *rdatalen, size_t *rfdslen, - cloudabi_sockaddr_t *peername, cloudabi_msgflags_t *rflags) + cloudabi_riflags_t flags, size_t *rdatalen, size_t *rfdslen, + cloudabi_roflags_t *rflags) { struct sockaddr_storage ss; struct msghdr hdr = { @@ -263,9 +185,9 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, int error; /* Convert flags. */ - if (flags & CLOUDABI_MSG_PEEK) + if (flags & CLOUDABI_SOCK_RECV_PEEK) hdr.msg_flags |= MSG_PEEK; - if (flags & CLOUDABI_MSG_WAITALL) + if (flags & CLOUDABI_SOCK_RECV_WAITALL) hdr.msg_flags |= MSG_WAITALL; control = NULL; @@ -278,13 +200,9 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, *rdatalen = td->td_retval[0]; td->td_retval[0] = 0; *rfdslen = 0; - cloudabi_convert_sockaddr((struct sockaddr *)&ss, - MIN(hdr.msg_namelen, sizeof(ss)), peername); *rflags = 0; - if (hdr.msg_flags & MSG_EOR) - *rflags |= CLOUDABI_MSG_EOR; if (hdr.msg_flags & MSG_TRUNC) - *rflags |= CLOUDABI_MSG_TRUNC; + *rflags |= CLOUDABI_SOCK_RECV_DATA_TRUNCATED; /* Extract file descriptors from SCM_RIGHTS messages. */ if (control != NULL) { @@ -303,7 +221,8 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, if (nfds > fdslen) { /* Unable to store file descriptors. */ nfds = fdslen; - *rflags |= CLOUDABI_MSG_CTRUNC; + *rflags |= + CLOUDABI_SOCK_RECV_FDS_TRUNCATED; } error = copyout(CMSG_DATA(chdr), fds, nfds * sizeof(int)); @@ -323,20 +242,14 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd, struct iovec *data, int cloudabi_sock_send(struct thread *td, cloudabi_fd_t fd, struct iovec *data, - size_t datalen, const cloudabi_fd_t *fds, size_t fdslen, - cloudabi_msgflags_t flags, size_t *rdatalen) + size_t datalen, const cloudabi_fd_t *fds, size_t fdslen, size_t *rdatalen) { struct msghdr hdr = { .msg_iov = data, .msg_iovlen = datalen, }; struct mbuf *control; - int error, mflags; - - /* Convert flags. */ - mflags = MSG_NOSIGNAL; - if (flags & CLOUDABI_MSG_EOR) - mflags |= MSG_EOR; + int error; /* Convert file descriptor array to an SCM_RIGHTS message. */ if (fdslen > MCLBYTES || CMSG_SPACE(fdslen * sizeof(int)) > MCLBYTES) { @@ -361,7 +274,7 @@ cloudabi_sock_send(struct thread *td, cloudabi_fd_t fd, struct iovec *data, control = NULL; } - error = kern_sendit(td, fd, &hdr, mflags, control, UIO_USERSPACE); + error = kern_sendit(td, fd, &hdr, MSG_NOSIGNAL, control, UIO_USERSPACE); if (error != 0) return (error); *rdatalen = td->td_retval[0]; diff --git a/sys/compat/cloudabi/cloudabi_util.h b/sys/compat/cloudabi/cloudabi_util.h index e263d5574492..d9a6096c73f1 100644 --- a/sys/compat/cloudabi/cloudabi_util.h +++ b/sys/compat/cloudabi/cloudabi_util.h @@ -75,10 +75,10 @@ int cloudabi_futex_lock_wrlock(struct thread *, cloudabi_lock_t *, /* Socket operations. */ int cloudabi_sock_recv(struct thread *, cloudabi_fd_t, struct iovec *, size_t, - cloudabi_fd_t *, size_t, cloudabi_msgflags_t, size_t *, size_t *, - cloudabi_sockaddr_t *, cloudabi_msgflags_t *); + cloudabi_fd_t *, size_t, cloudabi_riflags_t, size_t *, size_t *, + cloudabi_roflags_t *); int cloudabi_sock_send(struct thread *, cloudabi_fd_t, struct iovec *, size_t, - const cloudabi_fd_t *, size_t, cloudabi_msgflags_t, size_t *); + const cloudabi_fd_t *, size_t, size_t *); /* vDSO setup and teardown. */ void cloudabi_vdso_init(struct sysentvec *, char *, char *); diff --git a/sys/compat/cloudabi32/cloudabi32_proto.h b/sys/compat/cloudabi32/cloudabi32_proto.h index 8459b227e42e..30ce364e77cf 100644 --- a/sys/compat/cloudabi32/cloudabi32_proto.h +++ b/sys/compat/cloudabi32/cloudabi32_proto.h @@ -200,10 +200,6 @@ struct cloudabi_sys_mem_advise_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; }; -struct cloudabi_sys_mem_lock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_map_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; @@ -222,10 +218,6 @@ struct cloudabi_sys_mem_sync_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char flags_l_[PADL_(cloudabi_msflags_t)]; cloudabi_msflags_t flags; char flags_r_[PADR_(cloudabi_msflags_t)]; }; -struct cloudabi_sys_mem_unlock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_unmap_args { char mapping_l_[PADL_(void *)]; void * mapping; char mapping_r_[PADR_(void *)]; char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; @@ -265,7 +257,7 @@ struct cloudabi_sys_random_get_args { }; struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; + char unused_l_[PADL_(void *)]; void * unused; char unused_r_[PADR_(void *)]; }; struct cloudabi_sys_sock_bind_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; @@ -345,11 +337,9 @@ int cloudabi_sys_file_symlink(struct thread *, struct cloudabi_sys_file_symlink_ int cloudabi_sys_file_unlink(struct thread *, struct cloudabi_sys_file_unlink_args *); int cloudabi_sys_lock_unlock(struct thread *, struct cloudabi_sys_lock_unlock_args *); int cloudabi_sys_mem_advise(struct thread *, struct cloudabi_sys_mem_advise_args *); -int cloudabi_sys_mem_lock(struct thread *, struct cloudabi_sys_mem_lock_args *); int cloudabi_sys_mem_map(struct thread *, struct cloudabi_sys_mem_map_args *); int cloudabi_sys_mem_protect(struct thread *, struct cloudabi_sys_mem_protect_args *); int cloudabi_sys_mem_sync(struct thread *, struct cloudabi_sys_mem_sync_args *); -int cloudabi_sys_mem_unlock(struct thread *, struct cloudabi_sys_mem_unlock_args *); int cloudabi_sys_mem_unmap(struct thread *, struct cloudabi_sys_mem_unmap_args *); int cloudabi32_sys_poll(struct thread *, struct cloudabi32_sys_poll_args *); int cloudabi32_sys_poll_fd(struct thread *, struct cloudabi32_sys_poll_fd_args *); @@ -399,6 +389,12 @@ int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_ #endif /* COMPAT_FREEBSD10 */ + +#ifdef COMPAT_FREEBSD11 + + +#endif /* COMPAT_FREEBSD11 */ + #define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_res_get AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_time_get AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_condvar_signal AUE_NULL @@ -432,11 +428,9 @@ int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_ #define CLOUDABI32_SYS_AUE_cloudabi_sys_file_unlink AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_lock_unlock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_advise AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_lock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_map AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_protect AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_sync AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unlock AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unmap AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll_fd AUE_NULL diff --git a/sys/compat/cloudabi32/cloudabi32_sock.c b/sys/compat/cloudabi32/cloudabi32_sock.c index 1b01fc67214c..b4fa09ca1d42 100644 --- a/sys/compat/cloudabi32/cloudabi32_sock.c +++ b/sys/compat/cloudabi32/cloudabi32_sock.c @@ -75,7 +75,7 @@ cloudabi32_sys_sock_recv(struct thread *td, error = cloudabi_sock_recv(td, uap->sock, iov, ri.ri_data_len, TO_PTR(ri.ri_fds), ri.ri_fds_len, ri.ri_flags, &rdatalen, - &rfdslen, &ro.ro_peername, &ro.ro_flags); + &rfdslen, &ro.ro_flags); free(iov, M_SOCKET); if (error != 0) return (error); @@ -118,7 +118,7 @@ cloudabi32_sys_sock_send(struct thread *td, } error = cloudabi_sock_send(td, uap->sock, iov, si.si_data_len, - TO_PTR(si.si_fds), si.si_fds_len, si.si_flags, &datalen); + TO_PTR(si.si_fds), si.si_fds_len, &datalen); free(iov, M_SOCKET); if (error != 0) return (error); diff --git a/sys/compat/cloudabi32/cloudabi32_syscall.h b/sys/compat/cloudabi32/cloudabi32_syscall.h index 112fc23994a4..d6b37536ea8f 100644 --- a/sys/compat/cloudabi32/cloudabi32_syscall.h +++ b/sys/compat/cloudabi32/cloudabi32_syscall.h @@ -38,28 +38,26 @@ #define CLOUDABI32_SYS_cloudabi_sys_file_unlink 30 #define CLOUDABI32_SYS_cloudabi_sys_lock_unlock 31 #define CLOUDABI32_SYS_cloudabi_sys_mem_advise 32 -#define CLOUDABI32_SYS_cloudabi_sys_mem_lock 33 -#define CLOUDABI32_SYS_cloudabi_sys_mem_map 34 -#define CLOUDABI32_SYS_cloudabi_sys_mem_protect 35 -#define CLOUDABI32_SYS_cloudabi_sys_mem_sync 36 -#define CLOUDABI32_SYS_cloudabi_sys_mem_unlock 37 -#define CLOUDABI32_SYS_cloudabi_sys_mem_unmap 38 -#define CLOUDABI32_SYS_cloudabi32_sys_poll 39 -#define CLOUDABI32_SYS_cloudabi32_sys_poll_fd 40 -#define CLOUDABI32_SYS_cloudabi_sys_proc_exec 41 -#define CLOUDABI32_SYS_cloudabi_sys_proc_exit 42 -#define CLOUDABI32_SYS_cloudabi_sys_proc_fork 43 -#define CLOUDABI32_SYS_cloudabi_sys_proc_raise 44 -#define CLOUDABI32_SYS_cloudabi_sys_random_get 45 -#define CLOUDABI32_SYS_cloudabi_sys_sock_accept 46 -#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 47 -#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 48 -#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 49 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 50 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 51 -#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 52 -#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 53 -#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 54 -#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 55 -#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 56 -#define CLOUDABI32_SYS_MAXSYSCALL 57 +#define CLOUDABI32_SYS_cloudabi_sys_mem_map 33 +#define CLOUDABI32_SYS_cloudabi_sys_mem_protect 34 +#define CLOUDABI32_SYS_cloudabi_sys_mem_sync 35 +#define CLOUDABI32_SYS_cloudabi_sys_mem_unmap 36 +#define CLOUDABI32_SYS_cloudabi32_sys_poll 37 +#define CLOUDABI32_SYS_cloudabi32_sys_poll_fd 38 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exec 39 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exit 40 +#define CLOUDABI32_SYS_cloudabi_sys_proc_fork 41 +#define CLOUDABI32_SYS_cloudabi_sys_proc_raise 42 +#define CLOUDABI32_SYS_cloudabi_sys_random_get 43 +#define CLOUDABI32_SYS_cloudabi_sys_sock_accept 44 +#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 45 +#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 46 +#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 47 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 48 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 49 +#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 50 +#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 51 +#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 52 +#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 53 +#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 54 +#define CLOUDABI32_SYS_MAXSYSCALL 55 diff --git a/sys/compat/cloudabi32/cloudabi32_syscalls.c b/sys/compat/cloudabi32/cloudabi32_syscalls.c index c81960e48ffd..c047dcc82f79 100644 --- a/sys/compat/cloudabi32/cloudabi32_syscalls.c +++ b/sys/compat/cloudabi32/cloudabi32_syscalls.c @@ -39,28 +39,26 @@ const char *cloudabi32_syscallnames[] = { "cloudabi_sys_file_unlink", /* 30 = cloudabi_sys_file_unlink */ "cloudabi_sys_lock_unlock", /* 31 = cloudabi_sys_lock_unlock */ "cloudabi_sys_mem_advise", /* 32 = cloudabi_sys_mem_advise */ - "cloudabi_sys_mem_lock", /* 33 = cloudabi_sys_mem_lock */ - "cloudabi_sys_mem_map", /* 34 = cloudabi_sys_mem_map */ - "cloudabi_sys_mem_protect", /* 35 = cloudabi_sys_mem_protect */ - "cloudabi_sys_mem_sync", /* 36 = cloudabi_sys_mem_sync */ - "cloudabi_sys_mem_unlock", /* 37 = cloudabi_sys_mem_unlock */ - "cloudabi_sys_mem_unmap", /* 38 = cloudabi_sys_mem_unmap */ - "cloudabi32_sys_poll", /* 39 = cloudabi32_sys_poll */ - "cloudabi32_sys_poll_fd", /* 40 = cloudabi32_sys_poll_fd */ - "cloudabi_sys_proc_exec", /* 41 = cloudabi_sys_proc_exec */ - "cloudabi_sys_proc_exit", /* 42 = cloudabi_sys_proc_exit */ - "cloudabi_sys_proc_fork", /* 43 = cloudabi_sys_proc_fork */ - "cloudabi_sys_proc_raise", /* 44 = cloudabi_sys_proc_raise */ - "cloudabi_sys_random_get", /* 45 = cloudabi_sys_random_get */ - "cloudabi_sys_sock_accept", /* 46 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 47 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 48 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 49 = cloudabi_sys_sock_listen */ - "cloudabi32_sys_sock_recv", /* 50 = cloudabi32_sys_sock_recv */ - "cloudabi32_sys_sock_send", /* 51 = cloudabi32_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 52 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 53 = cloudabi_sys_sock_stat_get */ - "cloudabi32_sys_thread_create", /* 54 = cloudabi32_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 55 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_yield", /* 56 = cloudabi_sys_thread_yield */ + "cloudabi_sys_mem_map", /* 33 = cloudabi_sys_mem_map */ + "cloudabi_sys_mem_protect", /* 34 = cloudabi_sys_mem_protect */ + "cloudabi_sys_mem_sync", /* 35 = cloudabi_sys_mem_sync */ + "cloudabi_sys_mem_unmap", /* 36 = cloudabi_sys_mem_unmap */ + "cloudabi32_sys_poll", /* 37 = cloudabi32_sys_poll */ + "cloudabi32_sys_poll_fd", /* 38 = cloudabi32_sys_poll_fd */ + "cloudabi_sys_proc_exec", /* 39 = cloudabi_sys_proc_exec */ + "cloudabi_sys_proc_exit", /* 40 = cloudabi_sys_proc_exit */ + "cloudabi_sys_proc_fork", /* 41 = cloudabi_sys_proc_fork */ + "cloudabi_sys_proc_raise", /* 42 = cloudabi_sys_proc_raise */ + "cloudabi_sys_random_get", /* 43 = cloudabi_sys_random_get */ + "cloudabi_sys_sock_accept", /* 44 = cloudabi_sys_sock_accept */ + "cloudabi_sys_sock_bind", /* 45 = cloudabi_sys_sock_bind */ + "cloudabi_sys_sock_connect", /* 46 = cloudabi_sys_sock_connect */ + "cloudabi_sys_sock_listen", /* 47 = cloudabi_sys_sock_listen */ + "cloudabi32_sys_sock_recv", /* 48 = cloudabi32_sys_sock_recv */ + "cloudabi32_sys_sock_send", /* 49 = cloudabi32_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 50 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 51 = cloudabi_sys_sock_stat_get */ + "cloudabi32_sys_thread_create", /* 52 = cloudabi32_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 53 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 54 = cloudabi_sys_thread_yield */ }; diff --git a/sys/compat/cloudabi32/cloudabi32_sysent.c b/sys/compat/cloudabi32/cloudabi32_sysent.c index 9116f5c0665e..c0106a3ce19e 100644 --- a/sys/compat/cloudabi32/cloudabi32_sysent.c +++ b/sys/compat/cloudabi32/cloudabi32_sysent.c @@ -47,28 +47,26 @@ struct sysent cloudabi32_sysent[] = { { AS(cloudabi_sys_file_unlink_args), (sy_call_t *)cloudabi_sys_file_unlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 30 = cloudabi_sys_file_unlink */ { AS(cloudabi_sys_lock_unlock_args), (sy_call_t *)cloudabi_sys_lock_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 31 = cloudabi_sys_lock_unlock */ { AS(cloudabi_sys_mem_advise_args), (sy_call_t *)cloudabi_sys_mem_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 32 = cloudabi_sys_mem_advise */ - { AS(cloudabi_sys_mem_lock_args), (sy_call_t *)cloudabi_sys_mem_lock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_lock */ - { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_map */ - { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_protect */ - { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_sync */ - { AS(cloudabi_sys_mem_unlock_args), (sy_call_t *)cloudabi_sys_mem_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi_sys_mem_unlock */ - { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi_sys_mem_unmap */ - { AS(cloudabi32_sys_poll_args), (sy_call_t *)cloudabi32_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi32_sys_poll */ - { AS(cloudabi32_sys_poll_fd_args), (sy_call_t *)cloudabi32_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi32_sys_poll_fd */ - { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_exec */ - { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_exit */ - { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_proc_fork */ - { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_proc_raise */ - { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_random_get */ - { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi_sys_sock_listen */ - { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi32_sys_sock_recv */ - { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi32_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi32_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 55 = cloudabi_sys_thread_exit */ - { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 56 = cloudabi_sys_thread_yield */ + { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_map */ + { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_protect */ + { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_sync */ + { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_unmap */ + { AS(cloudabi32_sys_poll_args), (sy_call_t *)cloudabi32_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi32_sys_poll */ + { AS(cloudabi32_sys_poll_fd_args), (sy_call_t *)cloudabi32_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi32_sys_poll_fd */ + { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi_sys_proc_exec */ + { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi_sys_proc_exit */ + { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_fork */ + { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_raise */ + { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_random_get */ + { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_sock_accept */ + { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_bind */ + { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_connect */ + { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_listen */ + { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi32_sys_sock_recv */ + { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi32_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi32_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_thread_exit */ + { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_yield */ }; diff --git a/sys/compat/cloudabi32/cloudabi32_systrace_args.c b/sys/compat/cloudabi32/cloudabi32_systrace_args.c index 6d037bc70b08..1d2eef2c51fb 100644 --- a/sys/compat/cloudabi32/cloudabi32_systrace_args.c +++ b/sys/compat/cloudabi32/cloudabi32_systrace_args.c @@ -310,16 +310,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* cloudabi_sys_mem_lock */ - case 33: { - struct cloudabi_sys_mem_lock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_map */ - case 34: { + case 33: { struct cloudabi_sys_mem_map_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ @@ -331,7 +323,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_mem_protect */ - case 35: { + case 34: { struct cloudabi_sys_mem_protect_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -340,7 +332,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_mem_sync */ - case 36: { + case 35: { struct cloudabi_sys_mem_sync_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -348,16 +340,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* cloudabi_sys_mem_unlock */ - case 37: { - struct cloudabi_sys_mem_unlock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_unmap */ - case 38: { + case 36: { struct cloudabi_sys_mem_unmap_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -365,7 +349,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi32_sys_poll */ - case 39: { + case 37: { struct cloudabi32_sys_poll_args *p = params; uarg[0] = (intptr_t) p->in; /* const cloudabi32_subscription_t * */ uarg[1] = (intptr_t) p->out; /* cloudabi32_event_t * */ @@ -374,7 +358,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi32_sys_poll_fd */ - case 40: { + case 38: { struct cloudabi32_sys_poll_fd_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_subscription_t * */ @@ -386,7 +370,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_proc_exec */ - case 41: { + case 39: { struct cloudabi_sys_proc_exec_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->data; /* const void * */ @@ -397,26 +381,26 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_proc_exit */ - case 42: { + case 40: { struct cloudabi_sys_proc_exit_args *p = params; iarg[0] = p->rval; /* cloudabi_exitcode_t */ *n_args = 1; break; } /* cloudabi_sys_proc_fork */ - case 43: { + case 41: { *n_args = 0; break; } /* cloudabi_sys_proc_raise */ - case 44: { + case 42: { struct cloudabi_sys_proc_raise_args *p = params; iarg[0] = p->sig; /* cloudabi_signal_t */ *n_args = 1; break; } /* cloudabi_sys_random_get */ - case 45: { + case 43: { struct cloudabi_sys_random_get_args *p = params; uarg[0] = (intptr_t) p->buf; /* void * */ uarg[1] = p->buf_len; /* size_t */ @@ -424,15 +408,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_accept */ - case 46: { + case 44: { struct cloudabi_sys_sock_accept_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ - uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ + uarg[1] = (intptr_t) p->unused; /* void * */ *n_args = 2; break; } /* cloudabi_sys_sock_bind */ - case 47: { + case 45: { struct cloudabi_sys_sock_bind_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -442,7 +426,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_connect */ - case 48: { + case 46: { struct cloudabi_sys_sock_connect_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -452,7 +436,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_listen */ - case 49: { + case 47: { struct cloudabi_sys_sock_listen_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->backlog; /* cloudabi_backlog_t */ @@ -460,7 +444,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi32_sys_sock_recv */ - case 50: { + case 48: { struct cloudabi32_sys_sock_recv_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_recv_in_t * */ @@ -469,7 +453,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi32_sys_sock_send */ - case 51: { + case 49: { struct cloudabi32_sys_sock_send_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_send_in_t * */ @@ -478,7 +462,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_shutdown */ - case 52: { + case 50: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ @@ -486,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_stat_get */ - case 53: { + case 51: { struct cloudabi_sys_sock_stat_get_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ @@ -495,14 +479,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi32_sys_thread_create */ - case 54: { + case 52: { struct cloudabi32_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi32_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 55: { + case 53: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ @@ -510,7 +494,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_thread_yield */ - case 56: { + case 54: { *n_args = 0; break; } @@ -1058,21 +1042,8 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* cloudabi_sys_mem_lock */ - case 33: - switch(ndx) { - case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; /* cloudabi_sys_mem_map */ - case 34: + case 33: switch(ndx) { case 0: p = "userland void *"; @@ -1097,7 +1068,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_mem_protect */ - case 35: + case 34: switch(ndx) { case 0: p = "userland void *"; @@ -1113,7 +1084,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_mem_sync */ - case 36: + case 35: switch(ndx) { case 0: p = "userland void *"; @@ -1128,21 +1099,8 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* cloudabi_sys_mem_unlock */ - case 37: - switch(ndx) { - case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; /* cloudabi_sys_mem_unmap */ - case 38: + case 36: switch(ndx) { case 0: p = "userland void *"; @@ -1155,7 +1113,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi32_sys_poll */ - case 39: + case 37: switch(ndx) { case 0: p = "userland const cloudabi32_subscription_t *"; @@ -1171,7 +1129,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi32_sys_poll_fd */ - case 40: + case 38: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1196,7 +1154,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_exec */ - case 41: + case 39: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1218,7 +1176,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_exit */ - case 42: + case 40: switch(ndx) { case 0: p = "cloudabi_exitcode_t"; @@ -1228,10 +1186,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_fork */ - case 43: + case 41: break; /* cloudabi_sys_proc_raise */ - case 44: + case 42: switch(ndx) { case 0: p = "cloudabi_signal_t"; @@ -1241,7 +1199,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_random_get */ - case 45: + case 43: switch(ndx) { case 0: p = "userland void *"; @@ -1254,20 +1212,20 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_accept */ - case 46: + case 44: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: - p = "userland cloudabi_sockstat_t *"; + p = "userland void *"; break; default: break; }; break; /* cloudabi_sys_sock_bind */ - case 47: + case 45: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1286,7 +1244,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_connect */ - case 48: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1305,7 +1263,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_listen */ - case 49: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1318,7 +1276,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi32_sys_sock_recv */ - case 50: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1334,7 +1292,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi32_sys_sock_send */ - case 51: + case 49: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1350,7 +1308,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_shutdown */ - case 52: + case 50: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1363,7 +1321,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_stat_get */ - case 53: + case 51: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1379,7 +1337,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi32_sys_thread_create */ - case 54: + case 52: switch(ndx) { case 0: p = "userland cloudabi32_threadattr_t *"; @@ -1389,7 +1347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_thread_exit */ - case 55: + case 53: switch(ndx) { case 0: p = "userland cloudabi_lock_t *"; @@ -1402,7 +1360,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_thread_yield */ - case 56: + case 54: break; default: break; @@ -1580,120 +1538,110 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_lock */ + /* cloudabi_sys_mem_map */ case 33: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_map */ + /* cloudabi_sys_mem_protect */ case 34: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_protect */ + /* cloudabi_sys_mem_sync */ case 35: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_sync */ + /* cloudabi_sys_mem_unmap */ case 36: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_unlock */ - case 37: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_mem_unmap */ - case 38: - if (ndx == 0 || ndx == 1) - p = "void"; - break; /* cloudabi32_sys_poll */ - case 39: + case 37: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi32_sys_poll_fd */ - case 40: + case 38: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_proc_exec */ - case 41: + case 39: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_exit */ - case 42: + case 40: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_fork */ - case 43: + case 41: /* cloudabi_sys_proc_raise */ - case 44: + case 42: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_random_get */ - case 45: + case 43: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_accept */ - case 46: + case 44: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi_sys_sock_bind */ - case 47: + case 45: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_connect */ - case 48: + case 46: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_listen */ - case 49: + case 47: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi32_sys_sock_recv */ - case 50: + case 48: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi32_sys_sock_send */ - case 51: + case 49: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_shutdown */ - case 52: + case 50: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_stat_get */ - case 53: + case 51: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi32_sys_thread_create */ - case 54: + case 52: if (ndx == 0 || ndx == 1) p = "cloudabi_tid_t"; break; /* cloudabi_sys_thread_exit */ - case 55: + case 53: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_thread_yield */ - case 56: + case 54: default: break; }; diff --git a/sys/compat/cloudabi64/cloudabi64_proto.h b/sys/compat/cloudabi64/cloudabi64_proto.h index 08d7264d026d..f1d250fd24d9 100644 --- a/sys/compat/cloudabi64/cloudabi64_proto.h +++ b/sys/compat/cloudabi64/cloudabi64_proto.h @@ -200,10 +200,6 @@ struct cloudabi_sys_mem_advise_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; }; -struct cloudabi_sys_mem_lock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_map_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; @@ -222,10 +218,6 @@ struct cloudabi_sys_mem_sync_args { char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; char flags_l_[PADL_(cloudabi_msflags_t)]; cloudabi_msflags_t flags; char flags_r_[PADR_(cloudabi_msflags_t)]; }; -struct cloudabi_sys_mem_unlock_args { - char mapping_l_[PADL_(const void *)]; const void * mapping; char mapping_r_[PADR_(const void *)]; - char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; -}; struct cloudabi_sys_mem_unmap_args { char mapping_l_[PADL_(void *)]; void * mapping; char mapping_r_[PADR_(void *)]; char mapping_len_l_[PADL_(size_t)]; size_t mapping_len; char mapping_len_r_[PADR_(size_t)]; @@ -265,7 +257,7 @@ struct cloudabi_sys_random_get_args { }; struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; + char unused_l_[PADL_(void *)]; void * unused; char unused_r_[PADR_(void *)]; }; struct cloudabi_sys_sock_bind_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; @@ -345,11 +337,9 @@ int cloudabi_sys_file_symlink(struct thread *, struct cloudabi_sys_file_symlink_ int cloudabi_sys_file_unlink(struct thread *, struct cloudabi_sys_file_unlink_args *); int cloudabi_sys_lock_unlock(struct thread *, struct cloudabi_sys_lock_unlock_args *); int cloudabi_sys_mem_advise(struct thread *, struct cloudabi_sys_mem_advise_args *); -int cloudabi_sys_mem_lock(struct thread *, struct cloudabi_sys_mem_lock_args *); int cloudabi_sys_mem_map(struct thread *, struct cloudabi_sys_mem_map_args *); int cloudabi_sys_mem_protect(struct thread *, struct cloudabi_sys_mem_protect_args *); int cloudabi_sys_mem_sync(struct thread *, struct cloudabi_sys_mem_sync_args *); -int cloudabi_sys_mem_unlock(struct thread *, struct cloudabi_sys_mem_unlock_args *); int cloudabi_sys_mem_unmap(struct thread *, struct cloudabi_sys_mem_unmap_args *); int cloudabi64_sys_poll(struct thread *, struct cloudabi64_sys_poll_args *); int cloudabi64_sys_poll_fd(struct thread *, struct cloudabi64_sys_poll_fd_args *); @@ -399,6 +389,12 @@ int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_ #endif /* COMPAT_FREEBSD10 */ + +#ifdef COMPAT_FREEBSD11 + + +#endif /* COMPAT_FREEBSD11 */ + #define CLOUDABI64_SYS_AUE_cloudabi_sys_clock_res_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_clock_time_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_condvar_signal AUE_NULL @@ -432,11 +428,9 @@ int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_ #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_unlink AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_lock_unlock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_advise AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_lock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_map AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_protect AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_sync AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_unlock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_unmap AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_poll AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_poll_fd AUE_NULL diff --git a/sys/compat/cloudabi64/cloudabi64_sock.c b/sys/compat/cloudabi64/cloudabi64_sock.c index 22ec664729ad..482b6d8f67e9 100644 --- a/sys/compat/cloudabi64/cloudabi64_sock.c +++ b/sys/compat/cloudabi64/cloudabi64_sock.c @@ -75,7 +75,7 @@ cloudabi64_sys_sock_recv(struct thread *td, error = cloudabi_sock_recv(td, uap->sock, iov, ri.ri_data_len, TO_PTR(ri.ri_fds), ri.ri_fds_len, ri.ri_flags, &rdatalen, - &rfdslen, &ro.ro_peername, &ro.ro_flags); + &rfdslen, &ro.ro_flags); free(iov, M_SOCKET); if (error != 0) return (error); @@ -118,7 +118,7 @@ cloudabi64_sys_sock_send(struct thread *td, } error = cloudabi_sock_send(td, uap->sock, iov, si.si_data_len, - TO_PTR(si.si_fds), si.si_fds_len, si.si_flags, &datalen); + TO_PTR(si.si_fds), si.si_fds_len, &datalen); free(iov, M_SOCKET); if (error != 0) return (error); diff --git a/sys/compat/cloudabi64/cloudabi64_syscall.h b/sys/compat/cloudabi64/cloudabi64_syscall.h index 2fcf5b3e6f75..d9d013c77a09 100644 --- a/sys/compat/cloudabi64/cloudabi64_syscall.h +++ b/sys/compat/cloudabi64/cloudabi64_syscall.h @@ -38,28 +38,26 @@ #define CLOUDABI64_SYS_cloudabi_sys_file_unlink 30 #define CLOUDABI64_SYS_cloudabi_sys_lock_unlock 31 #define CLOUDABI64_SYS_cloudabi_sys_mem_advise 32 -#define CLOUDABI64_SYS_cloudabi_sys_mem_lock 33 -#define CLOUDABI64_SYS_cloudabi_sys_mem_map 34 -#define CLOUDABI64_SYS_cloudabi_sys_mem_protect 35 -#define CLOUDABI64_SYS_cloudabi_sys_mem_sync 36 -#define CLOUDABI64_SYS_cloudabi_sys_mem_unlock 37 -#define CLOUDABI64_SYS_cloudabi_sys_mem_unmap 38 -#define CLOUDABI64_SYS_cloudabi64_sys_poll 39 -#define CLOUDABI64_SYS_cloudabi64_sys_poll_fd 40 -#define CLOUDABI64_SYS_cloudabi_sys_proc_exec 41 -#define CLOUDABI64_SYS_cloudabi_sys_proc_exit 42 -#define CLOUDABI64_SYS_cloudabi_sys_proc_fork 43 -#define CLOUDABI64_SYS_cloudabi_sys_proc_raise 44 -#define CLOUDABI64_SYS_cloudabi_sys_random_get 45 -#define CLOUDABI64_SYS_cloudabi_sys_sock_accept 46 -#define CLOUDABI64_SYS_cloudabi_sys_sock_bind 47 -#define CLOUDABI64_SYS_cloudabi_sys_sock_connect 48 -#define CLOUDABI64_SYS_cloudabi_sys_sock_listen 49 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 50 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 51 -#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 52 -#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 53 -#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 54 -#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 55 -#define CLOUDABI64_SYS_cloudabi_sys_thread_yield 56 -#define CLOUDABI64_SYS_MAXSYSCALL 57 +#define CLOUDABI64_SYS_cloudabi_sys_mem_map 33 +#define CLOUDABI64_SYS_cloudabi_sys_mem_protect 34 +#define CLOUDABI64_SYS_cloudabi_sys_mem_sync 35 +#define CLOUDABI64_SYS_cloudabi_sys_mem_unmap 36 +#define CLOUDABI64_SYS_cloudabi64_sys_poll 37 +#define CLOUDABI64_SYS_cloudabi64_sys_poll_fd 38 +#define CLOUDABI64_SYS_cloudabi_sys_proc_exec 39 +#define CLOUDABI64_SYS_cloudabi_sys_proc_exit 40 +#define CLOUDABI64_SYS_cloudabi_sys_proc_fork 41 +#define CLOUDABI64_SYS_cloudabi_sys_proc_raise 42 +#define CLOUDABI64_SYS_cloudabi_sys_random_get 43 +#define CLOUDABI64_SYS_cloudabi_sys_sock_accept 44 +#define CLOUDABI64_SYS_cloudabi_sys_sock_bind 45 +#define CLOUDABI64_SYS_cloudabi_sys_sock_connect 46 +#define CLOUDABI64_SYS_cloudabi_sys_sock_listen 47 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 48 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 49 +#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 50 +#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 51 +#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 52 +#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 53 +#define CLOUDABI64_SYS_cloudabi_sys_thread_yield 54 +#define CLOUDABI64_SYS_MAXSYSCALL 55 diff --git a/sys/compat/cloudabi64/cloudabi64_syscalls.c b/sys/compat/cloudabi64/cloudabi64_syscalls.c index 5b760e0d6877..d46245b12a1b 100644 --- a/sys/compat/cloudabi64/cloudabi64_syscalls.c +++ b/sys/compat/cloudabi64/cloudabi64_syscalls.c @@ -39,28 +39,26 @@ const char *cloudabi64_syscallnames[] = { "cloudabi_sys_file_unlink", /* 30 = cloudabi_sys_file_unlink */ "cloudabi_sys_lock_unlock", /* 31 = cloudabi_sys_lock_unlock */ "cloudabi_sys_mem_advise", /* 32 = cloudabi_sys_mem_advise */ - "cloudabi_sys_mem_lock", /* 33 = cloudabi_sys_mem_lock */ - "cloudabi_sys_mem_map", /* 34 = cloudabi_sys_mem_map */ - "cloudabi_sys_mem_protect", /* 35 = cloudabi_sys_mem_protect */ - "cloudabi_sys_mem_sync", /* 36 = cloudabi_sys_mem_sync */ - "cloudabi_sys_mem_unlock", /* 37 = cloudabi_sys_mem_unlock */ - "cloudabi_sys_mem_unmap", /* 38 = cloudabi_sys_mem_unmap */ - "cloudabi64_sys_poll", /* 39 = cloudabi64_sys_poll */ - "cloudabi64_sys_poll_fd", /* 40 = cloudabi64_sys_poll_fd */ - "cloudabi_sys_proc_exec", /* 41 = cloudabi_sys_proc_exec */ - "cloudabi_sys_proc_exit", /* 42 = cloudabi_sys_proc_exit */ - "cloudabi_sys_proc_fork", /* 43 = cloudabi_sys_proc_fork */ - "cloudabi_sys_proc_raise", /* 44 = cloudabi_sys_proc_raise */ - "cloudabi_sys_random_get", /* 45 = cloudabi_sys_random_get */ - "cloudabi_sys_sock_accept", /* 46 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 47 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 48 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 49 = cloudabi_sys_sock_listen */ - "cloudabi64_sys_sock_recv", /* 50 = cloudabi64_sys_sock_recv */ - "cloudabi64_sys_sock_send", /* 51 = cloudabi64_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 52 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 53 = cloudabi_sys_sock_stat_get */ - "cloudabi64_sys_thread_create", /* 54 = cloudabi64_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 55 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_yield", /* 56 = cloudabi_sys_thread_yield */ + "cloudabi_sys_mem_map", /* 33 = cloudabi_sys_mem_map */ + "cloudabi_sys_mem_protect", /* 34 = cloudabi_sys_mem_protect */ + "cloudabi_sys_mem_sync", /* 35 = cloudabi_sys_mem_sync */ + "cloudabi_sys_mem_unmap", /* 36 = cloudabi_sys_mem_unmap */ + "cloudabi64_sys_poll", /* 37 = cloudabi64_sys_poll */ + "cloudabi64_sys_poll_fd", /* 38 = cloudabi64_sys_poll_fd */ + "cloudabi_sys_proc_exec", /* 39 = cloudabi_sys_proc_exec */ + "cloudabi_sys_proc_exit", /* 40 = cloudabi_sys_proc_exit */ + "cloudabi_sys_proc_fork", /* 41 = cloudabi_sys_proc_fork */ + "cloudabi_sys_proc_raise", /* 42 = cloudabi_sys_proc_raise */ + "cloudabi_sys_random_get", /* 43 = cloudabi_sys_random_get */ + "cloudabi_sys_sock_accept", /* 44 = cloudabi_sys_sock_accept */ + "cloudabi_sys_sock_bind", /* 45 = cloudabi_sys_sock_bind */ + "cloudabi_sys_sock_connect", /* 46 = cloudabi_sys_sock_connect */ + "cloudabi_sys_sock_listen", /* 47 = cloudabi_sys_sock_listen */ + "cloudabi64_sys_sock_recv", /* 48 = cloudabi64_sys_sock_recv */ + "cloudabi64_sys_sock_send", /* 49 = cloudabi64_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 50 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 51 = cloudabi_sys_sock_stat_get */ + "cloudabi64_sys_thread_create", /* 52 = cloudabi64_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 53 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 54 = cloudabi_sys_thread_yield */ }; diff --git a/sys/compat/cloudabi64/cloudabi64_sysent.c b/sys/compat/cloudabi64/cloudabi64_sysent.c index 702032ac921d..97b99087940d 100644 --- a/sys/compat/cloudabi64/cloudabi64_sysent.c +++ b/sys/compat/cloudabi64/cloudabi64_sysent.c @@ -47,28 +47,26 @@ struct sysent cloudabi64_sysent[] = { { AS(cloudabi_sys_file_unlink_args), (sy_call_t *)cloudabi_sys_file_unlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 30 = cloudabi_sys_file_unlink */ { AS(cloudabi_sys_lock_unlock_args), (sy_call_t *)cloudabi_sys_lock_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 31 = cloudabi_sys_lock_unlock */ { AS(cloudabi_sys_mem_advise_args), (sy_call_t *)cloudabi_sys_mem_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 32 = cloudabi_sys_mem_advise */ - { AS(cloudabi_sys_mem_lock_args), (sy_call_t *)cloudabi_sys_mem_lock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_lock */ - { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_map */ - { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_protect */ - { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_sync */ - { AS(cloudabi_sys_mem_unlock_args), (sy_call_t *)cloudabi_sys_mem_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi_sys_mem_unlock */ - { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi_sys_mem_unmap */ - { AS(cloudabi64_sys_poll_args), (sy_call_t *)cloudabi64_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi64_sys_poll */ - { AS(cloudabi64_sys_poll_fd_args), (sy_call_t *)cloudabi64_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi64_sys_poll_fd */ - { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_exec */ - { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_exit */ - { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_proc_fork */ - { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_proc_raise */ - { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_random_get */ - { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi_sys_sock_listen */ - { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi64_sys_sock_recv */ - { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi64_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi64_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 55 = cloudabi_sys_thread_exit */ - { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 56 = cloudabi_sys_thread_yield */ + { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_map */ + { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_protect */ + { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_sync */ + { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_unmap */ + { AS(cloudabi64_sys_poll_args), (sy_call_t *)cloudabi64_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi64_sys_poll */ + { AS(cloudabi64_sys_poll_fd_args), (sy_call_t *)cloudabi64_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi64_sys_poll_fd */ + { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi_sys_proc_exec */ + { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi_sys_proc_exit */ + { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_fork */ + { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_raise */ + { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_random_get */ + { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_sock_accept */ + { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_bind */ + { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_connect */ + { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_listen */ + { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi64_sys_sock_recv */ + { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi64_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi64_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_thread_exit */ + { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_yield */ }; diff --git a/sys/compat/cloudabi64/cloudabi64_systrace_args.c b/sys/compat/cloudabi64/cloudabi64_systrace_args.c index 74005abcf11b..e71a6d869a54 100644 --- a/sys/compat/cloudabi64/cloudabi64_systrace_args.c +++ b/sys/compat/cloudabi64/cloudabi64_systrace_args.c @@ -310,16 +310,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* cloudabi_sys_mem_lock */ - case 33: { - struct cloudabi_sys_mem_lock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_map */ - case 34: { + case 33: { struct cloudabi_sys_mem_map_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ @@ -331,7 +323,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_mem_protect */ - case 35: { + case 34: { struct cloudabi_sys_mem_protect_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -340,7 +332,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_mem_sync */ - case 36: { + case 35: { struct cloudabi_sys_mem_sync_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -348,16 +340,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* cloudabi_sys_mem_unlock */ - case 37: { - struct cloudabi_sys_mem_unlock_args *p = params; - uarg[0] = (intptr_t) p->mapping; /* const void * */ - uarg[1] = p->mapping_len; /* size_t */ - *n_args = 2; - break; - } /* cloudabi_sys_mem_unmap */ - case 38: { + case 36: { struct cloudabi_sys_mem_unmap_args *p = params; uarg[0] = (intptr_t) p->mapping; /* void * */ uarg[1] = p->mapping_len; /* size_t */ @@ -365,7 +349,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi64_sys_poll */ - case 39: { + case 37: { struct cloudabi64_sys_poll_args *p = params; uarg[0] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */ uarg[1] = (intptr_t) p->out; /* cloudabi64_event_t * */ @@ -374,7 +358,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi64_sys_poll_fd */ - case 40: { + case 38: { struct cloudabi64_sys_poll_fd_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */ @@ -386,7 +370,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_proc_exec */ - case 41: { + case 39: { struct cloudabi_sys_proc_exec_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->data; /* const void * */ @@ -397,26 +381,26 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_proc_exit */ - case 42: { + case 40: { struct cloudabi_sys_proc_exit_args *p = params; iarg[0] = p->rval; /* cloudabi_exitcode_t */ *n_args = 1; break; } /* cloudabi_sys_proc_fork */ - case 43: { + case 41: { *n_args = 0; break; } /* cloudabi_sys_proc_raise */ - case 44: { + case 42: { struct cloudabi_sys_proc_raise_args *p = params; iarg[0] = p->sig; /* cloudabi_signal_t */ *n_args = 1; break; } /* cloudabi_sys_random_get */ - case 45: { + case 43: { struct cloudabi_sys_random_get_args *p = params; uarg[0] = (intptr_t) p->buf; /* void * */ uarg[1] = p->buf_len; /* size_t */ @@ -424,15 +408,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_accept */ - case 46: { + case 44: { struct cloudabi_sys_sock_accept_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ - uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ + uarg[1] = (intptr_t) p->unused; /* void * */ *n_args = 2; break; } /* cloudabi_sys_sock_bind */ - case 47: { + case 45: { struct cloudabi_sys_sock_bind_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -442,7 +426,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_connect */ - case 48: { + case 46: { struct cloudabi_sys_sock_connect_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->fd; /* cloudabi_fd_t */ @@ -452,7 +436,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_listen */ - case 49: { + case 47: { struct cloudabi_sys_sock_listen_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->backlog; /* cloudabi_backlog_t */ @@ -460,7 +444,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi64_sys_sock_recv */ - case 50: { + case 48: { struct cloudabi64_sys_sock_recv_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi64_recv_in_t * */ @@ -469,7 +453,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi64_sys_sock_send */ - case 51: { + case 49: { struct cloudabi64_sys_sock_send_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi64_send_in_t * */ @@ -478,7 +462,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_shutdown */ - case 52: { + case 50: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ @@ -486,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_sock_stat_get */ - case 53: { + case 51: { struct cloudabi_sys_sock_stat_get_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ @@ -495,14 +479,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi64_sys_thread_create */ - case 54: { + case 52: { struct cloudabi64_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi64_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 55: { + case 53: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ @@ -510,7 +494,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) break; } /* cloudabi_sys_thread_yield */ - case 56: { + case 54: { *n_args = 0; break; } @@ -1058,21 +1042,8 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* cloudabi_sys_mem_lock */ - case 33: - switch(ndx) { - case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; /* cloudabi_sys_mem_map */ - case 34: + case 33: switch(ndx) { case 0: p = "userland void *"; @@ -1097,7 +1068,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_mem_protect */ - case 35: + case 34: switch(ndx) { case 0: p = "userland void *"; @@ -1113,7 +1084,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_mem_sync */ - case 36: + case 35: switch(ndx) { case 0: p = "userland void *"; @@ -1128,21 +1099,8 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* cloudabi_sys_mem_unlock */ - case 37: - switch(ndx) { - case 0: - p = "userland const void *"; - break; - case 1: - p = "size_t"; - break; - default: - break; - }; - break; /* cloudabi_sys_mem_unmap */ - case 38: + case 36: switch(ndx) { case 0: p = "userland void *"; @@ -1155,7 +1113,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi64_sys_poll */ - case 39: + case 37: switch(ndx) { case 0: p = "userland const cloudabi64_subscription_t *"; @@ -1171,7 +1129,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi64_sys_poll_fd */ - case 40: + case 38: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1196,7 +1154,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_exec */ - case 41: + case 39: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1218,7 +1176,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_exit */ - case 42: + case 40: switch(ndx) { case 0: p = "cloudabi_exitcode_t"; @@ -1228,10 +1186,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_proc_fork */ - case 43: + case 41: break; /* cloudabi_sys_proc_raise */ - case 44: + case 42: switch(ndx) { case 0: p = "cloudabi_signal_t"; @@ -1241,7 +1199,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_random_get */ - case 45: + case 43: switch(ndx) { case 0: p = "userland void *"; @@ -1254,20 +1212,20 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_accept */ - case 46: + case 44: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: - p = "userland cloudabi_sockstat_t *"; + p = "userland void *"; break; default: break; }; break; /* cloudabi_sys_sock_bind */ - case 47: + case 45: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1286,7 +1244,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_connect */ - case 48: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1305,7 +1263,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_listen */ - case 49: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1318,7 +1276,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi64_sys_sock_recv */ - case 50: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1334,7 +1292,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi64_sys_sock_send */ - case 51: + case 49: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1350,7 +1308,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_shutdown */ - case 52: + case 50: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1363,7 +1321,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_sock_stat_get */ - case 53: + case 51: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1379,7 +1337,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi64_sys_thread_create */ - case 54: + case 52: switch(ndx) { case 0: p = "userland cloudabi64_threadattr_t *"; @@ -1389,7 +1347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_thread_exit */ - case 55: + case 53: switch(ndx) { case 0: p = "userland cloudabi_lock_t *"; @@ -1402,7 +1360,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) }; break; /* cloudabi_sys_thread_yield */ - case 56: + case 54: break; default: break; @@ -1580,120 +1538,110 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_lock */ + /* cloudabi_sys_mem_map */ case 33: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_map */ + /* cloudabi_sys_mem_protect */ case 34: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_protect */ + /* cloudabi_sys_mem_sync */ case 35: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_sync */ + /* cloudabi_sys_mem_unmap */ case 36: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_mem_unlock */ - case 37: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_mem_unmap */ - case 38: - if (ndx == 0 || ndx == 1) - p = "void"; - break; /* cloudabi64_sys_poll */ - case 39: + case 37: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi64_sys_poll_fd */ - case 40: + case 38: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_proc_exec */ - case 41: + case 39: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_exit */ - case 42: + case 40: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_fork */ - case 43: + case 41: /* cloudabi_sys_proc_raise */ - case 44: + case 42: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_random_get */ - case 45: + case 43: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_accept */ - case 46: + case 44: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi_sys_sock_bind */ - case 47: + case 45: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_connect */ - case 48: + case 46: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_listen */ - case 49: + case 47: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_sock_recv */ - case 50: + case 48: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_sock_send */ - case 51: + case 49: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_shutdown */ - case 52: + case 50: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_stat_get */ - case 53: + case 51: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_thread_create */ - case 54: + case 52: if (ndx == 0 || ndx == 1) p = "cloudabi_tid_t"; break; /* cloudabi_sys_thread_exit */ - case 55: + case 53: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_thread_yield */ - case 56: + case 54: default: break; }; diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 479e3cd25be6..5421b3cfb795 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -201,9 +201,9 @@ _meta_filemon= 1 # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used # for _meta_filemon but not for _SKIP_DEPEND. -.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \ +.if !defined(NO_SKIP_DEPEND) && (make(*obj) || \ ${.TARGETS:M*clean*} == ${.TARGETS} || \ - ${.TARGETS:M*install*} == ${.TARGETS} + ${.TARGETS:M*install*} == ${.TARGETS}) _SKIP_DEPEND= 1 .endif .if defined(_SKIP_DEPEND) || defined(_meta_filemon) diff --git a/sys/contrib/cloudabi/cloudabi32_types.h b/sys/contrib/cloudabi/cloudabi32_types.h index 2986e894c2b9..95dac188e4fd 100644 --- a/sys/contrib/cloudabi/cloudabi32_types.h +++ b/sys/contrib/cloudabi/cloudabi32_types.h @@ -109,7 +109,7 @@ typedef struct { _Alignas(4) uint32_t ri_data_len; _Alignas(4) uint32_t ri_fds; _Alignas(4) uint32_t ri_fds_len; - _Alignas(2) cloudabi_msgflags_t ri_flags; + _Alignas(2) cloudabi_riflags_t ri_flags; } cloudabi32_recv_in_t; _Static_assert(offsetof(cloudabi32_recv_in_t, ri_data) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi32_recv_in_t, ri_data_len) == 4, "Incorrect layout"); @@ -119,12 +119,25 @@ _Static_assert(offsetof(cloudabi32_recv_in_t, ri_flags) == 16, "Incorrect layout _Static_assert(sizeof(cloudabi32_recv_in_t) == 20, "Incorrect layout"); _Static_assert(_Alignof(cloudabi32_recv_in_t) == 4, "Incorrect layout"); +typedef struct { + _Alignas(4) uint32_t ro_datalen; + _Alignas(4) uint32_t ro_fdslen; + _Alignas(1) char ro_unused[40]; + _Alignas(2) cloudabi_roflags_t ro_flags; +} cloudabi32_recv_out_t; +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_datalen) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_fdslen) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_unused) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_flags) == 48, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_recv_out_t) == 52, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_recv_out_t) == 4, "Incorrect layout"); + typedef struct { _Alignas(4) uint32_t si_data; _Alignas(4) uint32_t si_data_len; _Alignas(4) uint32_t si_fds; _Alignas(4) uint32_t si_fds_len; - _Alignas(2) cloudabi_msgflags_t si_flags; + _Alignas(2) cloudabi_siflags_t si_flags; } cloudabi32_send_in_t; _Static_assert(offsetof(cloudabi32_send_in_t, si_data) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi32_send_in_t, si_data_len) == 4, "Incorrect layout"); @@ -201,21 +214,6 @@ _Static_assert(_Alignof(cloudabi32_tcb_t) == 4, "Incorrect layout"); typedef void cloudabi32_threadentry_t(cloudabi_tid_t tid, uint32_t aux); -typedef struct { - _Alignas(4) uint32_t ro_datalen; - _Alignas(4) uint32_t ro_fdslen; - _Alignas(2) cloudabi_sockaddr_t ro_sockname; - _Alignas(2) cloudabi_sockaddr_t ro_peername; - _Alignas(2) cloudabi_msgflags_t ro_flags; -} cloudabi32_recv_out_t; -_Static_assert(offsetof(cloudabi32_recv_out_t, ro_datalen) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi32_recv_out_t, ro_fdslen) == 4, "Incorrect layout"); -_Static_assert(offsetof(cloudabi32_recv_out_t, ro_sockname) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi32_recv_out_t, ro_peername) == 28, "Incorrect layout"); -_Static_assert(offsetof(cloudabi32_recv_out_t, ro_flags) == 48, "Incorrect layout"); -_Static_assert(sizeof(cloudabi32_recv_out_t) == 52, "Incorrect layout"); -_Static_assert(_Alignof(cloudabi32_recv_out_t) == 4, "Incorrect layout"); - typedef struct { _Alignas(4) uint32_t entry_point; _Alignas(4) uint32_t stack; diff --git a/sys/contrib/cloudabi/cloudabi64_types.h b/sys/contrib/cloudabi/cloudabi64_types.h index 0a185ac47d0e..bb624cf736c2 100644 --- a/sys/contrib/cloudabi/cloudabi64_types.h +++ b/sys/contrib/cloudabi/cloudabi64_types.h @@ -109,7 +109,7 @@ typedef struct { _Alignas(8) uint64_t ri_data_len; _Alignas(8) uint64_t ri_fds; _Alignas(8) uint64_t ri_fds_len; - _Alignas(2) cloudabi_msgflags_t ri_flags; + _Alignas(2) cloudabi_riflags_t ri_flags; } cloudabi64_recv_in_t; _Static_assert(offsetof(cloudabi64_recv_in_t, ri_data) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_recv_in_t, ri_data_len) == 8, "Incorrect layout"); @@ -119,12 +119,25 @@ _Static_assert(offsetof(cloudabi64_recv_in_t, ri_flags) == 32, "Incorrect layout _Static_assert(sizeof(cloudabi64_recv_in_t) == 40, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_recv_in_t) == 8, "Incorrect layout"); +typedef struct { + _Alignas(8) uint64_t ro_datalen; + _Alignas(8) uint64_t ro_fdslen; + _Alignas(1) char ro_unused[40]; + _Alignas(2) cloudabi_roflags_t ro_flags; +} cloudabi64_recv_out_t; +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_unused) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, "Incorrect layout"); +_Static_assert(sizeof(cloudabi64_recv_out_t) == 64, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi64_recv_out_t) == 8, "Incorrect layout"); + typedef struct { _Alignas(8) uint64_t si_data; _Alignas(8) uint64_t si_data_len; _Alignas(8) uint64_t si_fds; _Alignas(8) uint64_t si_fds_len; - _Alignas(2) cloudabi_msgflags_t si_flags; + _Alignas(2) cloudabi_siflags_t si_flags; } cloudabi64_send_in_t; _Static_assert(offsetof(cloudabi64_send_in_t, si_data) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_send_in_t, si_data_len) == 8, "Incorrect layout"); @@ -201,21 +214,6 @@ _Static_assert(_Alignof(cloudabi64_tcb_t) == 8, "Incorrect layout"); typedef void cloudabi64_threadentry_t(cloudabi_tid_t tid, uint64_t aux); -typedef struct { - _Alignas(8) uint64_t ro_datalen; - _Alignas(8) uint64_t ro_fdslen; - _Alignas(2) cloudabi_sockaddr_t ro_sockname; - _Alignas(2) cloudabi_sockaddr_t ro_peername; - _Alignas(2) cloudabi_msgflags_t ro_flags; -} cloudabi64_recv_out_t; -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_sockname) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_peername) == 36, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, "Incorrect layout"); -_Static_assert(sizeof(cloudabi64_recv_out_t) == 64, "Incorrect layout"); -_Static_assert(_Alignof(cloudabi64_recv_out_t) == 8, "Incorrect layout"); - typedef struct { _Alignas(8) uint64_t entry_point; _Alignas(8) uint64_t stack; diff --git a/sys/contrib/cloudabi/cloudabi_types_common.h b/sys/contrib/cloudabi/cloudabi_types_common.h index 86e76d3fbbbf..b5c204e859e8 100644 --- a/sys/contrib/cloudabi/cloudabi_types_common.h +++ b/sys/contrib/cloudabi/cloudabi_types_common.h @@ -197,7 +197,6 @@ typedef uint8_t cloudabi_filetype_t; #define CLOUDABI_FILETYPE_REGULAR_FILE 96 #define CLOUDABI_FILETYPE_SHARED_MEMORY 112 #define CLOUDABI_FILETYPE_SOCKET_DGRAM 128 -#define CLOUDABI_FILETYPE_SOCKET_SEQPACKET 129 #define CLOUDABI_FILETYPE_SOCKET_STREAM 130 #define CLOUDABI_FILETYPE_SYMBOLIC_LINK 144 @@ -237,13 +236,6 @@ typedef uint8_t cloudabi_msflags_t; #define CLOUDABI_MS_INVALIDATE 0x02 #define CLOUDABI_MS_SYNC 0x04 -typedef uint16_t cloudabi_msgflags_t; -#define CLOUDABI_MSG_CTRUNC 0x0001 -#define CLOUDABI_MSG_EOR 0x0002 -#define CLOUDABI_MSG_PEEK 0x0004 -#define CLOUDABI_MSG_TRUNC 0x0008 -#define CLOUDABI_MSG_WAITALL 0x0010 - typedef uint32_t cloudabi_nthreads_t; typedef uint16_t cloudabi_oflags_t; @@ -252,6 +244,10 @@ typedef uint16_t cloudabi_oflags_t; #define CLOUDABI_O_EXCL 0x0004 #define CLOUDABI_O_TRUNC 0x0008 +typedef uint16_t cloudabi_riflags_t; +#define CLOUDABI_SOCK_RECV_PEEK 0x0004 +#define CLOUDABI_SOCK_RECV_WAITALL 0x0010 + typedef uint64_t cloudabi_rights_t; #define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001 #define CLOUDABI_RIGHT_FD_READ 0x0000000000000002 @@ -295,11 +291,9 @@ typedef uint64_t cloudabi_rights_t; #define CLOUDABI_RIGHT_SOCK_SHUTDOWN 0x0000008000000000 #define CLOUDABI_RIGHT_SOCK_STAT_GET 0x0000010000000000 -typedef uint8_t cloudabi_sa_family_t; -#define CLOUDABI_AF_UNSPEC 0 -#define CLOUDABI_AF_INET 1 -#define CLOUDABI_AF_INET6 2 -#define CLOUDABI_AF_UNIX 3 +typedef uint16_t cloudabi_roflags_t; +#define CLOUDABI_SOCK_RECV_FDS_TRUNCATED 0x0001 +#define CLOUDABI_SOCK_RECV_DATA_TRUNCATED 0x0008 typedef uint8_t cloudabi_scope_t; #define CLOUDABI_SCOPE_PRIVATE 4 @@ -309,6 +303,8 @@ typedef uint8_t cloudabi_sdflags_t; #define CLOUDABI_SHUT_RD 0x01 #define CLOUDABI_SHUT_WR 0x02 +typedef uint16_t cloudabi_siflags_t; + typedef uint8_t cloudabi_signal_t; #define CLOUDABI_SIGABRT 1 #define CLOUDABI_SIGALRM 2 @@ -428,34 +424,11 @@ _Static_assert(sizeof(cloudabi_lookup_t) == 8, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_lookup_t) == 4, "Incorrect layout"); typedef struct { - _Alignas(1) cloudabi_sa_family_t sa_family; - union { - struct { - _Alignas(1) uint8_t addr[4]; - _Alignas(2) uint16_t port; - } sa_inet; - struct { - _Alignas(1) uint8_t addr[16]; - _Alignas(2) uint16_t port; - } sa_inet6; - }; -} cloudabi_sockaddr_t; -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_family) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.addr) == 2, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.port) == 6, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.addr) == 2, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.port) == 18, "Incorrect layout"); -_Static_assert(sizeof(cloudabi_sockaddr_t) == 20, "Incorrect layout"); -_Static_assert(_Alignof(cloudabi_sockaddr_t) == 2, "Incorrect layout"); - -typedef struct { - _Alignas(2) cloudabi_sockaddr_t ss_sockname; - _Alignas(2) cloudabi_sockaddr_t ss_peername; + _Alignas(1) char ss_unused[40]; _Alignas(2) cloudabi_errno_t ss_error; _Alignas(4) cloudabi_sstate_t ss_state; } cloudabi_sockstat_t; -_Static_assert(offsetof(cloudabi_sockstat_t, ss_sockname) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockstat_t, ss_peername) == 20, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockstat_t, ss_unused) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi_sockstat_t, ss_error) == 40, "Incorrect layout"); _Static_assert(offsetof(cloudabi_sockstat_t, ss_state) == 44, "Incorrect layout"); _Static_assert(sizeof(cloudabi_sockstat_t) == 48, "Incorrect layout"); diff --git a/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S b/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S index 3acebc1b11ae..80f8084ce230 100644 --- a/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S +++ b/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S @@ -311,15 +311,9 @@ ENTRY(cloudabi_sys_mem_advise) ret END(cloudabi_sys_mem_advise) -ENTRY(cloudabi_sys_mem_lock) - mov w8, #33 - svc #0 - ret -END(cloudabi_sys_mem_lock) - ENTRY(cloudabi_sys_mem_map) str x6, [sp, #-8] - mov w8, #34 + mov w8, #33 svc #0 ldr x2, [sp, #-8] b.cs 1f @@ -330,32 +324,26 @@ ENTRY(cloudabi_sys_mem_map) END(cloudabi_sys_mem_map) ENTRY(cloudabi_sys_mem_protect) - mov w8, #35 + mov w8, #34 svc #0 ret END(cloudabi_sys_mem_protect) ENTRY(cloudabi_sys_mem_sync) - mov w8, #36 + mov w8, #35 svc #0 ret END(cloudabi_sys_mem_sync) -ENTRY(cloudabi_sys_mem_unlock) - mov w8, #37 - svc #0 - ret -END(cloudabi_sys_mem_unlock) - ENTRY(cloudabi_sys_mem_unmap) - mov w8, #38 + mov w8, #36 svc #0 ret END(cloudabi_sys_mem_unmap) ENTRY(cloudabi_sys_poll) str x3, [sp, #-8] - mov w8, #39 + mov w8, #37 svc #0 ldr x2, [sp, #-8] b.cs 1f @@ -367,7 +355,7 @@ END(cloudabi_sys_poll) ENTRY(cloudabi_sys_poll_fd) str x6, [sp, #-8] - mov w8, #40 + mov w8, #38 svc #0 ldr x2, [sp, #-8] b.cs 1f @@ -378,19 +366,19 @@ ENTRY(cloudabi_sys_poll_fd) END(cloudabi_sys_poll_fd) ENTRY(cloudabi_sys_proc_exec) - mov w8, #41 + mov w8, #39 svc #0 ret END(cloudabi_sys_proc_exec) ENTRY(cloudabi_sys_proc_exit) - mov w8, #42 + mov w8, #40 svc #0 END(cloudabi_sys_proc_exit) ENTRY(cloudabi_sys_proc_fork) stp x0, x1, [sp, #-16] - mov w8, #43 + mov w8, #41 svc #0 ldp x2, x3, [sp, #-16] b.cs 1f @@ -402,20 +390,20 @@ ENTRY(cloudabi_sys_proc_fork) END(cloudabi_sys_proc_fork) ENTRY(cloudabi_sys_proc_raise) - mov w8, #44 + mov w8, #42 svc #0 ret END(cloudabi_sys_proc_raise) ENTRY(cloudabi_sys_random_get) - mov w8, #45 + mov w8, #43 svc #0 ret END(cloudabi_sys_random_get) ENTRY(cloudabi_sys_sock_accept) str x2, [sp, #-8] - mov w8, #46 + mov w8, #44 svc #0 ldr x2, [sp, #-8] b.cs 1f @@ -426,50 +414,50 @@ ENTRY(cloudabi_sys_sock_accept) END(cloudabi_sys_sock_accept) ENTRY(cloudabi_sys_sock_bind) - mov w8, #47 + mov w8, #45 svc #0 ret END(cloudabi_sys_sock_bind) ENTRY(cloudabi_sys_sock_connect) - mov w8, #48 + mov w8, #46 svc #0 ret END(cloudabi_sys_sock_connect) ENTRY(cloudabi_sys_sock_listen) - mov w8, #49 + mov w8, #47 svc #0 ret END(cloudabi_sys_sock_listen) ENTRY(cloudabi_sys_sock_recv) - mov w8, #50 + mov w8, #48 svc #0 ret END(cloudabi_sys_sock_recv) ENTRY(cloudabi_sys_sock_send) - mov w8, #51 + mov w8, #49 svc #0 ret END(cloudabi_sys_sock_send) ENTRY(cloudabi_sys_sock_shutdown) - mov w8, #52 + mov w8, #50 svc #0 ret END(cloudabi_sys_sock_shutdown) ENTRY(cloudabi_sys_sock_stat_get) - mov w8, #53 + mov w8, #51 svc #0 ret END(cloudabi_sys_sock_stat_get) ENTRY(cloudabi_sys_thread_create) str x1, [sp, #-8] - mov w8, #54 + mov w8, #52 svc #0 ldr x2, [sp, #-8] b.cs 1f @@ -480,12 +468,12 @@ ENTRY(cloudabi_sys_thread_create) END(cloudabi_sys_thread_create) ENTRY(cloudabi_sys_thread_exit) - mov w8, #55 + mov w8, #53 svc #0 END(cloudabi_sys_thread_exit) ENTRY(cloudabi_sys_thread_yield) - mov w8, #56 + mov w8, #54 svc #0 ret END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_armv6.S b/sys/contrib/cloudabi/cloudabi_vdso_armv6.S index b4d68cc9b658..26944ff6bc44 100644 --- a/sys/contrib/cloudabi/cloudabi_vdso_armv6.S +++ b/sys/contrib/cloudabi/cloudabi_vdso_armv6.S @@ -283,14 +283,8 @@ ENTRY(cloudabi_sys_mem_advise) bx lr END(cloudabi_sys_mem_advise) -ENTRY(cloudabi_sys_mem_lock) - mov ip, #33 - swi 0 - bx lr -END(cloudabi_sys_mem_lock) - ENTRY(cloudabi_sys_mem_map) - mov ip, #34 + mov ip, #33 swi 0 ldrcc r2, [sp, #16] strcc r0, [r2] @@ -299,32 +293,26 @@ ENTRY(cloudabi_sys_mem_map) END(cloudabi_sys_mem_map) ENTRY(cloudabi_sys_mem_protect) - mov ip, #35 + mov ip, #34 swi 0 bx lr END(cloudabi_sys_mem_protect) ENTRY(cloudabi_sys_mem_sync) - mov ip, #36 + mov ip, #35 swi 0 bx lr END(cloudabi_sys_mem_sync) -ENTRY(cloudabi_sys_mem_unlock) - mov ip, #37 - swi 0 - bx lr -END(cloudabi_sys_mem_unlock) - ENTRY(cloudabi_sys_mem_unmap) - mov ip, #38 + mov ip, #36 swi 0 bx lr END(cloudabi_sys_mem_unmap) ENTRY(cloudabi_sys_poll) str r3, [sp, #-4] - mov ip, #39 + mov ip, #37 swi 0 ldrcc r2, [sp, #-4] strcc r0, [r2] @@ -333,7 +321,7 @@ ENTRY(cloudabi_sys_poll) END(cloudabi_sys_poll) ENTRY(cloudabi_sys_poll_fd) - mov ip, #40 + mov ip, #38 swi 0 ldrcc r2, [sp, #8] strcc r0, [r2] @@ -342,20 +330,20 @@ ENTRY(cloudabi_sys_poll_fd) END(cloudabi_sys_poll_fd) ENTRY(cloudabi_sys_proc_exec) - mov ip, #41 + mov ip, #39 swi 0 bx lr END(cloudabi_sys_proc_exec) ENTRY(cloudabi_sys_proc_exit) - mov ip, #42 + mov ip, #40 swi 0 END(cloudabi_sys_proc_exit) ENTRY(cloudabi_sys_proc_fork) str r0, [sp, #-4] str r1, [sp, #-8] - mov ip, #43 + mov ip, #41 swi 0 ldrcc r2, [sp, #-4] ldrcc r3, [sp, #-8] @@ -366,20 +354,20 @@ ENTRY(cloudabi_sys_proc_fork) END(cloudabi_sys_proc_fork) ENTRY(cloudabi_sys_proc_raise) - mov ip, #44 + mov ip, #42 swi 0 bx lr END(cloudabi_sys_proc_raise) ENTRY(cloudabi_sys_random_get) - mov ip, #45 + mov ip, #43 swi 0 bx lr END(cloudabi_sys_random_get) ENTRY(cloudabi_sys_sock_accept) str r2, [sp, #-4] - mov ip, #46 + mov ip, #44 swi 0 ldrcc r2, [sp, #-4] strcc r0, [r2] @@ -388,50 +376,50 @@ ENTRY(cloudabi_sys_sock_accept) END(cloudabi_sys_sock_accept) ENTRY(cloudabi_sys_sock_bind) - mov ip, #47 + mov ip, #45 swi 0 bx lr END(cloudabi_sys_sock_bind) ENTRY(cloudabi_sys_sock_connect) - mov ip, #48 + mov ip, #46 swi 0 bx lr END(cloudabi_sys_sock_connect) ENTRY(cloudabi_sys_sock_listen) - mov ip, #49 + mov ip, #47 swi 0 bx lr END(cloudabi_sys_sock_listen) ENTRY(cloudabi_sys_sock_recv) - mov ip, #50 + mov ip, #48 swi 0 bx lr END(cloudabi_sys_sock_recv) ENTRY(cloudabi_sys_sock_send) - mov ip, #51 + mov ip, #49 swi 0 bx lr END(cloudabi_sys_sock_send) ENTRY(cloudabi_sys_sock_shutdown) - mov ip, #52 + mov ip, #50 swi 0 bx lr END(cloudabi_sys_sock_shutdown) ENTRY(cloudabi_sys_sock_stat_get) - mov ip, #53 + mov ip, #51 swi 0 bx lr END(cloudabi_sys_sock_stat_get) ENTRY(cloudabi_sys_thread_create) str r1, [sp, #-4] - mov ip, #54 + mov ip, #52 swi 0 ldrcc r2, [sp, #-4] strcc r0, [r2] @@ -440,12 +428,12 @@ ENTRY(cloudabi_sys_thread_create) END(cloudabi_sys_thread_create) ENTRY(cloudabi_sys_thread_exit) - mov ip, #55 + mov ip, #53 swi 0 END(cloudabi_sys_thread_exit) ENTRY(cloudabi_sys_thread_yield) - mov ip, #56 + mov ip, #54 swi 0 bx lr END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_i686.S b/sys/contrib/cloudabi/cloudabi_vdso_i686.S index d02c6e18dcde..a226103d57b6 100644 --- a/sys/contrib/cloudabi/cloudabi_vdso_i686.S +++ b/sys/contrib/cloudabi/cloudabi_vdso_i686.S @@ -302,14 +302,8 @@ ENTRY(cloudabi_sys_mem_advise) ret END(cloudabi_sys_mem_advise) -ENTRY(cloudabi_sys_mem_lock) - mov $33, %eax - int $0x80 - ret -END(cloudabi_sys_mem_lock) - ENTRY(cloudabi_sys_mem_map) - mov $34, %eax + mov $33, %eax int $0x80 jc 1f mov 32(%esp), %ecx @@ -320,31 +314,25 @@ ENTRY(cloudabi_sys_mem_map) END(cloudabi_sys_mem_map) ENTRY(cloudabi_sys_mem_protect) - mov $35, %eax + mov $34, %eax int $0x80 ret END(cloudabi_sys_mem_protect) ENTRY(cloudabi_sys_mem_sync) - mov $36, %eax + mov $35, %eax int $0x80 ret END(cloudabi_sys_mem_sync) -ENTRY(cloudabi_sys_mem_unlock) - mov $37, %eax - int $0x80 - ret -END(cloudabi_sys_mem_unlock) - ENTRY(cloudabi_sys_mem_unmap) - mov $38, %eax + mov $36, %eax int $0x80 ret END(cloudabi_sys_mem_unmap) ENTRY(cloudabi_sys_poll) - mov $39, %eax + mov $37, %eax int $0x80 jc 1f mov 16(%esp), %ecx @@ -355,7 +343,7 @@ ENTRY(cloudabi_sys_poll) END(cloudabi_sys_poll) ENTRY(cloudabi_sys_poll_fd) - mov $40, %eax + mov $38, %eax int $0x80 jc 1f mov 28(%esp), %ecx @@ -366,18 +354,18 @@ ENTRY(cloudabi_sys_poll_fd) END(cloudabi_sys_poll_fd) ENTRY(cloudabi_sys_proc_exec) - mov $41, %eax + mov $39, %eax int $0x80 ret END(cloudabi_sys_proc_exec) ENTRY(cloudabi_sys_proc_exit) - mov $42, %eax + mov $40, %eax int $0x80 END(cloudabi_sys_proc_exit) ENTRY(cloudabi_sys_proc_fork) - mov $43, %eax + mov $41, %eax int $0x80 jc 1f mov 4(%esp), %ecx @@ -390,19 +378,19 @@ ENTRY(cloudabi_sys_proc_fork) END(cloudabi_sys_proc_fork) ENTRY(cloudabi_sys_proc_raise) - mov $44, %eax + mov $42, %eax int $0x80 ret END(cloudabi_sys_proc_raise) ENTRY(cloudabi_sys_random_get) - mov $45, %eax + mov $43, %eax int $0x80 ret END(cloudabi_sys_random_get) ENTRY(cloudabi_sys_sock_accept) - mov $46, %eax + mov $44, %eax int $0x80 jc 1f mov 12(%esp), %ecx @@ -413,49 +401,49 @@ ENTRY(cloudabi_sys_sock_accept) END(cloudabi_sys_sock_accept) ENTRY(cloudabi_sys_sock_bind) - mov $47, %eax + mov $45, %eax int $0x80 ret END(cloudabi_sys_sock_bind) ENTRY(cloudabi_sys_sock_connect) - mov $48, %eax + mov $46, %eax int $0x80 ret END(cloudabi_sys_sock_connect) ENTRY(cloudabi_sys_sock_listen) - mov $49, %eax + mov $47, %eax int $0x80 ret END(cloudabi_sys_sock_listen) ENTRY(cloudabi_sys_sock_recv) - mov $50, %eax + mov $48, %eax int $0x80 ret END(cloudabi_sys_sock_recv) ENTRY(cloudabi_sys_sock_send) - mov $51, %eax + mov $49, %eax int $0x80 ret END(cloudabi_sys_sock_send) ENTRY(cloudabi_sys_sock_shutdown) - mov $52, %eax + mov $50, %eax int $0x80 ret END(cloudabi_sys_sock_shutdown) ENTRY(cloudabi_sys_sock_stat_get) - mov $53, %eax + mov $51, %eax int $0x80 ret END(cloudabi_sys_sock_stat_get) ENTRY(cloudabi_sys_thread_create) - mov $54, %eax + mov $52, %eax int $0x80 jc 1f mov 8(%esp), %ecx @@ -466,12 +454,12 @@ ENTRY(cloudabi_sys_thread_create) END(cloudabi_sys_thread_create) ENTRY(cloudabi_sys_thread_exit) - mov $55, %eax + mov $53, %eax int $0x80 END(cloudabi_sys_thread_exit) ENTRY(cloudabi_sys_thread_yield) - mov $56, %eax + mov $54, %eax int $0x80 ret END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S b/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S index 74f59dbdc6b3..a9bb629904aa 100644 --- a/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S +++ b/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S @@ -759,23 +759,6 @@ ENTRY(cloudabi_sys_mem_advise) ret END(cloudabi_sys_mem_advise) -ENTRY(cloudabi_sys_mem_lock) - push %ebp - mov %esp, %ebp - mov 8(%ebp), %ecx - mov %ecx, -16(%ebp) - movl $0, -12(%ebp) - mov 12(%ebp), %ecx - mov %ecx, -8(%ebp) - movl $0, -4(%ebp) - mov $33, %eax - mov %ebp, %ecx - sub $16, %ecx - int $0x80 - pop %ebp - ret -END(cloudabi_sys_mem_lock) - ENTRY(cloudabi_sys_mem_map) push %ebp mov %esp, %ebp @@ -795,7 +778,7 @@ ENTRY(cloudabi_sys_mem_map) mov %ecx, -8(%ebp) mov 32(%ebp), %ecx mov %ecx, -4(%ebp) - mov $34, %eax + mov $33, %eax mov %ebp, %ecx sub $48, %ecx int $0x80 @@ -820,7 +803,7 @@ ENTRY(cloudabi_sys_mem_protect) movl $0, -12(%ebp) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) - mov $35, %eax + mov $34, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -839,7 +822,7 @@ ENTRY(cloudabi_sys_mem_sync) movl $0, -12(%ebp) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) - mov $36, %eax + mov $35, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -847,23 +830,6 @@ ENTRY(cloudabi_sys_mem_sync) ret END(cloudabi_sys_mem_sync) -ENTRY(cloudabi_sys_mem_unlock) - push %ebp - mov %esp, %ebp - mov 8(%ebp), %ecx - mov %ecx, -16(%ebp) - movl $0, -12(%ebp) - mov 12(%ebp), %ecx - mov %ecx, -8(%ebp) - movl $0, -4(%ebp) - mov $37, %eax - mov %ebp, %ecx - sub $16, %ecx - int $0x80 - pop %ebp - ret -END(cloudabi_sys_mem_unlock) - ENTRY(cloudabi_sys_mem_unmap) push %ebp mov %esp, %ebp @@ -873,7 +839,7 @@ ENTRY(cloudabi_sys_mem_unmap) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $38, %eax + mov $36, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -893,7 +859,7 @@ ENTRY(cloudabi_sys_poll) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $39, %eax + mov $37, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -927,7 +893,7 @@ ENTRY(cloudabi_sys_poll_fd) mov 28(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $40, %eax + mov $38, %eax mov %ebp, %ecx sub $48, %ecx int $0x80 @@ -958,7 +924,7 @@ ENTRY(cloudabi_sys_proc_exec) mov 24(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $41, %eax + mov $39, %eax mov %ebp, %ecx sub $40, %ecx int $0x80 @@ -971,7 +937,7 @@ ENTRY(cloudabi_sys_proc_exit) mov %esp, %ebp mov 8(%ebp), %ecx mov %ecx, -16(%ebp) - mov $42, %eax + mov $40, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -980,7 +946,7 @@ END(cloudabi_sys_proc_exit) ENTRY(cloudabi_sys_proc_fork) push %ebp mov %esp, %ebp - mov $43, %eax + mov $41, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1002,7 +968,7 @@ ENTRY(cloudabi_sys_proc_raise) mov %esp, %ebp mov 8(%ebp), %ecx mov %ecx, -16(%ebp) - mov $44, %eax + mov $42, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1019,7 +985,7 @@ ENTRY(cloudabi_sys_random_get) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $45, %eax + mov $43, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1035,7 +1001,7 @@ ENTRY(cloudabi_sys_sock_accept) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $46, %eax + mov $44, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1062,7 +1028,7 @@ ENTRY(cloudabi_sys_sock_bind) mov 20(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $47, %eax + mov $45, %eax mov %ebp, %ecx sub $32, %ecx int $0x80 @@ -1083,7 +1049,7 @@ ENTRY(cloudabi_sys_sock_connect) mov 20(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $48, %eax + mov $46, %eax mov %ebp, %ecx sub $32, %ecx int $0x80 @@ -1098,7 +1064,7 @@ ENTRY(cloudabi_sys_sock_listen) mov %ecx, -16(%ebp) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) - mov $49, %eax + mov $47, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1117,7 +1083,7 @@ ENTRY(cloudabi_sys_sock_recv) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $50, %eax + mov $48, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -1136,7 +1102,7 @@ ENTRY(cloudabi_sys_sock_send) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) movl $0, -4(%ebp) - mov $51, %eax + mov $49, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -1151,7 +1117,7 @@ ENTRY(cloudabi_sys_sock_shutdown) mov %ecx, -16(%ebp) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) - mov $52, %eax + mov $50, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1169,7 +1135,7 @@ ENTRY(cloudabi_sys_sock_stat_get) movl $0, -12(%ebp) mov 16(%ebp), %ecx mov %ecx, -8(%ebp) - mov $53, %eax + mov $51, %eax mov %ebp, %ecx sub $24, %ecx int $0x80 @@ -1183,7 +1149,7 @@ ENTRY(cloudabi_sys_thread_create) mov 8(%ebp), %ecx mov %ecx, -16(%ebp) movl $0, -12(%ebp) - mov $54, %eax + mov $52, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1205,7 +1171,7 @@ ENTRY(cloudabi_sys_thread_exit) movl $0, -12(%ebp) mov 12(%ebp), %ecx mov %ecx, -8(%ebp) - mov $55, %eax + mov $53, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 @@ -1214,7 +1180,7 @@ END(cloudabi_sys_thread_exit) ENTRY(cloudabi_sys_thread_yield) push %ebp mov %esp, %ebp - mov $56, %eax + mov $54, %eax mov %ebp, %ecx sub $16, %ecx int $0x80 diff --git a/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S b/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S index 049cb0d8a0cf..c68047cc6e3d 100644 --- a/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S +++ b/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S @@ -326,15 +326,9 @@ ENTRY(cloudabi_sys_mem_advise) ret END(cloudabi_sys_mem_advise) -ENTRY(cloudabi_sys_mem_lock) - mov $33, %eax - syscall - ret -END(cloudabi_sys_mem_lock) - ENTRY(cloudabi_sys_mem_map) mov %rcx, %r10 - mov $34, %eax + mov $33, %eax syscall jc 1f mov 8(%rsp), %rcx @@ -345,32 +339,26 @@ ENTRY(cloudabi_sys_mem_map) END(cloudabi_sys_mem_map) ENTRY(cloudabi_sys_mem_protect) - mov $35, %eax + mov $34, %eax syscall ret END(cloudabi_sys_mem_protect) ENTRY(cloudabi_sys_mem_sync) - mov $36, %eax + mov $35, %eax syscall ret END(cloudabi_sys_mem_sync) -ENTRY(cloudabi_sys_mem_unlock) - mov $37, %eax - syscall - ret -END(cloudabi_sys_mem_unlock) - ENTRY(cloudabi_sys_mem_unmap) - mov $38, %eax + mov $36, %eax syscall ret END(cloudabi_sys_mem_unmap) ENTRY(cloudabi_sys_poll) push %rcx - mov $39, %eax + mov $37, %eax syscall pop %rcx jc 1f @@ -382,7 +370,7 @@ END(cloudabi_sys_poll) ENTRY(cloudabi_sys_poll_fd) mov %rcx, %r10 - mov $40, %eax + mov $38, %eax syscall jc 1f mov 8(%rsp), %rcx @@ -394,20 +382,20 @@ END(cloudabi_sys_poll_fd) ENTRY(cloudabi_sys_proc_exec) mov %rcx, %r10 - mov $41, %eax + mov $39, %eax syscall ret END(cloudabi_sys_proc_exec) ENTRY(cloudabi_sys_proc_exit) - mov $42, %eax + mov $40, %eax syscall END(cloudabi_sys_proc_exit) ENTRY(cloudabi_sys_proc_fork) push %rdi push %rsi - mov $43, %eax + mov $41, %eax syscall pop %rsi pop %rcx @@ -420,20 +408,20 @@ ENTRY(cloudabi_sys_proc_fork) END(cloudabi_sys_proc_fork) ENTRY(cloudabi_sys_proc_raise) - mov $44, %eax + mov $42, %eax syscall ret END(cloudabi_sys_proc_raise) ENTRY(cloudabi_sys_random_get) - mov $45, %eax + mov $43, %eax syscall ret END(cloudabi_sys_random_get) ENTRY(cloudabi_sys_sock_accept) push %rdx - mov $46, %eax + mov $44, %eax syscall pop %rcx jc 1f @@ -445,51 +433,51 @@ END(cloudabi_sys_sock_accept) ENTRY(cloudabi_sys_sock_bind) mov %rcx, %r10 - mov $47, %eax + mov $45, %eax syscall ret END(cloudabi_sys_sock_bind) ENTRY(cloudabi_sys_sock_connect) mov %rcx, %r10 - mov $48, %eax + mov $46, %eax syscall ret END(cloudabi_sys_sock_connect) ENTRY(cloudabi_sys_sock_listen) - mov $49, %eax + mov $47, %eax syscall ret END(cloudabi_sys_sock_listen) ENTRY(cloudabi_sys_sock_recv) - mov $50, %eax + mov $48, %eax syscall ret END(cloudabi_sys_sock_recv) ENTRY(cloudabi_sys_sock_send) - mov $51, %eax + mov $49, %eax syscall ret END(cloudabi_sys_sock_send) ENTRY(cloudabi_sys_sock_shutdown) - mov $52, %eax + mov $50, %eax syscall ret END(cloudabi_sys_sock_shutdown) ENTRY(cloudabi_sys_sock_stat_get) - mov $53, %eax + mov $51, %eax syscall ret END(cloudabi_sys_sock_stat_get) ENTRY(cloudabi_sys_thread_create) push %rsi - mov $54, %eax + mov $52, %eax syscall pop %rcx jc 1f @@ -500,12 +488,12 @@ ENTRY(cloudabi_sys_thread_create) END(cloudabi_sys_thread_create) ENTRY(cloudabi_sys_thread_exit) - mov $55, %eax + mov $53, %eax syscall END(cloudabi_sys_thread_exit) ENTRY(cloudabi_sys_thread_yield) - mov $56, %eax + mov $54, %eax syscall ret END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/syscalls32.master b/sys/contrib/cloudabi/syscalls32.master index 4e0c2b293249..02ef57f17fa4 100644 --- a/sys/contrib/cloudabi/syscalls32.master +++ b/sys/contrib/cloudabi/syscalls32.master @@ -204,11 +204,7 @@ size_t mapping_len, \ cloudabi_advice_t advice); } -33 AUE_NULL STD { void cloudabi_sys_mem_lock( \ - const void *mapping, \ - size_t mapping_len); } - -34 AUE_NULL STD { void cloudabi_sys_mem_map( \ +33 AUE_NULL STD { void cloudabi_sys_mem_map( \ void *addr, \ size_t len, \ cloudabi_mprot_t prot, \ @@ -216,30 +212,26 @@ cloudabi_fd_t fd, \ cloudabi_filesize_t off); } -35 AUE_NULL STD { void cloudabi_sys_mem_protect( \ +34 AUE_NULL STD { void cloudabi_sys_mem_protect( \ void *mapping, \ size_t mapping_len, \ cloudabi_mprot_t prot); } -36 AUE_NULL STD { void cloudabi_sys_mem_sync( \ +35 AUE_NULL STD { void cloudabi_sys_mem_sync( \ void *mapping, \ size_t mapping_len, \ cloudabi_msflags_t flags); } -37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \ - const void *mapping, \ - size_t mapping_len); } - -38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ +36 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ void *mapping, \ size_t mapping_len); } -39 AUE_NULL STD { size_t cloudabi32_sys_poll( \ +37 AUE_NULL STD { size_t cloudabi32_sys_poll( \ const cloudabi32_subscription_t *in, \ cloudabi32_event_t *out, \ size_t nsubscriptions); } -40 AUE_NULL STD { size_t cloudabi32_sys_poll_fd( \ +38 AUE_NULL STD { size_t cloudabi32_sys_poll_fd( \ cloudabi_fd_t fd, \ const cloudabi32_subscription_t *in, \ size_t in_len, \ @@ -247,69 +239,69 @@ size_t out_len, \ const cloudabi32_subscription_t *timeout); } -41 AUE_NULL STD { void cloudabi_sys_proc_exec( \ +39 AUE_NULL STD { void cloudabi_sys_proc_exec( \ cloudabi_fd_t fd, \ const void *data, \ size_t data_len, \ const cloudabi_fd_t *fds, \ size_t fds_len); } -42 AUE_NULL STD { void cloudabi_sys_proc_exit( \ +40 AUE_NULL STD { void cloudabi_sys_proc_exit( \ cloudabi_exitcode_t rval); } -43 AUE_NULL STD { void cloudabi_sys_proc_fork(); } +41 AUE_NULL STD { void cloudabi_sys_proc_fork(); } -44 AUE_NULL STD { void cloudabi_sys_proc_raise( \ +42 AUE_NULL STD { void cloudabi_sys_proc_raise( \ cloudabi_signal_t sig); } -45 AUE_NULL STD { void cloudabi_sys_random_get( \ +43 AUE_NULL STD { void cloudabi_sys_random_get( \ void *buf, \ size_t buf_len); } -46 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ +44 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ cloudabi_fd_t sock, \ - cloudabi_sockstat_t *buf); } + void *unused); } -47 AUE_NULL STD { void cloudabi_sys_sock_bind( \ +45 AUE_NULL STD { void cloudabi_sys_sock_bind( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t path_len); } -48 AUE_NULL STD { void cloudabi_sys_sock_connect( \ +46 AUE_NULL STD { void cloudabi_sys_sock_connect( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t path_len); } -49 AUE_NULL STD { void cloudabi_sys_sock_listen( \ +47 AUE_NULL STD { void cloudabi_sys_sock_listen( \ cloudabi_fd_t sock, \ cloudabi_backlog_t backlog); } -50 AUE_NULL STD { void cloudabi32_sys_sock_recv( \ +48 AUE_NULL STD { void cloudabi32_sys_sock_recv( \ cloudabi_fd_t sock, \ const cloudabi32_recv_in_t *in, \ cloudabi32_recv_out_t *out); } -51 AUE_NULL STD { void cloudabi32_sys_sock_send( \ +49 AUE_NULL STD { void cloudabi32_sys_sock_send( \ cloudabi_fd_t sock, \ const cloudabi32_send_in_t *in, \ cloudabi32_send_out_t *out); } -52 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ +50 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ cloudabi_fd_t sock, \ cloudabi_sdflags_t how); } -53 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ +51 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ cloudabi_fd_t sock, \ cloudabi_sockstat_t *buf, \ cloudabi_ssflags_t flags); } -54 AUE_NULL STD { cloudabi_tid_t cloudabi32_sys_thread_create( \ +52 AUE_NULL STD { cloudabi_tid_t cloudabi32_sys_thread_create( \ cloudabi32_threadattr_t *attr); } -55 AUE_NULL STD { void cloudabi_sys_thread_exit( \ +53 AUE_NULL STD { void cloudabi_sys_thread_exit( \ cloudabi_lock_t *lock, \ cloudabi_scope_t scope); } -56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } +54 AUE_NULL STD { void cloudabi_sys_thread_yield(); } diff --git a/sys/contrib/cloudabi/syscalls64.master b/sys/contrib/cloudabi/syscalls64.master index 7f57d76ce878..e35863099500 100644 --- a/sys/contrib/cloudabi/syscalls64.master +++ b/sys/contrib/cloudabi/syscalls64.master @@ -204,11 +204,7 @@ size_t mapping_len, \ cloudabi_advice_t advice); } -33 AUE_NULL STD { void cloudabi_sys_mem_lock( \ - const void *mapping, \ - size_t mapping_len); } - -34 AUE_NULL STD { void cloudabi_sys_mem_map( \ +33 AUE_NULL STD { void cloudabi_sys_mem_map( \ void *addr, \ size_t len, \ cloudabi_mprot_t prot, \ @@ -216,30 +212,26 @@ cloudabi_fd_t fd, \ cloudabi_filesize_t off); } -35 AUE_NULL STD { void cloudabi_sys_mem_protect( \ +34 AUE_NULL STD { void cloudabi_sys_mem_protect( \ void *mapping, \ size_t mapping_len, \ cloudabi_mprot_t prot); } -36 AUE_NULL STD { void cloudabi_sys_mem_sync( \ +35 AUE_NULL STD { void cloudabi_sys_mem_sync( \ void *mapping, \ size_t mapping_len, \ cloudabi_msflags_t flags); } -37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \ - const void *mapping, \ - size_t mapping_len); } - -38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ +36 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ void *mapping, \ size_t mapping_len); } -39 AUE_NULL STD { size_t cloudabi64_sys_poll( \ +37 AUE_NULL STD { size_t cloudabi64_sys_poll( \ const cloudabi64_subscription_t *in, \ cloudabi64_event_t *out, \ size_t nsubscriptions); } -40 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \ +38 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \ cloudabi_fd_t fd, \ const cloudabi64_subscription_t *in, \ size_t in_len, \ @@ -247,69 +239,69 @@ size_t out_len, \ const cloudabi64_subscription_t *timeout); } -41 AUE_NULL STD { void cloudabi_sys_proc_exec( \ +39 AUE_NULL STD { void cloudabi_sys_proc_exec( \ cloudabi_fd_t fd, \ const void *data, \ size_t data_len, \ const cloudabi_fd_t *fds, \ size_t fds_len); } -42 AUE_NULL STD { void cloudabi_sys_proc_exit( \ +40 AUE_NULL STD { void cloudabi_sys_proc_exit( \ cloudabi_exitcode_t rval); } -43 AUE_NULL STD { void cloudabi_sys_proc_fork(); } +41 AUE_NULL STD { void cloudabi_sys_proc_fork(); } -44 AUE_NULL STD { void cloudabi_sys_proc_raise( \ +42 AUE_NULL STD { void cloudabi_sys_proc_raise( \ cloudabi_signal_t sig); } -45 AUE_NULL STD { void cloudabi_sys_random_get( \ +43 AUE_NULL STD { void cloudabi_sys_random_get( \ void *buf, \ size_t buf_len); } -46 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ +44 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ cloudabi_fd_t sock, \ - cloudabi_sockstat_t *buf); } + void *unused); } -47 AUE_NULL STD { void cloudabi_sys_sock_bind( \ +45 AUE_NULL STD { void cloudabi_sys_sock_bind( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t path_len); } -48 AUE_NULL STD { void cloudabi_sys_sock_connect( \ +46 AUE_NULL STD { void cloudabi_sys_sock_connect( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t path_len); } -49 AUE_NULL STD { void cloudabi_sys_sock_listen( \ +47 AUE_NULL STD { void cloudabi_sys_sock_listen( \ cloudabi_fd_t sock, \ cloudabi_backlog_t backlog); } -50 AUE_NULL STD { void cloudabi64_sys_sock_recv( \ +48 AUE_NULL STD { void cloudabi64_sys_sock_recv( \ cloudabi_fd_t sock, \ const cloudabi64_recv_in_t *in, \ cloudabi64_recv_out_t *out); } -51 AUE_NULL STD { void cloudabi64_sys_sock_send( \ +49 AUE_NULL STD { void cloudabi64_sys_sock_send( \ cloudabi_fd_t sock, \ const cloudabi64_send_in_t *in, \ cloudabi64_send_out_t *out); } -52 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ +50 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ cloudabi_fd_t sock, \ cloudabi_sdflags_t how); } -53 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ +51 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ cloudabi_fd_t sock, \ cloudabi_sockstat_t *buf, \ cloudabi_ssflags_t flags); } -54 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \ +52 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \ cloudabi64_threadattr_t *attr); } -55 AUE_NULL STD { void cloudabi_sys_thread_exit( \ +53 AUE_NULL STD { void cloudabi_sys_thread_exit( \ cloudabi_lock_t *lock, \ cloudabi_scope_t scope); } -56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } +54 AUE_NULL STD { void cloudabi_sys_thread_yield(); } diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h index 3648352f1da6..f893bd25ee56 100644 --- a/sys/dev/bnxt/bnxt.h +++ b/sys/dev/bnxt/bnxt.h @@ -214,6 +214,18 @@ __FBSDID("$FreeBSD$"); /* Chip info */ #define BNXT_TSO_SIZE UINT16_MAX +#define min_t(type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1 : __min2; }) + +#define max_t(type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1 : __max2; }) + +#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) + /* NVRAM access */ enum bnxt_nvm_directory_type { BNX_DIR_TYPE_UNUSED = 0, @@ -569,6 +581,20 @@ struct bnxt_softc { struct bnxt_nvram_info *nvm_info; bool wol; uint8_t wol_filter_id; + uint16_t rx_coal_usecs; + uint16_t rx_coal_usecs_irq; + uint16_t rx_coal_frames; + uint16_t rx_coal_frames_irq; + uint16_t tx_coal_usecs; + uint16_t tx_coal_usecs_irq; + uint16_t tx_coal_frames; + uint16_t tx_coal_frames_irq; + +#define BNXT_USEC_TO_COAL_TIMER(x) ((x) * 25 / 2) +#define BNXT_DEF_STATS_COAL_TICKS 1000000 +#define BNXT_MIN_STATS_COAL_TICKS 250000 +#define BNXT_MAX_STATS_COAL_TICKS 1000000 + }; struct bnxt_filter_info { diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c index 3590944f3dd6..fe18da885bcb 100644 --- a/sys/dev/bnxt/bnxt_hwrm.c +++ b/sys/dev/bnxt/bnxt_hwrm.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include "bnxt.h" #include "bnxt_hwrm.h" @@ -1547,3 +1548,131 @@ bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc) req.wol_filter_id = softc->wol_filter_id; return hwrm_send_message(softc, &req, sizeof(req)); } + +static void bnxt_hwrm_set_coal_params(struct bnxt_softc *softc, uint32_t max_frames, + uint32_t buf_tmrs, uint16_t flags, + struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req) +{ + req->flags = htole16(flags); + req->num_cmpl_dma_aggr = htole16((uint16_t)max_frames); + req->num_cmpl_dma_aggr_during_int = htole16(max_frames >> 16); + req->cmpl_aggr_dma_tmr = htole16((uint16_t)buf_tmrs); + req->cmpl_aggr_dma_tmr_during_int = htole16(buf_tmrs >> 16); + /* Minimum time between 2 interrupts set to buf_tmr x 2 */ + req->int_lat_tmr_min = htole16((uint16_t)buf_tmrs * 2); + req->int_lat_tmr_max = htole16((uint16_t)buf_tmrs * 4); + req->num_cmpl_aggr_int = htole16((uint16_t)max_frames * 4); +} + + +int bnxt_hwrm_set_coal(struct bnxt_softc *softc) +{ + int i, rc = 0; + struct hwrm_ring_cmpl_ring_cfg_aggint_params_input req_rx = {0}, + req_tx = {0}, *req; + uint16_t max_buf, max_buf_irq; + uint16_t buf_tmr, buf_tmr_irq; + uint32_t flags; + + bnxt_hwrm_cmd_hdr_init(softc, &req_rx, + HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS); + bnxt_hwrm_cmd_hdr_init(softc, &req_tx, + HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS); + + /* Each rx completion (2 records) should be DMAed immediately. + * DMA 1/4 of the completion buffers at a time. + */ + max_buf = min_t(uint16_t, softc->rx_coal_frames / 4, 2); + /* max_buf must not be zero */ + max_buf = clamp_t(uint16_t, max_buf, 1, 63); + max_buf_irq = clamp_t(uint16_t, softc->rx_coal_frames_irq, 1, 63); + buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs); + /* buf timer set to 1/4 of interrupt timer */ + buf_tmr = max_t(uint16_t, buf_tmr / 4, 1); + buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->rx_coal_usecs_irq); + buf_tmr_irq = max_t(uint16_t, buf_tmr_irq, 1); + + flags = HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_TIMER_RESET; + + /* RING_IDLE generates more IRQs for lower latency. Enable it only + * if coal_usecs is less than 25 us. + */ + if (softc->rx_coal_usecs < 25) + flags |= HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_RING_IDLE; + + bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, + buf_tmr_irq << 16 | buf_tmr, flags, &req_rx); + + /* max_buf must not be zero */ + max_buf = clamp_t(uint16_t, softc->tx_coal_frames, 1, 63); + max_buf_irq = clamp_t(uint16_t, softc->tx_coal_frames_irq, 1, 63); + buf_tmr = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs); + /* buf timer set to 1/4 of interrupt timer */ + buf_tmr = max_t(uint16_t, buf_tmr / 4, 1); + buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(softc->tx_coal_usecs_irq); + buf_tmr_irq = max_t(uint16_t, buf_tmr_irq, 1); + flags = HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_TIMER_RESET; + bnxt_hwrm_set_coal_params(softc, max_buf_irq << 16 | max_buf, + buf_tmr_irq << 16 | buf_tmr, flags, &req_tx); + + for (i = 0; i < softc->nrxqsets; i++) { + + + req = &req_rx; + /* + * TBD: + * Check if Tx also needs to be done + * So far, Tx processing has been done in softirq contest + * + * req = &req_tx; + */ + req->ring_id = htole16(softc->grp_info[i].cp_ring_id); + + rc = hwrm_send_message(softc, req, sizeof(*req)); + if (rc) + break; + } + return rc; +} + + + +int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, + int bmap_size) +{ + struct hwrm_func_drv_rgtr_input req = {0}; + bitstr_t *async_events_bmap; + uint32_t *events; + int i; + + async_events_bmap = bit_alloc(256, M_DEVBUF, M_WAITOK|M_ZERO); + events = (uint32_t *)async_events_bmap; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_RGTR); + + req.enables = + htole32(HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD); + + memset(async_events_bmap, 0, sizeof(256 / 8)); + + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE); + bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE); + + if (bmap && bmap_size) { + for (i = 0; i < bmap_size; i++) { + if (bit_test(bmap, i)) + bit_set(async_events_bmap, i); + } + } + + for (i = 0; i < 8; i++) + req.async_event_fwd[i] |= htole32(events[i]); + + free(async_events_bmap, M_DEVBUF); + + return hwrm_send_message(softc, &req, sizeof(req)); +} + diff --git a/sys/dev/bnxt/bnxt_hwrm.h b/sys/dev/bnxt/bnxt_hwrm.h index b80695a54c03..9125f7694525 100644 --- a/sys/dev/bnxt/bnxt_hwrm.h +++ b/sys/dev/bnxt/bnxt_hwrm.h @@ -101,5 +101,7 @@ int bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc); uint16_t bnxt_hwrm_get_wol_fltrs(struct bnxt_softc *softc, uint16_t handle); int bnxt_hwrm_alloc_wol_fltr(struct bnxt_softc *softc); int bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc); - +int bnxt_hwrm_set_coal(struct bnxt_softc *softc); +int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, + int bmap_size); #endif diff --git a/sys/dev/bnxt/bnxt_sysctl.c b/sys/dev/bnxt/bnxt_sysctl.c index 6f79b56f07ec..614eef9a300c 100644 --- a/sys/dev/bnxt/bnxt_sysctl.c +++ b/sys/dev/bnxt/bnxt_sysctl.c @@ -549,6 +549,166 @@ bnxt_vlan_strip_sysctl(SYSCTL_HANDLER_ARGS) { return rc; } +static int +bnxt_set_coal_rx_usecs(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_usecs; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_usecs = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_frames(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_frames; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_frames = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_usecs_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_usecs_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_usecs_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_rx_frames_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->rx_coal_frames_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->rx_coal_frames_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_usecs(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_usecs; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_usecs = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_frames(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_frames; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_frames = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_usecs_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_usecs_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_usecs_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + +static int +bnxt_set_coal_tx_frames_irq(SYSCTL_HANDLER_ARGS) { + struct bnxt_softc *softc = arg1; + int rc; + int val; + + if (softc == NULL) + return EBUSY; + + val = softc->tx_coal_frames_irq; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc || !req->newptr) + return rc; + + softc->tx_coal_frames_irq = val; + rc = bnxt_hwrm_set_coal(softc); + + return rc; +} + int bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) { @@ -572,6 +732,31 @@ bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "if_name", CTLFLAG_RD, iflib_get_ifp(softc->ctx)->if_xname, 0, "interface name"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs, + "I", "interrupt coalescing Rx Usecs"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames, + "I", "interrupt coalescing Rx Frames"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs_irq, + "I", "interrupt coalescing Rx Usecs IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames_irq, + "I", "interrupt coalescing Rx Frames IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs, + "I", "interrupt coalescing Tx Usces"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames, + "I", "interrupt coalescing Tx Frames"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs_irq, + "I", "interrupt coalescing Tx Usecs IRQ"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", + CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames_irq, + "I", "interrupt coalescing Tx Frames IRQ"); + return 0; } diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 7baa16e7a330..d01bf3c71c4e 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -691,6 +691,12 @@ bnxt_attach_pre(if_ctx_t ctx) goto drv_rgtr_fail; } + rc = bnxt_hwrm_func_rgtr_async_events(softc, NULL, 0); + if (rc) { + device_printf(softc->dev, "attach: hwrm rgtr async evts failed\n"); + goto drv_rgtr_fail; + } + /* Get the HW capabilities */ rc = bnxt_hwrm_func_qcaps(softc); if (rc) @@ -2286,11 +2292,11 @@ bnxt_report_link(struct bnxt_softc *softc) HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) flow_ctrl = "FC - receive"; else - flow_ctrl = "none"; + flow_ctrl = "FC - none"; iflib_link_state_change(softc->ctx, LINK_STATE_UP, IF_Gbps(100)); - device_printf(softc->dev, "Link is UP %s, %s\n", duplex, - flow_ctrl); + device_printf(softc->dev, "Link is UP %s, %s - %d Mbps \n", duplex, + flow_ctrl, (softc->link_info.link_speed * 100)); } else { iflib_link_state_change(softc->ctx, LINK_STATE_DOWN, bnxt_get_baudrate(&softc->link_info)); diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 5f61fef1035f..8b9ef8b0c306 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -587,7 +587,7 @@ int t4_prep_adapter(struct adapter *adapter, u8 *buf); int t4_shutdown_adapter(struct adapter *adapter); int t4_init_devlog_params(struct adapter *adapter, int fw_attach); int t4_init_sge_params(struct adapter *adapter); -int t4_init_tp_params(struct adapter *adap); +int t4_init_tp_params(struct adapter *adap, bool sleep_ok); int t4_filter_field_shift(const struct adapter *adap, int filter_sel); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id); void t4_fatal_err(struct adapter *adapter); @@ -605,20 +605,21 @@ int t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid, unsigned int flags, unsigned int defq, unsigned int skeyidx, unsigned int skey); int t4_read_rss(struct adapter *adapter, u16 *entries); -void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, - unsigned int start_index, unsigned int rw); -void t4_read_rss_key(struct adapter *adapter, u32 *key); -void t4_write_rss_key(struct adapter *adap, u32 *key, int idx); -void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); -void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); +void t4_read_rss_key(struct adapter *adapter, u32 *key, bool sleep_ok); +void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx, + bool sleep_ok); +void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, + u32 *valp, bool sleep_ok); +void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, + u32 val, bool sleep_ok); void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 *vfl, u32 *vfh); + u32 *vfl, u32 *vfh, bool sleep_ok); void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 vfl, u32 vfh); -u32 t4_read_rss_pf_map(struct adapter *adapter); -void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap); -u32 t4_read_rss_pf_mask(struct adapter *adapter); -void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask); + u32 vfl, u32 vfh, bool sleep_ok); +u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok); +void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok); +u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok); +void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok); int t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); @@ -664,19 +665,24 @@ void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); void t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]); void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, - unsigned int *ipg); + unsigned int *ipg, bool sleep_ok); void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, unsigned int mask, unsigned int val); void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); -void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st); -void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st); -void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st); -void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st); +void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, + bool sleep_ok); +void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, + bool sleep_ok); +void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, + bool sleep_ok); +void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, + bool sleep_ok); +void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok); void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); + struct tp_tcp_stats *v6, bool sleep_ok); void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, - struct tp_fcoe_stats *st); + struct tp_fcoe_stats *st, bool sleep_ok); void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, const unsigned short *alpha, const unsigned short *beta); @@ -687,7 +693,8 @@ int t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg); int t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, unsigned int start, unsigned int n); void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); -int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map); +int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map, + bool sleep_ok); void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); void t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); @@ -802,6 +809,15 @@ int t4_get_devlog_level(struct adapter *adapter, unsigned int *level); int t4_set_devlog_level(struct adapter *adapter, unsigned int level); void t4_sge_decode_idma_state(struct adapter *adapter, int state); +void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); +void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok); + static inline int t4vf_query_params(struct adapter *adapter, unsigned int nparams, const u32 *params, u32 *vals) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index e29f23b16060..862e4dc5d830 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -469,7 +469,7 @@ static int t4_edc_err_read(struct adapter *adap, int idx) CH_WARN(adap, "%s: T4 NOT supported.\n", __func__); return 0; } - if (idx != 0 && idx != 1) { + if (idx != MEM_EDC0 && idx != MEM_EDC1) { CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx); return 0; } @@ -886,7 +886,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0xd010, 0xd03c, 0xdfc0, 0xdfe0, 0xe000, 0xea7c, - 0xf000, 0x11190, + 0xf000, 0x11110, + 0x11118, 0x11190, 0x19040, 0x1906c, 0x19078, 0x19080, 0x1908c, 0x190e4, @@ -1424,8 +1425,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x1ff00, 0x1ff84, 0x1ffc0, 0x1ffc8, 0x30000, 0x30030, - 0x30038, 0x30038, - 0x30040, 0x30040, 0x30100, 0x30144, 0x30190, 0x301a0, 0x301a8, 0x301b8, @@ -1536,8 +1535,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x33c3c, 0x33c50, 0x33cf0, 0x33cfc, 0x34000, 0x34030, - 0x34038, 0x34038, - 0x34040, 0x34040, 0x34100, 0x34144, 0x34190, 0x341a0, 0x341a8, 0x341b8, @@ -1648,8 +1645,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x37c3c, 0x37c50, 0x37cf0, 0x37cfc, 0x38000, 0x38030, - 0x38038, 0x38038, - 0x38040, 0x38040, 0x38100, 0x38144, 0x38190, 0x381a0, 0x381a8, 0x381b8, @@ -1760,8 +1755,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x3bc3c, 0x3bc50, 0x3bcf0, 0x3bcfc, 0x3c000, 0x3c030, - 0x3c038, 0x3c038, - 0x3c040, 0x3c040, 0x3c100, 0x3c144, 0x3c190, 0x3c1a0, 0x3c1a8, 0x3c1b8, @@ -2254,13 +2247,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x1ff00, 0x1ff84, 0x1ffc0, 0x1ffc8, 0x30000, 0x30030, - 0x30038, 0x30038, - 0x30040, 0x30040, - 0x30048, 0x30048, - 0x30050, 0x30050, - 0x3005c, 0x30060, - 0x30068, 0x30068, - 0x30070, 0x30070, 0x30100, 0x30168, 0x30190, 0x301a0, 0x301a8, 0x301b8, @@ -2323,13 +2309,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x326a8, 0x326a8, 0x326ec, 0x326ec, 0x32a00, 0x32abc, - 0x32b00, 0x32b38, + 0x32b00, 0x32b18, + 0x32b20, 0x32b38, 0x32b40, 0x32b58, 0x32b60, 0x32b78, 0x32c00, 0x32c00, 0x32c08, 0x32c3c, - 0x32e00, 0x32e2c, - 0x32f00, 0x32f2c, 0x33000, 0x3302c, 0x33034, 0x33050, 0x33058, 0x33058, @@ -2394,13 +2379,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x33c38, 0x33c50, 0x33cf0, 0x33cfc, 0x34000, 0x34030, - 0x34038, 0x34038, - 0x34040, 0x34040, - 0x34048, 0x34048, - 0x34050, 0x34050, - 0x3405c, 0x34060, - 0x34068, 0x34068, - 0x34070, 0x34070, 0x34100, 0x34168, 0x34190, 0x341a0, 0x341a8, 0x341b8, @@ -2463,13 +2441,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x366a8, 0x366a8, 0x366ec, 0x366ec, 0x36a00, 0x36abc, - 0x36b00, 0x36b38, + 0x36b00, 0x36b18, + 0x36b20, 0x36b38, 0x36b40, 0x36b58, 0x36b60, 0x36b78, 0x36c00, 0x36c00, 0x36c08, 0x36c3c, - 0x36e00, 0x36e2c, - 0x36f00, 0x36f2c, 0x37000, 0x3702c, 0x37034, 0x37050, 0x37058, 0x37058, @@ -2700,6 +2677,7 @@ struct t4_vpd_hdr { #define EEPROM_MAX_POLL 5000 /* x 5000 == 50ms */ #define EEPROM_STAT_ADDR 0x7bfc +#define VPD_SIZE 0x800 #define VPD_BASE 0x400 #define VPD_BASE_OLD 0 #define VPD_LEN 1024 @@ -3040,13 +3018,13 @@ enum { SF_ATTEMPTS = 10, /* max retries for SF operations */ /* flash command opcodes */ - SF_PROG_PAGE = 2, /* program page */ + SF_PROG_PAGE = 2, /* program 256B page */ SF_WR_DISABLE = 4, /* disable writes */ SF_RD_STATUS = 5, /* read status register */ SF_WR_ENABLE = 6, /* enable writes */ SF_RD_DATA_FAST = 0xb, /* read flash */ SF_RD_ID = 0x9f, /* read ID */ - SF_ERASE_SECTOR = 0xd8, /* erase sector */ + SF_ERASE_SECTOR = 0xd8, /* erase 64KB sector */ }; /** @@ -3994,6 +3972,9 @@ static void sge_intr_handler(struct adapter *adapter) "SGE too many priority ingress contexts", -1, 0 }, { F_INGRESS_SIZE_ERR, "SGE illegal ingress QID", -1, 0 }, { F_EGRESS_SIZE_ERR, "SGE illegal egress QID", -1, 0 }, + { F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1 | + F_ERR_PCIE_ERROR2 | F_ERR_PCIE_ERROR3, + "SGE PCIe error for a DBP thread", -1, 0 }, { 0 } }; @@ -4009,8 +3990,6 @@ static void sge_intr_handler(struct adapter *adapter) * For now, treat below interrupts as fatal so that we disable SGE and * get better debug */ static const struct intr_info t6_sge_intr_info[] = { - { F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1, - "SGE PCIe error for a DBP thread", -1, 1 }, { F_FATAL_WRE_LEN, "SGE Actual WRE packet is less than advertized length", -1, 1 }, @@ -4065,6 +4044,7 @@ static void cim_intr_handler(struct adapter *adapter) { F_MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 }, { F_TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 }, { F_TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, + { F_TIMER0INT, "CIM TIMER0 interrupt", -1, 1 }, { 0 } }; static const struct intr_info cim_upintr_info[] = { @@ -4098,11 +4078,26 @@ static void cim_intr_handler(struct adapter *adapter) { F_TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 }, { 0 } }; + u32 val, fw_err; int fat; - if (t4_read_reg(adapter, A_PCIE_FW) & F_PCIE_FW_ERR) + fw_err = t4_read_reg(adapter, A_PCIE_FW); + if (fw_err & F_PCIE_FW_ERR) t4_report_fw_error(adapter); + /* When the Firmware detects an internal error which normally wouldn't + * raise a Host Interrupt, it forces a CIM Timer0 interrupt in order + * to make sure the Host sees the Firmware Crash. So if we have a + * Timer0 interrupt and don't see a Firmware Crash, ignore the Timer0 + * interrupt. + */ + val = t4_read_reg(adapter, A_CIM_HOST_INT_CAUSE); + if (val & F_TIMER0INT) + if (!(fw_err & F_PCIE_FW_ERR) || + (G_PCIE_FW_EVAL(fw_err) != PCIE_FW_EVAL_CRASH)) + t4_write_reg(adapter, A_CIM_HOST_INT_CAUSE, + F_TIMER0INT); + fat = t4_handle_intr_status(adapter, A_CIM_HOST_INT_CAUSE, cim_intr_info) + t4_handle_intr_status(adapter, A_CIM_HOST_UPACC_INT_CAUSE, @@ -4850,55 +4845,177 @@ int t4_read_rss(struct adapter *adapter, u16 *map) } /** - * t4_fw_tp_pio_rw - Access TP PIO through LDST - * @adap: the adapter - * @vals: where the indirect register values are stored/written - * @nregs: how many indirect registers to read/write - * @start_idx: index of first indirect register to read/write - * @rw: Read (1) or Write (0) + * t4_tp_fw_ldst_rw - Access TP indirect register through LDST + * @adap: the adapter + * @cmd: TP fw ldst address space type + * @vals: where the indirect register values are stored/written + * @nregs: how many indirect registers to read/write + * @start_idx: index of first indirect register to read/write + * @rw: Read (1) or Write (0) + * @sleep_ok: if true we may sleep while awaiting command completion * - * Access TP PIO registers through LDST - */ -void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, - unsigned int start_index, unsigned int rw) + * Access TP indirect registers through LDST + **/ +static int t4_tp_fw_ldst_rw(struct adapter *adap, int cmd, u32 *vals, + unsigned int nregs, unsigned int start_index, + unsigned int rw, bool sleep_ok) { - int ret, i; - int cmd = FW_LDST_ADDRSPC_TP_PIO; + int ret = 0; + unsigned int i; struct fw_ldst_cmd c; - for (i = 0 ; i < nregs; i++) { + for (i = 0; i < nregs; i++) { memset(&c, 0, sizeof(c)); c.op_to_addrspace = cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | (rw ? F_FW_CMD_READ : - F_FW_CMD_WRITE) | + F_FW_CMD_WRITE) | V_FW_LDST_CMD_ADDRSPACE(cmd)); c.cycles_to_len16 = cpu_to_be32(FW_LEN16(c)); c.u.addrval.addr = cpu_to_be32(start_index + i); c.u.addrval.val = rw ? 0 : cpu_to_be32(vals[i]); - ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); - if (ret == 0) { - if (rw) - vals[i] = be32_to_cpu(c.u.addrval.val); - } + ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, + sleep_ok); + if (ret) + return ret; + + if (rw) + vals[i] = be32_to_cpu(c.u.addrval.val); } + return 0; +} + +/** + * t4_tp_indirect_rw - Read/Write TP indirect register through LDST or backdoor + * @adap: the adapter + * @reg_addr: Address Register + * @reg_data: Data register + * @buff: where the indirect register values are stored/written + * @nregs: how many indirect registers to read/write + * @start_index: index of first indirect register to read/write + * @rw: READ(1) or WRITE(0) + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read/Write TP indirect registers through LDST if possible. + * Else, use backdoor access + **/ +static void t4_tp_indirect_rw(struct adapter *adap, u32 reg_addr, u32 reg_data, + u32 *buff, u32 nregs, u32 start_index, int rw, + bool sleep_ok) +{ + int rc = -EINVAL; + int cmd; + + switch (reg_addr) { + case A_TP_PIO_ADDR: + cmd = FW_LDST_ADDRSPC_TP_PIO; + break; + case A_TP_TM_PIO_ADDR: + cmd = FW_LDST_ADDRSPC_TP_TM_PIO; + break; + case A_TP_MIB_INDEX: + cmd = FW_LDST_ADDRSPC_TP_MIB; + break; + default: + goto indirect_access; + } + + if (t4_use_ldst(adap)) + rc = t4_tp_fw_ldst_rw(adap, cmd, buff, nregs, start_index, rw, + sleep_ok); + +indirect_access: + + if (rc) { + if (rw) + t4_read_indirect(adap, reg_addr, reg_data, buff, nregs, + start_index); + else + t4_write_indirect(adap, reg_addr, reg_data, buff, nregs, + start_index); + } +} + +/** + * t4_tp_pio_read - Read TP PIO registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP PIO Registers + **/ +void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, buff, nregs, + start_index, 1, sleep_ok); +} + +/** + * t4_tp_pio_write - Write TP PIO registers + * @adap: the adapter + * @buff: where the indirect register values are stored + * @nregs: how many indirect registers to write + * @start_index: index of first indirect register to write + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Write TP PIO Registers + **/ +void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, + __DECONST(u32 *, buff), nregs, start_index, 0, sleep_ok); +} + +/** + * t4_tp_tm_pio_read - Read TP TM PIO registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP TM PIO Registers + **/ +void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs, + u32 start_index, bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_TM_PIO_ADDR, A_TP_TM_PIO_DATA, buff, + nregs, start_index, 1, sleep_ok); +} + +/** + * t4_tp_mib_read - Read TP MIB registers + * @adap: the adapter + * @buff: where the indirect register values are written + * @nregs: how many indirect registers to read + * @start_index: index of first indirect register to read + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Read TP MIB Registers + **/ +void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index, + bool sleep_ok) +{ + t4_tp_indirect_rw(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, buff, nregs, + start_index, 1, sleep_ok); } /** * t4_read_rss_key - read the global RSS key * @adap: the adapter * @key: 10-entry array holding the 320-bit RSS key + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the global 320-bit RSS key. */ -void t4_read_rss_key(struct adapter *adap, u32 *key) +void t4_read_rss_key(struct adapter *adap, u32 *key, bool sleep_ok) { - if (t4_use_ldst(adap)) - t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 1); - else - t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10, - A_TP_RSS_SECRET_KEY0); + t4_tp_pio_read(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok); } /** @@ -4906,12 +5023,14 @@ void t4_read_rss_key(struct adapter *adap, u32 *key) * @adap: the adapter * @key: 10-entry array holding the 320-bit RSS key * @idx: which RSS key to write + * @sleep_ok: if true we may sleep while awaiting command completion * * Writes one of the RSS keys with the given 320-bit value. If @idx is * 0..15 the corresponding entry in the RSS key table is written, * otherwise the global RSS key is written. */ -void t4_write_rss_key(struct adapter *adap, u32 *key, int idx) +void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx, + bool sleep_ok) { u8 rss_key_addr_cnt = 16; u32 vrt = t4_read_reg(adap, A_TP_RSS_CONFIG_VRT); @@ -4925,11 +5044,7 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, int idx) (vrt & F_KEYEXTEND) && (G_KEYMODE(vrt) == 3)) rss_key_addr_cnt = 32; - if (t4_use_ldst(adap)) - t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 0); - else - t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10, - A_TP_RSS_SECRET_KEY0); + t4_tp_pio_write(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok); if (idx >= 0 && idx < rss_key_addr_cnt) { if (rss_key_addr_cnt > 16) @@ -4947,19 +5062,15 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, int idx) * @adapter: the adapter * @index: the entry in the PF RSS table to read * @valp: where to store the returned value + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Configuration Table at the specified index and returns * the value found there. */ void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, - u32 *valp) + u32 *valp, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, valp, 1, - A_TP_RSS_PF0_CONFIG + index, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - valp, 1, A_TP_RSS_PF0_CONFIG + index); + t4_tp_pio_read(adapter, valp, 1, A_TP_RSS_PF0_CONFIG + index, sleep_ok); } /** @@ -4967,19 +5078,16 @@ void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, * @adapter: the adapter * @index: the entry in the VF RSS table to read * @val: the value to store + * @sleep_ok: if true we may sleep while awaiting command completion * * Writes the PF RSS Configuration Table at the specified index with the * specified value. */ void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, - u32 val) + u32 val, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &val, 1, - A_TP_RSS_PF0_CONFIG + index, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &val, 1, A_TP_RSS_PF0_CONFIG + index); + t4_tp_pio_write(adapter, &val, 1, A_TP_RSS_PF0_CONFIG + index, + sleep_ok); } /** @@ -4988,12 +5096,13 @@ void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, * @index: the entry in the VF RSS table to read * @vfl: where to store the returned VFL * @vfh: where to store the returned VFH + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the VF RSS Configuration Table at the specified index and returns * the (VFL, VFH) values found there. */ void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 *vfl, u32 *vfh) + u32 *vfl, u32 *vfh, bool sleep_ok) { u32 vrt, mask, data; @@ -5015,15 +5124,8 @@ void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, /* * Grab the VFL/VFH values ... */ - if (t4_use_ldst(adapter)) { - t4_fw_tp_pio_rw(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, 1); - t4_fw_tp_pio_rw(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, 1); - } else { - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - vfl, 1, A_TP_RSS_VFL_CONFIG); - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - vfh, 1, A_TP_RSS_VFH_CONFIG); - } + t4_tp_pio_read(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok); + t4_tp_pio_read(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok); } /** @@ -5038,7 +5140,7 @@ void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, * specified (VFL, VFH) values. */ void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, - u32 vfl, u32 vfh) + u32 vfl, u32 vfh, bool sleep_ok) { u32 vrt, mask, data; @@ -5053,15 +5155,8 @@ void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, /* * Load up VFL/VFH with the values to be written ... */ - if (t4_use_ldst(adapter)) { - t4_fw_tp_pio_rw(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, 0); - t4_fw_tp_pio_rw(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, 0); - } else { - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &vfl, 1, A_TP_RSS_VFL_CONFIG); - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &vfh, 1, A_TP_RSS_VFH_CONFIG); - } + t4_tp_pio_write(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok); + t4_tp_pio_write(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok); /* * Write the VFL/VFH into the VF Table at index'th location. @@ -5075,18 +5170,16 @@ void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, /** * t4_read_rss_pf_map - read PF RSS Map * @adapter: the adapter + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Map register and returns its value. */ -u32 t4_read_rss_pf_map(struct adapter *adapter) +u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok) { u32 pfmap; - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmap, 1, A_TP_RSS_PF_MAP); + t4_tp_pio_read(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok); + return pfmap; } @@ -5097,30 +5190,24 @@ u32 t4_read_rss_pf_map(struct adapter *adapter) * * Writes the specified value to the PF RSS Map register. */ -void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap) +void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmap, 1, A_TP_RSS_PF_MAP); + t4_tp_pio_write(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok); } /** * t4_read_rss_pf_mask - read PF RSS Mask * @adapter: the adapter + * @sleep_ok: if true we may sleep while awaiting command completion * * Reads the PF RSS Mask register and returns its value. */ -u32 t4_read_rss_pf_mask(struct adapter *adapter) +u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok) { u32 pfmask; - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 1); - else - t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmask, 1, A_TP_RSS_PF_MSK); + t4_tp_pio_read(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok); + return pfmask; } @@ -5131,13 +5218,9 @@ u32 t4_read_rss_pf_mask(struct adapter *adapter) * * Writes the specified value to the PF RSS Mask register. */ -void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask) +void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok) { - if (t4_use_ldst(adapter)) - t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 0); - else - t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &pfmask, 1, A_TP_RSS_PF_MSK); + t4_tp_pio_write(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok); } /** @@ -5145,12 +5228,13 @@ void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask) * @adap: the adapter * @v4: holds the TCP/IP counter values * @v6: holds the TCP/IPv6 counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. * Either @v4 or @v6 may be %NULL to skip the corresponding stats. */ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) + struct tp_tcp_stats *v6, bool sleep_ok) { u32 val[A_TP_MIB_TCP_RXT_SEG_LO - A_TP_MIB_TCP_OUT_RST + 1]; @@ -5159,16 +5243,16 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, #define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) if (v4) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - ARRAY_SIZE(val), A_TP_MIB_TCP_OUT_RST); + t4_tp_mib_read(adap, val, ARRAY_SIZE(val), + A_TP_MIB_TCP_OUT_RST, sleep_ok); v4->tcp_out_rsts = STAT(OUT_RST); v4->tcp_in_segs = STAT64(IN_SEG); v4->tcp_out_segs = STAT64(OUT_SEG); v4->tcp_retrans_segs = STAT64(RXT_SEG); } if (v6) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - ARRAY_SIZE(val), A_TP_MIB_TCP_V6OUT_RST); + t4_tp_mib_read(adap, val, ARRAY_SIZE(val), + A_TP_MIB_TCP_V6OUT_RST, sleep_ok); v6->tcp_out_rsts = STAT(OUT_RST); v6->tcp_in_segs = STAT64(IN_SEG); v6->tcp_out_segs = STAT64(OUT_SEG); @@ -5183,32 +5267,41 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, * t4_tp_get_err_stats - read TP's error MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's error counters. */ -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) +void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->hdr_in_errs, nchan, A_TP_MIB_HDR_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tcp_in_errs, nchan, A_TP_MIB_TCP_IN_ERR_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tnl_cong_drops, nchan, A_TP_MIB_TNL_CNG_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->ofld_chan_drops, nchan, A_TP_MIB_OFD_CHN_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tnl_tx_drops, nchan, A_TP_MIB_TNL_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->ofld_vlan_drops, nchan, A_TP_MIB_OFD_VLN_DROP_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - st->tcp6_in_errs, nchan, A_TP_MIB_TCP_V6IN_ERR_0); + t4_tp_mib_read(adap, st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0, + sleep_ok); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, - &st->ofld_no_neigh, 2, A_TP_MIB_OFD_ARP_DROP); + t4_tp_mib_read(adap, st->hdr_in_errs, nchan, A_TP_MIB_HDR_IN_ERR_0, + sleep_ok); + + t4_tp_mib_read(adap, st->tcp_in_errs, nchan, A_TP_MIB_TCP_IN_ERR_0, + sleep_ok); + + t4_tp_mib_read(adap, st->tnl_cong_drops, nchan, + A_TP_MIB_TNL_CNG_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->ofld_chan_drops, nchan, + A_TP_MIB_OFD_CHN_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->tnl_tx_drops, nchan, A_TP_MIB_TNL_DROP_0, + sleep_ok); + + t4_tp_mib_read(adap, st->ofld_vlan_drops, nchan, + A_TP_MIB_OFD_VLN_DROP_0, sleep_ok); + + t4_tp_mib_read(adap, st->tcp6_in_errs, nchan, + A_TP_MIB_TCP_V6IN_ERR_0, sleep_ok); + + t4_tp_mib_read(adap, &st->ofld_no_neigh, 2, A_TP_MIB_OFD_ARP_DROP, + sleep_ok); } /** @@ -5218,29 +5311,30 @@ void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) * * Returns the values of TP's proxy counters. */ -void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st) +void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->proxy, - nchan, A_TP_MIB_TNL_LPBK_0); + t4_tp_mib_read(adap, st->proxy, nchan, A_TP_MIB_TNL_LPBK_0, sleep_ok); } /** * t4_tp_get_cpl_stats - read TP's CPL MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's CPL counters. */ -void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st) +void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, + bool sleep_ok) { int nchan = adap->chip_params->nchan; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->req, - nchan, A_TP_MIB_CPL_IN_REQ_0); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->rsp, - nchan, A_TP_MIB_CPL_OUT_RSP_0); + t4_tp_mib_read(adap, st->req, nchan, A_TP_MIB_CPL_IN_REQ_0, sleep_ok); + + t4_tp_mib_read(adap, st->rsp, nchan, A_TP_MIB_CPL_OUT_RSP_0, sleep_ok); } /** @@ -5250,10 +5344,11 @@ void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st) * * Returns the values of TP's RDMA counters. */ -void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st) +void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, + bool sleep_ok) { - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->rqe_dfr_pkt, - 2, A_TP_MIB_RQE_DFR_PKT); + t4_tp_mib_read(adap, &st->rqe_dfr_pkt, 2, A_TP_MIB_RQE_DFR_PKT, + sleep_ok); } /** @@ -5261,20 +5356,24 @@ void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st) * @adap: the adapter * @idx: the port index * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's FCoE counters for the selected port. */ void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, - struct tp_fcoe_stats *st) + struct tp_fcoe_stats *st, bool sleep_ok) { u32 val[2]; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->frames_ddp, - 1, A_TP_MIB_FCOE_DDP_0 + idx); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &st->frames_drop, - 1, A_TP_MIB_FCOE_DROP_0 + idx); - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, - 2, A_TP_MIB_FCOE_BYTE_0_HI + 2 * idx); + t4_tp_mib_read(adap, &st->frames_ddp, 1, A_TP_MIB_FCOE_DDP_0 + idx, + sleep_ok); + + t4_tp_mib_read(adap, &st->frames_drop, 1, + A_TP_MIB_FCOE_DROP_0 + idx, sleep_ok); + + t4_tp_mib_read(adap, val, 2, A_TP_MIB_FCOE_BYTE_0_HI + 2 * idx, + sleep_ok); + st->octets_ddp = ((u64)val[0] << 32) | val[1]; } @@ -5282,15 +5381,17 @@ void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, * t4_get_usm_stats - read TP's non-TCP DDP MIB counters * @adap: the adapter * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion * * Returns the values of TP's counters for non-TCP directly-placed packets. */ -void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st) +void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok) { u32 val[4]; - t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val, 4, - A_TP_MIB_USM_PKTS); + t4_tp_mib_read(adap, val, 4, A_TP_MIB_USM_PKTS, sleep_ok); + st->frames = val[0]; st->drops = val[1]; st->octets = ((u64)val[2] << 32) | val[3]; @@ -5869,7 +5970,7 @@ void t4_get_port_stats_offset(struct adapter *adap, int idx, void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { u32 bgmap = t4_get_mps_bg_map(adap, idx); - u32 stat_ctl; + u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -5877,8 +5978,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) T5_PORT_REG(idx, A_MPS_PORT_STAT_##name##_L))) #define GET_STAT_COM(name) t4_read_reg64(adap, A_MPS_STAT_##name##_L) - stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); - p->tx_pause = GET_STAT(TX_PORT_PAUSE); p->tx_octets = GET_STAT(TX_PORT_BYTES); p->tx_frames = GET_STAT(TX_PORT_FRAMES); @@ -7676,51 +7775,120 @@ struct flash_desc { int t4_get_flash_params(struct adapter *adapter) { /* - * Table for non-Numonix supported flash parts. Numonix parts are left - * to the preexisting well-tested code. All flash parts have 64KB - * sectors. + * Table for non-standard supported Flash parts. Note, all Flash + * parts must have 64KB sectors. */ static struct flash_desc supported_flash[] = { - { 0x150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ + { 0x00150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ }; int ret; - u32 info = 0; + u32 flashid = 0; + unsigned int part, manufacturer; + unsigned int density, size; + + /* + * Issue a Read ID Command to the Flash part. We decode supported + * Flash parts and their sizes from this. There's a newer Query + * Command which can retrieve detailed geometry information but many + * Flash parts don't support it. + */ ret = sf1_write(adapter, 1, 1, 0, SF_RD_ID); if (!ret) - ret = sf1_read(adapter, 3, 0, 1, &info); + ret = sf1_read(adapter, 3, 0, 1, &flashid); t4_write_reg(adapter, A_SF_OP, 0); /* unlock SF */ if (ret < 0) return ret; - for (ret = 0; ret < ARRAY_SIZE(supported_flash); ++ret) - if (supported_flash[ret].vendor_and_model_id == info) { - adapter->params.sf_size = supported_flash[ret].size_mb; + /* + * Check to see if it's one of our non-standard supported Flash parts. + */ + for (part = 0; part < ARRAY_SIZE(supported_flash); part++) + if (supported_flash[part].vendor_and_model_id == flashid) { + adapter->params.sf_size = + supported_flash[part].size_mb; adapter->params.sf_nsec = adapter->params.sf_size / SF_SEC_SIZE; - return 0; + goto found; } - if ((info & 0xff) != 0x20) /* not a Numonix flash */ - return -EINVAL; - info >>= 16; /* log2 of size */ - if (info >= 0x14 && info < 0x18) - adapter->params.sf_nsec = 1 << (info - 16); - else if (info == 0x18) - adapter->params.sf_nsec = 64; - else - return -EINVAL; - adapter->params.sf_size = 1 << info; + /* + * Decode Flash part size. The code below looks repetative with + * common encodings, but that's not guaranteed in the JEDEC + * specification for the Read JADEC ID command. The only thing that + * we're guaranteed by the JADEC specification is where the + * Manufacturer ID is in the returned result. After that each + * Manufacturer ~could~ encode things completely differently. + * Note, all Flash parts must have 64KB sectors. + */ + manufacturer = flashid & 0xff; + switch (manufacturer) { + case 0x20: { /* Micron/Numonix */ + /* + * This Density -> Size decoding table is taken from Micron + * Data Sheets. + */ + density = (flashid >> 16) & 0xff; + switch (density) { + case 0x14: size = 1 << 20; break; /* 1MB */ + case 0x15: size = 1 << 21; break; /* 2MB */ + case 0x16: size = 1 << 22; break; /* 4MB */ + case 0x17: size = 1 << 23; break; /* 8MB */ + case 0x18: size = 1 << 24; break; /* 16MB */ + case 0x19: size = 1 << 25; break; /* 32MB */ + case 0x20: size = 1 << 26; break; /* 64MB */ + case 0x21: size = 1 << 27; break; /* 128MB */ + case 0x22: size = 1 << 28; break; /* 256MB */ + default: + CH_ERR(adapter, "Micron Flash Part has bad size, " + "ID = %#x, Density code = %#x\n", + flashid, density); + return -EINVAL; + } + break; + } + + case 0xef: { /* Winbond */ + /* + * This Density -> Size decoding table is taken from Winbond + * Data Sheets. + */ + density = (flashid >> 16) & 0xff; + switch (density) { + case 0x17: size = 1 << 23; break; /* 8MB */ + case 0x18: size = 1 << 24; break; /* 16MB */ + + default: + CH_ERR(adapter, "Winbond Flash Part has bad size, " + "ID = %#x, Density code = %#x\n", + flashid, density); + return -EINVAL; + } + break; + } + + default: + CH_ERR(adapter, "Unsupported Flash Part, ID = %#x\n", flashid); + return -EINVAL; + } + + /* + * Store decoded Flash size and fall through into vetting code. + */ + adapter->params.sf_size = size; + adapter->params.sf_nsec = size / SF_SEC_SIZE; + + found: /* * We should ~probably~ reject adapters with FLASHes which are too * small but we have some legacy FPGAs with small FLASHes that we'd * still like to use. So instead we emit a scary message ... */ if (adapter->params.sf_size < FLASH_MIN_SIZE) - CH_WARN(adapter, "WARNING!!! FLASH size %#x < %#x!!!\n", - adapter->params.sf_size, FLASH_MIN_SIZE); + CH_WARN(adapter, "WARNING: Flash Part ID %#x, size %#x < %#x\n", + flashid, adapter->params.sf_size, FLASH_MIN_SIZE); return 0; } @@ -7877,10 +8045,9 @@ int t4_shutdown_adapter(struct adapter *adapter) t4_intr_disable(adapter); t4_write_reg(adapter, A_DBG_GPIO_EN, 0); for_each_port(adapter, port) { - u32 a_port_cfg = PORT_REG(port, - is_t4(adapter) - ? A_XGMAC_PORT_CFG - : A_MAC_PORT_CFG); + u32 a_port_cfg = is_t4(adapter) ? + PORT_REG(port, A_XGMAC_PORT_CFG) : + T5_PORT_REG(port, A_MAC_PORT_CFG); t4_write_reg(adapter, a_port_cfg, t4_read_reg(adapter, a_port_cfg) @@ -8051,21 +8218,15 @@ int t4_init_sge_params(struct adapter *adapter) /* * Read and cache the adapter's compressed filter mode and ingress config. */ -static void read_filter_mode_and_ingress_config(struct adapter *adap) +static void read_filter_mode_and_ingress_config(struct adapter *adap, + bool sleep_ok) { struct tp_params *tpp = &adap->params.tp; - if (t4_use_ldst(adap)) { - t4_fw_tp_pio_rw(adap, &tpp->vlan_pri_map, 1, - A_TP_VLAN_PRI_MAP, 1); - t4_fw_tp_pio_rw(adap, &tpp->ingress_config, 1, - A_TP_INGRESS_CONFIG, 1); - } else { - t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &tpp->vlan_pri_map, 1, A_TP_VLAN_PRI_MAP); - t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, - &tpp->ingress_config, 1, A_TP_INGRESS_CONFIG); - } + t4_tp_pio_read(adap, &tpp->vlan_pri_map, 1, A_TP_VLAN_PRI_MAP, + sleep_ok); + t4_tp_pio_read(adap, &tpp->ingress_config, 1, A_TP_INGRESS_CONFIG, + sleep_ok); /* * Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field @@ -8097,7 +8258,7 @@ static void read_filter_mode_and_ingress_config(struct adapter *adap) * * Initialize various fields of the adapter's TP Parameters structure. */ -int t4_init_tp_params(struct adapter *adap) +int t4_init_tp_params(struct adapter *adap, bool sleep_ok) { int chan; u32 v; @@ -8111,7 +8272,7 @@ int t4_init_tp_params(struct adapter *adap) for (chan = 0; chan < MAX_NCHAN; chan++) tpp->tx_modq[chan] = chan; - read_filter_mode_and_ingress_config(adap); + read_filter_mode_and_ingress_config(adap, sleep_ok); /* * Cache a mask of the bits that represent the error vector portion of @@ -8707,14 +8868,13 @@ void t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]) * Return the current configuration of a HW Tx scheduler. */ void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, - unsigned int *ipg) + unsigned int *ipg, bool sleep_ok) { unsigned int v, addr, bpt, cpt; if (kbps) { addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2; - t4_write_reg(adap, A_TP_TM_PIO_ADDR, addr); - v = t4_read_reg(adap, A_TP_TM_PIO_DATA); + t4_tp_tm_pio_read(adap, &v, 1, addr, sleep_ok); if (sched & 1) v >>= 16; bpt = (v >> 8) & 0xff; @@ -8728,8 +8888,7 @@ void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbp } if (ipg) { addr = A_TP_TX_MOD_Q1_Q0_TIMER_SEPARATOR - sched / 2; - t4_write_reg(adap, A_TP_TM_PIO_ADDR, addr); - v = t4_read_reg(adap, A_TP_TM_PIO_DATA); + t4_tp_tm_pio_read(adap, &v, 1, addr, sleep_ok); if (sched & 1) v >>= 16; v &= 0xffff; @@ -9179,13 +9338,15 @@ int t4_load_bootcfg(struct adapter *adap,const u8 *cfg_data, unsigned int size) * t4_set_filter_mode - configure the optional components of filter tuples * @adap: the adapter * @mode_map: a bitmap selcting which optional filter components to enable + * @sleep_ok: if true we may sleep while awaiting command completion * * Sets the filter mode by selecting the optional components to enable * in filter tuples. Returns 0 on success and a negative error if the * requested mode needs more bits than are available for optional * components. */ -int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map) +int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map, + bool sleep_ok) { static u8 width[] = { 1, 3, 17, 17, 8, 8, 16, 9, 3, 1 }; @@ -9196,12 +9357,8 @@ int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map) nbits += width[i]; if (nbits > FILTER_OPT_LEN) return -EINVAL; - if (t4_use_ldst(adap)) - t4_fw_tp_pio_rw(adap, &mode_map, 1, A_TP_VLAN_PRI_MAP, 0); - else - t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, &mode_map, - 1, A_TP_VLAN_PRI_MAP); - read_filter_mode_and_ingress_config(adap); + t4_tp_pio_write(adap, &mode_map, 1, A_TP_VLAN_PRI_MAP, sleep_ok); + read_filter_mode_and_ingress_config(adap, sleep_ok); return 0; } @@ -9392,7 +9549,7 @@ int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type cty } int t4_sched_config(struct adapter *adapter, int type, int minmaxen, - int sleep_ok) + int sleep_ok) { struct fw_sched_cmd cmd; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 7732e0badee0..af9f78f20fc1 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -4450,7 +4450,7 @@ adapter_full_init(struct adapter *sc) for (i = 0; i < nitems(rss_key); i++) { rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); } - t4_write_rss_key(sc, &rss_key[0], -1); + t4_write_rss_key(sc, &rss_key[0], -1, 1); #endif if (!(sc->flags & IS_VF)) @@ -6528,7 +6528,7 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS) return (ENOMEM); mtx_lock(&sc->reg_lock); - t4_tp_get_cpl_stats(sc, &stats); + t4_tp_get_cpl_stats(sc, &stats, 0); mtx_unlock(&sc->reg_lock); if (sc->chip_params->nchan > 2) { @@ -6568,7 +6568,7 @@ sysctl_ddp_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - t4_get_usm_stats(sc, &stats); + t4_get_usm_stats(sc, &stats, 1); sbuf_printf(sb, "Frames: %u\n", stats.frames); sbuf_printf(sb, "Octets: %ju\n", stats.octets); @@ -6716,7 +6716,7 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS) return (ENOMEM); for (i = 0; i < nchan; i++) - t4_get_fcoe_stats(sc, i, &stats[i]); + t4_get_fcoe_stats(sc, i, &stats[i], 1); if (nchan > 2) { sbuf_printf(sb, " channel 0 channel 1" @@ -6771,7 +6771,7 @@ sysctl_hw_sched(SYSCTL_HANDLER_ARGS) "Class IPG (0.1 ns) Flow IPG (us)"); for (i = 0; i < NTX_SCHED; ++i, map >>= 2) { - t4_get_tx_sched(sc, i, &kbps, &ipg); + t4_get_tx_sched(sc, i, &kbps, &ipg, 1); sbuf_printf(sb, "\n %u %-5s %u ", i, (mode & (1 << i)) ? "flow" : "class", map & 3); if (kbps) @@ -7505,7 +7505,7 @@ sysctl_rdma_stats(SYSCTL_HANDLER_ARGS) return (ENOMEM); mtx_lock(&sc->reg_lock); - t4_tp_get_rdma_stats(sc, &stats); + t4_tp_get_rdma_stats(sc, &stats, 0); mtx_unlock(&sc->reg_lock); sbuf_printf(sb, "NoRQEModDefferals: %u\n", stats.rqe_dfr_mod); @@ -7534,7 +7534,7 @@ sysctl_tcp_stats(SYSCTL_HANDLER_ARGS) return (ENOMEM); mtx_lock(&sc->reg_lock); - t4_tp_get_tcp_stats(sc, &v4, &v6); + t4_tp_get_tcp_stats(sc, &v4, &v6, 0); mtx_unlock(&sc->reg_lock); sbuf_printf(sb, @@ -7639,7 +7639,7 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS) return (ENOMEM); mtx_lock(&sc->reg_lock); - t4_tp_get_err_stats(sc, &stats); + t4_tp_get_err_stats(sc, &stats, 0); mtx_unlock(&sc->reg_lock); if (sc->chip_params->nchan > 2) { @@ -8459,7 +8459,7 @@ set_filter_mode(struct adapter *sc, uint32_t mode) } #endif - rc = -t4_set_filter_mode(sc, fconf); + rc = -t4_set_filter_mode(sc, fconf, true); done: end_synchronized_op(sc, LOCK_HELD); return (rc); diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 23c9201e107d..d5ba58e568ed 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -827,7 +827,7 @@ t4_read_chip_settings(struct adapter *sc) rc = EINVAL; } - t4_init_tp_params(sc); + t4_init_tp_params(sc, 1); t4_read_mtu_tbl(sc, sc->params.mtus, NULL); t4_load_mtus(sc, sc->params.mtus, sc->params.a_wnd, sc->params.b_wnd); diff --git a/sys/dev/iicbus/iicbus.h b/sys/dev/iicbus/iicbus.h index 10853192e975..c73e475bc153 100644 --- a/sys/dev/iicbus/iicbus.h +++ b/sys/dev/iicbus/iicbus.h @@ -39,6 +39,7 @@ struct iicbus_softc { device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ + u_int owncount; /* iicbus ownership nesting count */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ u_char strict; /* deny operations that violate the diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c index 27c8464bd353..d32b640b4cab 100644 --- a/sys/dev/iicbus/iiconf.c +++ b/sys/dev/iicbus/iiconf.c @@ -113,26 +113,30 @@ iicbus_request_bus(device_t bus, device_t dev, int how) IICBUS_LOCK(sc); - while ((error == 0) && (sc->owner != NULL)) + while (error == 0 && sc->owner != NULL && sc->owner != dev) error = iicbus_poll(sc, how); if (error == 0) { - sc->owner = dev; - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the request is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), - IIC_REQUEST_BUS, (caddr_t)&how); - IICBUS_LOCK(sc); - - if (error != 0) { - sc->owner = NULL; - wakeup_one(sc); + ++sc->owncount; + if (sc->owner == NULL) { + sc->owner = dev; + /* + * Drop the lock around the call to the bus driver, it + * should be allowed to sleep in the IIC_WAIT case. + * Drivers might also need to grab locks that would + * cause a LOR if our lock is held. + */ + IICBUS_UNLOCK(sc); + /* Ask the underlying layers if the request is ok */ + error = IICBUS_CALLBACK(device_get_parent(bus), + IIC_REQUEST_BUS, (caddr_t)&how); + IICBUS_LOCK(sc); + + if (error != 0) { + sc->owner = NULL; + sc->owncount = 0; + wakeup_one(sc); + } } } @@ -150,7 +154,6 @@ int iicbus_release_bus(device_t bus, device_t dev) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - int error; IICBUS_LOCK(sc); @@ -159,26 +162,16 @@ iicbus_release_bus(device_t bus, device_t dev) return (IIC_EBUSBSY); } - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the release is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); - - if (error == 0) { + if (--sc->owncount == 0) { + /* Drop the lock while informing the low-level driver. */ + IICBUS_UNLOCK(sc); + IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); IICBUS_LOCK(sc); sc->owner = NULL; - - /* wakeup a waiting thread */ wakeup_one(sc); - IICBUS_UNLOCK(sc); } - - return (error); + IICBUS_UNLOCK(sc); + return (0); } /* @@ -470,3 +463,55 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) iicbus_stop(bus); return (error); } + +int +iicdev_readfrom(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with a repeat-start between them; first we + * write the address-within-device, then we read from the device. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); +} + +int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with no stop or start between them; first + * we write the address then we write the data to that address, all in a + * single transfer from two scattered buffers. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); +} diff --git a/sys/dev/iicbus/iiconf.h b/sys/dev/iicbus/iiconf.h index 03b958346dc0..856b029af9ff 100644 --- a/sys/dev/iicbus/iiconf.h +++ b/sys/dev/iicbus/iiconf.h @@ -133,6 +133,16 @@ int iicbus_transfer_excl(device_t bus, struct iic_msg *msgs, uint32_t nmsgs, int how); int iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs); +/* + * Simple register read/write routines, but the "register" can be any size. + * The transfers are done with iicbus_transfer_excl(). Reads use a repeat-start + * between sending the address and reading; writes use a single start/stop. + */ +int iicdev_readfrom(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); +int iicdev_writeto(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); + #define IICBUS_MODVER 1 #define IICBUS_MINVER 1 #define IICBUS_MAXVER 1 diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 385cb3f148a2..f7f3f3cb9ae6 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -325,8 +325,10 @@ static int iwm_mvm_get_signal_strength(struct iwm_softc *, struct iwm_rx_phy_info *); static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); -static int iwm_get_noise(struct iwm_softc *sc, +static int iwm_get_noise(struct iwm_softc *, const struct iwm_mvm_statistics_rx_non_phy *); +static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, + struct iwm_rx_packet *); static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *, uint32_t, boolean_t); static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, @@ -388,6 +390,7 @@ static struct ieee80211vap * const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void iwm_vap_delete(struct ieee80211vap *); +static void iwm_xmit_queue_drain(struct iwm_softc *); static void iwm_scan_start(struct ieee80211com *); static void iwm_scan_end(struct ieee80211com *); static void iwm_update_mcast(struct ieee80211com *); @@ -3158,6 +3161,15 @@ iwm_get_noise(struct iwm_softc *sc, #endif } +static void +iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +{ + struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; + + memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); + sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); +} + /* * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * @@ -4103,7 +4115,7 @@ iwm_release(struct iwm_softc *sc, struct iwm_node *in) * get here from RUN state. */ tfd_msk = 0xf; - mbufq_drain(&sc->sc_snd); + iwm_xmit_queue_drain(sc); iwm_mvm_flush_tx_path(sc, tfd_msk, IWM_CMD_SYNC); /* * We seem to get away with just synchronously sending the @@ -4439,13 +4451,6 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) break; case IEEE80211_S_RUN: - { - struct iwm_host_cmd cmd = { - .id = IWM_LQ_CMD, - .len = { sizeof(in->in_lq), }, - .flags = IWM_CMD_SYNC, - }; - in = IWM_NODE(vap->iv_bss); /* Update the association state, now we have it all */ /* (eg associd comes in at this point */ @@ -4470,15 +4475,13 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) iwm_mvm_update_quotas(sc, ivp); iwm_setrates(sc, in); - cmd.data[0] = &in->in_lq; - if ((error = iwm_send_cmd(sc, &cmd)) != 0) { + if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, - "%s: IWM_LQ_CMD failed\n", __func__); + "%s: IWM_LQ_CMD failed: %d\n", __func__, error); } iwm_mvm_led_enable(sc); break; - } default: break; @@ -5291,13 +5294,9 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_CALIB_RES_NOTIF_PHY_DB: break; - case IWM_STATISTICS_NOTIFICATION: { - struct iwm_notif_statistics *stats; - stats = (void *)pkt->data; - memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); - sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); + case IWM_STATISTICS_NOTIFICATION: + iwm_mvm_handle_rx_statistics(sc, pkt); break; - } case IWM_NVM_ACCESS_CMD: case IWM_MCC_UPDATE_CMD: @@ -6213,6 +6212,19 @@ iwm_vap_delete(struct ieee80211vap *vap) free(ivp, M_80211_VAP); } +static void +iwm_xmit_queue_drain(struct iwm_softc *sc) +{ + struct mbuf *m; + struct ieee80211_node *ni; + + while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + ieee80211_free_node(ni); + m_freem(m); + } +} + static void iwm_scan_start(struct ieee80211com *ic) { @@ -6372,6 +6384,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) callout_drain(&sc->sc_watchdog_to); iwm_stop_device(sc); if (do_net80211) { + IWM_LOCK(sc); + iwm_xmit_queue_drain(sc); + IWM_UNLOCK(sc); ieee80211_ifdetach(&sc->sc_ic); } @@ -6405,7 +6420,6 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) sc->sc_notif_wait = NULL; } - mbufq_drain(&sc->sc_snd); IWM_LOCK_DESTROY(sc); return (0); diff --git a/sys/dev/iwm/if_iwm_scan.c b/sys/dev/iwm/if_iwm_scan.c index 8fc13f1eb1d1..ee49086293d0 100644 --- a/sys/dev/iwm/if_iwm_scan.c +++ b/sys/dev/iwm/if_iwm_scan.c @@ -307,15 +307,13 @@ iwm_mvm_lmac_scan_fill_channels(struct iwm_softc *sc, int j; for (nchan = j = 0; - j < ic->ic_nchans && nchan < sc->ucode_capa.n_scan_channels; j++) { - c = &ic->ic_channels[j]; - /* For 2GHz, only populate 11b channels */ - /* For 5GHz, only populate 11a channels */ + j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or * something in the chanlist. */ - if (iwm_mvm_scan_skip_channel(c)) { + if (!IEEE80211_IS_CHAN_2GHZ(c) && !IEEE80211_IS_CHAN_5GHZ(c)) { IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_EEPROM, "%s: skipping channel (freq=%d, ieee=%d, flags=0x%08x)\n", __func__, c->ic_freq, c->ic_ieee, c->ic_flags); @@ -346,20 +344,19 @@ iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, struct iwm_scan_channel_cfg_umac *chan, int n_ssids) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_scan_state *ss = ic->ic_scan; struct ieee80211_channel *c; uint8_t nchan; int j; for (nchan = j = 0; - j < ic->ic_nchans && nchan < sc->ucode_capa.n_scan_channels; j++) { - c = &ic->ic_channels[j]; - /* For 2GHz, only populate 11b channels */ - /* For 5GHz, only populate 11a channels */ + j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or * something in the chanlist. */ - if (iwm_mvm_scan_skip_channel(c)) { + if (!IEEE80211_IS_CHAN_2GHZ(c) && !IEEE80211_IS_CHAN_5GHZ(c)) { IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_EEPROM, "%s: skipping channel (freq=%d, ieee=%d, flags=0x%08x)\n", __func__, c->ic_freq, c->ic_ieee, c->ic_flags); @@ -726,7 +723,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) if (iwm_mvm_rrm_scan_needed(sc)) req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); - req->flags = iwm_mvm_scan_rxon_flags(&sc->sc_ic.ic_channels[0]); + req->flags = iwm_mvm_scan_rxon_flags(sc->sc_ic.ic_scan->ss_chans[0]); req->filter_flags = htole32(IWM_MAC_FILTER_ACCEPT_GRP | IWM_MAC_FILTER_IN_BEACON); diff --git a/sys/dev/iwm/if_iwm_sta.c b/sys/dev/iwm/if_iwm_sta.c index f740035b1fdd..21d6e5e590ae 100644 --- a/sys/dev/iwm/if_iwm_sta.c +++ b/sys/dev/iwm/if_iwm_sta.c @@ -283,7 +283,6 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE); if (ret) return ret; - mbufq_drain(&sc->sc_snd); /* XXX needed ? */ for (ac = 0; ac < WME_NUM_AC; ac++) { tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]); } diff --git a/sys/dev/iwm/if_iwm_util.c b/sys/dev/iwm/if_iwm_util.c index a090aeb5f65f..68670b4f822c 100644 --- a/sys/dev/iwm/if_iwm_util.c +++ b/sys/dev/iwm/if_iwm_util.c @@ -489,6 +489,32 @@ iwm_dma_contig_free(struct iwm_dma_info *dma) } } +/** + * iwm_mvm_send_lq_cmd() - Send link quality command + * @init: This command is sent as part of station initialization right + * after station has been added. + * + * The link quality command is sent as the last step of station creation. + * This is the special case in which init is set and we call a callback in + * this case to clear the state indicating that station creation is in + * progress. + */ +int +iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init) +{ + struct iwm_host_cmd cmd = { + .id = IWM_LQ_CMD, + .len = { sizeof(struct iwm_lq_cmd), }, + .flags = init ? 0 : IWM_CMD_ASYNC, + .data = { lq, }, + }; + + if (lq->sta_id == IWM_MVM_STATION_COUNT) + return EINVAL; + + return iwm_send_cmd(sc, &cmd); +} + boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc) { diff --git a/sys/dev/iwm/if_iwm_util.h b/sys/dev/iwm/if_iwm_util.h index b46877d31ee1..2f6c31532d78 100644 --- a/sys/dev/iwm/if_iwm_util.h +++ b/sys/dev/iwm/if_iwm_util.h @@ -120,6 +120,9 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, struct iwm_dma_info *dma, bus_size_t size, bus_size_t alignment); extern void iwm_dma_contig_free(struct iwm_dma_info *); +extern int iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, + boolean_t init); + extern boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc); extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx); diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 0088f55c008b..f79c5488674b 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -2898,6 +2898,18 @@ struct iwm_mcast_filter_cmd { uint8_t addr_list[0]; } __packed; /* IWM_MCAST_FILTERING_CMD_API_S_VER_1 */ +/* + * The first MAC indices (starting from 0) + * are available to the driver, AUX follows + */ +#define IWM_MAC_INDEX_AUX 4 +#define IWM_MAC_INDEX_MIN_DRIVER 0 +#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX +#define IWM_NUM_MAC_INDEX (IWM_MAC_INDEX_AUX + 1) + +/*********************************** + * Statistics API + ***********************************/ struct iwm_mvm_statistics_dbg { uint32_t burst_check; uint32_t burst_count; @@ -2914,24 +2926,6 @@ struct iwm_mvm_statistics_div { uint32_t reserved2; } __packed; /* IWM_STATISTICS_SLOW_DIV_API_S_VER_2 */ -struct iwm_mvm_statistics_general_common { - uint32_t temperature; /* radio temperature */ - uint32_t temperature_m; /* radio voltage */ - struct iwm_mvm_statistics_dbg dbg; - uint32_t sleep_time; - uint32_t slots_out; - uint32_t slots_idle; - uint32_t ttl_timestamp; - struct iwm_mvm_statistics_div div; - uint32_t rx_enable_counter; - /* - * num_of_sos_states: - * count the number of times we have to re-tune - * in order to get out of bad PHY status - */ - uint32_t num_of_sos_states; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ - struct iwm_mvm_statistics_rx_non_phy { uint32_t bogus_cts; /* CTS received when not expecting CTS */ uint32_t bogus_ack; /* ACK received when not expecting ACK */ @@ -3002,6 +2996,23 @@ struct iwm_mvm_statistics_rx_ht_phy { uint32_t unsupport_mcs; } __packed; /* IWM_STATISTICS_HT_RX_PHY_API_S_VER_1 */ +struct iwm_mvm_statistics_tx_non_phy { + uint32_t preamble_cnt; + uint32_t rx_detected_cnt; + uint32_t bt_prio_defer_cnt; + uint32_t bt_prio_kill_cnt; + uint32_t few_bytes_cnt; + uint32_t cts_timeout; + uint32_t ack_timeout; + uint32_t expected_ack_cnt; + uint32_t actual_ack_cnt; + uint32_t dump_msdu_cnt; + uint32_t burst_abort_next_frame_mismatch_cnt; + uint32_t burst_abort_missing_next_frame_cnt; + uint32_t cts_timeout_collision; + uint32_t ack_or_ba_timeout_collision; +} __packed; /* IWM_STATISTICS_TX_NON_PHY_API_S_VER_3 */ + #define IWM_MAX_CHAINS 3 struct iwm_mvm_statistics_tx_non_phy_agg { @@ -3032,20 +3043,7 @@ struct iwm_mvm_statistics_tx_channel_width { }; /* IWM_STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */ struct iwm_mvm_statistics_tx { - uint32_t preamble_cnt; - uint32_t rx_detected_cnt; - uint32_t bt_prio_defer_cnt; - uint32_t bt_prio_kill_cnt; - uint32_t few_bytes_cnt; - uint32_t cts_timeout; - uint32_t ack_timeout; - uint32_t expected_ack_cnt; - uint32_t actual_ack_cnt; - uint32_t dump_msdu_cnt; - uint32_t burst_abort_next_frame_mismatch_cnt; - uint32_t burst_abort_missing_next_frame_cnt; - uint32_t cts_timeout_collision; - uint32_t ack_or_ba_timeout_collision; + struct iwm_mvm_statistics_tx_non_phy general; struct iwm_mvm_statistics_tx_non_phy_agg agg; struct iwm_mvm_statistics_tx_channel_width channel_width; } __packed; /* IWM_STATISTICS_TX_API_S_VER_4 */ @@ -3062,17 +3060,38 @@ struct iwm_mvm_statistics_bt_activity { uint32_t lo_priority_rx_denied_cnt; } __packed; /* IWM_STATISTICS_BT_ACTIVITY_API_S_VER_1 */ -struct iwm_mvm_statistics_general { - struct iwm_mvm_statistics_general_common common; +struct iwm_mvm_statistics_general_v8 { + uint32_t radio_temperature; + uint32_t radio_voltage; + struct iwm_mvm_statistics_dbg dbg; + uint32_t sleep_time; + uint32_t slots_out; + uint32_t slots_idle; + uint32_t ttl_timestamp; + struct iwm_mvm_statistics_div slow_div; + uint32_t rx_enable_counter; + /* + * num_of_sos_states: + * count the number of times we have to re-tune + * in order to get out of bad PHY status + */ + uint32_t num_of_sos_states; uint32_t beacon_filtered; uint32_t missed_beacons; - int8_t beacon_filter_average_energy; - int8_t beacon_filter_reason; - int8_t beacon_filter_current_energy; - int8_t beacon_filter_reserved; + uint8_t beacon_filter_average_energy; + uint8_t beacon_filter_reason; + uint8_t beacon_filter_current_energy; + uint8_t beacon_filter_reserved; uint32_t beacon_filter_delta_time; struct iwm_mvm_statistics_bt_activity bt_activity; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ + uint64_t rx_time; + uint64_t on_time_rf; + uint64_t on_time_scan; + uint64_t tx_time; + uint32_t beacon_counter[IWM_NUM_MAC_INDEX]; + uint8_t beacon_average_energy[IWM_NUM_MAC_INDEX]; + uint8_t reserved[4 - (IWM_NUM_MAC_INDEX % 4)]; +} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_8 */ struct iwm_mvm_statistics_rx { struct iwm_mvm_statistics_rx_phy ofdm; @@ -3086,23 +3105,22 @@ struct iwm_mvm_statistics_rx { * * By default, uCode issues this notification after receiving a beacon * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * IWM_REPLY_STATISTICS_CMD 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues IWM_REPLY_STATISTICS_CMD - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears statistics - * appropriately so that each notification contains statistics for only the - * one channel that has just been scanned. + * IWM_STATISTICS_CMD (0x9c), below. */ -struct iwm_notif_statistics { /* IWM_STATISTICS_NTFY_API_S_VER_8 */ +struct iwm_notif_statistics_v10 { uint32_t flag; struct iwm_mvm_statistics_rx rx; struct iwm_mvm_statistics_tx tx; - struct iwm_mvm_statistics_general general; -} __packed; + struct iwm_mvm_statistics_general_v8 general; +} __packed; /* IWM_STATISTICS_NTFY_API_S_VER_10 */ + +#define IWM_STATISTICS_FLG_CLEAR 0x1 +#define IWM_STATISTICS_FLG_DISABLE_NOTIF 0x2 + +struct iwm_statistics_cmd { + uint32_t flags; +} __packed; /* IWM_STATISTICS_CMD_API_S_VER_1 */ /*********************************** * Smart Fifo API @@ -3187,14 +3205,6 @@ struct iwm_sf_cfg_cmd { * BEGIN mvm/fw-api-mac.h */ -/* - * The first MAC indices (starting from 0) - * are available to the driver, AUX follows - */ -#define IWM_MAC_INDEX_AUX 4 -#define IWM_MAC_INDEX_MIN_DRIVER 0 -#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX - enum iwm_ac { IWM_AC_BK, IWM_AC_BE, @@ -3971,12 +3981,12 @@ enum { * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT */ -#define IWM_RATE_MCS_CHAN_WIDTH_POS 11 -#define IWM_RATE_MCS_CHAN_WIDTH_MSK (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_20 (0 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_40 (1 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_80 (2 << IWM_RATE_MCS_CHAN_WIDTH_POS) -#define IWM_RATE_MCS_CHAN_WIDTH_160 (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_POS 11 +#define IWM_RATE_MCS_CHAN_WIDTH_MSK (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_20 (0 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_40 (1 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_80 (2 << IWM_RATE_MCS_CHAN_WIDTH_POS) +#define IWM_RATE_MCS_CHAN_WIDTH_160 (3 << IWM_RATE_MCS_CHAN_WIDTH_POS) /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ #define IWM_RATE_MCS_SGI_POS 13 @@ -3989,7 +3999,7 @@ enum { #define IWM_RATE_MCS_ANT_C_MSK (4 << IWM_RATE_MCS_ANT_POS) #define IWM_RATE_MCS_ANT_AB_MSK (IWM_RATE_MCS_ANT_A_MSK | \ IWM_RATE_MCS_ANT_B_MSK) -#define IWM_RATE_MCS_ANT_ABC_MSK (IWM_RATE_MCS_ANT_AB_MSK | \ +#define IWM_RATE_MCS_ANT_ABC_MSK (IWM_RATE_MCS_ANT_AB_MSK | \ IWM_RATE_MCS_ANT_C_MSK) #define IWM_RATE_MCS_ANT_MSK IWM_RATE_MCS_ANT_ABC_MSK #define IWM_RATE_MCS_ANT_NUM 3 @@ -3999,8 +4009,8 @@ enum { #define IWM_RATE_MCS_STBC_MSK (1 << IWM_RATE_MCS_STBC_POS) /* Bit 19: (0) Beamforming is off, (1) Beamforming is on */ -#define IWM_RATE_MCS_BF_POS 19 -#define IWM_RATE_MCS_BF_MSK (1 << IWM_RATE_MCS_BF_POS) +#define IWM_RATE_MCS_BF_POS 19 +#define IWM_RATE_MCS_BF_MSK (1 << IWM_RATE_MCS_BF_POS) /* Bit 20: (0) ZLF is off, (1) ZLF is on */ #define IWM_RATE_MCS_ZLF_POS 20 @@ -4023,28 +4033,64 @@ enum { /* Link quality command flags bit fields */ /* Bit 0: (0) Don't use RTS (1) Use RTS */ -#define IWM_LQ_FLAG_USE_RTS_POS 0 -#define IWM_LQ_FLAG_USE_RTS_MSK (1 << IWM_LQ_FLAG_USE_RTS_POS) +#define IWM_LQ_FLAG_USE_RTS_POS 0 +#define IWM_LQ_FLAG_USE_RTS_MSK (1 << IWM_LQ_FLAG_USE_RTS_POS) /* Bit 1-3: LQ command color. Used to match responses to LQ commands */ -#define IWM_LQ_FLAG_COLOR_POS 1 -#define IWM_LQ_FLAG_COLOR_MSK (7 << IWM_LQ_FLAG_COLOR_POS) +#define IWM_LQ_FLAG_COLOR_POS 1 +#define IWM_LQ_FLAG_COLOR_MSK (7 << IWM_LQ_FLAG_COLOR_POS) /* Bit 4-5: Tx RTS BW Signalling * (0) No RTS BW signalling * (1) Static BW signalling * (2) Dynamic BW signalling */ -#define IWM_LQ_FLAG_RTS_BW_SIG_POS 4 -#define IWM_LQ_FLAG_RTS_BW_SIG_NONE (0 << IWM_LQ_FLAG_RTS_BW_SIG_POS) -#define IWM_LQ_FLAG_RTS_BW_SIG_STATIC (1 << IWM_LQ_FLAG_RTS_BW_SIG_POS) -#define IWM_LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_POS 4 +#define IWM_LQ_FLAG_RTS_BW_SIG_NONE (0 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_STATIC (1 << IWM_LQ_FLAG_RTS_BW_SIG_POS) +#define IWM_LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << IWM_LQ_FLAG_RTS_BW_SIG_POS) /* Bit 6: (0) No dynamic BW selection (1) Allow dynamic BW selection * Dyanmic BW selection allows Tx with narrower BW then requested in rates */ -#define IWM_LQ_FLAG_DYNAMIC_BW_POS 6 -#define IWM_LQ_FLAG_DYNAMIC_BW_MSK (1 << IWM_LQ_FLAG_DYNAMIC_BW_POS) +#define IWM_LQ_FLAG_DYNAMIC_BW_POS 6 +#define IWM_LQ_FLAG_DYNAMIC_BW_MSK (1 << IWM_LQ_FLAG_DYNAMIC_BW_POS) + +/* Single Stream Tx Parameters (lq_cmd->ss_params) + * Flags to control a smart FW decision about whether BFER/STBC/SISO will be + * used for single stream Tx. + */ + +/* Bit 0-1: Max STBC streams allowed. Can be 0-3. + * (0) - No STBC allowed + * (1) - 2x1 STBC allowed (HT/VHT) + * (2) - 4x2 STBC allowed (HT/VHT) + * (3) - 3x2 STBC allowed (HT only) + * All our chips are at most 2 antennas so only (1) is valid for now. + */ +#define IWM_LQ_SS_STBC_ALLOWED_POS 0 +#define IWM_LQ_SS_STBC_ALLOWED_MSK (3 << IWM_LQ_SS_STBC_ALLOWED_MSK) + +/* 2x1 STBC is allowed */ +#define IWM_LQ_SS_STBC_1SS_ALLOWED (1 << IWM_LQ_SS_STBC_ALLOWED_POS) + +/* Bit 2: Beamformer (VHT only) is allowed */ +#define IWM_LQ_SS_BFER_ALLOWED_POS 2 +#define IWM_LQ_SS_BFER_ALLOWED (1 << IWM_LQ_SS_BFER_ALLOWED_POS) + +/* Bit 3: Force BFER or STBC for testing + * If this is set: + * If BFER is allowed then force the ucode to choose BFER else + * If STBC is allowed then force the ucode to choose STBC over SISO + */ +#define IWM_LQ_SS_FORCE_POS 3 +#define IWM_LQ_SS_FORCE (1 << IWM_LQ_SS_FORCE_POS) + +/* Bit 31: ss_params field is valid. Used for FW backward compatibility + * with other drivers which don't support the ss_params API yet + */ +#define IWM_LQ_SS_PARAMS_VALID_POS 31 +#define IWM_LQ_SS_PARAMS_VALID (1 << IWM_LQ_SS_PARAMS_VALID_POS) /** * struct iwm_lq_cmd - link quality command @@ -4068,11 +4114,11 @@ enum { * 2 - 0x3f: maximal number of frames (up to 3f == 63) * @rs_table: array of rates for each TX try, each is rate_n_flags, * meaning it is a combination of IWM_RATE_MCS_* and IWM_RATE_*_PLCP - * @bf_params: beam forming params, currently not used + * @ss_params: single stream features. declare whether STBC or BFER are allowed. */ struct iwm_lq_cmd { uint8_t sta_id; - uint8_t reserved1; + uint8_t reduced_tpc; uint16_t control; /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */ uint8_t flags; @@ -4086,7 +4132,7 @@ struct iwm_lq_cmd { uint8_t agg_frame_cnt_limit; uint32_t reserved2; uint32_t rs_table[IWM_LQ_MAX_RETRY_NUM]; - uint32_t bf_params; + uint32_t ss_params; }; /* LINK_QUALITY_CMD_API_S_VER_1 */ /* @@ -4523,7 +4569,8 @@ struct iwm_mvm_tx_resp { uint8_t pa_integ_res_b[3]; uint8_t pa_integ_res_c[3]; uint16_t measurement_req_id; - uint16_t reserved; + uint8_t reduced_tpc; + uint8_t reserved; uint32_t tfd_info; uint16_t seq_ctl; diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index d2bf48d6ab44..7d9ae98dc3d1 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -529,7 +529,7 @@ struct iwm_softc { /* phy contexts. we only use the first one */ struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX]; - struct iwm_notif_statistics sc_stats; + struct iwm_notif_statistics_v10 sc_stats; int sc_noise; caddr_t sc_drvbpf; diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 0597493a7ca7..c634afb62e37 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -1593,9 +1593,7 @@ ixgbe_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, if (tcp_lro_rx(&rxr->lro, m, 0) == 0) return; } - IXGBE_RX_UNLOCK(rxr); (*ifp->if_input)(ifp, m); - IXGBE_RX_LOCK(rxr); } /* ixgbe_rx_input */ /************************************************************************ @@ -1880,7 +1878,9 @@ ixgbe_rxeof(struct ix_queue *que) /* Now send to the stack or do LRO */ if (sendmp != NULL) { rxr->next_to_check = i; + IXGBE_RX_UNLOCK(rxr); ixgbe_rx_input(rxr, ifp, sendmp, ptype); + IXGBE_RX_LOCK(rxr); i = rxr->next_to_check; } @@ -1897,13 +1897,13 @@ ixgbe_rxeof(struct ix_queue *que) rxr->next_to_check = i; + IXGBE_RX_UNLOCK(rxr); + /* * Flush any outstanding LRO work */ tcp_lro_flush_all(lro); - IXGBE_RX_UNLOCK(rxr); - /* * Still have cleaning to do? */ diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index a04ff5871753..ae8a50260328 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -235,7 +235,7 @@ mmcsd_attach(device_t dev) * insertion that results in switches to/from a transfer mode involving * re-tuning, iff there are multiple devices on a given bus. Until now * mmc(4) lacks support for rescanning already attached buses, however, - * and sdhci(4) has no support for embedded/shared buses in the first + * and sdhci(4) to date has no support for shared buses in the first * place either. */ sc->max_data = mmc_get_max_data(dev); diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index 13a7667f0e42..e724bd43086c 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -2677,7 +2677,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_INFO, "Error sending command, " + mpr_dprint(sc, MPR_XINFO, "Error sending command, " "freezing SIM queue\n"); } } diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h index 41d34edbc7cd..bbf9d77c7388 100644 --- a/sys/fs/fdescfs/fdesc.h +++ b/sys/fs/fdescfs/fdesc.h @@ -34,7 +34,9 @@ * $FreeBSD$ */ -#ifdef _KERNEL +#ifndef _FS_FDESC_H_ +#define _FS_FDESC_H_ + /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 struct fdescmount { @@ -66,4 +68,4 @@ extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, struct vnode **); -#endif /* _KERNEL */ +#endif /* !_FS_FDESC_H_ */ diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 2b22ef9bdf3d..65846fd86283 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -306,10 +306,6 @@ ncl_putpages(struct vop_putpages_args *ap) printf("ncl_putpages: called on noncache-able vnode\n"); mtx_lock(&np->n_mtx); } - - for (i = 0; i < npages; i++) - rtvals[i] = VM_PAGER_ERROR; - /* * When putting pages, do not extend file past EOF. */ @@ -320,6 +316,9 @@ ncl_putpages(struct vop_putpages_args *ap) } mtx_unlock(&np->n_mtx); + for (i = 0; i < npages; i++) + rtvals[i] = VM_PAGER_ERROR; + VM_CNT_INC(v_vnodeout); VM_CNT_ADD(v_vnodepgsout, count); @@ -337,8 +336,10 @@ ncl_putpages(struct vop_putpages_args *ap) cred); crfree(cred); - if (error == 0 || !nfs_keep_dirty_on_error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + if (error == 0 || !nfs_keep_dirty_on_error) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + np->n_size - offset, npages * PAGE_SIZE); + } return (rtvals[0]); } diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 990336db6bcf..dc396030f160 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -621,9 +621,11 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (!error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); - return rtvals[0]; + if (error == 0) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + npages * PAGE_SIZE, npages * PAGE_SIZE); + } + return (rtvals[0]); #endif /* SMBFS_RWGENERIC */ } diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index afcad52c3dd1..0765400d37cf 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -738,15 +738,16 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) lagg_setmulti(lp); + LAGG_WUNLOCK(sc); + if ((error = lagg_proto_addport(sc, lp)) != 0) { /* Remove the port, without calling pr_delport. */ + LAGG_WLOCK(sc); lagg_port_destroy(lp, 0); LAGG_UNLOCK_ASSERT(sc); return (error); } - LAGG_WUNLOCK(sc); - /* Update lagg capabilities */ lagg_capabilities(sc); lagg_linkstate(sc); diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c index a92864dea65e..04e2f7be5145 100644 --- a/sys/netinet/cc/cc_cdg.c +++ b/sys/netinet/cc/cc_cdg.c @@ -431,11 +431,6 @@ static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) { struct cdg *cdg_data = ccv->cc_data; - uint32_t cwin; - u_int mss; - - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CDG_DELAY: @@ -453,7 +448,7 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) */ if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || cdg_data->queue_state < CDG_Q_FULL) { - CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); CCV(ccv, snd_recover) = CCV(ccv, snd_max); } else { /* @@ -466,19 +461,13 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) cdg_data->shadow_w, RENO_BETA); CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, - cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), + V_cdg_beta_loss)); cdg_data->window_incr = cdg_data->rtt_count = 0; } ENTER_RECOVERY(CCV(ccv, t_flags)); break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; - CCV(ccv, snd_cwnd) = mss; - break; default: newreno_cc_algo.cong_signal(ccv, signal_type); break; diff --git a/sys/netinet/cc/cc_chd.c b/sys/netinet/cc/cc_chd.c index 0b8c982ffd12..d7b53fec4d6a 100644 --- a/sys/netinet/cc/cc_chd.c +++ b/sys/netinet/cc/cc_chd.c @@ -330,12 +330,10 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_type) struct ertt *e_t; struct chd *chd_data; int qdly; - u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; - mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CHD_DELAY: @@ -375,12 +373,6 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_type) } ENTER_FASTRECOVERY(CCV(ccv, t_flags)); break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; - CCV(ccv, snd_cwnd) = mss; - break; default: newreno_cc_algo.cong_signal(ccv, signal_type); diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c index d2304d227487..64398faa929b 100644 --- a/sys/netinet/cc/cc_cubic.c +++ b/sys/netinet/cc/cc_cubic.c @@ -225,12 +225,8 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; - uint32_t cwin; - u_int mss; cubic_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -239,8 +235,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -251,7 +246,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->t_last_cong = ticks; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -266,13 +261,9 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) { + if (CCV(ccv, t_rxtshift) >= 2) cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; - cubic_ssthresh_update(ccv); - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = mss; - } break; } } diff --git a/sys/netinet/cc/cc_dctcp.c b/sys/netinet/cc/cc_dctcp.c index 199cf05fcb63..ce75750fef8b 100644 --- a/sys/netinet/cc/cc_dctcp.c +++ b/sys/netinet/cc/cc_dctcp.c @@ -230,29 +230,27 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - uint32_t cwin, ssthresh_on_loss; - u_int mss; + u_int win, mss; dctcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); + win = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); - ssthresh_on_loss = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = mss * + max(win / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion * recovery. Reverse cwnd value using * snd_cwnd_prev and recalculate snd_ssthresh */ - cwin = CCV(ccv, snd_cwnd_prev); - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + win = CCV(ccv, snd_cwnd_prev); + CCV(ccv, snd_ssthresh) = + max(win / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -262,17 +260,18 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) * Save current snd_cwnd when the host encounters both * congestion recovery and fast recovery. */ - CCV(ccv, snd_cwnd_prev) = cwin; + CCV(ccv, snd_cwnd_prev) = win; if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; + CCV(ccv, snd_ssthresh) = + mss * max(win / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } else - CCV(ccv, snd_ssthresh) = max((cwin - ((cwin * + CCV(ccv, snd_ssthresh) = max((win - ((win * dctcp_data->alpha) >> 11)) / mss, 2) * mss; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -285,8 +284,6 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; - CCV(ccv, snd_cwnd) = mss; } break; } diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c index 4018eaf2542d..92820f56de8c 100644 --- a/sys/netinet/cc/cc_htcp.c +++ b/sys/netinet/cc/cc_htcp.c @@ -271,12 +271,8 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; - uint32_t cwin; - u_int mss; htcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -291,9 +287,8 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) (htcp_data->maxrtt - htcp_data->minrtt) * 95) / 100; htcp_ssthresh_update(ccv); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -310,7 +305,7 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) htcp_ssthresh_update(ccv); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -325,10 +320,6 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; - CCV(ccv, snd_ssthresh) = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; - CCV(ccv, snd_cwnd) = mss; break; } } @@ -520,10 +511,6 @@ htcp_ssthresh_update(struct cc_var *ccv) CCV(ccv, snd_ssthresh) = ((u_long)CCV(ccv, snd_cwnd) * htcp_data->beta) >> HTCP_SHIFT; } - - /* Align ssthresh to MSS boundary */ - CCV(ccv, snd_ssthresh) = (CCV(ccv, snd_ssthresh) / CCV(ccv, t_maxseg)) - * CCV(ccv, t_maxseg); } diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 392a2f21cd84..b2c72fe9fcb1 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -182,42 +182,30 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - uint32_t cwin, ssthresh_on_loss; - u_int mss; - - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); - ssthresh_on_loss = - max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2) - * mss; + u_int win; /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - cwin = max(cwin / 2 / mss, 2) * mss; + win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * + CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; - CCV(ccv, snd_cwnd) = cwin; - } + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) + CCV(ccv, snd_ssthresh) = win; ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; - CCV(ccv, snd_cwnd) = cwin; + CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_cwnd) = win; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = ssthresh_on_loss; - CCV(ccv, snd_cwnd) = mss; - break; } } diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 1f60ae1776ef..d167292b292f 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -2074,7 +2074,6 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, struct mbuf *mm; control->data = dmbuf; - mm = control->data; for (mm = control->data; mm; mm = mm->m_next) { control->length += SCTP_BUF_LEN(mm); } diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 15e5afffc48f..b1c968e83f97 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -435,16 +435,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - if (CC_ALGO(tp)->cong_signal == NULL) { - /* - * RFC5681 Section 3.1 - * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) - */ - tp->snd_ssthresh = - max((tp->snd_max - tp->snd_una) / 2 / maxseg, 2) - * maxseg; - tp->snd_cwnd = maxseg; - } + tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / + maxseg) * maxseg; + tp->snd_cwnd = maxseg; break; case CC_RTO_ERR: TCPSTAT_INC(tcps_sndrexmitbad); @@ -2613,15 +2606,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += maxseg; - /* - * RFC5681 Section 3.2 talks about cwnd - * inflation on additional dupacks and - * deflation on recovering from loss. - * - * We keep cwnd into check so that - * we don't have to 'deflate' it when we - * get out of recovery. - */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -2661,22 +2645,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->snd_ssthresh + - maxseg * - (tp->t_dupacks - tp->snd_limited); + tp->snd_cwnd = tp->snd_ssthresh + + maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; diff --git a/sys/netinet/tcp_stacks/fastpath.c b/sys/netinet/tcp_stacks/fastpath.c index fe903d46e40d..caad7538ccfc 100644 --- a/sys/netinet/tcp_stacks/fastpath.c +++ b/sys/netinet/tcp_stacks/fastpath.c @@ -1052,15 +1052,6 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += tp->t_maxseg; - /* - * RFC5681 Section 3.2 talks about cwnd - * inflation on additional dupacks and - * deflation on recovering from loss. - * - * We keep cwnd into check so that - * we don't have to 'deflate' it when we - * get out of recovery. - */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -1100,22 +1091,19 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->t_maxseg; + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->t_maxseg; + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * - (tp->t_dupacks - tp->snd_limited); + tp->snd_cwnd = tp->snd_ssthresh + + tp->t_maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h index 0c0af309b129..56c1b8c02e60 100644 --- a/sys/sys/pctrie.h +++ b/sys/sys/pctrie.h @@ -76,7 +76,7 @@ name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t key) \ return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key)); \ } \ \ -static __inline struct type * \ +static __inline __unused struct type * \ name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key) \ { \ \ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 4d23e5846f29..e5bb3c2ff8db 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1315,13 +1315,24 @@ vnode_pager_putpages_ioflags(int pager_flags) return (ioflags); } +/* + * vnode_pager_undirty_pages(). + * + * A helper to mark pages as clean after pageout that was possibly + * done with a short write. The lpos argument specifies the page run + * length in bytes, and the written argument specifies how many bytes + * were actually written. eof is the offset past the last valid byte + * in the vnode using the absolute file position of the first byte in + * the run as the base from which it is computed. + */ void -vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, + int lpos) { vm_object_t obj; - int i, pos; + int i, pos, pos_devb; - if (written == 0) + if (written == 0 && eof >= lpos) return; obj = ma[0]->object; VM_OBJECT_WLOCK(obj); @@ -1335,6 +1346,37 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); } } + if (eof >= lpos) /* avoid truncation */ + goto done; + for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { + if (pos != trunc_page(pos)) { + /* + * The page contains the last valid byte in + * the vnode, mark the rest of the page as + * clean, potentially making the whole page + * clean. + */ + pos_devb = roundup2(pos & PAGE_MASK, DEV_BSIZE); + vm_page_clear_dirty(ma[i], pos_devb, PAGE_SIZE - + pos_devb); + + /* + * If the page was cleaned, report the pageout + * on it as successful. msync() no longer + * needs to write out the page, endlessly + * creating write requests and dirty buffers. + */ + if (ma[i]->dirty == 0) + rtvals[i] = VM_PAGER_OK; + + pos = round_page(pos); + } else { + /* vm_pageout_flush() clears dirty */ + rtvals[i] = VM_PAGER_BAD; + pos += PAGE_SIZE; + } + } +done: VM_OBJECT_WUNLOCK(obj); } diff --git a/sys/vm/vnode_pager.h b/sys/vm/vnode_pager.h index df8f4b2d7f4a..2399c4ee85b0 100644 --- a/sys/vm/vnode_pager.h +++ b/sys/vm/vnode_pager.h @@ -50,7 +50,8 @@ int vnode_pager_local_getpages_async(struct vop_getpages_async_args *ap); int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, + off_t eof, int lpos); void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c index 883519014467..9f5b08f2d1ce 100644 --- a/usr.bin/indent/args.c +++ b/usr.bin/indent/args.c @@ -166,6 +166,7 @@ struct pro { {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines}, {"st", PRO_SPECIAL, 0, STDIN, 0}, {"ta", PRO_BOOL, false, ON, &auto_typedefs}, + {"ts", PRO_INT, 8, 0, &tabsize}, {"troff", PRO_BOOL, false, ON, &troff}, {"ut", PRO_BOOL, true, ON, &use_tabs}, {"v", PRO_BOOL, false, ON, &verbose}, diff --git a/usr.bin/indent/indent.1 b/usr.bin/indent/indent.1 index 2c226d2e9f5c..83b9254ebf56 100644 --- a/usr.bin/indent/indent.1 +++ b/usr.bin/indent/indent.1 @@ -30,7 +30,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd January 2, 2017 +.Dd July 25, 2017 .Dt INDENT 1 .Os .Sh NAME @@ -85,6 +85,7 @@ .Op Fl \&st .Op Fl \&ta .Op Fl troff +.Op Fl ts Ns Ar n .Op Fl U Ns Ar file .Op Fl ut | Fl nut .Op Fl v | Fl \&nv @@ -459,13 +460,15 @@ listing in much the same spirit as .Xr vgrind 1 . If the output file is not specified, the default is standard output, rather than formatting in place. +.It Fl ts Ns Ar n +Assumed distance between tab stops. +The default is 8. .It Fl U Ns Ar file Adds type names from .Ar file to the list of type keywords. .It Fl ut , nut Enables (disables) the use of tab characters in the output. -Tabs are assumed to be aligned on columns divisible by 8. The default is .Fl ut . .It Fl v , \&nv diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 2b0b1a80b88d..728f22c60ffd 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -292,7 +292,7 @@ main(int argc, char **argv) if (*p == ' ') col++; else if (*p == '\t') - col = ((col - 1) & ~7) + 9; + col = tabsize * (1 + (col - 1) / tabsize) + 1; else break; p++; @@ -1050,7 +1050,7 @@ main(int argc, char **argv) if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) ps.block_init = 0; - if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - 8)) + if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - tabsize)) force_nl = true; } break; @@ -1267,18 +1267,21 @@ indent_declaration(int cur_dec_ind, int tabs_to_var) char *startpos = e_code; /* - * get the tab math right for indentations that are not multiples of 8 + * get the tab math right for indentations that are not multiples of tabsize */ - if ((ps.ind_level * ps.ind_size) % 8 != 0) { - pos += (ps.ind_level * ps.ind_size) % 8; - cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + if ((ps.ind_level * ps.ind_size) % tabsize != 0) { + pos += (ps.ind_level * ps.ind_size) % tabsize; + cur_dec_ind += (ps.ind_level * ps.ind_size) % tabsize; } - if (tabs_to_var) - while ((pos & ~7) + 8 <= cur_dec_ind) { + if (tabs_to_var) { + int tpos; + + while ((tpos = tabsize * (1 + pos / tabsize)) <= cur_dec_ind) { CHECK_SIZE_CODE; *e_code++ = '\t'; - pos = (pos & ~7) + 8; + pos = tpos; } + } while (pos < cur_dec_ind) { CHECK_SIZE_CODE; *e_code++ = ' '; diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h index 1c09208c0e5a..018badb7e89b 100644 --- a/usr.bin/indent/indent_globs.h +++ b/usr.bin/indent/indent_globs.h @@ -42,10 +42,6 @@ #define label_offset 2 /* number of levels a label is placed to left * of code */ -#define tabsize 8 /* the size of a tab */ -#define tabmask 0177770 /* mask used when figuring length of lines - * with tabs */ - #define false 0 #define true 1 @@ -213,6 +209,7 @@ int use_tabs; /* set true to use tabs for spacing, int auto_typedefs; /* set true to recognize identifiers * ending in "_t" like typedefs */ int space_after_cast; /* "b = (int) a" vs "b = (int)a" */ +int tabsize; /* the size of a tab */ /* -troff font state information */ diff --git a/usr.bin/indent/io.c b/usr.bin/indent/io.c index f707e1624a33..fea13c1d44f0 100644 --- a/usr.bin/indent/io.c +++ b/usr.bin/indent/io.c @@ -227,12 +227,12 @@ dump_line(void) target += ps.comment_delta; while (*com_st == '\t') /* consider original indentation in * case this is a box comment */ - com_st++, target += 8; + com_st++, target += tabsize; while (target <= 0) if (*com_st == ' ') target++, com_st++; else if (*com_st == '\t') - target = ((target - 1) & ~7) + 9, com_st++; + target = tabsize * (1 + (target - 1) / tabsize) + 1, com_st++; else target = 1; if (cur_col > target) { /* if comment can't fit on this line, @@ -458,17 +458,19 @@ pad_output(int current, int target) /* current: the current column value */ /* target: position we want it at */ { - int curr; /* internal column pointer */ - int tcur; if (troff) fprintf(output, "\\h'|%dp'", (target - 1) * 7); else { + int curr; /* internal column pointer */ + if (current >= target) return (current); /* line is already long enough */ curr = current; if (use_tabs) { - while ((tcur = ((curr - 1) & tabmask) + tabsize + 1) <= target) { + int tcur; + + while ((tcur = tabsize * (1 + (curr - 1) / tabsize) + 1) <= target) { putc('\t', output); curr = tcur; } @@ -517,7 +519,7 @@ count_spaces_until(int cur, char *buffer, char *end) break; case '\t': - cur = ((cur - 1) & tabmask) + tabsize + 1; + cur = tabsize * (1 + (cur - 1) / tabsize) + 1; break; case 010: /* backspace */ diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c index 00cb23a657c4..723247b77c83 100644 --- a/usr.bin/indent/pr_comment.c +++ b/usr.bin/indent/pr_comment.c @@ -142,7 +142,7 @@ pr_comment(void) } ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind; if (ps.com_col <= target_col) - ps.com_col = ((target_col + 7) & ~7) + 1; + ps.com_col = tabsize * (1 + (target_col - 1) / tabsize) + 1; if (ps.com_col + 24 > adj_max_col) adj_max_col = ps.com_col + 24; } diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 24cf89183e5a..40af63478942 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -607,8 +607,6 @@ static struct syscall decoded_syscalls[] = { .args = { { Ptr, 0 }, { CloudABIMFlags, 1 } } }, { .name = "cloudabi_sys_mem_advise", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIAdvice, 2 } } }, - { .name = "cloudabi_sys_mem_lock", .ret_type = 1, .nargs = 2, - .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_mem_map", .ret_type = 1, .nargs = 6, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 }, { CloudABIMFlags, 3 }, { Int, 4 }, { Int, 5 } } }, @@ -616,8 +614,6 @@ static struct syscall decoded_syscalls[] = { .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 } } }, { .name = "cloudabi_sys_mem_sync", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMSFlags, 2 } } }, - { .name = "cloudabi_sys_mem_unlock", .ret_type = 1, .nargs = 2, - .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_mem_unmap", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_proc_exec", .ret_type = 1, .nargs = 5, @@ -796,8 +792,8 @@ static struct xlat cloudabi_filetype[] = { X(FILETYPE_CHARACTER_DEVICE) X(FILETYPE_DIRECTORY) X(FILETYPE_FIFO) X(FILETYPE_POLL) X(FILETYPE_PROCESS) X(FILETYPE_REGULAR_FILE) X(FILETYPE_SHARED_MEMORY) - X(FILETYPE_SOCKET_DGRAM) X(FILETYPE_SOCKET_SEQPACKET) - X(FILETYPE_SOCKET_STREAM) X(FILETYPE_SYMBOLIC_LINK) + X(FILETYPE_SOCKET_DGRAM) X(FILETYPE_SOCKET_STREAM) + X(FILETYPE_SYMBOLIC_LINK) XEND }; @@ -827,11 +823,6 @@ static struct xlat cloudabi_oflags[] = { XEND }; -static struct xlat cloudabi_sa_family[] = { - X(AF_UNSPEC) X(AF_INET) X(AF_INET6) X(AF_UNIX) - XEND -}; - static struct xlat cloudabi_sdflags[] = { X(SHUT_RD) X(SHUT_WR) XEND @@ -2279,10 +2270,6 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, cloudabi_sockstat_t ss; if (get_struct(pid, (void *)args[sc->offset], &ss, sizeof(ss)) != -1) { - fprintf(fp, "{ %s, ", xlookup( - cloudabi_sa_family, ss.ss_sockname.sa_family)); - fprintf(fp, "%s, ", xlookup( - cloudabi_sa_family, ss.ss_peername.sa_family)); fprintf(fp, "%s, ", xlookup( cloudabi_errno, ss.ss_error)); fprintf(fp, "%s }", xlookup_bits(